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: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 letsdtexceed the explicit-stability limit.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 exposingnode_tree(),node_scheduling(), and a voltage stateV. In practice this is abraincell.Cellinstance 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:
AssertionError – If target is not a
DiffEqModule.TypeError – If target does not expose the node-tree machinery required by
dhs_voltage_step().
See also
dhs_voltage_stepSingle implicit-Euler DHS step for the cable voltage.
ind_exp_euler_stepIndependent 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 withbraincell.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)