iSTTC Notebook: Function & Code Documentation
This notebook estimates intrinsic neural timescales (ITs) from single-unit recordings spanning the entire mouse brain. Timescales are defined as the decay time constant of the autocorrelation function of spontaneous neural activity, reflecting how neural circuits integrate information over time.
Two complementary approaches are integrated: (1) the iSTTC method (Pochinok et al., 2025) for unbiased ACF estimation, and (2) multi-exponential BIC model fitting (Shi et al., 2025).
Spike Train Tiling Coefficient adapted for ITs. Reduces systematic bias under low firing rates and bursty dynamics.
ACF modeled as sum of M exponentials (M = 1–4) by BIC. Captures multiple slopes single-exponential models miss.
IBL Neuropixels — 115 mice, 223 brain regions. Same dataset as Shi et al. (2025) (IBL, 2023).
Google Colab. Dependencies: ONE-api, numpy, scipy, numba, joblib.
Setup & Dependencies
The first cell mounts Google Drive and installs all required packages. Dependencies include ONE-api (IBL data access), numpy / scipy (numerical routines), numba (JIT compilation for the iSTTC kernel), joblib (parallelized session processing), and matplotlib (single-neuron visualization).
iSTTC Implementation
The iSTTC computes the ACF directly on spike times, avoiding binning. All inner functions are JIT-compiled via Numba's @njit.
Computes T_A: the fraction of total recording duration within Δt of any spike.
Operates directly on spike times without binning — a key distinction from conventional ACF.
Computes P_A|B: fraction of spikes in train A within Δt of any spike in train B. Uses binary search for efficient neighborhood queries. Yields substantially lower REE than binned ACF, especially under low firing rate and high Lv.
Core computation. For each lag k, the spike train is split into two segments (A: shifted; B: unshifted). STTC formula applied at each lag:
Zero-padded intervals are excluded from T computation, enabling unbiased application to epoched data — overcoming a key PearsonR limitation.
User-facing interface. Sorts spike times, casts to np.float64. Defaults: Δt = 5 ms, n_lags = 1200, lag_shift = 5 ms (Pochinok et al., 2025, §7.4).
Multi-Exponential Model Fitting
Captures multiple linear slopes in log-ACF that single-exponential models fail to describe.
Fits M = 1, 2, 3, 4 component models via scipy.optimize.curve_fit. Initial params on log scale; lower bound = 5 ms, upper = max lag.
BIC
Constraint: each component must contribute ≥ 1% of total autocorrelation (cᵢ ≥ 0.01 · Σⱼ cⱼ).
Effective Timescale
Confidence Interval
95% CI via error propagation through the covariance matrix; Student's t distribution for small samples.
Local Variance (Lv)
Lv correlates with excitation strength of the Hawkes process. iSTTC advantage over ACF is most pronounced under Lv > 1 — the bursty, low-rate regime characteristic of neocortex. See Dashboard §04 for how Lv relates to measured timescales.
Poisson firing dynamics
Regular, oscillatory firing
Bursty firing — clusters + long silences
iSTTC advantage maximal at Lv > 1 (bursty neocortical regime)
Quality Control Criteria
Monotonic decline 50–200 ms. Coef = −0.946, p < 10⁻¹⁶ (Pochinok et al., 2025).
95% CI of τ_eff excludes zero. Coef = −1.325, p < 10⁻¹⁶.
Model fit R² ≥ 0.5 (Shi et al., 2025; Cavanagh et al., 2016).
≥ 100 spikes. Guards against brief-firing unreliable estimates.
iSTTC increases neurons meeting all criteria by ~7–8% vs. PearsonR (Pochinok et al., 2025, Figure 5E).
Spontaneous Activity Window
Extracts the 10-minute passive period at the end of each session: head-fixed mice, dark environment, no stimuli or reward. Used as proxy for spontaneous activity following Shi et al. (2025).
Single Neuron & Session Analysis
Sequentially: (1) compute iSTTC ACF, (2) fit multi-exponential with BIC, (3) evaluate QC criteria, (4) compute FR and Lv. Output: τ_eff, τᵢ, cᵢ, fit quality, raw ACF + fitted curve.
Unit of work per neuron cluster. Validates IBL QC labels (≥ 2), checks spike count, calls analyze_single_neuron, merges with session metadata.
Downloads data via ONE API, identifies spontaneous window, runs _process_cluster in parallel via joblib.Parallel.
Visualization
- Left: raw iSTTC points (blue) + multi-exponential fit (red), fit info, 50–200 ms QC window.
- Right: neuron summary — FR, Lv, spike count, τᵢ, cᵢ, CIs, QC outcomes.
Batch Processing Infrastructure
get_next_pids— retrieves unprocessed PIDs per team member from CSV registry.mark_isttc_done— updates registry on completion.run_batch— connects ONE API, processes sessions sequentially, saves incrementally (minimizes data loss).
Parameter Summary
| Parameter | Value | Source |
|---|---|---|
| Δt (iSTTC window) | 25 ms | Pochinok et al. (2025), §7.4 |
lag_shift | 5–10 ms | Pochinok et al. (2025) |
| n_lags | 600–1200 | This notebook |
| Maximum components | 4 | Shi et al. (2025) |
| Min. component contribution | 1% | Shi et al. (2025) |
| R² threshold | ≥ 0.5 | Pochinok et al. (2025); Shi et al. (2025) |
| Min. spike count | 100 | This notebook |
| Spontaneous activity duration | ~10 min | Shi et al. (2025) |
Methodological Rationale
iSTTC reduces systematic ACF estimation bias by ~8% REE vs. PearsonR, with ~10× lower REE vs. epoched data — justifying continuous spontaneous recording. The multi-timescale model captures multiple log-ACF slopes that single-exponential fails to describe; 51% of neurons in Shi et al. (2025) required ≥ 2 components, consistent with 72% observed here.
References
- Cavanagh SE et al. (2016). Autocorrelation structure at rest predicts value correlates. eLife 5:e18937.
- International Brain Laboratory (2023). Brain-wide map of neural activity. bioRxiv.
- Murray JD et al. (2014). A hierarchy of intrinsic timescales. Nature Neuroscience 17:1661.
- Pochinok I et al. (2025). iSTTC: robust method for intrinsic timescale estimation. bioRxiv. doi.org/10.1101/2025.08.01.668071
- Shi Y-L et al. (2025). Brain-wide organization of intrinsic timescales. bioRxiv. doi.org/10.1101/2025.08.30.673281
- Shinomoto S et al. (2009). Relating neuronal firing patterns to cortical differentiation. PLoS Comp Biol 5:e1000433.
- Wasmuht DF et al. (2018). Intrinsic neuronal dynamics predict functional roles during working memory. Nat Commun 9:3499.