Repository navigation
Fix channel order bug and make select_channels private - #4712
Conversation
alejoe91
left a comment
There was a problem hiding this comment.
Another couple of minor comments :)
| channel_indices = [] | ||
| unit_channel_ids = old_unit_id_to_channel_ids[unit_id] | ||
|
|
||
| for channel_id in channel_ids: | ||
| if channel_id in unit_channel_ids: | ||
| idx = np.where(old_unit_id_to_channel_ids[unit_id] == channel_id)[0][0] | ||
| channel_indices.append(idx) |
There was a problem hiding this comment.
| channel_indices = [] | |
| unit_channel_ids = old_unit_id_to_channel_ids[unit_id] | |
| for channel_id in channel_ids: | |
| if channel_id in unit_channel_ids: | |
| idx = np.where(old_unit_id_to_channel_ids[unit_id] == channel_id)[0][0] | |
| channel_indices.append(idx) | |
| unit_channel_ids = old_unit_id_to_channel_ids[unit_id] | |
| channel_ids_in_unit = [ch for ch in channel_ids if channel_id in unit_channel_ids] | |
| channel_indices = self.sorting_analyzer.channel_ids_to_indices(channel_ids_in_unit) |
I think that this does the exact same thing, right?
There was a problem hiding this comment.
You need the old channel_ids_to_indices, not the new ones from self.sorting_analyzer.channel_ids_to_indices
There was a problem hiding this comment.
self is the old analyzer, no?
See:
old_waveforms = self.data["waveforms"]
There was a problem hiding this comment.
Oop - we're both wrong. The channel_indices tell you how to map between the channel_indices with respect to the sparsity mask for each unit (no the overall channel_indices). You can make the code look very simple if you have access to the new sorting_analyzer's sparsity mask, which we don't easily have.
I've updated the variables names, which I think should help avoid confusion.
|
Fixes #4700 |
Co-authored-by: Alessio Buccino <alejoe9187@gmail.com>
alejoe91
left a comment
There was a problem hiding this comment.
Perfetto! Just renamed a couple of variables in the _select_channels_sparse_data function.
The added tests are bullet-proof!
Fixes a channel order bug in the sparsity mask for the new
select_channelsmethod for analyzers.Discussed with @alejoe91 and decided to keep this method private for now - we hope users will access through the
split_bymethod rather than directly.Fixed waveforms and pca selection.