Skip to content

Commit 7db4647

Browse files
committed
fix chris bug
1 parent e1535da commit 7db4647

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/spikeinterface/core/channelsaggregationrecording.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ def __init__(self, recording_list, renamed_channel_ids=None):
3030
), "'renamed_channel_ids' doesn't have the right size or has duplicates!"
3131
channel_ids = list(renamed_channel_ids)
3232
else:
33-
# Collect channel IDs from all recordings
34-
all_channels_have_same_type = np.unique([rec.channel_ids.dtype for rec in recording_list]).size == 1
35-
all_channel_ids_are_unique = False
33+
# Explicitly check if all channel_ids arrays are either all integers or all strings.
34+
all_int_dtype = all(np.issubdtype(rec.channel_ids.dtype, np.integer) for rec in recording_list)
35+
all_str_dtype = all(np.issubdtype(rec.channel_ids.dtype, np.str_) for rec in recording_list)
36+
37+
all_channels_have_same_type = all_int_dtype or all_str_dtype
3638
if all_channels_have_same_type:
3739
combined_ids = np.concatenate([rec.channel_ids for rec in recording_list])
3840
all_channel_ids_are_unique = np.unique(combined_ids).size == num_all_channels

src/spikeinterface/core/channelslice.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ def __init__(self, parent_recording, channel_ids=None, renamed_channel_ids=None)
3131
parents_chan_ids = parent_recording.get_channel_ids()
3232

3333
# some checks
34-
assert all(
35-
chan_id in parents_chan_ids for chan_id in self._channel_ids
36-
), "ChannelSliceRecording : channel ids are not all in parents"
34+
is_channel_in_parent = [chan_id in parents_chan_ids.tolist() for chan_id in self._channel_ids.tolist()]
35+
assert all(is_channel_in_parent), "ChannelSliceRecording : channel ids are not all in parents"
36+
3737
assert len(self._channel_ids) == len(
3838
self._renamed_channel_ids
3939
), "ChannelSliceRecording: renamed channel_ids must be the same size"

0 commit comments

Comments
 (0)