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 withbrainstate.noise_E (
Noise) – Additive noise process for the excitatory population. Default isNone.noise_I (
Noise) – Additive noise process for the inhibitory population. Default isNone.noise_M (
Noise) – Additive noise process for the modulatory population. Default isNone.rE_init (
Callable) – Initializer for the excitatory staterE. Default isbraintools.init.Constant(0.0).rI_init (
Callable) – Initializer for the inhibitory staterI. Default isbraintools.init.Constant(0.0).rM_init (
Callable) – Initializer for the modulatory staterM. Default isbraintools.init.Constant(0.0).method (
str) – The numerical integration method to use. One of'exp_euler','euler','rk2', or'rk4', that is implemented inbraintools.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 populationdrI(rI, rE, rM, ext): Right-hand side for inhibitory populationdrM(rM, rE, rI, ext): Right-hand side for modulatory populationF(x, *args)(optional): 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]#
- derivative(state, t, E_ext, I_ext, M_ext)[source]#
Compute derivatives for all three populations.
- Parameters:
- Returns:
Tuple of (drE/dt, drI/dt, drM/dt) derivatives.
- Return type:
- 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, andrM.- Parameters:
batch_size (int or None, optional) – Optional leading batch dimension. If
None, no batch dimension is used. Default isNone.
- 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. Ifnoise_Eis 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. Ifnoise_Iis 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. Ifnoise_Mis set, its output is added.
- Returns:
The updated excitatory activity
rEwith the same shape as the internal state.- Return type:
array-like
Notes
The method performs numerical integration using the specified method (
exp_eulerby default) and updates the internal statesrE,rI, andrMin-place.