braincell.quad.staggered_step

Contents

braincell.quad.staggered_step#

braincell.quad.staggered_step(target, *args)#

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. When required by an ion model, its total source current is cached at the old voltage before any state advances.

  2. The cable voltage is advanced with a locally linearized implicit Euler step solved on the node-tree by dhs_voltage_step() (the dendritic hierarchical solver, DHS). The axial block is implicit, so it is not subject to the corresponding explicit-stability limit.

  3. Continuous runtime-synapse states and ion/channel states are advanced at the new voltage. Dependent states use independent exponential Euler updates; submodules marked for independent integration dispatch to their configured solvers. The exact family ordering is selected by target.ion_channel_update_order.

This is a first-order Lie/semi-implicit split: the voltage phase reads the old mechanism state, and the mechanism phase reads the new voltage. It is not a symmetric Strang split, so no general second-order accuracy claim is made. The benefit is a cheap, stable implicit solve for the linear axial block while retaining specialized updates for channel kinetics.

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:

TypeError – If target is not a DiffEqModule, or does not expose the node-tree machinery required by dhs_voltage_step().

See also

dhs_voltage_step

Single implicit-Euler DHS step for the cable voltage.

ind_exp_euler_step

Independent exponential-Euler kernel used for dependent 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)