Markov#
- class braincell.channel.Markov(size, name=None, solver=None, substeps=None)[source]#
Probability-state channel kinetics described by transition pairs.
pairsdefine one conserved probability pool. One state is eliminated and reconstructed algebraically from the others;dependent_statenames it, and declaring it is mandatory. Which state is eliminated changes the conditioning of the steady-state solve, so inferring it from the ordering ofpairs– as this template once did – meant that reordering an otherwise-equivalent transition table silently changed the model.state_values()returns the raw stored states plus the reconstructed dependent state.compute_derivative()uses_kinetic_state_values(), which clips each independent state to[0, 1]before evaluating the transition graph while still reconstructing the dependent state from the raw stored sum. Clipping is governed byclip_statesand projects only the values fed to the kinetics; the stored states are untouched.Transition rates may return either a bare value, read as per-millisecond, or a properly united inverse time; anything else is rejected against the rate method’s own name. This mirrors
Gate.time_uniton the HH side, except that the unit is fixed atu.msrather than declared per transition – the catalogue’s Markov channels all come from NEURON.modsources written in milliseconds.- Variables:
pairs (tuple of Transition or tuple) – Class-level declaration of the transition graph. Each entry is either a
Transitionor the plain tuple of its fields; both forms are normalised by__init_subclass__.conserve (Any, default 1.0) – Total probability mass the declared states must sum to. Resolved per instance the same way as
Gatemetadata – astrnames an instance attribute, a callable is applied to the instance, anything else is a literal.dependent_state (str) – Name of the state eliminated from the independent set and reconstructed as
conserveminus the others. Every subclass that declarespairsmust declare this too; omitting it raisesValueErrorwhen the subclass is created.default_solver (str, default "backward_euler") – Solver name used by
IndependentIntegrationwhen the constructor’ssolverargument is not supplied.default_substeps (int, default 1) – Number of solver substeps per outer integration step, used when the constructor’s
substepsargument is not supplied.clip_states (bool, default True) – Project each independent state into
[0, 1]before evaluating the transition graph, so a probability pool that has drifted off the simplex still yields meaningful kinetics; the stored states themselves are left untouched. On by default, unlikeGate.clipon the HH side, because an out-of-simplex probability pool corrupts the kinetics, whereas an unclipped HH gate is merely inaccurate.reset_to_steady_state (bool, default False) – Make
reset_state()delegate toreset_steady_state()rather than zeroing the independent states. Off by default, because solving the stationary distribution is only meaningful for a channel whose transition graph is well conditioned at the reset voltage; the catalogue’s resurgent sodium and calcium-gated potassium schemes opt in.
- clip_states: ClassVar[bool] = True#
Project independent states into
[0, 1]before evaluating the transition graph. On by default: a probability pool that leaves the simplex makes the kinetics meaningless, whereas an HH gate merely becomes inaccurate. SeeGate.clipfor the HH-side switch.
- compute_derivative(V, *ions)[source]#
Compute the derivative of the channel’s state variables.
This method should be implemented by subclasses to calculate how the channel’s state changes over time.
- Parameters:
*args – Variable length argument list.
**kwargs – Arbitrary keyword arguments.
- Raises:
NotImplementedError – This method must be implemented by subclasses.
- init_state(V, *ions, batch_size=None)[source]#
Initialize the state of the ion channel.
This method should set up the initial state of all variables for the channel.
- Parameters:
*args – Variable length argument list.
**kwargs – Arbitrary keyword arguments.
- reset_state(V, *ions, batch_size=None)[source]#
Reset the state of the ion channel.
This method should reset all state variables of the channel to their initial values.
- Parameters:
*args – Variable length argument list.
**kwargs – Arbitrary keyword arguments.
- reset_to_steady_state: ClassVar[bool] = False#
Opt in to seeding
reset_state()from the stationary distribution instead of zeros. See the class docstring.