Skip to content

Commit

Permalink
allow users to specify stride (needed for duration plots) and use 'ag…
Browse files Browse the repository at this point in the history
…g' when plots are not shown
  • Loading branch information
jeremyleung521 committed May 31, 2024
1 parent faf035b commit 22e0eb6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lpath/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def __init__(self, arguments):
for pathway in self.pathways:
non_zero = pathway[numpy.nonzero(pathway[:, 0])] # Removing padding frames...
weights.append(non_zero[-1, -1])
durations.append(len(non_zero))
durations.append(len(non_zero) / arguments.stride)
target_iter.append(non_zero[-1][0])
iter_num += [frame[0] for frame in non_zero]
states.append(pathway[:, 2])
Expand All @@ -169,6 +169,7 @@ def __init__(self, arguments):
self.num_iter = numpy.asarray(iter_num, dtype=object)
self.target_iter = numpy.asarray(target_iter)
self.num_clusters = len(path_indices)
self.stride = arguments.stride

# weighted_counts = [numpy.sum(self.weights[self.states == i]) for i in range(self.num_clusters)]
# self.weighted_counts = numpy.array(weighted_counts, dtype=float)
Expand All @@ -192,6 +193,9 @@ def __init__(self, arguments):
self.show_fig = arguments.dendrogram_show
self.ax_idx = 0

if not self.show_fig:
matplotlib.use('agg')

def plt_config(self, ax_idx=None, separate=None):
"""
Process matplotlib arguments and append fig/axis objects to class.
Expand Down

0 comments on commit 22e0eb6

Please sign in to comment.