Skip to content

Commit

Permalink
Merge pull request #2252 from alejoe91/fix-1729
Browse files Browse the repository at this point in the history
Assert renamed_channels/unit_ids is unique
  • Loading branch information
alejoe91 authored Nov 24, 2023
2 parents 6c28f26 + e8431dc commit fcbf422
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/spikeinterface/core/channelslice.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def __init__(self, parent_recording, channel_ids=None, renamed_channel_ids=None)
channel_ids = parent_recording.get_channel_ids()
if renamed_channel_ids is None:
renamed_channel_ids = channel_ids
else:
assert len(renamed_channel_ids) == len(
np.unique(renamed_channel_ids)
), "renamed_channel_ids must be unique!"

self._parent_recording = parent_recording
self._channel_ids = np.asarray(channel_ids)
Expand Down
1 change: 1 addition & 0 deletions src/spikeinterface/core/unitsselectionsorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(self, parent_sorting, unit_ids=None, renamed_unit_ids=None):
unit_ids = parent_sorting.get_unit_ids()
if renamed_unit_ids is None:
renamed_unit_ids = unit_ids
assert len(renamed_unit_ids) == len(np.unique(renamed_unit_ids)), "renamed_unit_ids must be unique!"

self._parent_sorting = parent_sorting
self._unit_ids = np.asarray(unit_ids)
Expand Down

0 comments on commit fcbf422

Please sign in to comment.