Skip to content

Commit

Permalink
avoid early return in saving histogram
Browse files Browse the repository at this point in the history
  • Loading branch information
rugeli committed Jun 10, 2024
1 parent c16c377 commit b1083ea
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions cellpack/autopack/Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,23 @@ def run_analysis_workflow(
**analysis_config["create_report"],
)

def histogram(self, distances, filename, title_str="", x_label="", y_label="", save_png=True, add_to_result=True):
def histogram(
self,
distances,
filename,
title_str="",
x_label="",
y_label="",
add_to_result=True,
save_png=False,
):
if add_to_result:
# add histogrm to result file and display on the web page
self.helper.plot_data.add_histogram(
title=f"{title_str}: {x_label}",
xaxis_title=x_label,
traces={y_label: numpy.array(distances)},
)
if save_png:
# use matplotlib to create histogram and save as png
plt.clf()
Expand Down Expand Up @@ -620,14 +636,6 @@ def histogram(self, distances, filename, title_str="", x_label="", y_label="", s
plt.savefig(filename)
plt.close()

if add_to_result:
# add histogrm to result file and display on the web page
self.helper.plot_data.add_histogram(
title=f"{title_str}: {x_label}",
xaxis_title=x_label,
traces={y_label: numpy.array(distances)},
)

def plot(self, rdf, radii, file_name):
plt.clf()
matplotlib.rc("font", size=14)
Expand Down

0 comments on commit b1083ea

Please sign in to comment.