ThresholdLinearStep#

class brainmass.ThresholdLinearStep(in_size, tau_E=Quantity(0.02, 's'), tau_I=Quantity(0.01, 's'), beta_E=0.066, beta_I=0.351, init_E=ZeroInit(unit=1), init_I=ZeroInit(unit=1), noise_E=None, noise_I=None)#

Threshold-linear two-population rate model.

This model describes excitatory (E) and inhibitory (I) population rates with threshold-linear input-output functions [1]. The continuous-time dynamics are

\[\begin{split}\begin{aligned} &\tau_{E} \frac{d \nu_{E}}{d t} = -\nu_{E} + \beta_{E}\,[I_{E}]_{+}, \\ &\tau_{I} \frac{d \nu_{I}}{d t} = -\nu_{I} + \beta_{I}\,[I_{I}]_{+}, \end{aligned}\end{split}\]

where \([x]_+ = \max(x, 0)\) is the rectifier. \(\nu_E\) and \(\nu_I\) denote E and I firing rates; \(\tau_E\) and \(\tau_I\) are their intrinsic time constants; \(\beta_E\) and \(\beta_I\) are gains.

Parameters:
  • in_size (int | Sequence[int] | integer | Sequence[integer]) – Spatial shape for the E and I populations. Can be an int or a tuple of int. All parameters are broadcastable to this shape.

  • tau_E (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param) – Excitatory time constant with unit of time (e.g., 2e-2 * u.second). Default is 2e-2 * u.second.

  • tau_I (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param) – Inhibitory time constant with unit of time (e.g., 1e-2 * u.second). Default is 1e-2 * u.second.

  • beta_E (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param) – Excitatory gain (dimensionless). Default is 0.066.

  • beta_I (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param) – Inhibitory gain (dimensionless). Default is 0.351.

  • init_E (Callable) – Parameter for the excitatory rate state E. Default is braintools.init.ZeroInit().

  • init_I (Callable) – Parameter for the inhibitory rate state I. Default is braintools.init.ZeroInit().

  • noise_E (Noise) – Additive noise process for the E population. If provided, called each update and added to E_inp. Default is None.

  • noise_I (Noise) – Additive noise process for the I population. If provided, called each update and added to I_inp. Default is None.

Return type:

Any

E#

Excitatory rate state (dimensionless). Shape equals (batch?,) + in_size after init_state.

Type:

brainstate.HiddenState

I#

Inhibitory rate state (dimensionless). Shape equals (batch?,) + in_size after init_state.

Type:

brainstate.HiddenState

Notes

  • Time derivatives implicitly have unit 1/time determined by the brainunit time units of tau_E and tau_I.

  • The rectification is applied to the external drives, and the states are clipped to be non-negative after each update.

References

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

Initialize excitatory and inhibitory states.

Parameters:

batch_size (int or None, optional) – Optional leading batch dimension. If None, no batch dimension is used. Default is None.

update(E_inp=None, I_inp=None)[source]#

Advance the system by one time step.

Parameters:
  • E_inp (array-like or scalar or None, optional) – External input drive to the excitatory population. If None, treated as zero. If noise_E is set, its output is added.

  • I_inp (array-like or scalar or None, optional) – External input drive to the inhibitory population. If None, treated as zero. If noise_I is set, its output is added.

Returns:

The updated excitatory rate E with the same shape as the internal state.

Return type:

array-like

Notes

Uses exponential-Euler updates via brainstate.nn.exp_euler_step with rectification applied to inputs and non-negativity enforced on states.