Get spikes, clusters and channels data

Downloads and loads in spikes, clusters and channels data for a given session. Data is returned

[1]:
from oneibl.one import ONE
import brainbox.io.one as bbone
one = ONE()

# Find eid of interest
eid = one.search(subject='CSH_ZAD_001', date='2020-01-14')[0]
Connected to https://alyx.internationalbrainlab.org as mayo

Example 1: Download spikes, clusters and channels data for all available probes for this session. The data for each probe is returned as a dict

[2]:
spikes, clusters, channels = bbone.load_spike_sorting_with_channel(eid, one=one)
print(spikes.keys())
print(spikes['probe00'].keys())
2021-04-01 09:07:50.629 INFO     [one.py:290] Local files for spikes and clusters for C:\Users\Mayo\Downloads\FlatIron\zadorlab\Subjects\CSH_ZAD_001\2020-01-14\002 and probe00 found. To re-download set force=True
2021-04-01 09:07:50.969 INFO     [one.py:290] Local files for spikes and clusters for C:\Users\Mayo\Downloads\FlatIron\zadorlab\Subjects\CSH_ZAD_001\2020-01-14\002 and probe01 found. To re-download set force=True
2021-04-01 09:07:53.650 INFO     [one.py:94] Channel locations for probe00 have been resolved. Channel and cluster locations obtained from ephys aligned histology track.
2021-04-01 09:07:54.73 INFO     [one.py:149] Channel locations for probe01 have not been resolved. Channel and cluster locations obtained from histology track.
dict_keys(['probe00', 'probe01'])
dict_keys(['amps', 'clusters', 'depths', 'samples', 'templates', 'times'])

Example 2: Download spikes, clusters and channels data for a single probe

[3]:
spikes, clusters, channels = bbone.load_spike_sorting_with_channel(eid, one=one, probe='probe00')
print(spikes.keys())
2021-04-01 09:07:55.852 INFO     [one.py:290] Local files for spikes and clusters for C:\Users\Mayo\Downloads\FlatIron\zadorlab\Subjects\CSH_ZAD_001\2020-01-14\002 and probe00 found. To re-download set force=True
2021-04-01 09:07:58.559 INFO     [one.py:94] Channel locations for probe00 have been resolved. Channel and cluster locations obtained from ephys aligned histology track.
dict_keys(['probe00'])

Example 3: The default spikes and clusters datasets that are downloaded are ’ [‘clusters.channels’, ‘clusters.depths’, ‘clusters.metrics’, ‘spikes.clusters’, ‘spikes.times’] If we also want to load for example, ’clusters.peakToTrough we can add a dataset_types argument

[4]:
dtypes_extra = ['clusters.peakToTrough']
spikes, clusters, channels = bbone.load_spike_sorting_with_channel(eid, one=one, probe='probe00',
                                                                   dataset_types=dtypes_extra)
print(clusters['probe00'].keys())
2021-04-01 09:07:59.116 INFO     [one.py:290] Local files for spikes and clusters for C:\Users\Mayo\Downloads\FlatIron\zadorlab\Subjects\CSH_ZAD_001\2020-01-14\002 and probe00 found. To re-download set force=True
2021-04-01 09:08:01.822 INFO     [one.py:94] Channel locations for probe00 have been resolved. Channel and cluster locations obtained from ephys aligned histology track.
dict_keys(['amps', 'brainLocationAcronyms_ccf_2017', 'brainLocationIds_ccf_2017', 'channels', 'depths', 'metrics', 'mlapdv', 'peakToTrough', 'uuids', 'waveforms', 'waveformsChannels', 'acronym', 'atlas_id', 'x', 'y', 'z'])

Example 4: By default, load_spike_sorting_with_channel will look for available data on your local computer and if all the datasets are found it will not check for consistency with files stored on flatiron (to speed up loading process). To make sure that data is always synced to flatiron we can set a force flag to True

[5]:
spikes, clusters, channels = bbone.load_spike_sorting_with_channel(eid, one=one, probe='probe00',
                                                                   force=True)
2021-04-01 09:08:02.381 INFO     [one.py:273] Did not find local files for spikes and clusters for C:\Users\Mayo\Downloads\FlatIron\zadorlab\Subjects\CSH_ZAD_001\2020-01-14\002 and probe00. Downloading....
2021-04-01 09:08:06.185 INFO     [one.py:94] Channel locations for probe00 have been resolved. Channel and cluster locations obtained from ephys aligned histology track.