Skip to content

Commit

Permalink
dbg
Browse files Browse the repository at this point in the history
  • Loading branch information
Heerpa committed May 23, 2024
1 parent 55c6a9d commit e6b8210
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
23 changes: 15 additions & 8 deletions picasso_workflow/analyse.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class AutoPicasso(AbstractModuleCollection):

# for single-dataset analysis
movie = None
info = None
info = []
identifications = None
locs = None
drift = None
Expand Down Expand Up @@ -709,9 +709,10 @@ def export_brightfield(self, i, parameters, results):
the module index in the protocol
parameters : dict
necessary items:
filepath : str or list of str
filepath : str or list of str or dict
the tiff file(s) to load. The converted file(s) will
have the same name, but with .png extension
if dict: keys are labels
optional items:
min_quantile : float, default: 0
the quantile below which pixels are shown black
Expand All @@ -724,25 +725,31 @@ def export_brightfield(self, i, parameters, results):
as input, potentially changed values, for consistency
results : dict
the analysis results
filename : the png file
labeled filepath : dict
keys : labels
values : filepaths
"""
fps_in = parameters["filepath"]
if isinstance(fps_in, str):
fps_in = [fps_in]
fps_out = []
for fp in fps_in:
if isinstance(fps_in, list):
d = {}
for i, fp in enumerate(fps_in):
d[str(i)] = fp
fps_out = {}
for label, fp in fps_in.items():
mov, _ = io.load_movie(fp)
frame = mov[0]
fn = os.path.split(fp)[1]
fn = os.path.splitext(fn)[0] + ".png"
fp = os.path.join(results["folder"], fn)
fps_out.append(fp)
fps_out[label] = fp
min_quantile = parameters.get("min_quantile", 0)
max_quantile = parameters.get("max_quantile", 1)
process_brightfield.save_frame(
fp, frame, min_quantile, max_quantile
)
results["filepaths"] = fps_out
results["labeled filepaths"] = fps_out
return parameters, results

@module_decorator
Expand Down Expand Up @@ -1100,7 +1107,7 @@ def smlm_clusterer(self, i, parameters, results):
parameters: dict
with required keys:
radius : float
the smlm radius
the smlm radius, in px
min_locs : float
the smlm min_locs
and optional keys:
Expand Down
6 changes: 5 additions & 1 deletion picasso_workflow/confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,11 @@ def export_brightfield(self, i, parameters, results):
self.report_page_name, self.report_page_id, text
)

for fp in results.get("filepaths"):
for label, fp in results.get("filepaths").items():
text = f"""{label}"""
self.ci.update_page_content(
self.report_page_name, self.report_page_id, text
)
self.ci.upload_attachment(self.report_page_id, fp)
self.ci.update_page_content_with_image_attachment(
self.report_page_name,
Expand Down
1 change: 1 addition & 0 deletions picasso_workflow/tests/test_analyse.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def localize(self, mock_get_spots, mock_fit_spot, mock_locs_from_fits):
],
dtype=self.locs_dtype,
)
self.ap.info = []

parameters = {"box_size": 7, "fit_parallel": False}

Expand Down
2 changes: 1 addition & 1 deletion picasso_workflow/tests/test_confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def export_brightfield(self):
results = {
"start time": "now",
"duration": 16.4,
"filepaths": ["myfp.png"],
"filepaths": {"GFP": "myfp.png"},
}
self.cr.export_brightfield(0, parameters, results)

Expand Down

0 comments on commit e6b8210

Please sign in to comment.