Preprocessing routines (stnmf.preprocessing
)
Data is brought into appropriate format to be used with and passed to
stnmf.STNMF
.
Spike-triggered analyses (stnmf.preprocessing.spiketriggered
)
Collection of functions performing spike-triggered analyses for multiple cells
|
Compute the spike-triggered average (STA) for multiple cells |
|
Collect the effective spike-triggered stimulus ensemble (STE) |
|
Obtain the spatial crop dimensions containing the receptive field for multiple cells |
|
Obtain temporal and spatial profiles of the STA for multiple cells |
Data preparation
stnmf.STNMF
expects an effective spike-triggered stimulus
ensemble (STE) as input. To format the stimulus and spike response into
an STE the following pipeline can be utilized.
Data requirements
Spatiotemporal stimulus as iterator or iterable with each element yielding a (x,y,trial_length) array_like. For instance, that may be a (num_trials,x,y,trial_length)
numpy.ndarray
. The spatial dimensions should enclose the entire projector screen. It will be cropped for each cell. Each array element is a pixel contrast value deviating from zero either negatively (darker) or positively (brighter).Binned spike counts as (num_trials,trial_length,num_cells) array_like. Each array element is a non-negative integer describing the number of spikes within the (equally sized) time bin.
Pipeline
>>> from stnmf.preprocessing import spiketriggered
Calculate the spike-triggered averages (STAs) of all cells.
>>> stas = spiketriggered.average(stimulus, spikes, tau)
Find the relevant spatial windows around the STAs for all cells.
>>> crops = spiketriggered.window(stas)
Create the temporal profile of the STAs.
>>> sta_space, sta_temp = spiketriggered.profiles(stas, crops)
For each cell idx individually, select its respective data
>>> stim = stimulus[:, crops[idx], :] >>> spk = spikes[..., idx] >>> temporal = sta_temp[idx]
and create the STE, the input for STNMF.
>>> ste = spiketriggered.stimulusensemble(stim, spk, temporal)
Note
Review the individual function signatures to specify additional parameters.