FitzHughNagumoStep#
- class brainmass.FitzHughNagumoStep(in_size, alpha=3.0, beta=4.0, gamma=-1.5, delta=0.0, epsilon=0.5, tau=Quantity(20., 'ms'), noise_V=None, noise_w=None, init_V=Uniform(low=0, high=0.05), init_w=Uniform(low=0, high=0.05), method='exp_euler')#
FitzHugh–Nagumo neural mass model.
A two-dimensional reduction of the Hodgkin–Huxley model that captures excitability via a fast activator (
V) and a slow recovery variable (w). The form implemented here follows [1]:\[\begin{split}\frac{dV}{dt} = -\alpha V^3 + \beta V^2 + \gamma V - w + I_{\text{ext}}(t),\\ \tau \frac{dw}{dt} = V - \delta - \epsilon\, w.\end{split}\]- Parameters:
in_size (
int|Sequence[int] |integer|Sequence[integer]) – Spatial shape of the node/population. Can be anintor a tuple ofint. All parameters are broadcastable to this shape.alpha (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Cubic nonlinearity coefficient (dimensionless). Default is3.0.beta (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Quadratic nonlinearity coefficient (dimensionless). Default is4.0.gamma (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Linear coefficient (dimensionless). Default is-1.5.delta (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Offset for the recovery nullcline (dimensionless). Default is0.0.epsilon (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Recovery coupling strength (dimensionless). Default is0.5.tau (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Recovery time constant with unit of time (e.g.,20.0 * u.ms). Broadcastable toin_size. Default is20.0 * u.ms.noise_V (
Noise) – Additive noise process for the activatorV. If provided, it is called at each update and added toV_inp. Default isNone.noise_w (
Noise) – Additive noise process for the recovery variablew. If provided, it is called at each update and added tow_inp. Default isNone.init_V (
Callable) – Parameter for the activator stateV. Default isbraintools.init.Uniform(0, 0.05).init_w (
Callable) – Parameter for the recovery statew. Default isbraintools.init.Uniform(0, 0.05).method (
str) – The integration method to use. Either ‘exp_euler’ for exponential Euler (default) or any method supported bybraintools.quad, e.g. ‘rk4’, ‘midpoint’, ‘heun’, ‘euler’.
- Return type:
Any
- V#
Activator (membrane potential–like) state (dimensionless). Shape equals
(batch?,) + in_sizeafterinit_state.- Type:
brainstate.HiddenState
- w#
Recovery variable state (dimensionless). Shape equals
(batch?,) + in_sizeafterinit_state.- Type:
brainstate.HiddenState
Notes
Time derivatives returned by
dV()anddw()carry unit1/msto be consistent with explicit (exponential) Euler stepping withdtin milliseconds.The parameters
alpha,beta,gamma,deltaandepsilonare dimensionless in this implementation.tauhas unit of time.
References
- dV(V, w, inp)[source]#
Right-hand side for the activator variable
V.- Parameters:
V (array-like) – Current activator value (dimensionless).
w (array-like) – Current recovery variable (dimensionless), broadcastable to
V.inp (array-like or scalar) – External input to
V(includes noise if enabled).
- Returns:
Time derivative
dV/dtwith unit1/ms.- Return type:
array-like
- dw(w, x, inp=0.0)[source]#
Right-hand side for the recovery variable
w.- Parameters:
w (array-like) – Current recovery variable (dimensionless).
x (array-like) – Current activator value (dimensionless), broadcastable to
w.inp (array-like or scalar, optional) – External input to
w(includes noise if enabled). Default is0..
- Returns:
Time derivative
dw/dtwith unit1/ms.- Return type:
array-like
- update(V_inp=None, w_inp=None)[source]#
Advance the system by one time step.
- Parameters:
V_inp (array-like or scalar or None, optional) – External input to
V. IfNone, treated as zero. Ifnoise_Vis set, its output is added. Default isNone.w_inp (array-like or scalar or None, optional) – External input to
w. IfNone, treated as zero. Ifnoise_wis set, its output is added. Default isNone.
- Returns:
The updated activator state
Vwith the same shape as the internal state.- Return type:
array-like
Notes
Uses an exponential-Euler step via
brainstate.nn.exp_euler_stepfor both state variables and updatesVandwin-place.