Skip to content

Commit

Permalink
Merge pull request #190 from ttngu207/dev_per_field_processing
Browse files Browse the repository at this point in the history
Minor fix: infer/make output dir and improve key_source
  • Loading branch information
ttngu207 authored Apr 1, 2024
2 parents fe06539 + df3b4f6 commit 0c89ef4
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions element_calcium_imaging/field_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,28 @@ def key_source(self):
& "task_mode = 'trigger'"
) & "nfields > 0"
ks &= "(processing_method = 'suite2p' AND nrois > 0) OR (processing_method = 'caiman' AND nrois = 0)"
return ks
return ks - imaging.Processing.proj()

def make(self, key):
execution_time = datetime.utcnow()
processed_root_data_dir = scan.get_processed_root_data_dir()

output_dir = (imaging.ProcessingTask & key).fetch1("processing_output_dir")
output_dir = find_full_path(processed_root_data_dir, output_dir)

if not output_dir:
output_dir = imaging.ProcessingTask.infer_output_dir(
key, relative=True, mkdir=True
)
# update processing_output_dir
imaging.ProcessingTask.update1(
{**key, "processing_output_dir": output_dir.as_posix()}
)

try:
output_dir = find_full_path(processed_root_data_dir, output_dir)
except FileNotFoundError:
output_dir = processed_root_data_dir / output_dir
output_dir.mkdir(parents=True, exist_ok=True)

method, params = (
imaging.ProcessingTask * imaging.ProcessingParamSet & key
Expand Down

0 comments on commit 0c89ef4

Please sign in to comment.