nSTAT Python Documentation
Neural Spike Train Analysis Toolbox for Python — a faithful port of the
MATLAB nSTAT toolbox
(Cajigas, Malik & Brown, 2012),
plus an opt-in nstat.extras namespace for modern Python-only additions.
pip install nstat-toolboxNew here? Start with the friendly, illustrated
5-minute intro — runnable snippets, the nstat.extras
bridges, and the paper-example gallery.
Quickstart
pip install nstat-toolbox
nstat-install --download-example-data always # ~150 MB figshare dataset
import numpy as np
from nstat import nspikeTrain
times = np.sort(np.random.default_rng(0).uniform(0, 1, 100))
st = nspikeTrain(times, name="neuron1", sampleRate=1000,
minTime=0.0, maxTime=1.0)
print(f"{st.numSpikes} spikes")
What’s inside
Core (
nstat) — the MATLAB-faithful object model:SignalObj,nspikeTrain,Trial,Analysis,FitResult,DecodingAlgorithms, and the multivariate population goodness-of-fitpopulation_time_rescale().Extras (
nstat.extras) — opt-in bridges with no MATLAB counterpart: state-space EM (Dynamax), clusterless decoding, cross-validation oracles (NeMoS / pykalman / statsmodels), spike-train metrics (PySpike), and data interop (Neo / pynapple / pynwb).Five paper examples — the canonical Cajigas 2012 analyses, each runnable in under a minute on the example dataset.
Find your way around
Friendly 5-minute intro — the best starting point.
Concepts & Background — learn the neuroscience and statistics behind the toolbox (microelectrode recordings, spikes & the LFP, point-process GLMs, goodness-of-fit, decoding), with worked snippets and cited literature.
Paper-Aligned Toolbox Map — crosswalk between the 2012 paper and the Python API.
Class Definitions — method catalog for every core class.
API Reference — full API reference (auto-generated from docstrings).
Extras — opt-in bridges to the Python neuro ecosystem — narrative guides for each
nstat.extrasbridge, plus the visual summary.nSTAT Python Paper Examples — the figure gallery.
What’s New — per-release change summaries.
Citing nSTAT
If you use nSTAT in your work, please cite:
Cajigas I, Malik WQ, Brown EN. nSTAT: Open-source neural spike train analysis toolbox for Matlab. Journal of Neuroscience Methods 211: 245–264, Nov. 2012. doi:10.1016/j.jneumeth.2012.08.009
nSTAT is distributed under the GPL-2.0 license.