DiffEqGroupState

Contents

DiffEqGroupState#

class braincell.quad.DiffEqGroupState(value, **kwargs)#

An integrable hidden state whose trailing axis indexes independent states.

This is the state class used by every hidden variable owned by a braincell.Cell. A Cell is a spatial model: its runtime arrays are shaped pop_size + (n_cv,) for voltage and pop_size + (n_point,) for mechanism variables, so the trailing axis enumerates compartments (or points) that evolve independently. That is exactly the contract of brainstate.HiddenGroupStatevarshape is everything but the last axis and num_state is the last axis — which lets an eligibility-trace learner treat one array as num_state separately traced hidden units.

Notes

brainstate.HiddenGroupState requires value.ndim >= 2. This is why braincell.Cell makes its population axis mandatory (pop_size defaults to 1 and may not be empty) — the validation is inherited unmodified rather than relaxed.

See also

DiffEqSingleState

The ungrouped counterpart used by SingleCompartment.

state

Host-scoped factory that picks between the two.

Examples

>>> import brainunit as u
>>> import numpy as np
>>> import braincell
>>> st = braincell.DiffEqGroupState(np.zeros((1, 4)) * u.mV)
>>> st.varshape
(1,)
>>> st.num_state
4
>>> isinstance(st, braincell.DiffEqState)
True