Skip to content

Commit

Permalink
Debugged info addition when processing locs
Browse files Browse the repository at this point in the history
  • Loading branch information
Heerpa committed May 23, 2024
1 parent bb505e5 commit 7da89ae
Showing 1 changed file with 54 additions and 3 deletions.
57 changes: 54 additions & 3 deletions picasso_workflow/analyse.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ def module_wrapper(self, i, parameters):
if parameters.get("save_locs") is True or self.analysis_config.get(
"always_save"
):
if hasattr(self, "locs"):
if hasattr(self, "locs") and self.locs is not None:
self._save_locs(
os.path.join(results["folder"], "locs.hdf5")
)
if hasattr(self, "channel_locs"):
if (
hasattr(self, "channel_locs")
and self.channel_locs is not None
):
self._save_datasets_agg(results["folder"])
results["end time"] = datetime.now().strftime("%y-%m-%d %H:%M:%S")
td = datetime.strptime(
Expand Down Expand Up @@ -524,6 +527,16 @@ def identify(self, i, parameters, results):
results["folder"], pars["filename"]
)
results["ids_vs_frame"] = self._plot_ids_vs_frame(**pars)

# add info
new_info = {
"Generated by": "picasso-workflow : identify",
"Box Size": parameters["box_size"],
"Min. Net Gradient": parameters["min_gradient"],
"parameters": parameters,
}
self.info = self.info + [new_info]

return parameters, results

def _plot_ids_vs_frame(self, filename):
Expand Down Expand Up @@ -613,6 +626,21 @@ def localize(self, i, parameters, results):
pars["filename"]
)

# add info
localize_info = {
"Generated by": "Picasso Localize",
"ROI": None,
"Box Size": parameters["box_size"],
# "Min. Net Gradient": min_net_gradient,
# "Convergence Criterion": convergence,
# "Max. Iterations": max_iterations,
"Pixelsize": self.analysis_config["camera_info"].get("pixelsize"),
"Fit method": "gausslq",
"Wrapped by": "picasso-workflow : localize",
"parameters": parameters,
}
self.info = self.info + [localize_info]

# save locs
if pars := parameters.get("save_locs"):
if "filename" in pars.keys():
Expand Down Expand Up @@ -804,6 +832,13 @@ def undrift_rcc(self, i, parameters, results):
results["filepath_plot"], parameters["dimensions"]
)

# add info
new_info = {
"Generated by": "picasso-workflow : undrift_rcc",
"parameters": parameters,
}
self.info = self.info + [new_info]

# save locs
if pars := parameters.get("save_locs"):
if "filename" in pars.keys():
Expand Down Expand Up @@ -966,6 +1001,7 @@ def density(self, i, parameters, results):
)
density_info = {
"Generated by": "Picasso Density",
"Wrapped by": "picasso-workflow : density",
"Radius": parameters["radius"],
}
self.info.append(density_info)
Expand Down Expand Up @@ -1000,6 +1036,7 @@ def dbscan(self, i, parameters, results):
"Generated by": "Picasso DBSCAN",
"Radius": radius,
"Minimum local density": min_density,
"Wrapped by": "picasso-workflow : dbscan",
}
self.info.append(dbscan_info)
filepath = os.path.join(results["folder"], "locs_dbscan.hdf5")
Expand Down Expand Up @@ -1041,6 +1078,7 @@ def hdbscan(self, i, parameters, results):
"Generated by": "Picasso HDBSCAN",
"Min. cluster": min_cluster,
"Min. samples": min_samples,
"Wrapped by": "picasso-workflow : hdbscan",
}
self.info.append(hdbscan_info)
filepath = os.path.join(results["folder"], "locs_hdbscan.hdf5")
Expand Down Expand Up @@ -1096,6 +1134,7 @@ def smlm_clusterer(self, i, parameters, results):
"Radius_z": radius_z,
"Min locs": min_locs,
"Basic frame analysis": basic_fa,
"Wrapped by": "picasso-workflow : smlm_clusterer",
}
self.info.append(smlm_cluster_info)
filepath = os.path.join(results["folder"], "locs_smlm.hdf5")
Expand Down Expand Up @@ -1260,6 +1299,14 @@ def align_channels(self, i, parameters, results):
picasso_outpost.plot_shift(shifts, cum_shifts, fig_filepath)
results["fig_filepath"] = fig_filepath

# add info
new_info = {
"Generated by": "picasso-workflow : align_channels",
"shifts": results["shifts"],
"parameters": parameters,
}
self.info = self.info + [new_info]

return parameters, results

@module_decorator
Expand Down Expand Up @@ -1287,7 +1334,11 @@ def combine_channels(self, i, parameters, results):

# replace the channel_locs with the one combined dataset
self.channel_locs = [combined_locs]
info = self.channel_info[0] + ["Combined channels"]
new_info = {
"Generated by": "picasso-workflow : combine_channels",
"files combined": self.channel_tags,
}
info = self.channel_info[0] + [new_info]
self.channel_info = [info]
self.channel_tags = ["combined-channels"]

Expand Down

0 comments on commit 7da89ae

Please sign in to comment.