Skip to content

Commit

Permalink
fix has exceeding for bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zm711 committed Apr 17, 2024
1 parent 1424060 commit 7ad9bbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/spikeinterface/core/waveform_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,8 @@ def has_exceeding_spikes(recording, sorting):
if len(spike_vector_seg) > 0:
if spike_vector_seg["sample_index"][-1] > recording.get_num_samples(segment_index=segment_index) - 1:
return True
if spike_vector_seg["sample_index"][0] < 0:
return True
return False


Expand Down
3 changes: 2 additions & 1 deletion src/spikeinterface/curation/remove_excess_spikes.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def _custom_cache_spike_vector(self) -> None:
for segment_index in range(num_segments):
spike_vector = parent_spike_vector[segments_bounds[segment_index] : segments_bounds[segment_index + 1]]
end = np.searchsorted(spike_vector["sample_index"], self._num_samples[segment_index])
list_spike_vectors.append(spike_vector[:end])
start = np.searchsorted(spike_vector["sample_index"], 0)
list_spike_vectors.append(spike_vector[start:end])

spike_vector = np.concatenate(list_spike_vectors)
self._cached_spike_vector = spike_vector
Expand Down

0 comments on commit 7ad9bbb

Please sign in to comment.