braincell.quad.staggered_step

Contents

braincell.quad.staggered_step#

braincell.quad.staggered_step(target, *args)[source]#

Advance a multi-compartment cell by one staggered time step.

The staggered (operator-splitting) scheme separates the membrane voltage update from the ion-channel gating-variable update so that each sub-system can use the integrator best suited to it. Within a single time step dt:

  1. The cable voltage is advanced with an implicit Euler step solved on the node-tree by dhs_voltage_step() (the dendritic hierarchical solver, DHS). This is unconditionally stable for the linear axial block and lets dt exceed the explicit-stability limit.

  2. All remaining differential states (typically Hodgkin-Huxley gating variables and ion concentrations) are then advanced by ind_exp_euler_step(), with the voltage path ('V',) excluded so the new midpoint voltage from step 1 is not overwritten.

Splitting the cable problem from the channel problem is the same trick used by NEURON and many other compartmental simulators: it preserves second-order accuracy when the channel kinetics are smooth, while keeping the linear cable solve cheap.

Parameters:
  • target (DiffEqModule) – A multi-compartment cell exposing node_tree(), node_scheduling(), and a voltage state V. In practice this is a braincell.Cell instance whose membrane state is laid out on a node tree compatible with the DHS scheduler.

  • *args – Forwarded verbatim to DiffEqModule.compute_derivative() and the underlying voltage and channel solvers (typically the input currents being injected this step).

Returns:

The state of target — voltage, gating variables, and any auxiliary ion states — is updated in place.

Return type:

None

Raises:

See also

dhs_voltage_step

Single implicit-Euler DHS step for the cable voltage.

ind_exp_euler_step

Independent exponential-Euler update for the non-voltage states.

Notes

The staggered scheme is registered as both "staggered" (canonical) and "stagger" (alias), and can be selected with braincell.quad.get_integrator().

Examples

>>> import brainstate
>>> import brainunit as u
>>> from braincell.quad import staggered_step
>>> # Inside a simulation loop with a Cell instance ``cell``:
>>> with brainstate.environ.context(t=0. * u.ms, dt=0.025 * u.ms):
...     staggered_step(cell, input_current)