WilsonCowanAdaptiveStep#
- class brainmass.WilsonCowanAdaptiveStep(in_size, tau_E=Quantity(1., 'ms'), a_E=1.2, theta_E=2.8, tau_I=Quantity(1., 'ms'), a_I=1.0, theta_I=4.0, wEE=12.0, wIE=4.0, wEI=13.0, wII=11.0, r=1.0, tau_aE=Quantity(100., 'ms'), tau_aI=Quantity(80., 'ms'), b_E=0.1, b_I=0.08, noise_E=None, noise_I=None, rE_init=Constant(value=0.0), rI_init=Constant(value=0.0), aE_init=Constant(value=0.0), aI_init=Constant(value=0.0), method='exp_euler')#
Wilson-Cowan neural mass model with spike-frequency adaptation.
This variant adds adaptation currents to both excitatory and inhibitory populations, implementing spike-frequency adaptation. Adaptation currents build up with sustained activity and reduce the effective drive to each population, modeling neural fatigue and habituation effects.
- Parameters:
in_size (
int|Sequence[int] |integer|Sequence[integer]) – Spatial shape of each population (E and I). Can be an int, a tuple of ints, or any size compatible withbrainstate.tau_E (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Excitatory time constant with unit of time (e.g.,1. * u.ms). Broadcastable toin_size. Default is1. * u.ms.a_E (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Excitatory gain (dimensionless). Broadcastable toin_size. Default is1.2.theta_E (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Excitatory threshold (dimensionless). Broadcastable toin_size. Default is2.8.tau_I (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Inhibitory time constant with unit of time (e.g.,1. * u.ms). Broadcastable toin_size. Default is1. * u.ms.a_I (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Inhibitory gain (dimensionless). Broadcastable toin_size. Default is1..theta_I (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Inhibitory threshold (dimensionless). Broadcastable toin_size. Default is4.0.wEE (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – E→E coupling strength (dimensionless). Broadcastable toin_size. Default is12..wIE (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – E→I coupling strength (dimensionless). Broadcastable toin_size. Default is4..wEI (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – I→E coupling strength (dimensionless). Broadcastable toin_size. Default is13..wII (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – I→I coupling strength (dimensionless). Broadcastable toin_size. Default is11..r (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Refractory parameter (dimensionless) that limits maximum activation. Broadcastable toin_size. Default is1..tau_aE (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Excitatory adaptation time constant with unit of time (e.g.,100. * u.ms). Controls how fast adaptation builds up and decays. Broadcastable toin_size. Default is100. * u.ms.tau_aI (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Inhibitory adaptation time constant with unit of time (e.g.,80. * u.ms). Controls how fast adaptation builds up and decays. Broadcastable toin_size. Default is80. * u.ms.b_E (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Excitatory adaptation coupling strength (dimensionless). Controls how strongly activity drives adaptation. Broadcastable toin_size. Default is0.1.b_I (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Inhibitory adaptation coupling strength (dimensionless). Controls how strongly activity drives adaptation. Broadcastable toin_size. Default is0.08.noise_E (
Noise) – Additive noise process for the excitatory population. If provided, its output is added torE_inpat each update. Default isNone.noise_I (
Noise) – Additive noise process for the inhibitory population. If provided, its output is added torI_inpat each update. 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).aE_init (
Callable) – Initializer for the excitatory adaptation currentaE. Default isbraintools.init.Constant(0.0).aI_init (
Callable) – Initializer for the inhibitory adaptation currentaI. 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). Shape equals
(batch?,) + in_sizeafterinit_state.- Type:
brainstate.HiddenState
- rI#
Inhibitory population activity (dimensionless). Shape equals
(batch?,) + in_sizeafterinit_state.- Type:
brainstate.HiddenState
- aE#
Excitatory adaptation current (dimensionless). Shape equals
(batch?,) + in_sizeafterinit_state.- Type:
brainstate.HiddenState
- aI#
Inhibitory adaptation current (dimensionless). Shape equals
(batch?,) + in_sizeafterinit_state.- Type:
brainstate.HiddenState
Notes
The continuous-time Wilson-Cowan equations with adaptation are
\[\tau_E \frac{dr_E}{dt} = -r_E(t) + \bigl[1 - r\, r_E(t)\bigr] F_E\bigl(w_{EE} r_E(t) - w_{EI} r_I(t) + I_E(t) - a_E(t)\bigr),\]\[\tau_I \frac{dr_I}{dt} = -r_I(t) + \bigl[1 - r\, r_I(t)\bigr] F_I\bigl(w_{IE} r_E(t) - w_{II} r_I(t) + I_I(t) - a_I(t)\bigr),\]\[\tau_a^E \frac{da_E}{dt} = -a_E(t) + b_E\, r_E(t),\]\[\tau_a^I \frac{da_I}{dt} = -a_I(t) + b_I\, r_I(t),\]with the sigmoidal transfer function
\[F_j(x) = \frac{1}{1 + e^{-a_j (x - \theta_j)}} - \frac{1}{1 + e^{a_j \theta_j}},\quad j \in \{E, I\}.\]Adaptation currents increase with population activity and subtract from the effective input, implementing spike-frequency adaptation observed in real neurons.
References
Examples
>>> import brainmass >>> import brainunit as u >>> model = brainmass.WilsonCowanAdaptiveStep( ... in_size=100, ... tau_aE=100.*u.ms, ... b_E=0.1 ... )
- __init__(in_size, tau_E=Quantity(1., 'ms'), a_E=1.2, theta_E=2.8, tau_I=Quantity(1., 'ms'), a_I=1.0, theta_I=4.0, wEE=12.0, wIE=4.0, wEI=13.0, wII=11.0, r=1.0, tau_aE=Quantity(100., 'ms'), tau_aI=Quantity(80., 'ms'), b_E=0.1, b_I=0.08, noise_E=None, noise_I=None, rE_init=Constant(value=0.0), rI_init=Constant(value=0.0), aE_init=Constant(value=0.0), aI_init=Constant(value=0.0), method='exp_euler')[source]#
- Parameters:
tau_E (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
a_E (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
theta_E (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
tau_I (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
a_I (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
theta_I (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
wEE (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
wIE (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
wEI (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
wII (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
r (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
tau_aE (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
tau_aI (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
b_E (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
b_I (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
noise_E (Noise)
noise_I (Noise)
rE_init (Callable)
rI_init (Callable)
aE_init (Callable)
aI_init (Callable)
method (str)
- daE(aE, rE)[source]#
Right-hand side for the excitatory adaptation current.
- Parameters:
aE (array-like) – Excitatory adaptation current (dimensionless).
rE (array-like) – Excitatory activity (dimensionless).
- Returns:
Time derivative
daE/dtwith unit of1/time.- Return type:
array-like
- daI(aI, rI)[source]#
Right-hand side for the inhibitory adaptation current.
- Parameters:
aI (array-like) – Inhibitory adaptation current (dimensionless).
rI (array-like) – Inhibitory activity (dimensionless).
- Returns:
Time derivative
daI/dtwith unit of1/time.- Return type:
array-like
- derivative(state, t, E_ext, I_ext)[source]#
Compute derivatives for all four state variables.
- Parameters:
- Returns:
Tuple of (drE/dt, drI/dt, daE/dt, daI/dt) derivatives.
- Return type:
- drE(rE, rI, aE, ext)[source]#
Right-hand side for the excitatory population with adaptation.
- Parameters:
rE (array-like) – Excitatory activity (dimensionless).
rI (array-like) – Inhibitory activity (dimensionless).
aE (array-like) – Excitatory adaptation current (dimensionless).
ext (array-like or scalar) – External input to E.
- Returns:
Time derivative
drE/dtwith unit of1/time.- Return type:
array-like
- drI(rI, rE, aI, ext)[source]#
Right-hand side for the inhibitory population with adaptation.
- Parameters:
rI (array-like) – Inhibitory activity (dimensionless).
rE (array-like) – Excitatory activity (dimensionless).
aI (array-like) – Inhibitory adaptation current (dimensionless).
ext (array-like or scalar) – External input to I.
- Returns:
Time derivative
drI/dtwith unit of1/time.- Return type:
array-like
- init_state(batch_size=None, **kwargs)[source]#
Initialize model states
rE,rI,aE, andaI.- 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)[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.
- Returns:
The updated excitatory activity
rEwith the same shape as the internal state.- Return type:
array-like
Notes
The method performs numerical integration for all 4 state variables (rE, rI, aE, aI) using the specified method (
exp_eulerby default).