Skip to content

Commit

Permalink
Move query outside for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
kushalbakshi committed Jun 24, 2024
1 parent f963d59 commit 576abd0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions element_calcium_imaging/field_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,12 @@ def make(self, key):
)

field_processing_tasks = []
total_image_files = len(scan.ScanInfo.ScanFile & key)
for field_idx, plane_idx in zip(field_ind, PVmeta.meta["plane_indices"]):
pln_output_dir = output_dir / f"pln{plane_idx}_chn{channel}"
pln_output_dir.mkdir(parents=True, exist_ok=True)
if len(scan.ScanInfo.ScanFile & key) > 1:

if total_image_files > 1:
prepared_input_dir = output_dir.parent / "prepared_input"
prepared_input_dir.mkdir(exist_ok=True)

Expand All @@ -145,7 +147,7 @@ def make(self, key):
f.relative_to(processed_root_data_dir).as_posix()
for f in image_files_li
]
elif len(scan.ScanInfo.ScanFile & key) == 1:
elif total_image_files == 1:
image_files = [image_file]

field_processing_tasks.append(
Expand Down

0 comments on commit 576abd0

Please sign in to comment.