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 an int or a tuple of int. All parameters are broadcastable to this shape.

  • alpha (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param) – Cubic nonlinearity coefficient (dimensionless). Default is 3.0.

  • beta (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param) – Quadratic nonlinearity coefficient (dimensionless). Default is 4.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 is 0.0.

  • epsilon (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param) – Recovery coupling strength (dimensionless). Default is 0.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 to in_size. Default is 20.0 * u.ms.

  • noise_V (Noise) – Additive noise process for the activator V. If provided, it is called at each update and added to V_inp. Default is None.

  • noise_w (Noise) – Additive noise process for the recovery variable w. If provided, it is called at each update and added to w_inp. Default is None.

  • init_V (Callable) – Parameter for the activator state V. Default is braintools.init.Uniform(0, 0.05).

  • init_w (Callable) – Parameter for the recovery state w. Default is braintools.init.Uniform(0, 0.05).

  • method (str) – The integration method to use. Either ‘exp_euler’ for exponential Euler (default) or any method supported by braintools.quad, e.g. ‘rk4’, ‘midpoint’, ‘heun’, ‘euler’.

Return type:

Any

V#

Activator (membrane potential–like) state (dimensionless). Shape equals (batch?,) + in_size after init_state.

Type:

brainstate.HiddenState

w#

Recovery variable state (dimensionless). Shape equals (batch?,) + in_size after init_state.

Type:

brainstate.HiddenState

Notes

  • Time derivatives returned by dV() and dw() carry unit 1/ms to be consistent with explicit (exponential) Euler stepping with dt in milliseconds.

  • The parameters alpha, beta, gamma, delta and epsilon are dimensionless in this implementation. tau has 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/dt with unit 1/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 is 0..

Returns:

Time derivative dw/dt with unit 1/ms.

Return type:

array-like

init_state(batch_size=None, **kwargs)[source]#

State initialization function.

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. If None, treated as zero. If noise_V is set, its output is added. Default is None.

  • w_inp (array-like or scalar or None, optional) – External input to w. If None, treated as zero. If noise_w is set, its output is added. Default is None.

Returns:

The updated activator state V with the same shape as the internal state.

Return type:

array-like

Notes

Uses an exponential-Euler step via brainstate.nn.exp_euler_step for both state variables and updates V and w in-place.