Skip to content

Commit

Permalink
Update element_miniscope/miniscope.py
Browse files Browse the repository at this point in the history
Co-authored-by: Thinh Nguyen <[email protected]>
  • Loading branch information
kabilar and Thinh Nguyen authored Apr 29, 2022
1 parent daea6c3 commit 258e3f6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions element_miniscope/miniscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,17 +379,21 @@ def make(self, key):
sampling_rate = (ProcessingTask * Recording * RecordingInfo \
& key).fetch1('fps')

filename_hash = '.' + str(dict_to_uuid(dict(**key, **params)))

if not os.path.isfile(output_dir / filename_hash):
input_hash = dict_to_uuid(dict(**key, **params))
input_hash_fp = output_dir / f'.{input_hash }.json'

if not input_hash_fp.exist():
start_time = datetime.utcnow()
run_caiman(file_paths=avi_files,
parameters=params,
sampling_rate=sampling_rate,
output_dir=output_dir.as_posix(),
is3D=False)

with open(output_dir / filename_hash, 'w') as fp:
pass
completion_time = datetime.utcnow()
with open(input_hash_fp, 'w') as f:
json.dump({'start_time': start_time ,
'completion_time': completion_time ,
'duration': (completion_time - start_time).total_seconds()}, f, default=str)

_, imaging_dataset = get_loader_result(key, ProcessingTask)
caiman_dataset = imaging_dataset
Expand Down

0 comments on commit 258e3f6

Please sign in to comment.