SpikeInterface / spikeinterface

A Python-based module for creating flexible and robust spike sorting pipelines.
https://spikeinterface.readthedocs.io
MIT License
526 stars 187 forks source link

help with creating custom probe using probeinterface #3254

Open kshtjkumar opened 3 months ago

kshtjkumar commented 3 months ago

Hi we are using a custom 32 channel probe which looks like this: image-20

I want to map this with intan probes:

Screenshot 2024-07-25 at 1 13 15 AM
chrishalcrow commented 3 months ago

Hello kshtjkumar, I'm not an expert on this, but there's a tutorial here: https://github.com/SpikeInterface/SpikeInterface-Training-Edinburgh-May24/tree/main/hands_on/probe_handling Have a look at the jupyter notebook probe_handling.ipynb, and the second half shows how to implement a new probe. You could take a look at that and then come back when you have more specific questions and we can help you more precisely :)

jakeswann1 commented 3 months ago

Attached is a script I've used to generate a probeinterface file with some unusual geometry in the past, hopefully it can be useful!

generate_5x12-16_buz.txt

kshtjkumar commented 3 months ago

I will try but I still get stuck on how to get it mapped based on the dimensions, here is a closer look at the probe:

Screenshot 2024-07-26 at 2 30 54 AM
jakeswann1 commented 3 months ago

Can you just treat it as a linear probe and generate using probeinterface.generator.generate_linear_probe(num_elec=32, ypitch=100, contact_shapes='circle', contact_shape_params: dict = {'radius': 20}), then set indices as described here: https://probeinterface.readthedocs.io/en/latest/examples/ex_05_device_channel_indices.html ?

kshtjkumar commented 3 months ago

how do i set electrode ids to custom channels ? for example the electrode 1 which is at the tip is channel 0. Just like the table i pasted above. @jakeswann1

jakeswann1 commented 3 months ago

You can do this by following the instructions in the link in my previous comment. The key function is probe.set_device_channel_indices(channel_indices), where channel_indices is a list of the channels in the order in your table.

They do need to match the order of the electrode IDs assigned to your generated probe, which you can check with plot_probe(probe, with_contact_id=True, with_device_index=True). The order of contact IDs just tells you which electrode is which for the purposes of assigning the device index. The device index is the thing which should match the order of your channels in the recording file

If you want to set the contact_ids as well, to match the order in your 'ele_no' column, you can do that with probe.set_contact_ids

Hope this makes sense!