Skip to content

Commit 142459d

Browse files
author
Thinh Nguyen
committed
handle missing sample_rate from pykilosort params.py
1 parent 02069c9 commit 142459d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

element_array_ephys/ephys_no_curation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,10 @@ def make(self, key):
679679
kilosort_dir = find_full_path(get_ephys_root_data_dir(), output_dir)
680680

681681
kilosort_dataset = kilosort.Kilosort(kilosort_dir)
682-
acq_software = (EphysRecording & key).fetch1('acq_software')
682+
acq_software, sample_rate = (EphysRecording & key).fetch1(
683+
'acq_software', 'sampling_rate')
684+
685+
sample_rate = kilosort_dataset.data['params'].get('sample_rate', sample_rate)
683686

684687
# ---------- Unit ----------
685688
# -- Remove 0-spike units
@@ -709,7 +712,7 @@ def make(self, key):
709712
if (kilosort_dataset.data['spike_clusters'] == unit).any():
710713
unit_channel, _ = kilosort_dataset.get_best_channel(unit)
711714
unit_spike_times = (spike_times[kilosort_dataset.data['spike_clusters'] == unit]
712-
/ kilosort_dataset.data['params']['sample_rate'])
715+
/ sample_rate)
713716
spike_count = len(unit_spike_times)
714717

715718
units.append({

0 commit comments

Comments
 (0)