Hi Spikeinterface,
There seems to be an issue in the spikeinterface set_probes function in the core packages.
I am trying to set a probes to a recording but I get this error :
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[1], [line 50](vscode-notebook-cell:?execution_count=1&line=50)
[48](vscode-notebook-cell:?execution_count=1&line=48) recording_b = recording.remove_channels(remove_channel_ids=missing_numbers)
[49](vscode-notebook-cell:?execution_count=1&line=49) #probe.set_device_channel_indices(recording_b.get_channel_ids())
---> [50](vscode-notebook-cell:?execution_count=1&line=50) recording_clean = recording_b.set_probe(probe)
[51](vscode-notebook-cell:?execution_count=1&line=51) #recording = recording.remove_channels(remove_channel_ids=bad_channel['index_pixels'])
[52](vscode-notebook-cell:?execution_count=1&line=52) # setting the channel location
[53](vscode-notebook-cell:?execution_count=1&line=53) #recording.set_channel_locations(positions) to check...
[54](vscode-notebook-cell:?execution_count=1&line=54) rec_dict = dict(filt=recording_clean)
File [~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:96](https://vscode-remote+ssh-002dremote-002bvis-005fnode2.vscode-resource.vscode-cdn.net/camp/home/combadk/working/combadk/ScriptKC/CHIME_script/~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:96), in BaseRecordingSnippets.set_probe(self, probe, group_mode, in_place)
[94](https://vscode-remote+ssh-002dremote-002bvis-005fnode2.vscode-resource.vscode-cdn.net/camp/home/combadk/working/combadk/ScriptKC/CHIME_script/~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:94) probegroup = ProbeGroup()
[95](https://vscode-remote+ssh-002dremote-002bvis-005fnode2.vscode-resource.vscode-cdn.net/camp/home/combadk/working/combadk/ScriptKC/CHIME_script/~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:95) probegroup.add_probe(probe)
---> [96](https://vscode-remote+ssh-002dremote-002bvis-005fnode2.vscode-resource.vscode-cdn.net/camp/home/combadk/working/combadk/ScriptKC/CHIME_script/~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:96) return self.set_probes(probegroup, group_mode=group_mode, in_place=in_place)
File [~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:170](https://vscode-remote+ssh-002dremote-002bvis-005fnode2.vscode-resource.vscode-cdn.net/camp/home/combadk/working/combadk/ScriptKC/CHIME_script/~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:170), in BaseRecordingSnippets.set_probes(self, probe_or_probegroup, group_mode, in_place)
[163](https://vscode-remote+ssh-002dremote-002bvis-005fnode2.vscode-resource.vscode-cdn.net/camp/home/combadk/working/combadk/ScriptKC/CHIME_script/~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:163) if number_of_device_channel_indices >= self.get_num_channels():
[164](https://vscode-remote+ssh-002dremote-002bvis-005fnode2.vscode-resource.vscode-cdn.net/camp/home/combadk/working/combadk/ScriptKC/CHIME_script/~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:164) error_msg = (
[165](https://vscode-remote+ssh-002dremote-002bvis-005fnode2.vscode-resource.vscode-cdn.net/camp/home/combadk/working/combadk/ScriptKC/CHIME_script/~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:165) f"The given Probe have 'device_channel_indices' that do not match channel count \n"
[166](https://vscode-remote+ssh-002dremote-002bvis-005fnode2.vscode-resource.vscode-cdn.net/camp/home/combadk/working/combadk/ScriptKC/CHIME_script/~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:166) f"{number_of_device_channel_indices} vs {self.get_num_channels()} \n"
[167](https://vscode-remote+ssh-002dremote-002bvis-005fnode2.vscode-resource.vscode-cdn.net/camp/home/combadk/working/combadk/ScriptKC/CHIME_script/~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:167) f"device_channel_indices are the following: {device_channel_indices} \n"
[168](https://vscode-remote+ssh-002dremote-002bvis-005fnode2.vscode-resource.vscode-cdn.net/camp/home/combadk/working/combadk/ScriptKC/CHIME_script/~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:168) f"recording channels are the following: {self.get_channel_ids()} \n"
[169](https://vscode-remote+ssh-002dremote-002bvis-005fnode2.vscode-resource.vscode-cdn.net/camp/home/combadk/working/combadk/ScriptKC/CHIME_script/~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:169) )
--> [170](https://vscode-remote+ssh-002dremote-002bvis-005fnode2.vscode-resource.vscode-cdn.net/camp/home/combadk/working/combadk/ScriptKC/CHIME_script/~/.conda/envs/CHIME_kayvan/lib/python3.9/site-packages/spikeinterface/core/baserecordingsnippets.py:170) raise ValueError(error_msg)
...
ValueError: The given Probe have 'device_channel_indices' that do not match channel count
110 vs 52
device_channel_indices are the following: [ 1 2 4 5 6 7 9 10 11 13 18 19 20 24 28 35 37 38 39 40 41 44 47 49 50 52 54 58 59 63 68 70 72 79 81 83 84 86 87 88 89 90 91 92 94 97 100 104 106 107 108 110]
recording channels are the following: [ 1 2 4 5 6 7 9 10 11 13 18 19 20 24 28 35 37 38 39 40 41 44 47 49 50 52 54 58 59 63 68 70 72 79 81 83 84 86 87 88 89 90 91 92 94 97 100 104 106 107 108 110]
When I had a look at the code, it seems to check the max of the device_channel_indices against the number of channel in the recording should it be comparing size?
number_of_device_channel_indices = np.max(list(device_channel_indices) + [0])
if number_of_device_channel_indices >= self.get_num_channels():
error_msg = (
f"The given Probe have 'device_channel_indices' that do not match channel count \n"
f"{number_of_device_channel_indices} vs {self.get_num_channels()} \n"
f"device_channel_indices are the following: {device_channel_indices} \n"
f"recording channels are the following: {self.get_channel_ids()} \n"
)
raise ValueError(error_msg)
Hi Spikeinterface,
There seems to be an issue in the spikeinterface set_probes function in the core packages.
I am trying to set a probes to a recording but I get this error :
When I had a look at the code, it seems to check the max of the device_channel_indices against the number of channel in the recording should it be comparing size?