Input / Output¶
Datasets¶
This submodule includes functions for loading datasets. By default, datasets are downloaded and stored in the spykes
directory. This can be overridden by setting the SPYKES_DATA
environment variable to point to your own directory.
-
spykes.io.datasets.
load_neuropixels_data
(dir_name='neuropixels')[source]¶ Downloads and returns data for the Neuropixels example.
The dataset comes from UCL’s Cortex Lab.
Parameters: dir_name (str) – Specifies the directory to which the data files should be downloaded. This is concatenated with the user-set data directory. Returns: A dictionary where each key corresponds to a needed file. Return type: dict
-
spykes.io.datasets.
load_reaching_data
(dir_name='reaching')[source]¶ Downloads and returns data for the Reaching Dataset example.
The dataset is publicly available here. Because this is hosted on DropBox, you have to manually visit the link, then download it to the appropriate location (usually
h5
).Parameters: dir_name (str) – Specifies the directory to which the data files should be downloaded. This is concatenated with the user-set data directory. Returns: The dataset, loaded using deepdish.io.load()
.Return type: deep dish dataset
-
spykes.io.datasets.
load_reaching_xy
(event='goCueTime', feature='endpointOfReach', neuron='M1', window_min=0.0, window_max=500.0, threshold=10.0, dir_name='reaching')[source]¶ Extracts the reach direction and M1 spikes from the reaching dataset.
Parameters: - event (str) – Event to which to align each trial;
goCueTime
,targetOnTime
orrewardTime
. - feature (str) – The feature to get;
endpointOfReach
orreward
. - neuron (str) – The neuron response to use, either
M1
orPMd
. - window_min (double) – The lower window value around the align queue to get spike counts, in milliseconds.
- window_max (double) – The upper window value around the align queue to get spike counts, in milliseconds.
- threshold (double) – The threshold for selecting high-firing neurons, representing the minimum firing rate in Hz.
- dir_name (str) – Specifies the directory to which the data files should be downloaded. This is concatenated with the user-set data directory.
Returns: The
x
andy
features of the dataset.x
: Array with shape(num_samples, num_features)
y
: Array with shape(num_samples, num_neurons)
Return type: tuple
- event (str) – Event to which to align each trial;
-
spykes.io.datasets.
load_reward_data
(dir_name='reward')[source]¶ Downloads and returns the data for the PopVis example.
Downloads and returns data for Neural Coding Reward Example as well as PopVis Example. Dataset comes from Ramkumar et al’s “Premotor and Motor Cortices Encode Reward” paper.
Parameters: dir_name (str) – Specifies the directory to which the data files should be downloaded. This is concatenated with the user-set data directory. Returns: The two downloaded files. sess_one_mat
:mat
file for Monkey M, Session 1.sess_four_mat
:mat
file for Monkey M, Session 4.
Return type: tuple
-
spykes.io.datasets.
load_spikefinder_data
(dir_name='spikefinder')[source]¶ Downloads and returns a dataset of paired calcium recordings.
This dataset was used for the Spikefinder competition (DOI: 10.1101/177956), and consists of datasets of paired calcium traces and spike trains collected from multiple sources.
Parameters: dir_name (str) – Specifies the directory to which the data files should be downloaded. This is concatenated with the user-set data directory. Returns: Paths to the downloaded training and testing datasets. Each dataset is a CSV which can be loaded using Pandas, pd.read_csv(path)
.train_data
: List of pairs of strings, where each pair consists of the path to the calcium data (inputs) and the path to the spike data (ground truth) for that dataset pair.test_data
: List of strings, where each string is the path to a testing dataset.
Return type: tuple