preconstruct
The preconstruct module creates a dataset that is arranged to facilitate
neural decoding, i.e. reconstructing a stimulus given the neural
response that it induces.
To create the dataset, you must create a preconstruct.sources.DataSource
and pass it a preconstruct.dataset.DatasetBuilder and configure your dataset.
What this library can do
- Download your pprox files
and stimuli in WAVE format from Neurobank
(
preconstruct.sources.NeurobankSource) - Allow you to easily switch between different sources of data, such as
local files (
preconstruct.sources.FsSource) or Python dictionaries (preconstruct.sources.MemorySource) - Create gammatone-based spectrogram from raw WAVE data of the stimuli
(
preconstruct.dataset.DatasetBuilder.add_stimuli) - Automatically update your pprox files to match the stimtrial specification and store the data in a convenient pandas DataFrame
- Convert the point process from the pprox data into an array of fixed duration
bins containing the count of spikes occuring within the corresponding time window
(
preconstruct.dataset.DatasetBuilder.bin_responses) - Project the spikes into an alternate basis (
preconstruct.basisfunctions) - Rearrange the binned pprox data into windows of a given duration
taufor input into a neural decoding model
1""" 2The `preconstruct` module creates a dataset that is arranged to facilitate 3neural decoding, i.e. reconstructing a stimulus given the neural 4response that it induces. 5 6To create the dataset, you must create a `preconstruct.sources.DataSource` 7and pass it a `preconstruct.dataset.DatasetBuilder` and configure your dataset. 8 9## What this library can do 10 11- Download your [pprox](https://meliza.org/spec:2/pprox/) files 12and stimuli in WAVE format from [Neurobank](https://github.com/melizalab/neurobank) 13(`preconstruct.sources.NeurobankSource`) 14- Allow you to easily switch between different sources of data, such as 15local files (`preconstruct.sources.FsSource`) 16or Python dictionaries (`preconstruct.sources.MemorySource`) 17- Create gammatone-based spectrogram from raw WAVE data of the stimuli 18(`preconstruct.dataset.DatasetBuilder.add_stimuli`) 19- Automatically update your pprox files to match the 20[stimtrial specification](https://github.com/melizalab/lab_specs/blob/main/specs/stimulus_trial.md) 21and store the data in a convenient pandas DataFrame 22- Convert the point process from the pprox data into an array of fixed duration 23bins containing the count of spikes occuring within the corresponding time window 24(`preconstruct.dataset.DatasetBuilder.bin_responses`) 25- Project the spikes into an alternate basis (`preconstruct.basisfunctions`) 26- Rearrange the binned pprox data into windows of a given duration `tau` for 27input into a neural decoding model 28""" 29from joblib import Memory 30from appdirs import user_cache_dir 31 32from pathlib import Path 33from single_source import get_version 34 35__version__ = get_version(__name__, Path(__file__).parent.parent) 36 37APP_NAME = "preconstruct" 38APP_AUTHOR = "melizalab" 39 40 41_cache_dir = user_cache_dir(APP_NAME, APP_AUTHOR) 42_mem = Memory(_cache_dir, verbose=0) 43 44from preconstruct.dataset import Dataset, DatasetBuilder 45from preconstruct import basisfunctions