-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #440 from int-brain-lab/develop
Release 2.9.1
- Loading branch information
Showing
15 changed files
with
520 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,37 @@ | ||
""" | ||
Get spikes, clusters and channels data | ||
======================================== | ||
Downloads and loads in spikes, clusters and channels data for a given session. Data is returned | ||
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 | ||
""" | ||
import brainbox.io.one as bbone | ||
|
||
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, 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) | ||
|
||
one = ONE(base_url='https://openalyx.internationalbrainlab.org', silent=True) | ||
|
||
# Find eid of interest | ||
eid = one.search(subject='CSH_ZAD_029', date='2020-09-19')[0] | ||
|
||
################################################################################################## | ||
# 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 | ||
spikes, clusters, channels = bbone.load_spike_sorting_with_channel(eid, one=one) | ||
print(spikes.keys()) | ||
print(spikes['probe01'].keys()) | ||
|
||
################################################################################################## | ||
# Example 2: | ||
# Download spikes, clusters and channels data for a single probe | ||
spikes, clusters, channels = bbone.load_spike_sorting_with_channel(eid, one=one, probe='probe01') | ||
print(spikes.keys()) | ||
|
||
################################################################################################## | ||
# 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 | ||
|
||
spikes, clusters, channels = bbone.load_spike_sorting_with_channel(eid, one=one, probe='probe01', | ||
dataset_types=['clusters.peakToTrough']) | ||
print(clusters['probe01'].keys()) | ||
# available spike sorting collections for this probe insertion | ||
print(sl.collections) | ||
|
||
# the collection that has been loaded | ||
print(sl.collection) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
__version__ = "2.9.0" | ||
__version__ = "2.9.1" | ||
import warnings | ||
|
||
from ibllib.misc import logger_config | ||
|
Oops, something went wrong.