IBL channels cortical depth from channels object in ONE-api

I am trying to compute the cortical depth of the channels, from the channels obejct.

session_id = 6c6983ef-7383-4989-9183-32b1a300d17a
probe_id = c0c3c95d-43c3-4e30-9ce7-0519d0473911

probes_list, probenames = one.eid2pid(session_id) # probe_id is pid in the IBL tutorials

probes_list = np.array(probes_list)

probenames = np.array(probenames)

probe_name = probenames[probes_list == probe_id]

probe_name = probe_name[0]

del probes_list

del probenames

collectionname = f'alf/{probe_name}/pykilosort' # ensures channels are all from this probe

channels = one.load_object(session_id, 'channels', collection=collectionname)

I have found these two
probes description: ibllib.ephys.spikes — IBL Library documentation

Insertiondepth: iblatlas.atlas — IBL Library documentation

I have attempted…

from ibllib.ephys.spikes import probe_description

test = probe_description(collectionname)

But this gives an error.


You can find the channel locations using the following code

from one.api import ONE
from iblatlas.atlas import AllenAtlas, Insertion
from brainbox.io.one import SpikeSortingLoader

one = ONE(base_url='https://openalyx.internationalbrainlab.org')
ba = AllenAtlas()
pid = 'decc8d40-cf74-4263-ae9d-a0cc68b47e86'
# Load in the channels
ssl = SpikeSortingLoader(pid=pid, one=one, atlas=ba)
channels = ssl.load_channels()
# Coordinates of each channel in 3D space relative to Bregma
xyz = np.c_[channels['x'], channels['y'], channels['z']]

# From the channels we can compute an insertion object
ins = Insertion.from_track(xyz, brain_atlas=ba)

# The entry point of this insertion object on the surface of the cortex is given by
entry = ins.entry

You could then compute the depth or euclidean distance of each channel relative to this entry point, does this get out what you need?

I apologize I’m a statistician not an experimentalist, I’ve never actually had to insert a neuropixels probe so computing this is not something I am familiar with. It’s not clear how I could take your dv coordinates and compute a cortical depth measure from them. Is it as simple as just multiplying the entry array in my case …array([-0.003514, -0.002875, -0.000668]) element wise with the IBL convention coordinates for each channel?

I looked up the code of the method you used and its not really explained what this is.

from the source code we have this…

class Insertion(iblatlas.atlas.Insertion):
Defines an ephys probe insertion in 3D coordinate. IBL conventions.

To instantiate, use the static methods: `Insertion.from_track` and `Insertion.from_dict`.

and this…

class Insertion(x: float, y: float, z: float, phi: float, theta: float, depth: float, label: str = ‘’, beta: float = 0 )[source]

Bases: Insertion

Defines an ephys probe insertion in 3D coordinate. IBL conventions.

To instantiate, use the static methods: Insertion.from_track and Insertion.from_dict.