Skip to content

Commit

Permalink
trim dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
wspr committed Mar 22, 2024
1 parent 518172c commit 327a0e7
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions ausankey/ausankey.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,6 @@ def _sankey(
]
else:
bar_lr = [
weighted_sort(labels_lr[0], weights_lr[0], sorting),
weighted_sort(labels_lr[1], weights_lr[1], sorting),
]
nodes_lr = [
sort_nodes(labels_lr[0],node_sizes[ii]),
sort_nodes(labels_lr[1],node_sizes[ii+1]),
]
Expand Down Expand Up @@ -641,40 +637,6 @@ def sort_dict(lbl, sorting):
return sorted_labels


###########################################

def weighted_sort(lbl, wgt, sorting):
"""creates a sorted list of labels by their summed weights"""

if sorting == "top":
s = 1
elif sorting == "bottom":
s = -1
elif sorting == "center":
s = 1
else:
s = 0

arr = {}
for uniq in lbl.unique():
arr[uniq] = wgt[lbl == uniq].sum()

sort_arr = sorted(
list(arr.items()),
key=lambda item: s * item[1],
# sorting = 0,1,-1 affects this
)

sorted_labels = list(dict(sort_arr))

if sorting == "center":
# this kinda works but i dont think it's a good idea because you lose perception of relative sizes
# probably has an off-by-one even/odd error
sorted_labels = sorted_labels[1::2] + sorted_labels[-1::-2]

return sorted_labels


###########################################


Expand Down

0 comments on commit 327a0e7

Please sign in to comment.