WilsonCowanThreePopBase#

class brainmass.WilsonCowanThreePopBase(in_size, noise_E=None, noise_I=None, noise_M=None, rE_init=Constant(value=0.0), rI_init=Constant(value=0.0), rM_init=Constant(value=0.0), method='exp_euler')#

Abstract base class for three-population Wilson-Cowan models.

This base class extends the Wilson-Cowan framework to three populations: excitatory (E), inhibitory (I), and modulatory (M). The modulatory population can represent cholinergic/noradrenergic modulation, VIP interneurons, or long-range feedback.

Parameters:
  • in_size (int | Sequence[int] | integer | Sequence[integer]) – Spatial shape of each population (E, I, M). Can be an int, a tuple of ints, or any size compatible with brainstate.

  • noise_E (Noise) – Additive noise process for the excitatory population. Default is None.

  • noise_I (Noise) – Additive noise process for the inhibitory population. Default is None.

  • noise_M (Noise) – Additive noise process for the modulatory population. Default is None.

  • rE_init (Callable) – Initializer for the excitatory state rE. Default is braintools.init.Constant(0.0).

  • rI_init (Callable) – Initializer for the inhibitory state rI. Default is braintools.init.Constant(0.0).

  • rM_init (Callable) – Initializer for the modulatory state rM. Default is braintools.init.Constant(0.0).

  • method (str) – The numerical integration method to use. One of 'exp_euler', 'euler', 'rk2', or 'rk4', that is implemented in braintools.quad. Default is 'exp_euler'.

Return type:

Any

rE#

Excitatory population activity (dimensionless).

Type:

brainstate.HiddenState

rI#

Inhibitory population activity (dimensionless).

Type:

brainstate.HiddenState

rM#

Modulatory population activity (dimensionless).

Type:

brainstate.HiddenState

Notes

Subclasses must implement:

  • drE(rE, rI, rM, ext): Right-hand side for excitatory population

  • drI(rI, rE, rM, ext): Right-hand side for inhibitory population

  • drM(rM, rE, rI, ext): Right-hand side for modulatory population

  • F(x, *args) (optional): Transfer function

F(x, a, theta)[source]#

Sigmoidal transfer function.

__init__(in_size, noise_E=None, noise_I=None, noise_M=None, rE_init=Constant(value=0.0), rI_init=Constant(value=0.0), rM_init=Constant(value=0.0), method='exp_euler')[source]#
Parameters:
derivative(state, t, E_ext, I_ext, M_ext)[source]#

Compute derivatives for all three populations.

Parameters:
  • state (tuple) – Tuple of (rE, rI, rM) states.

  • t (float) – Current time.

  • E_ext (array-like or scalar) – External input to excitatory population.

  • I_ext (array-like or scalar) – External input to inhibitory population.

  • M_ext (array-like or scalar) – External input to modulatory population.

Returns:

Tuple of (drE/dt, drI/dt, drM/dt) derivatives.

Return type:

tuple

drE(rE, rI, rM, ext)[source]#

Right-hand side for the excitatory population.

Must be implemented by subclasses.

drI(rI, rE, rM, ext)[source]#

Right-hand side for the inhibitory population.

Must be implemented by subclasses.

drM(rM, rE, rI, ext)[source]#

Right-hand side for the modulatory population.

Must be implemented by subclasses.

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

Initialize model states rE, rI, and rM.

Parameters:

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

update(rE_inp=None, rI_inp=None, rM_inp=None)[source]#

Advance the system by one time step.

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

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

  • rM_inp (array-like or scalar or None, optional) – External input to the modulatory population. If None, treated as zero. If noise_M is set, its output is added.

Returns:

The updated excitatory activity rE with the same shape as the internal state.

Return type:

array-like

Notes

The method performs numerical integration using the specified method (exp_euler by default) and updates the internal states rE, rI, and rM in-place.