probeinterface icon indicating copy to clipboard operation
probeinterface copied to clipboard

read_probeinterface() does not read in device_channel_indices

Open ThetaS opened this issue 2 years ago • 8 comments

Hello,

I got this problem when attempting to attach a probe read in using read_probeinterface(). Since I have only one probe, I first convert the read in probegroup to dataframe then instantiate a Probe object from dataframe. The .json file was able to retain the device indices I saved but the read in function didn't take this column in as it was not in the dataframe. Is there something I misunderstood and did wrong, or it was a glitch of the function?

Thanks,

ThetaS avatar Jun 08 '23 06:06 ThetaS

Hi @ThetaS. Can you share the piece of code to generate the probe + the dataframe + the json file ?

samuelgarcia avatar Jun 08 '23 07:06 samuelgarcia

Thanks for the response and sorry for the delay! Sure, here are the code snippets: image

This is the calling from my analysis code: image

I'm working with the UCLA Masmanidis probes and had quite a hard to generate the probe map because they are checkerboard patterned and multi-shank. Hope I didn't miss any shortcuts and solutions for handling this problem.

Thank you very much.

ThetaS

128ANbottom_map.zip

ThetaS avatar Jun 12 '23 05:06 ThetaS

128_ANbottom_map.csv This is the CSV associated. Basically, the information from the Masmanidis lab's Matlab program and the wiring configuration to Intan 128 headstage.

For the calling part, I tried ndim = 2 and 3, both didn't work.

Best

ThetaS avatar Jun 12 '23 05:06 ThetaS

Hi, You have device_channel_ids, in probeinterface it should device_channel_indices and it should be starting from 0. So a zero-based index and not an "id" (identifier). contact_id = id = str or int = zeros-based orone-based device_channel_indices = index = zero-based in the python ecosystem

samuelgarcia avatar Jun 12 '23 12:06 samuelgarcia

Thank you very much for solving this problem and explain the backend logic! When plotting this probe I'm also a bit confused with the "plane axes" parameter. I don't think the doc explain this concept very well. Suppose my probe is 2D, may I know how this parameter is supposed to be tuned?

Again, thank you very much for the feedback.

ThetaS avatar Jun 15 '23 22:06 ThetaS

The plan axes is a bit more complicated. This is used internally for rotation. And so not so well documentated.

On this example : https://probeinterface.readthedocs.io/en/main/examples/ex_08_more_plotting_examples.html#sphx-glr-examples-ex-08-more-plotting-examples-py you can see that some some probe are rotated. In that case you should inspect the plane_axes and you will understand how this is used.

By default, you should not use this plan_axes and everything should be OK and with no rotation.

samuelgarcia avatar Jun 16 '23 07:06 samuelgarcia

Yes, I tried deleting the plane_axes parameter and the plotting works. But the previous question, I tried the keyword "device_channel_indices" and zero-based my indices and it failed to work.

image image image

The save part is the same as above, key modifications are shown in the images.

ThetaS avatar Jun 17 '23 03:06 ThetaS

I think the problem is how you're setting the probe in SpikeInterface!

You need to use in_place=True if you want to modify an existing object. Otherwise the set_probe/probegroup will return a separate object (see here: https://spikeinterface.readthedocs.io/en/latest/modules/core.html#handling-probes)

Basically you can do:

data.set_probegroup(probe, group_mode="by_shank", in_place=True)
# or
daa_w_probe = data.set_probegroup(probe, group_mode="by_shank") 
# then continue with data_w_probe

alejoe91 avatar Aug 23 '23 11:08 alejoe91