braincell.mech module#
Declarative mechanism specs for braincell.Cell.
The braincell.mech package is purely declarative: it describes
what to install on a cell without touching runtime state, JAX, or
brainstate. Every declaration type inherits from the
Mechanism marker base class.
Density mechanisms — distributed over a region of a cell. See
Densityand its concrete subclassesChannel(for ion channels) andIon(for ion species). Both accept a registry key string or a class object for their first positional argument.Point mechanisms — attached to a single location. See
Pointand its concrete subclassesCurrentClamp,SineClamp,FunctionClamp,StateProbe,MechanismProbe,CurrentProbe,ProbeMechanism, andSynapse.Junctionis the gap-junction point declaration and lives inbraincell.mech._junction.
Passive cable properties are recorded via CableProperty.
Class lookup by name is handled by MechanismRegistry
(accessed through get_registry()). Concrete channel / ion /
synapse classes register themselves with the global registry via the
register_channel() / register_ion() /
register_synapse() decorators, which run as a side effect of
importing braincell.channel / braincell.ion /
braincell.synapse.
See also
braincell.channelConcrete ion-channel implementations.
braincell.ionConcrete ion-species implementations.
braincell.synapseConcrete synapse implementations.
braincell.mech is the purely declarative mechanism layer for
braincell.Cell. It describes what to install on a cell without
touching runtime state, JAX, or brainstate. Every declaration inherits
from the Mechanism marker base class and splits into two families:
Density mechanisms are distributed over a region of a cell (
Densityand its concrete subclassesChannelfor ion channels andIonfor ion species).Point mechanisms are attached to a single location (
Pointand its subclasses, includingSynapse,Junction, and the probe declarations).
The passive cable property and the stimulus clamps
(CableProperty, CurrentClamp,
SineClamp, FunctionClamp) are also
declared here but are re-exported at the top level; see
braincell module for their reference entries.
Base#
Density Mechanisms#
Spatial Parameters#
Cable-property fields and density-mechanism parameters may be callables that
accept a CVContext. Cable-property callables are resolved during
discretization; channel and ion callables are resolved once per active CV by
Cell.init_state(). They are not called during every simulation step.
import brainunit as u
from braincell.filter import AllRegion
from braincell.mech import Channel
def na_gmax(context):
distance = context.path_distance_from_soma.to_decimal(u.um)
return (0.02 + 0.00008 * distance) * (u.mS / u.cm ** 2)
cell.paint(
AllRegion(),
Channel("Na_HH1952", name="na_distance", g_max=na_gmax),
)
cell.init_state()
path_distance_from_soma is zero for every soma CV and starts at zero at
each first-order neurite attachment. path_distance_to_root retains the
path through the root/soma branch. Callable results must be scalar and must
use a consistent unit type across all selected CVs.
Read-only geometry context for one control volume. |
Point Mechanisms#
Probes#
Probe for cell-owned state at one placed location. |
|
Probe for runtime state on a named mechanism. |
|
Probe for current at a placed location. |
|
Observer that records a named variable at a point location. |