concord-model-jansen-rit
Classic 3-population cortical column model (Jansen & Rit, 1995)
concord.models:jansen_rit.
For a conceptual introduction to neural mass models and the Jansen-Rit equations, see Neural Mass Models (background reading).
Package Structure
concord-model-jansen-rit/
src/concord_model_jansen_rit/
__init__.py exports JansenRit
equations.py pure derivative function (6 ODEs)
model.py JansenRit class implementing Model ABC
equations.py
Compute derivatives of the 6-variable Jansen-Rit ODE system. This is a pure numerical function with no Model ABC knowledge — it can be called directly for testing or used by the integrator.
| Parameter | Description |
|---|---|
| y | State vector, shape (6,). [y0, y1, y2, y3, y4, y5] |
| t | Current time (kept for integrator interface) |
| p_input | Instantaneous external input (mean + noise sample) |
| A, B | Max EPSP / IPSP amplitude (mV) |
| a, b | EPSP / IPSP time constants (1/s) |
| C1..C4 | Connectivity constants |
| e0, v0, r | Sigmoid parameters |
State variable mapping: y0 = excitatory PSP on pyramidal cells, y1 = PSP from external + feedback on excitatory interneurons, y2 = inhibitory PSP on pyramidal cells. y3, y4, y5 are their time derivatives. Output signal = y1 - y2.
model.py — JansenRit
Implements the Model ABC. Single-node cortical column producing alpha-band (~10 Hz) oscillations at default parameters.
| Constructor | Type | Description |
|---|---|---|
| dt | float | Internal integration time step in seconds. Default 1e-4 (0.1 ms). |
Returns "jansen_rit".
Returns a ParameterVector with 10 named parameters, their default values, and bounds:
| Name | Default | Lower | Upper | Units |
|---|---|---|---|---|
| A | 3.25 | 1.0 | 10.0 | mV |
| B | 22.0 | 5.0 | 50.0 | mV |
| a | 100.0 | 50.0 | 200.0 | 1/s |
| b | 50.0 | 10.0 | 100.0 | 1/s |
| C | 135.0 | 50.0 | 500.0 | |
| e0 | 2.5 | 1.0 | 5.0 | 1/s |
| v0 | 6.0 | 3.0 | 12.0 | mV |
| r | 0.56 | 0.1 | 1.0 | 1/mV |
| p | 220.0 | 0.0 | 500.0 | Hz |
| sigma | 22.0 | 0.0 | 100.0 | Hz |
Connectivity constants are derived from C: C1 = C, C2 = 0.8C, C3 = 0.25C, C4 = 0.25C.
Run the simulation and return a ModelOutput.
| Parameter | Type | Description |
|---|---|---|
| parameters | ParameterVector | Model parameters (from default_parameters() or modified) |
| duration_s | float | Simulation duration in seconds |
| fs | float | Output sampling rate in Hz |
| seed | int | None | Random seed for reproducibility. None = non-reproducible. |
Integration uses RK4 at the internal time step (default 0.1 ms). External input noise
is pre-generated for the full duration. After integration, the output is downsampled
to the requested fs using scipy.signal.decimate.
The returned ModelOutput contains:
data— shape (1, n_samples): the simulated signal (y1 - y2)state_variables— dict with keys "y0" through "y5", each shape (1, n_samples)time_axis— time stamps in secondsnode_labels— ["node_0"]
Entry Point Registration
In pyproject.toml:
[project.entry-points."concord.models"]
jansen_rit = "concord_model_jansen_rit:JansenRit"
This allows concord-fit (and other discovery tools) to find the model without hard imports.
See Python Entry Points for how discovery works.
Usage Example
from concord_model_jansen_rit import JansenRit
model = JansenRit()
params = model.default_parameters()
# Simulate 3 seconds at 1024 Hz
result = model.simulate(params, duration_s=3.0, fs=1024.0, seed=42)
# The output signal
signal = result.data[0, :] # shape (n_samples,)
times = result.time_axis # shape (n_samples,)
# Modify a parameter
p_idx = params.names.index("p")
params.values[p_idx] = 300.0 # higher input → more spiking
result2 = model.simulate(params, duration_s=3.0, fs=1024.0, seed=42)