Skip to content

Commit

Permalink
fix the bug for num_spikes in QualityMetrics._compute_metric
Browse files Browse the repository at this point in the history
  • Loading branch information
sytseng committed Jan 17, 2025
1 parent 75ad067 commit f342276
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/spyglass/spikesorting/v0/spikesorting_curation.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,11 +604,12 @@ def _compute_metric(self, waveform_extractor, metric_name, **metric_params):

is_nn_iso = metric_name == "nn_isolation"
is_nn_overlap = metric_name == "nn_noise_overlap"
is_num_spikes = metric_name == "num_spikes"
min_spikes = metric_params.get("min_spikes", 10)

for unit_id in waveform_extractor.sorting.get_unit_ids():
# checks to avoid bug in spikeinterface 0.98.2
if num_spikes[unit_id] < min_spikes:
if num_spikes[unit_id] < min_spikes and not is_num_spikes:
if is_nn_iso:
metric[str(unit_id)] = (np.nan, np.nan)
elif is_nn_overlap:
Expand Down

0 comments on commit f342276

Please sign in to comment.