Skip to content
 
 

Repository files navigation

Perturbation testing tutorial

Context

Minimal Python tutorial for perturbation testing using RNN and spiking RNN. to predict the effect of optogenetic stimulation of PV inhibitory neurons. It is a minimal reproduction of the results from Sourmpis et al., eLife 2026 (https://elifesciences.org/articles/106827).

We use data from the Allen institute Neuropixels dataset (see Siegle et al. 2021: https://www.nature.com/articles/s41586-020-03171-x). We use session 829720705 (Pvalb-Cre × Ai32, functional_connectivity) which includes optogenetic stimulation of PV neurons with simultaneous Neuropixels recordings.

Installation

Install uv, then sync the environment:

uv sync

This works everywhere (macOS, CPU-only PCs, etc.) and runs on CPU — or the Metal GPU on Apple Silicon. If you have an NVIDIA GPU, add the CUDA wheel:

uv sync --extra cu126

Training a spontaneous-activity generator

uv run python train_rnn.py

We recommend trying the sign-constrained leaky integrate-and-fire model:

uv run python train_rnn.py 
uv run python train_rnn.py --model lif
uv run python train_rnn.py --sign-constrained
uv run python train_rnn.py --sign-constrained --model lif

Example test-set rasters after training (data vs. model, excitatory units only):

Without optogenetic perturbation:

test rasters

With PV-opto perturbation (the model's inhibitory units are driven by the same i(t) as the recordings):

perturbation rasters

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages