Skip to content

Commit 905588f

Browse files
committed
2 parents 47f6a07 + 53f0312 commit 905588f

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

element_array_ephys/readers/kilosort_triggering.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,16 @@ 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 of processing rerun on different parameters (the hash changes)
314+
# delete outdated files
315+
outdated_files = [
316+
f
317+
for f in self._json_directory.glob("*")
318+
if f.is_file() and f.name != self._module_input_json.name
319+
]
320+
for f in outdated_files:
321+
f.unlink()
322+
313323
modules_status = {
314324
module: {"start_time": None, "completion_time": None, "duration": None}
315325
for module in self._modules
@@ -602,6 +612,16 @@ def _update_module_status(self, updated_module_status={}):
602612
modules_status = json.load(f)
603613
modules_status = {**modules_status, **updated_module_status}
604614
else:
615+
# handle cases of processing rerun on different parameters (the hash changes)
616+
# delete outdated files
617+
outdated_files = [
618+
f
619+
for f in self._json_directory.glob("*")
620+
if f.is_file() and f.name != self._module_input_json.name
621+
]
622+
for f in outdated_files:
623+
f.unlink()
624+
605625
modules_status = {
606626
module: {"start_time": None, "completion_time": None, "duration": None}
607627
for module in self._modules
@@ -747,8 +767,8 @@ def _write_channel_map_file(
747767
)
748768

749769
if is_0_based:
750-
channel_ind += 1
751-
shank_ind += 1
770+
channel_ind = channel_ind + 1
771+
shank_ind = shank_ind + 1
752772

753773
channel_count = len(channel_ind)
754774
chanMap0ind = np.arange(0, channel_count, dtype="float64")
@@ -757,8 +777,7 @@ def _write_channel_map_file(
757777

758778
# channels to exclude
759779
mask = get_noise_channels(ap_band_file, channel_count, sample_rate, bit_volts)
760-
bad_channel_ind = np.where(mask is False)[0]
761-
connected[bad_channel_ind] = 0
780+
connected = np.where(mask is False, 0, connected)
762781

763782
mdict = {
764783
"chanMap": chanMap,

0 commit comments

Comments
 (0)