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())
2020-10-29 14:58:27.315 INFO     [one.py:264] 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
2020-10-29 14:58:27.371 INFO     [one.py:264] 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
2020-10-29 14:58:27.692 INFO     [one.py:123] Channel locations for probe01 have not been resolved. Channel and cluster locations obtained from histology track.
2020-10-29 14:58:29.693 INFO     [one.py:89] Channel locations for probe00 have been resolved. Channel and cluster locations obtained from ephys aligned histology track.
dict_keys(['probe01', 'probe00'])
dict_keys(['clusters', '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())
2020-10-29 14:58:30.377 INFO     [one.py:264] 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
2020-10-29 14:58:30.686 INFO     [one.py:89] 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())
2020-10-29 14:58:31.383 INFO     [one.py:264] 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
2020-10-29 14:58:31.694 INFO     [one.py:89] Channel locations for probe00 have been resolved. Channel and cluster locations obtained from ephys aligned histology track.
dict_keys(['channels', 'depths', 'metrics', 'peakToTrough', '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)
2020-10-29 14:58:32.358 INFO     [one.py:247] 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....
2020-10-29 14:58:41.569 INFO     [one.py:89] Channel locations for probe00 have been resolved. Channel and cluster locations obtained from ephys aligned histology track.