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.

Point-process GLMs · time-rescaling goodness-of-fit · adaptive & hybrid decoding
State-space EM · clusterless decoding · data-interop & validation bridges
pip install nstat-toolbox

New 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-fit population_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

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.