Skip to content

Commit 7774492

Browse files
committed
Fix issue where hash is changed(different paramset) and trying to rerun processing
1 parent 152cc58 commit 7774492

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

element_array_ephys/readers/kilosort_triggering.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ def _update_module_status(self, updated_module_status={}):
310310
modules_status = json.load(f)
311311
modules_status = {**modules_status, **updated_module_status}
312312
else:
313+
# handle cases where hash is changed(different paramset) and trying to rerun same key
314+
# delete all files in kilosort output folder, all will be regenerated when kilosort is rerun
315+
# recreate /json_configs directory after all kilosort output files are deleted
316+
shutil.rmtree(self._ks_output_dir)
317+
self._json_directory.mkdir(parents=True, exist_ok=True)
318+
313319
modules_status = {
314320
module: {"start_time": None, "completion_time": None, "duration": None}
315321
for module in self._modules
@@ -602,6 +608,12 @@ def _update_module_status(self, updated_module_status={}):
602608
modules_status = json.load(f)
603609
modules_status = {**modules_status, **updated_module_status}
604610
else:
611+
# handle cases where hash is changed(different paramset) and trying to rerun same key
612+
# delete all files in kilosort output folder, all will be regenerated when kilosort is rerun
613+
# recreate /json_configs directory after all kilosort output files are deleted
614+
shutil.rmtree(self._ks_output_dir)
615+
self._json_directory.mkdir(parents=True, exist_ok=True)
616+
605617
modules_status = {
606618
module: {"start_time": None, "completion_time": None, "duration": None}
607619
for module in self._modules

0 commit comments

Comments
 (0)