Skip to content

Commit a5f7dbb

Browse files
authored
Fix cache spike vector in base sorting (#4710)
1 parent 38dff14 commit a5f7dbb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/spikeinterface/core/basesorting.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,11 +980,12 @@ def to_spike_vector(
980980

981981
if main_channel_indices is None:
982982
spikes = self._cached_spike_vector
983+
elif "channel_index" in self._cached_spike_vector.dtype.names:
984+
spikes = self._cached_spike_vector
983985
else:
984986
spike_dtype = minimum_spike_dtype + [("channel_index", "int64")]
985987
spikes = np.zeros(self._cached_spike_vector.size, dtype=spike_dtype)
986988
spikes[["sample_index", "unit_index", "segment_index"]] = self._cached_spike_vector
987-
988989
spikes["channel_index"] = main_channel_indices[spikes["unit_index"]]
989990

990991
if not concatenated:

0 commit comments

Comments
 (0)