Closed DradeAW closed 2 years ago
The PRB is somehow a bit ambiguous. You should generate your probe directly with probeinterface object and save then with the internal format (json based).
In PRB, file 'channels' refer to the "channel index" of the device so the wiring. It is zeros based. This 'channels' will be set to device_channel_indices
in the probe attributes.
Oh no. SOrry. there is a bug in the uimplementation of probeinterface. I will fix this soon. Sorry.
I understand now your problem.
'geometry'
is supposed to be a dict in our implementation instead of a list of list.
So something like this:
channel_groups = {
0: {
'channels': [10, 8, 25, 19, 23, 17, 11, 6, 22, 21, 7, 18, 20, 9, 16, 5],
'geometry': {
10: [0, 0],
8 : [-25, -12.5],
25 : [0, -25.0],
...
in that case the acutal implementation is working.
Were did you get this PRB ? it sounds like a variant of PRB. The main problem with PRB format is that nobody never specify it really but many tools use it (klusta, spyking-circus, tridesclous, the old spikeinterface, ....)
It is the main reason why we introduce the probeinterface format with clear spec.
What I would do is to parse manually you pseudo-prb file and build by your own a good probegroup. It will be more reliable:
channel_groups = ....
probegroup = ProbeGroup()
for group_id, group in channel_groups.items():
probe = Probe()
probe.set_contacts(positions=np.array(group['geometry']),
shapes='circle', shape_params={'radius': 5})
# probe.create_auto_shape(probe_type='tip')
contact_ids = np.array(group['label'], dtype='S')
probe.set_contact_ids(contact_ids)
probe.set_device_channel_indices(group['channels'])
probegroup.add_probe(probe)
I believe it came from Cambridge Neurotech
with the probe.
Thank you for the answer, we'll try it!
Hi,
We've tested the code, and we're having some issues.
Here is the code with the same arch.prb
:
import probeinterface as pi
import numpy as np
import spikeinterface as si
recording = si.BinaryRecordingExtractor("/path/to/recording.dat", 30000, 64, np.int16)
execfile("/path/to/arch.prb") # Acquiring the channel_groups dict
probegroup = pi.ProbeGroup()
for group_id, group in channel_groups.items():
probe = pi.Probe()
probe.set_contacts(positions=np.array(group['geometry']),
shapes='circle', shape_params={'radius': 5})
# probe.create_auto_shape(probe_type='tip')
contact_ids = np.array(group['label'], dtype='S')
probe.set_contact_ids(contact_ids)
probe.set_device_channel_indices(group['channels'])
probegroup.add_probe(probe)
recording.set_probegroup(probegroup)
recording.get_probegroup()
We get the following error:
File "~/miniconda3/envs/projet/lib/python3.8/site-packages/spikeinterface-0.94.0.dev0-py3.8.egg/spikeinterface/core/baserecording.py", line 400, in get_probegroup
raise ValueError('There is not Probe attached to recording. use set_probe(...)')
ValueError: There is not Probe attached to recording. use set_probe(...)
We are using the latest versions of spikeinterface
and probeinterface
.
You need to do
recording_with_probe = recording.set_probegroup(probegroup)
and then use recording_with_probe
or
recording = recording.set_probegroup(probegroup)
Ah yes, I feel kinda dumb ^^'
I keep forgetting spikeinterface
uses this king of setters.
Thank you!
Hi,
I'm trying to load the geometry of my probe using
probeinterface
. However, it crashes because of this line, where the channel id is taken, but that doesn't work in out case:https://github.com/SpikeInterface/probeinterface/blob/4c34a06293cd7a5602293829155a884d0f50a9fe/probeinterface/io.py#L451
Here is my prb file:
Here is the crash report:
Is my prb file wrong, or is it a bug?
Thank you, Drade