Coronal PlotΒΆ

Plot a coronal slice (best fit) that contains a given probe track. As input, use an eID and probe label. environment installation guide

# Author: Olivier Winter

import numpy as np
from one.api import ONE

import ibllib.atlas as atlas
import as bbone

# === Parameters section (edit) ===
eid = 'c7bd79c9-c47e-4ea5-aea3-74dda991b48e'
probe_label = 'probe01'
# === Code (do not edit) ===
ba = atlas.AllenAtlas(25)
one = ONE(base_url='')
traj ='trajectories', 'list', session=eid,
                     provenance='Ephys aligned histology track', probe=probe_label)[0]
channels = bbone.load_channel_locations(eid=eid, one=one, probe=probe_label)

picks ='insertions', 'read', id=traj['probe_insertion'])['json']
picks = np.array(picks['xyz_picks']) / 1e6
ins = atlas.Insertion.from_dict(traj)

cax = ba.plot_tilted_slice(xyz=picks, axis=1, volume='image')
cax.plot(picks[:, 0] * 1e6, picks[:, 2] * 1e6)
cax.plot(channels[probe_label].x * 1e6, channels[probe_label].z * 1e6, 'g*')
2021-09-02 15:49:25.255 INFO     [] Channel locations for probe01 have been resolved. Channel and cluster locations obtained from ephys aligned histology track.
[<matplotlib.lines.Line2D at 0x1a29dd2c8b0>]