Get spikes, clusters and channels data

Downloads and loads in spikes, clusters and channels data for a given probe insertion.

There could be several spike sorting collections, by default the loader will get the pykilosort collection

The channel locations can come from several sources, it will load the most advanced version of the histology available, regardless of the spike sorting version loaded. The steps are (from most advanced to fresh out of the imaging): - alf: the final version of channel locations, same as resolved with the difference that data has been written out to files - resolved: channel locations alignments have been agreed upon - aligned: channel locations have been aligned, but review or other alignments are pending, potentially not accurate - traced: the histology track has been recovered from microscopy, however the depths may not match, inacurate data

[1]:
from one.api import ONE
from ibllib.atlas import AllenAtlas
from brainbox.io.one import SpikeSortingLoader


one = ONE(base_url='https://openalyx.internationalbrainlab.org')
ba = AllenAtlas()

insertions = one.alyx.rest('insertions', 'list')
pid = insertions[0]['id']
sl = SpikeSortingLoader(pid=pid, one=one, atlas=ba)
spikes, clusters, channels = sl.load_spike_sorting()
clusters_labeled = SpikeSortingLoader.merge_clusters(spikes, clusters, channels)

# the histology property holds the provenance of the current channel locations
print(sl.histology)

# available spike sorting collections for this probe insertion
print(sl.collections)

# the collection that has been loaded
print(sl.collection)
Downloading: C:\Users\Mayo\Downloads\ONE\openalyx.internationalbrainlab.org\hoferlab\Subjects\SWC_043\2020-09-21\001\alf\probe00\spikes.depths.545f7a74-9a47-438b-8367-d715d70a3710.npy Bytes: 160769816
  0%|                                                                                    | 0/160769816 [00:00<?, ?it/s]
Downloading: C:\Users\Mayo\Downloads\ONE\openalyx.internationalbrainlab.org\hoferlab\Subjects\SWC_043\2020-09-21\001\alf\probe00\spikes.times.dd78976c-fc95-4221-83db-a034652b8867.npy Bytes: 160769816

  0%|                                                                                    | 0/160769816 [00:00<?, ?it/s]
Downloading: C:\Users\Mayo\Downloads\ONE\openalyx.internationalbrainlab.org\hoferlab\Subjects\SWC_043\2020-09-21\001\alf\probe00\spikes.amps.a51473f0-4139-4d01-9264-bea36db1789a.npy Bytes: 160769816


  0%|                                                                                    | 0/160769816 [00:00<?, ?it/s]
Downloading: C:\Users\Mayo\Downloads\ONE\openalyx.internationalbrainlab.org\hoferlab\Subjects\SWC_043\2020-09-21\001\alf\probe00\spikes.clusters.854e2ec7-c974-4dcc-8dea-b0a6063febdf.npy Bytes: 80384972



  3%|█▋                                                               | 4194304/160769816 [00:03<02:06, 1239444.88it/s]
  3%|█▋                                                               | 4194304/160769816 [00:03<02:13, 1170618.98it/s]

  8%|█████                                                           | 12582912/160769816 [00:05<00:55, 2674159.69it/s]
  8%|█████                                                           | 12582912/160769816 [00:05<00:57, 2579330.04it/s]


 16%|██████████                                                      | 25165824/160769816 [00:06<00:28, 4747321.70it/s]
 16%|██████████                                                      | 25165824/160769816 [00:07<00:31, 4363751.03it/s]

 26%|████████████████▋                                               | 41943040/160769816 [00:07<00:16, 7348626.02it/s]
 26%|████████████████▋                                               | 41943040/160769816 [00:08<00:18, 6328298.72it/s]


 39%|█████████████████████████                                       | 62914560/160769816 [00:09<00:10, 9134868.64it/s]

 16%|██████████                                                      | 25165824/160769816 [00:09<00:44, 3025314.88it/s]
 55%|██████████████████████████████████▌                            | 88080384/160769816 [00:11<00:06, 10856998.79it/s]
 55%|██████████████████████████████████▌                            | 88080384/160769816 [00:11<00:06, 11276234.73it/s]

 26%|████████████████▋                                               | 41943040/160769816 [00:11<00:26, 4531456.42it/s]


 73%|█████████████████████████████████████████████▎                | 117440512/160769816 [00:13<00:03, 12725534.56it/s]
 73%|█████████████████████████████████████████████▎                | 117440512/160769816 [00:13<00:03, 14017900.47it/s]

 39%|█████████████████████████                                       | 62914560/160769816 [00:14<00:16, 6042980.39it/s]
 94%|██████████████████████████████████████████████████████████▏   | 150994944/160769816 [00:14<00:00, 17543768.55it/s]


 94%|██████████████████████████████████████████████████████████▏   | 150994944/160769816 [00:15<00:00, 14055845.99it/s]
188743680it [00:15, 19522619.97it/s]

188743680it [00:17, 14884536.14it/s]


 78%|██████████████████████████████████████████████████▊              | 62914560/80384972 [00:17<00:03, 4906194.73it/s]
230686720it [00:18, 19720751.60it/s]

230686720it [00:20, 14695699.58it/s]
276824064it [00:20, 18713769.66it/s]


276824064it [00:22, 15833277.65it/s]

 94%|███████████████████████████████████████████████████████████▏   | 150994944/160769816 [00:23<00:01, 8618839.98it/s]
327155712it [00:23, 18941481.90it/s]


327155712it [00:25, 17072378.65it/s]
381681664it [00:25, 19788805.05it/s]

188743680it [00:26, 9424032.10it/s]


381681664it [00:28, 18242800.59it/s]
440401920it [00:28, 20433150.48it/s]


188743680it [00:29, 9708232.92it/s]

440401920it [00:30, 19692792.14it/s]
503316480it [00:31, 22002645.90it/s]


503316480it [00:32, 22090501.37it/s]
570425344it [00:33, 23916177.35it/s]

276824064it [00:33, 11185644.53it/s]


570425344it [00:35, 23924582.17it/s]
641728512it [00:35, 25772737.53it/s]


327155712it [00:35, 18147470.74it/s]

327155712it [00:37, 12231862.95it/s]


381681664it [00:37, 22761988.58it/s]
717225984it [00:38, 27321963.47it/s]


440401920it [00:38, 28693300.64it/s]


503316480it [00:39, 34302402.90it/s]


570425344it [00:40, 40330122.44it/s]
796917760it [00:41, 26088204.83it/s]


641728512it [00:41, 45733866.73it/s]


717225984it [00:42, 52325483.04it/s]


796917760it [00:43, 60589771.65it/s]


877302732it [00:43, 20029463.87it/s]
641728512it [00:47, 11281434.78it/s]

327155712it [00:49, 12231862.95it/s]
717225984it [00:56, 10133174.58it/s]

796917760it [01:00, 12095516.55it/s]
968884224it [01:01, 12708073.33it/s]

440401920it [01:03, 6664034.17it/s]
880803840it [01:04, 14741138.74it/s]
1157627904it [01:04, 22098822.48it/s]

503316480it [01:05, 8873726.50it/s]
968884224it [01:06, 18583083.19it/s]
1363148800it [01:06, 39466105.75it/s]
1061158912it [01:07, 24337143.69it/s]
1585446912it [01:08, 68863434.63it/s]

570425344it [01:08, 11715230.19it/s]
1157627904it [01:09, 31615608.33it/s]
1824522240it [01:09, 107255733.19it/s]
1258291200it [01:10, 39801661.32it/s]
2080374784it [01:10, 150113724.66it/s]

641728512it [01:11, 14422221.34it/s]
1363148800it [01:11, 47824972.54it/s]
2353004544it [01:11, 174511156.50it/s]
1472200704it [01:13, 54408913.68it/s]
2642411520it [01:13, 189084242.53it/s]

717225984it [01:13, 17977819.29it/s]
1585446912it [01:14, 61184769.69it/s]
2948595712it [01:14, 207007515.52it/s]
3107979264it [01:15, 216537881.66it/s]

796917760it [01:15, 22153407.02it/s]
3268749080it [01:15, 43329662.91it/s]
1824522240it [01:17, 74748718.78it/s]

1950351360it [01:18, 81467218.89it/s]

2214592512it [01:20, 91639453.19it/s]

2495610880it [01:23, 103992985.07it/s]

2642411520it [01:24, 113227135.05it/s]

2948595712it [01:26, 136593837.30it/s]

3268749080it [01:27, 37372560.93it/s]


1472200704it [01:28, 50412156.74it/s]

1585446912it [01:30, 55491712.57it/s]

1702887424it [01:31, 62231590.48it/s]

1824522240it [01:33, 69917232.77it/s]

1950351360it [01:34, 76566392.85it/s]

2080374784it [01:35, 82122757.92it/s]

2214592512it [01:37, 88570824.44it/s]

2353004544it [01:38, 94250198.22it/s]

2495610880it [01:39, 95373075.11it/s]

2642411520it [01:41, 98389637.53it/s]

2793406464it [01:42, 101698035.10it/s]

2948595712it [01:44, 104380331.17it/s]

3107979264it [01:45, 110039322.21it/s]

3268749080it [01:45, 30926098.92it/s]
Downloading: C:\Users\Mayo\Downloads\ONE\openalyx.internationalbrainlab.org\hoferlab\Subjects\SWC_043\2020-09-21\001\alf\probe00\clusters.depths.cf745deb-4a45-418f-9871-6a51a6ec712d.npy Bytes: 6480
100%|█████████████████████████████████████████████████████████████████████████| 6480/6480 [00:00<00:00, 1381893.94it/s]
Downloading: C:\Users\Mayo\Downloads\ONE\openalyx.internationalbrainlab.org\hoferlab\Subjects\SWC_043\2020-09-21\001\alf\probe00\clusters.channels.0d0bad29-7f05-4825-8cf9-50d9b7dc83c3.npy Bytes: 6480Downloading: C:\Users\Mayo\Downloads\ONE\openalyx.internationalbrainlab.org\hoferlab\Subjects\SWC_043\2020-09-21\001\alf\probe00\clusters.metrics.8091108f-a0d2-44e0-bf01-5c0a93de7844.pqt Bytes: 96974

  0%|                                                                                        | 0/96974 [00:00<?, ?it/s]
100%|██████████████████████████████████████████████████████████████████████████| 6480/6480 [00:00<00:00, 732669.02it/s]
100%|████████████████████████████████████████████████████████████████████████| 96974/96974 [00:00<00:00, 176760.57it/s]
Downloading: C:\Users\Mayo\Downloads\ONE\openalyx.internationalbrainlab.org\hoferlab\Subjects\SWC_043\2020-09-21\001\alf\probe00\channels.rawInd.5327c66d-dab0-41b3-b180-3aa7d47d5303.npy Bytes: 3120
Downloading: C:\Users\Mayo\Downloads\ONE\openalyx.internationalbrainlab.org\hoferlab\Subjects\SWC_043\2020-09-21\001\alf\probe00\channels.localCoordinates.53ab50fe-b57d-4013-909f-05219e77b053.npy Bytes: 6064

100%|██████████████████████████████████████████████████████████████████████████| 3120/3120 [00:00<00:00, 519253.57it/s]
100%|██████████████████████████████████████████████████████████████████████████| 6064/6064 [00:00<00:00, 370534.94it/s]
Downloading: C:\Users\Mayo\Downloads\ONE\openalyx.internationalbrainlab.org\hoferlab\Subjects\SWC_043\2020-09-21\001\alf\probe00\channels.localCoordinates.53ab50fe-b57d-4013-909f-05219e77b053.npy Bytes: 6064
100%|██████████████████████████████████████████████████████████████████████████| 6064/6064 [00:00<00:00, 749278.52it/s]
traced
['alf/probe00']
alf/probe00