Skip to content

Neuroscience

Neuroscience systems.

They cover spiking and conductance-based neurons, populations, networks, excitable networks, and synapses.

AdaptiveDelayNetworkSystem(n_units=5, *, omega=1.0, spread=0.1, kappa=1.0, epsilon=0.1, rho=1.0, tau0=3.0, seed=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Phase units coupled all to all through adaptive conduction delays.

The delays adapt to the activity of the units, as myelination.

Unit i follows dtheta_i/dt = omega_i + (kappa / N) sum_j sin(theta_j(t - tau_ij) - theta_i), and every delay dtau_ij/dt = epsilon H(tau_ij) (-(tau_ij - tau0) + rho sin(theta_j - theta_i)) relaxes to its baseline tau0 and is pushed by the phase difference of its units. With the defaults, fixed delays of 3 leave the units incoherent, and the adaptation of the delays restores a partial synchrony. The system has the phases unit_<i>.theta of the units and the delays axon_<i>_<j>.tau of the axons from unit i to unit j.

Parameters:

Name Type Description Default
n_units int

The number of units.

5
omega float

The mean natural frequency.

1.0
spread float

The standard deviation of the natural frequencies.

0.1
kappa float

The coupling strength, divided by the number of units.

1.0
epsilon float

The adaptation rate of the delays.

0.1
rho float

The strength of the push of the phase difference on the delays.

1.0
tau0 float

The baseline delay of every edge.

3.0
seed int | None

The seed of the frequencies and the initial phases.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import AdaptiveDelayNetworkSystem
>>> len(AdaptiveDelayNetworkSystem(4).prepare().system_.interactions)
16
Source code in src/skcomplex/systems/biology/neuroscience/_plastic_networks.py
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
def __init__(
    self,
    n_units: int = 5,
    *,
    omega: float = 1.0,
    spread: float = 0.1,
    kappa: float = 1.0,
    epsilon: float = 0.1,
    rho: float = 1.0,
    tau0: float = 3.0,
    seed: int | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_units = n_units
    self.omega = omega
    self.spread = spread
    self.kappa = kappa
    self.epsilon = epsilon
    self.rho = rho
    self.tau0 = tau0
    self.seed = seed

AdaptrodeSystem(*, alpha0=0.25, alpha1=0.05, alpha2=0.01, delta0=0.1, delta1=0.02, delta2=0.002, period=10.0, stop=150.0, label='system', solver='auto', backend='auto')

Bases: DynamicalSystem

An Adaptrode synapse driven by a train of input pulses that stops after a while.

While the pulses arrive the fast weight follows each pulse, the medium weight builds up, and the slow weight builds up further. After the input stops the fast weight falls back quickly to the medium one, which keeps a trace of the activity far longer, while the slow weight retains a long-term memory. The system has the weights synapse.w0, synapse.w1, and synapse.w2.

Parameters:

Name Type Description Default
alpha0 float

The learning rate of the fast weight.

0.25
alpha1 float

The learning rate of the medium weight.

0.05
alpha2 float

The learning rate of the slow weight.

0.01
delta0 float

The decay rate of the fast weight.

0.1
delta1 float

The decay rate of the medium weight.

0.02
delta2 float

The decay rate of the slow weight.

0.002
period float

The number of steps between the starts of two pulses.

10.0
stop float

The step after which the input stays off.

150.0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import AdaptrodeSystem
>>> AdaptrodeSystem(stop=50.0).prepare().system_.elements[0].values['stop']
50.0
Source code in src/skcomplex/systems/biology/neuroscience/_synapses.py
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __init__(
    self,
    *,
    alpha0: float = 0.25,
    alpha1: float = 0.05,
    alpha2: float = 0.01,
    delta0: float = 0.1,
    delta1: float = 0.02,
    delta2: float = 0.002,
    period: float = 10.0,
    stop: float = 150.0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label=label, solver=solver, backend=backend)
    self.alpha0 = alpha0
    self.alpha1 = alpha1
    self.alpha2 = alpha2
    self.delta0 = delta0
    self.delta1 = delta1
    self.delta2 = delta2
    self.period = period
    self.stop = stop

AmariNeuralFieldSystem(n_sites=800, *, length=20.0, tau=1.0, h=-0.2, A=1.0, sigma=1.0, width=1.0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The Amari neural field.

Its lateral inhibition holds a stationary bump of activity.

The potential follows tau u_t = -u + integral w(x - y) H(u(y)) dy + h on a periodic line, where H is the Heaviside firing rate, h < 0 the resting level, and w(x) = A (1 - |x| / sigma) exp(-|x| / sigma) the lateral-inhibition kernel. Amari showed that a bump of width a is stationary when W(a) + h = 0, with W(a) = A a exp(-a / sigma) the integral of w from 0 to a, and stable when w(a) < 0. A localized excitation then relaxes to the wide root, a = 2.54 for the defaults. The system has the potential field.u.

Parameters:

Name Type Description Default
n_sites int

The number of sites of the line.

800
length float

The length of the line.

20.0
tau float

The time constant of the potential.

1.0
h float

The resting level.

-0.2
A float

The amplitude of the kernel.

1.0
sigma float

The range of the kernel.

1.0
width float

The width of the initial excitation, a potential of 1 around the middle of the line and h elsewhere.

1.0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import AmariNeuralFieldSystem
>>> AmariNeuralFieldSystem(100).prepare().system_.elements[0].h
-0.2
Source code in src/skcomplex/systems/biology/neuroscience/_neural_fields.py
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
def __init__(
    self,
    n_sites: int = 800,
    *,
    length: float = 20.0,
    tau: float = 1.0,
    h: float = -0.2,
    A: float = 1.0,
    sigma: float = 1.0,
    width: float = 1.0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_sites = n_sites
    self.length = length
    self.tau = tau
    self.h = h
    self.A = A
    self.sigma = sigma
    self.width = width

AssociativeSiteElement(label, *, x=0.0, phi=1.0, x_c=0.85, gamma_plus=0.005, gamma_minus=0.005, size=None)

Bases: Element

Sites of a dense homogeneous associative network, with an activity and a slow reservoir.

Parameters:

Name Type Description Default
label str

The label of the site or of the group of sites.

required
x Annotated[float | Array, UNIT]

The initial activity.

0.0
phi Annotated[float | Array, UNIT]

The initial reservoir.

1.0
x_c Annotated[float | Array, open(0, 1)]

The activity above which a site counts as active.

0.85
gamma_plus Annotated[float | Array, closed_open(0, oo)]

The recovery rate of the reservoir.

0.005
gamma_minus Annotated[float | Array, closed_open(0, oo)]

The depletion rate of the reservoir.

0.005
size int | None

The number of members, or None for one.

None

Examples:

>>> from skcomplex.systems.biology.neuroscience import AssociativeSiteElement
>>> AssociativeSiteElement('sites').x_c
0.85
Source code in src/skcomplex/systems/biology/neuroscience/_associative.py
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
def __init__(
    self,
    label: str,
    *,
    x: Annotated[float | Array, UNIT] = 0.0,
    phi: Annotated[float | Array, UNIT] = 1.0,
    x_c: Annotated[float | Array, RealSet.open(0, 1)] = 0.85,
    gamma_plus: Annotated[float | Array, RealSet.closed_open(0, oo)] = 0.005,
    gamma_minus: Annotated[float | Array, RealSet.closed_open(0, oo)] = 0.005,
    size: int | None = None,
) -> None:
    super().__init__(label, size=size)
    self.x = x
    self.phi = phi
    self.x_c = x_c
    self.gamma_plus = gamma_plus
    self.gamma_minus = gamma_minus

AssociativeThoughtProcessSystem(cliques=CLIQUES, *, w=0.15, z=1.0, x_c=0.85, gamma_plus=0.005, gamma_minus=0.005, start=(0, 1), label='system', solver='auto', backend='auto')

Bases: BaseSystem

The dense homogeneous associative network of Gros.

Its memories become active one after the other.

Every memory is a clique of sites joined by excitatory links of strength w, and every other pair of sites inhibits each other with strength z. Without reservoirs the network is a winners-take-all network whose cliques are stable attractors. The reservoirs of an active clique deplete slowly, and once they are low the clique loses its excitation and its hold on the other sites, so the activity hops to an associated clique that shares sites with it. The memories become transient attractors, and the network runs through a sequence of them, an associative thought process. The default is the network of seven sites and six cliques of Gros (2015, figure 10.12). The system has the activities sites.x and the reservoirs sites.phi.

Parameters:

Name Type Description Default
cliques Sequence[Sequence[int]]

The memories, each a sequence of site indices.

CLIQUES
w float

The strength of the excitatory links within a clique.

0.15
z float

The strength of the inhibition between sites of no common clique.

1.0
x_c float

The activity above which a site counts as active.

0.85
gamma_plus float

The recovery rate of the reservoirs.

0.005
gamma_minus float

The depletion rate of the reservoirs.

0.005
start Sequence[int]

The sites that are active at the start.

(0, 1)
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import AssociativeThoughtProcessSystem
>>> AssociativeThoughtProcessSystem().prepare().system_.elements[0].size
7
Source code in src/skcomplex/systems/biology/neuroscience/_associative.py
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
def __init__(
    self,
    cliques: Sequence[Sequence[int]] = CLIQUES,
    *,
    w: float = 0.15,
    z: float = 1.0,
    x_c: float = 0.85,
    gamma_plus: float = 0.005,
    gamma_minus: float = 0.005,
    start: Sequence[int] = (0, 1),
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.cliques = cliques
    self.w = w
    self.z = z
    self.x_c = x_c
    self.gamma_plus = gamma_plus
    self.gamma_minus = gamma_minus
    self.start = start

AxonElement(label, *, tau=1.0, tau0=1.0)

Bases: Element

Axon on an edge of a network, whose conduction delay myelination changes.

Parameters:

Name Type Description Default
label str

The label of the axon or of the group on the edges.

required
tau Annotated[float, closed_open(0, oo)]

The initial conduction delay.

1.0
tau0 Annotated[float, closed_open(0, oo)]

The baseline delay that the delay relaxes to.

1.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import AxonElement
>>> AxonElement('axon', tau0=2.0).tau0
2.0
Source code in src/skcomplex/systems/biology/neuroscience/_plastic_networks.py
52
53
54
55
56
57
58
59
60
61
def __init__(
    self,
    label: str,
    *,
    tau: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    tau0: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
) -> None:
    super().__init__(label)
    self.tau = tau
    self.tau0 = tau0

CliqueCompetitionInteraction(label, *, sites, w=((0.0,),), z=1.0, phi_w=0.7, phi_z=0.15, width=0.05, f_w_min=0.1, f_z_min=0.0)

Bases: Interaction

Competition of the cliques of a winners-take-all network.

The reservoirs of the sites gate the competition.

Site i grows by dx_i/dt = (1 - x_i) r_i for a positive input r_i and decays by dx_i/dt = x_i r_i for a negative one, with r_i = sum_j [f_w(phi_i) w_ij + z_ij f_z(phi_j)] x_j. The excitatory links w_ij > 0 join the sites of every clique, and every other pair inhibits with z_ij = -|z|. The reservoir functions f(phi) = f_min + (1 - f_min) (atan((phi - phi_c) / width) - atan(-phi_c / width)) / (atan((1 - phi_c) / width) - atan(-phi_c / width)) switch off the excitation of a site whose own reservoir is low and the inhibition by a site whose reservoir is low.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
sites Role

The path of the group of sites.

required
w Sequence[Sequence[float]]

The excitatory links, a symmetric matrix with zeros where sites inhibit each other.

((0.0,),)
z Annotated[float, closed_open(0, oo)]

The strength of the inhibition.

1.0
phi_w Annotated[float, open(0, 1)]

The inflection point of the reservoir function of the excitation.

0.7
phi_z Annotated[float, open(0, 1)]

The inflection point of the reservoir function of the inhibition.

0.15
width Annotated[float, open(0, oo)]

The width of the reservoir functions.

0.05
f_w_min Annotated[float, closed(0, 1)]

The floor of the reservoir function of the excitation.

0.1
f_z_min Annotated[float, closed(0, 1)]

The floor of the reservoir function of the inhibition.

0.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import CliqueCompetitionInteraction
>>> CliqueCompetitionInteraction('competition', sites='sites', w=((0.0, 0.1), (0.1, 0.0))).z
1.0
Source code in src/skcomplex/systems/biology/neuroscience/_associative.py
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
def __init__(
    self,
    label: str,
    *,
    sites: Role,
    w: Sequence[Sequence[float]] = ((0.0,),),
    z: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    phi_w: Annotated[float, RealSet.open(0, 1)] = 0.7,
    phi_z: Annotated[float, RealSet.open(0, 1)] = 0.15,
    width: Annotated[float, RealSet.open(0, oo)] = 0.05,
    f_w_min: Annotated[float, RealSet.closed(0, 1)] = 0.1,
    f_z_min: Annotated[float, RealSet.closed(0, 1)] = 0.0,
) -> None:
    super().__init__(label)
    self.sites = sites
    self.w = w
    self.z = z
    self.phi_w = phi_w
    self.phi_z = phi_z
    self.width = width
    self.f_w_min = f_w_min
    self.f_z_min = f_z_min

DelayAdaptationInteraction(label, *, source, target, axon, kappa=0.1, epsilon=0.01, rho=1.0, width=0.05, shortest=0.1)

Bases: Interaction

Phase coupling through adaptive conduction delays.

The delays adapt to the phase differences of the units they join.

The target unit reads the phase of the source unit along the axon as it was one conduction delay ago, dtheta_i/dt += kappa sin(theta_j(t - tau_ij) - theta_i). The delay relaxes to its baseline and is pushed by the phase difference, dtau_ij/dt = epsilon H(tau_ij) (-(tau_ij - tau0_ij) + rho sin(theta_j - theta_i)), where the smooth step H(tau) = (1 + tanh(tau / width)) / 2 keeps the delay nonnegative. The coupling reads the delay no shorter than shortest, which bounds the steps of the solver.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
source Role

The path of the unit that sends the signal.

required
target Role

The path of the unit that receives the signal.

required
axon Role

The path of the axon that conducts it.

required
kappa float

The coupling strength of an edge.

0.1
epsilon Annotated[float, closed_open(0, oo)]

The adaptation rate of the delays.

0.01
rho float

The strength of the push of the phase difference on the delay.

1.0
width Annotated[float, open(0, oo)]

The width of the smooth step.

0.05
shortest float

The shortest delay the coupling reads.

0.1

Examples:

>>> from skcomplex.systems.biology.neuroscience import DelayAdaptationInteraction
>>> DelayAdaptationInteraction('myelination', source='a', target='b', axon='ab', rho=0.5).rho
0.5
Source code in src/skcomplex/systems/biology/neuroscience/_plastic_networks.py
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
def __init__(
    self,
    label: str,
    *,
    source: Role,
    target: Role,
    axon: Role,
    kappa: float = 0.1,
    epsilon: Annotated[float, RealSet.closed_open(0, oo)] = 0.01,
    rho: float = 1.0,
    width: Annotated[float, RealSet.open(0, oo)] = 0.05,
    shortest: float = 0.1,
) -> None:
    super().__init__(label)
    self.source = source
    self.target = target
    self.axon = axon
    self.kappa = kappa
    self.epsilon = epsilon
    self.rho = rho
    self.width = width
    self.shortest = shortest

DelayedLIFNetworkSystem(n_neurons=10, *, probability=0.3, J=0.5, D=1.5, mu=25.0, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

A random network of leaky integrate-and-fire neurons with delayed spikes.

The spikes reach their targets after a delay.

Every neuron is driven above threshold and fires on its own with period tau ln((mu - reset) / (mu - threshold)). Each directed link exists with a probability and moves the target's potential by J per spike, after the delay D. Excitation speeds the firing up and inhibition slows it down. The system has the potentials neuron_<i>.v, the traces neuron_<i>.s, and the spikes of neuron i as spike_<i> events.

Parameters:

Name Type Description Default
n_neurons int

The number of neurons.

10
probability float

The probability of each directed link.

0.3
J float

The efficacy of every link in mV.

0.5
D float

The transmission delay in ms.

1.5
mu float

The constant drive in mV.

25.0
random_state int | Generator | None

The seed or generator of the links and the initial potentials.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import DelayedLIFNetworkSystem
>>> len(DelayedLIFNetworkSystem(5).prepare().system_.elements)
5
Source code in src/skcomplex/systems/biology/neuroscience/_networks.py
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
def __init__(
    self,
    n_neurons: int = 10,
    *,
    probability: float = 0.3,
    J: float = 0.5,
    D: float = 1.5,
    mu: float = 25.0,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_neurons = n_neurons
    self.probability = probability
    self.J = J
    self.D = D
    self.mu = mu
    self.random_state = random_state

DelayedSynapseInteraction(label, *, source, target, J=0.5, D=1.5)

Bases: Interaction

Synapse that adds the delayed presynaptic trace to the postsynaptic potential.

The trace is the one from a transmission delay ago.

The target gains J s_source(t - D), so every presynaptic spike moves the postsynaptic potential by J in total, spread over the decay time of the trace and arriving after the delay D.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
source Role

The path of the presynaptic neuron.

required
target Role

The path of the postsynaptic neuron.

required
J float

The efficacy in mV, positive for excitation and negative for inhibition.

0.5
D Annotated[float, open(0, oo)]

The transmission delay in ms.

1.5

Examples:

>>> from skcomplex.systems.biology.neuroscience import DelayedSynapseInteraction
>>> DelayedSynapseInteraction('synapse', source='a', target='b', J=-1.0).D
1.5
Source code in src/skcomplex/systems/biology/neuroscience/_networks.py
305
306
307
308
309
310
311
312
313
314
315
316
317
318
def __init__(
    self,
    label: str,
    *,
    source: Role,
    target: Role,
    J: float = 0.5,
    D: Annotated[float, RealSet.open(0, oo)] = 1.5,
) -> None:
    super().__init__(label)
    self.source = source
    self.target = target
    self.J = J
    self.D = D

ExcitableElement(label, *, phase=0, p=0.1, stimulus=0.0, space=None)

Bases: Element

Cyclic excitable element of the Kinouchi-Copelli network.

The element is quiescent at 0, excited at 1, and refractory up to m - 1.

Transitions move its phase every step. A quiescent element is excited by the external stimulus with probability 1 - exp(-r), where r is the stimulus rate per step, or by each excited neighbour with the transmission probability p, so it stays quiescent with probability exp(-r) (1 - p)^n when n neighbours are excited. An excited or refractory element moves to the next state, and the last refractory state returns to quiescence.

Parameters:

Name Type Description Default
label str

The label of the element or the site group.

required
phase Annotated[float, NN]

The initial state, 0 for quiescent, 1 for excited, and 2 to n_states - 1 for refractory.

0
p Annotated[float, closed_open(0, oo)]

The probability that an excited neighbour excites the element in one step.

0.1
stimulus Annotated[float, closed_open(0, oo)]

The rate r of the external stimulus per step.

0.0
space BaseSpace | None

The space whose sites hold one member each, or None for one member.

None

Examples:

>>> from skcomplex.systems.biology.neuroscience import ExcitableElement
>>> ExcitableElement('neuron').p
0.1
Source code in src/skcomplex/systems/biology/neuroscience/_excitable.py
65
66
67
68
69
70
71
72
73
74
75
76
77
def __init__(
    self,
    label: str,
    *,
    phase: Annotated[float, NN] = 0,
    p: Annotated[float, RealSet.closed_open(0, oo)] = 0.1,
    stimulus: Annotated[float, RealSet.closed_open(0, oo)] = 0.0,
    space: BaseSpace | None = None,
) -> None:
    super().__init__(label, space=space)
    self.phase = phase
    self.p = p
    self.stimulus = stimulus

FitzHughNagumoNeuronElement(label, *, v=-1.2, w=-0.6)

Bases: Element

FitzHugh-Nagumo neuron, with a fast potential v and a slow recovery w.

The neuron has no laws of its own. FitzHugh-Nagumo kinetics change it.

Parameters:

Name Type Description Default
label str

The label of the neuron.

required
v float

The initial potential.

-1.2
w float

The initial recovery.

-0.6

Examples:

>>> from skcomplex.systems.biology.neuroscience import FitzHughNagumoNeuronElement
>>> FitzHughNagumoNeuronElement('neuron').w
-0.6
Source code in src/skcomplex/systems/biology/neuroscience/_conductances.py
45
46
47
48
49
50
51
52
53
54
def __init__(
    self,
    label: str,
    *,
    v: float = -1.2,
    w: float = -0.6,
) -> None:
    super().__init__(label)
    self.v = v
    self.w = w

FitzhughNagumoODESystem(v=-1.2, w=-0.6, *, a=0.7, b=0.8, epsilon=0.08, I=0.5, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The FitzHugh-Nagumo neuron.

It is the two-variable reduction of Hodgkin and Huxley's excitable membrane.

Without current the neuron rests on a stable fixed point and answers a large enough kick with one spike. A current I between about 0.33 and 1.42 destabilizes the rest and the neuron fires periodically. The system has the potential neuron.v and the recovery neuron.w.

Parameters:

Name Type Description Default
v float

The initial potential.

-1.2
w float

The initial recovery.

-0.6
a float

The offset of the recovery.

0.7
b float

The damping of the recovery.

0.8
epsilon float

The time scale of the recovery.

0.08
I float

The applied current.

0.5
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import FitzhughNagumoODESystem
>>> FitzhughNagumoODESystem(I=0.0).prepare().system_.interactions[0].I
0.0
Source code in src/skcomplex/systems/biology/neuroscience/_conductances.py
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
def __init__(
    self,
    v: float = -1.2,
    w: float = -0.6,
    *,
    a: float = 0.7,
    b: float = 0.8,
    epsilon: float = 0.08,
    I: float = 0.5,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.v = v
    self.w = w
    self.a = a
    self.b = b
    self.epsilon = epsilon
    self.I = I

GlobalInhibitionInteraction(label, *, oscillators, inhibitor, W_z=1.5, theta_z=0.1)

Bases: Interaction

Inhibition of every oscillator of a lattice by a global inhibitor.

The inhibition acts once the inhibitor exceeds its threshold.

Every oscillator gets -W_z H(z - theta_z) from the inhibitor, a smooth step of width kappa of the oscillator. It is the coupling of the members of a group to a hub element, and InhibitorDriveInteraction drives the hub.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
oscillators Role

The path of the lattice of oscillators.

required
inhibitor Role

The path of the inhibitor.

required
W_z Annotated[float, closed_open(0, oo)]

The strength of the inhibition.

1.5
theta_z float

The threshold of the inhibitor.

0.1

Examples:

>>> from skcomplex.systems.biology.neuroscience import GlobalInhibitionInteraction
>>> GlobalInhibitionInteraction('inhibition', inhibitor='z', oscillators='grid').W_z
1.5
Source code in src/skcomplex/systems/biology/neuroscience/_networks.py
364
365
366
367
368
369
370
371
372
373
374
375
376
377
def __init__(
    self,
    label: str,
    *,
    oscillators: Role,
    inhibitor: Role,
    W_z: Annotated[float, RealSet.closed_open(0, oo)] = 1.5,
    theta_z: float = 0.1,
) -> None:
    super().__init__(label)
    self.oscillators = oscillators
    self.inhibitor = inhibitor
    self.W_z = W_z
    self.theta_z = theta_z

HodgkinHuxleyElement(label, *, v=-65.0, n=0.3177, m=0.0529, h=0.5961, C=1.0, g_na=120.0, g_k=36.0, g_l=0.3, e_na=50.0, e_k=-77.0, e_l=-54.387, I=10.0)

Bases: Element

Squid giant axon membrane of Hodgkin and Huxley.

The membrane has sodium, potassium, and leak currents.

The potential follows C v' = I - g_Na m³ h (v - E_Na) - g_K n⁴ (v - E_K) - g_L (v - E_L), and each gate x of n, m, and h relaxes as x' = alpha_x(v) (1 - x) - beta_x(v) x, in the modern convention with rest near -65 mV. Upward crossings of 0 mV are recorded as spike events. Units are mV, ms, mS/cm², and µA/cm². The element holds the states and parameters and has no laws of its own: the current, gating, and crossing interactions of HodgkinHuxleySystem read its parameters.

Parameters:

Name Type Description Default
label str

The label of the neuron.

required
v float

The initial membrane potential.

-65.0
n Annotated[float, closed_open(0, oo)]

The initial potassium activation.

0.3177
m Annotated[float, closed_open(0, oo)]

The initial sodium activation.

0.0529
h Annotated[float, closed_open(0, oo)]

The initial sodium inactivation.

0.5961
C Annotated[float, open(0, oo)]

The membrane capacitance.

1.0
g_na Annotated[float, closed_open(0, oo)]

The maximal sodium conductance.

120.0
g_k Annotated[float, closed_open(0, oo)]

The maximal potassium conductance.

36.0
g_l Annotated[float, closed_open(0, oo)]

The leak conductance.

0.3
e_na float

The sodium reversal potential.

50.0
e_k float

The potassium reversal potential.

-77.0
e_l float

The leak reversal potential.

-54.387
I float

The applied current.

10.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import HodgkinHuxleyElement
>>> HodgkinHuxleyElement('axon', I=10.0).g_na
120.0
Source code in src/skcomplex/systems/biology/neuroscience/_conductances.py
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
def __init__(
    self,
    label: str,
    *,
    v: float = -65.0,
    n: Annotated[float, RealSet.closed_open(0, oo)] = 0.3177,
    m: Annotated[float, RealSet.closed_open(0, oo)] = 0.0529,
    h: Annotated[float, RealSet.closed_open(0, oo)] = 0.5961,
    C: Annotated[float, RealSet.open(0, oo)] = 1.0,
    g_na: Annotated[float, RealSet.closed_open(0, oo)] = 120.0,
    g_k: Annotated[float, RealSet.closed_open(0, oo)] = 36.0,
    g_l: Annotated[float, RealSet.closed_open(0, oo)] = 0.3,
    e_na: float = 50.0,
    e_k: float = -77.0,
    e_l: float = -54.387,
    I: float = 10.0,
) -> None:
    super().__init__(label)
    self.v = v
    self.n = n
    self.m = m
    self.h = h
    self.C = C
    self.g_na = g_na
    self.g_k = g_k
    self.g_l = g_l
    self.e_na = e_na
    self.e_k = e_k
    self.e_l = e_l
    self.I = I

HodgkinHuxleySystem(v=-65.0, *, I=10.0, C=1.0, g_na=120.0, g_k=36.0, g_l=0.3, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The Hodgkin-Huxley neuron.

Its sodium and potassium channels produce action potentials.

The gates start at their steady state at the initial potential, and the current is switched on at the start. A constant current above about 6.2 µA/cm² makes the neuron fire periodically, and a weaker one gives at most a few spikes before it settles. The system has the potential neuron.v, the gates neuron.n, neuron.m, and neuron.h, and its spikes as spike events.

Parameters:

Name Type Description Default
v float

The initial membrane potential in mV.

-65.0
I float

The applied current in µA/cm².

10.0
C float

The membrane capacitance in µF/cm².

1.0
g_na float

The maximal sodium conductance in mS/cm².

120.0
g_k float

The maximal potassium conductance in mS/cm².

36.0
g_l float

The leak conductance in mS/cm².

0.3
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import HodgkinHuxleySystem
>>> round(HodgkinHuxleySystem().prepare().system_.elements[0].h, 4)
0.5961
Source code in src/skcomplex/systems/biology/neuroscience/_conductances.py
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
def __init__(
    self,
    v: float = -65.0,
    *,
    I: float = 10.0,
    C: float = 1.0,
    g_na: float = 120.0,
    g_k: float = 36.0,
    g_l: float = 0.3,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.v = v
    self.I = I
    self.C = C
    self.g_na = g_na
    self.g_k = g_k
    self.g_l = g_l

InhibitorDecayInteraction(label, *, target)

Bases: Interaction

Decay of a global inhibitor without drive, z' = -phi z.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the inhibitor, whose values are z and phi.

required

Examples:

>>> from skcomplex.systems.biology.neuroscience import InhibitorDecayInteraction
>>> InhibitorDecayInteraction('decay', target='inhibitor').target
'inhibitor'
Source code in src/skcomplex/systems/biology/neuroscience/_networks.py
86
87
88
def __init__(self, label: str, *, target: Role) -> None:
    super().__init__(label)
    self.target = target

InhibitorDriveInteraction(label, *, inhibitor, oscillators)

Bases: Interaction

Drive of a global inhibitor by the largest activity of the lattice oscillators.

The activity is m H(x - theta_x).

The inhibitor gets phi max_j m_j H(x_j - theta_x), with the rate phi of the inhibitor and a smooth step of width kappa of every oscillator, so it is driven when at least one stimulated oscillator is active. It is the coupling of a hub element to a group by the largest value over the group.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
inhibitor Role

The path of the inhibitor.

required
oscillators Role

The path of the lattice of oscillators.

required

Examples:

>>> from skcomplex.systems.biology.neuroscience import InhibitorDriveInteraction
>>> InhibitorDriveInteraction('drive', inhibitor='z', oscillators='grid').oscillators
'grid'
Source code in src/skcomplex/systems/biology/neuroscience/_networks.py
419
420
421
422
423
424
425
426
427
428
def __init__(
    self,
    label: str,
    *,
    inhibitor: Role,
    oscillators: Role,
) -> None:
    super().__init__(label)
    self.inhibitor = inhibitor
    self.oscillators = oscillators

InhibitorElement(label, *, z=0.0, phi=3.0)

Bases: Element

Global inhibitor of a LEGION network, with its activity z and its rate phi.

Parameters:

Name Type Description Default
label str

The label of the inhibitor.

required
z Annotated[float, closed_open(0, oo)]

The initial activity.

0.0
phi Annotated[float, open(0, oo)]

The rate of the inhibitor.

3.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import InhibitorElement
>>> InhibitorElement('inhibitor').phi
3.0
Source code in src/skcomplex/systems/biology/neuroscience/_networks.py
56
57
58
59
60
61
62
63
64
65
def __init__(
    self,
    label: str,
    *,
    z: Annotated[float, RealSet.closed_open(0, oo)] = 0.0,
    phi: Annotated[float, RealSet.open(0, oo)] = 3.0,
) -> None:
    super().__init__(label)
    self.z = z
    self.phi = phi

IntegrateAndFireSystem(v=-65.0, *, rest=-65.0, threshold=-50.0, reset=-65.0, resistance=10.0, tau=10.0, I=2.0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The leaky integrate-and-fire neuron, tau v' = -(v - rest) + R I.

It spikes and resets at a threshold.

With R I above threshold - rest it fires periodically with period tau ln(R I / (R I - threshold + rest)) when reset = rest. The system has the membrane potential neuron.v and its spikes recorded as spike events.

Parameters:

Name Type Description Default
v float

The initial membrane potential in mV.

-65.0
rest float

The resting potential in mV.

-65.0
threshold float

The potential at which the neuron spikes in mV.

-50.0
reset float

The potential after a spike in mV.

-65.0
resistance float

The membrane resistance in MΩ.

10.0
tau float

The membrane time constant in ms.

10.0
I float

The input current in nA.

2.0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import IntegrateAndFireSystem
>>> trajectory = IntegrateAndFireSystem().prepare().simulate(until=50.0, dt=0.1)
>>> round(trajectory.events[0].time, 2)
13.86
Source code in src/skcomplex/systems/biology/neuroscience/_neurons.py
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
def __init__(
    self,
    v: float = -65.0,
    *,
    rest: float = -65.0,
    threshold: float = -50.0,
    reset: float = -65.0,
    resistance: float = 10.0,
    tau: float = 10.0,
    I: float = 2.0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.v = v
    self.rest = rest
    self.threshold = threshold
    self.reset = reset
    self.resistance = resistance
    self.tau = tau
    self.I = I

IzhikevichElement(label, *, v=-65.0, u=-13.0)

Bases: Element

Izhikevich neuron, a quadratic potential v and a linear recovery u.

Parameters:

Name Type Description Default
label str

The label of the neuron.

required
v float

The initial potential.

-65.0
u float

The initial recovery.

-13.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import IzhikevichElement
>>> IzhikevichElement('neuron').u
-13.0
Source code in src/skcomplex/systems/biology/neuroscience/_neurons.py
46
47
48
49
def __init__(self, label: str, *, v: float = -65.0, u: float = -13.0) -> None:
    super().__init__(label)
    self.v = v
    self.u = u

IzhikevichInteraction(label, *, target, a=0.02, b=0.2, I=10.0)

Bases: Interaction

Izhikevich's quadratic potential and linear recovery of a neuron.

The potential follows v' = 0.04 v² + 5 v + 140 - u + I and the recovery u' = a (b v - u). A spike reset fires the neuron.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the neuron, with the potential v and the recovery u.

required
a float

The time scale of the recovery.

0.02
b float

The sensitivity of the recovery to the potential.

0.2
I float

The input current.

10.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import IzhikevichInteraction
>>> IzhikevichInteraction('membrane', target='neuron').b
0.2
Source code in src/skcomplex/systems/biology/neuroscience/_neurons.py
82
83
84
85
86
87
def __init__(self, label: str, *, target: Role, a: float = 0.02, b: float = 0.2, I: float = 10.0) -> None:
    super().__init__(label)
    self.target = target
    self.a = a
    self.b = b
    self.I = I

IzhikevichSystem(v=-65.0, u=None, *, a=0.02, b=0.2, c=-65.0, d=8.0, I=10.0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The Izhikevich neuron.

Its four parameters give regular spiking, bursting, chattering, and more.

The potential follows v' = 0.04 v² + 5 v + 140 - u + I and the recovery u' = a (b v - u). When v reaches 30 mV the neuron spikes, v resets to c, and u grows by d. The defaults give regular spiking. The system has the potential neuron.v, the recovery neuron.u, and its spikes as spike events.

Parameters:

Name Type Description Default
v float

The initial membrane potential in mV.

-65.0
u float | None

The initial recovery variable, or None for b v.

None
a float

The time scale of the recovery.

0.02
b float

The sensitivity of the recovery to the potential.

0.2
c float

The potential after a spike.

-65.0
d float

The increase of the recovery after a spike.

8.0
I float

The input current.

10.0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import IzhikevichSystem
>>> IzhikevichSystem(d=2.0).prepare().system_.interactions[1].kick
2.0
Source code in src/skcomplex/systems/biology/neuroscience/_neurons.py
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
def __init__(
    self,
    v: float = -65.0,
    u: float | None = None,
    *,
    a: float = 0.02,
    b: float = 0.2,
    c: float = -65.0,
    d: float = 8.0,
    I: float = 10.0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.v = v
    self.u = u
    self.a = a
    self.b = b
    self.c = c
    self.d = d
    self.I = I

KinouchiCopelliSystem(graph=None, *, sigma=1.0, stimulus=0.0, n_states=5, excited=None, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The Kinouchi-Copelli network of excitable elements.

Its dynamic range peaks at the critical point.

Every element excites each quiescent neighbour with the transmission probability p = sigma / K, where K is the mean degree of the graph, so sigma is the branching ratio, the mean number of elements one excitation excites. Below sigma = 1 activity dies out without a stimulus, and above it activity sustains itself. The response, the mean firing rate against the stimulus rate, spans the most decades of stimulus at sigma = 1. The system has the states neurons.phase, one value per node. Its standard observable activity is the fraction of excited elements, the firing rate per step.

Parameters:

Name Type Description Default
graph Graph | None

The NetworkX graph, or None for an Erdős-Rényi graph of 1000 nodes with mean degree 10.

None
sigma float

The branching ratio.

1.0
stimulus float

The rate r of the external stimulus per step, which excites a quiescent element with probability 1 - exp(-r).

0.0
n_states int

The number of states of the cycle, one quiescent, one excited, and n_states - 2 refractory.

5
excited float | None

The initial fraction of excited elements, with the others quiescent, or None for states drawn uniformly over the cycle.

None
random_state int | Generator | None

The seed or generator of the default graph and of the initial states.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> import networkx as nx
>>> from skcomplex.systems.biology.neuroscience import KinouchiCopelliSystem
>>> system = KinouchiCopelliSystem(nx.random_regular_graph(4, 20, seed=0), sigma=1.0).prepare().system_
>>> system.elements[0].p
0.25
Source code in src/skcomplex/systems/biology/neuroscience/_excitable.py
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
def __init__(
    self,
    graph: nx.Graph | None = None,
    *,
    sigma: float = 1.0,
    stimulus: float = 0.0,
    n_states: int = 5,
    excited: float | None = None,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.graph = graph
    self.sigma = sigma
    self.stimulus = stimulus
    self.n_states = n_states
    self.excited = excited
    self.random_state = random_state

LeakyIntegrateAndFireElement(label, *, v=-65.0)

Bases: Element

Leaky integrate-and-fire neuron with the potential v.

Parameters:

Name Type Description Default
label str

The label of the neuron.

required
v float

The initial potential.

-65.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import LeakyIntegrateAndFireElement
>>> LeakyIntegrateAndFireElement('neuron').v
-65.0
Source code in src/skcomplex/systems/biology/neuroscience/_neurons.py
118
119
120
def __init__(self, label: str, *, v: float = -65.0) -> None:
    super().__init__(label)
    self.v = v

LeakyIntegrateAndFireInteraction(label, *, target, rest=-65.0, resistance=10.0, tau=10.0, I=2.0)

Bases: Interaction

Leak of the potential of a neuron towards rest + resistance I over the time tau.

The potential follows tau v' = -(v - rest) + resistance I. A spike reset fires the neuron. Units are mV, ms, MΩ, and nA.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the neuron, with the potential v.

required
rest float

The resting potential.

-65.0
resistance Annotated[float, open(0, oo)]

The membrane resistance.

10.0
tau Annotated[float, open(0, oo)]

The membrane time constant.

10.0
I float

The input current.

2.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import LeakyIntegrateAndFireInteraction
>>> LeakyIntegrateAndFireInteraction('membrane', target='neuron').tau
10.0
Source code in src/skcomplex/systems/biology/neuroscience/_neurons.py
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
def __init__(
    self,
    label: str,
    *,
    target: Role,
    rest: float = -65.0,
    resistance: Annotated[float, RealSet.open(0, oo)] = 10.0,
    tau: Annotated[float, RealSet.open(0, oo)] = 10.0,
    I: float = 2.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.rest = rest
    self.resistance = resistance
    self.tau = tau
    self.I = I

LeakyIntegrationInteraction(label, *, target, state='x', goal=0.0, time=1.0, noise=None)

Bases: Interaction

Leaky integration of a potential or an activity towards its input over a time constant.

Neuroscience names it the leak of a membrane or of a population, as in the Wilson-Cowan and leaky integrate-and-fire models. The rate is (goal(ns) - x) / time(ns) of a state x of a target, with optional noise. With a constant goal and time and an additive noise of amplitude sigma, the state follows the Ornstein-Uhlenbeck process dx = (goal - x) / time dt + sigma dW, whose stationary variance is sigma**2 time / 2. A goal or a time function takes the namespace of the interaction, which reads the target as ns.target and the time as ns.t, and a number stands for a constant. A goal that is a number applies to every component of a vector state.

Parameters:

Name Type Description Default
label str

The label of the interaction, unique among the components of its system.

required
target Role

The path of the element or group whose state relaxes.

required
state str

The name of the state of the target that relaxes.

'x'
goal Callable[[SimpleNamespace], object] | float

A function of the namespace that returns the goal, or a number.

0.0
time Callable[[SimpleNamespace], object] | float

A function of the namespace that returns the relaxation time, or a positive number.

1.0
noise Callable[[SimpleNamespace], object] | float | None

A function of the namespace that returns the amplitude of the noise, a number, or None for no noise.

None

Raises:

Type Description
ValidationError

The state is not a name, or a function is neither callable nor a number.

Examples:

>>> from skcomplex.core.components.elements import Element
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.biology.neuroscience import LeakyIntegrationInteraction
>>> relaxation = LeakyIntegrationInteraction('relaxation', target='stock', goal=10.0, time=0.5)
>>> system = System(elements=[Element('stock', values={'x': 0.0})], interactions=[relaxation]).prepare()
>>> round(float(system.simulate(5.0, dt=0.01).get_values('stock.x')[-1]), 3)
10.0
Source code in src/skcomplex/systems/biology/neuroscience/_leaky_integration.py
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
def __init__(
    self,
    label: str,
    *,
    target: Role,
    state: str = 'x',
    goal: Callable[[SimpleNamespace], object] | float = 0.0,
    time: Callable[[SimpleNamespace], object] | float = 1.0,
    noise: Callable[[SimpleNamespace], object] | float | None = None,
) -> None:
    super().__init__(label)
    self.target = target
    self.state = state
    self.goal = goal
    self.time = time
    self.noise = noise

LegionSystem(stimulus=LEGION_OBJECTS, *, epsilon=0.1, W=6.0, W_z=1.5, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

A LEGION network, a lattice of relaxation oscillators.

The network segments a stimulus into its objects.

Stimulated oscillators excite their stimulated neighbours, so each connected object synchronizes, and a global inhibitor lets only one object be active at a time, so different objects take turns. The inhibitor is driven by the largest activity of the oscillators, so one active oscillator drives it fully. Unstimulated sites have a negative input and stay silent.

The default epsilon = 0.1 gives a cycle of about 60 time units, so with the default stimulus the second object first fires near t = 51 and the first near t = 70. The value 0.02 of Terman and Wang makes the slow phases five times longer, and then no object starts an active phase before t = 220. The system has the fast variables oscillators.x, the slow variables oscillators.y, and the inhibitor inhibitor.z.

Parameters:

Name Type Description Default
stimulus Sequence[Sequence[float]]

The lattice of 1 for stimulated and 0 for unstimulated sites, by rows. The default holds two objects.

LEGION_OBJECTS
epsilon float

The time scale of the slow variables.

0.1
W float

The total excitatory weight into a stimulated site, shared among its stimulated neighbours.

6.0
W_z float

The strength of the global inhibition.

1.5
random_state int | Generator | None

The seed or generator of the initial states.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import LegionSystem
>>> LegionSystem().prepare().system_.elements[0].space.shape
(4, 4)
Source code in src/skcomplex/systems/biology/neuroscience/_networks.py
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
def __init__(
    self,
    stimulus: Sequence[Sequence[float]] = LEGION_OBJECTS,
    *,
    epsilon: float = 0.1,
    W: float = 6.0,
    W_z: float = 1.5,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.stimulus = stimulus
    self.epsilon = epsilon
    self.W = W
    self.W_z = W_z
    self.random_state = random_state

MutualInhibitionInteraction(label, *, units, beta=2.0)

Bases: Interaction

Inhibition of every unit by the summed activity of all the other units.

The inhibition is -beta x_i sum_{j != i} x_j / tau_i.

It is the coupling of separate units to each other, with the term -beta x_i x_j / tau_i of every other unit j.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
units tuple[Role, ...]

The paths of the units.

required
beta Annotated[float, closed_open(0, oo)]

The strength of the inhibition.

2.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import MutualInhibitionInteraction
>>> MutualInhibitionInteraction('inhibition', units=['a', 'b'], beta=2.0).beta
2.0
Source code in src/skcomplex/systems/biology/neuroscience/_populations.py
315
316
317
318
319
320
321
322
323
324
def __init__(
    self,
    label: str,
    *,
    units: tuple[Role, ...],
    beta: Annotated[float, RealSet.closed_open(0, oo)] = 2.0,
) -> None:
    super().__init__(label)
    self.units = units
    self.beta = beta

NeuralFieldSiteElement(label, *, u=0.0, tau=1.0, h=-0.2, A=1.0, sigma=1.0, space=None)

Bases: Element

Site of a neural field.

The site holds the mean membrane potential of the neurons at one position.

The site holds the potential u, its time constant tau, the resting level h, and the amplitude A and the range sigma of the lateral-inhibition kernel w(x) = A (1 - |x| / sigma) exp(-|x| / sigma), which excites near neighbours and inhibits distant ones.

Parameters:

Name Type Description Default
label str

The label of the site or the field.

required
u float | Array

The initial membrane potential.

0.0
tau Annotated[float, open(0, oo)]

The time constant of the potential.

1.0
h float

The resting level.

-0.2
A Annotated[float, open(0, oo)]

The amplitude of the kernel.

1.0
sigma Annotated[float, open(0, oo)]

The range of the kernel.

1.0
space BaseSpace | None

The lattice whose sites hold one site of the field each, or None for one site.

None

Examples:

>>> from skcomplex.systems.biology.neuroscience import NeuralFieldSiteElement
>>> NeuralFieldSiteElement('site').h
-0.2
Source code in src/skcomplex/systems/biology/neuroscience/_neural_fields.py
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
def __init__(
    self,
    label: str,
    *,
    u: float | Array = 0.0,
    tau: Annotated[float, RealSet.open(0, oo)] = 1.0,
    h: float = -0.2,
    A: Annotated[float, RealSet.open(0, oo)] = 1.0,
    sigma: Annotated[float, RealSet.open(0, oo)] = 1.0,
    space: BaseSpace | None = None,
) -> None:
    super().__init__(label, space=space)
    self.u = u
    self.tau = tau
    self.h = h
    self.A = A
    self.sigma = sigma

NeuralMassElement(label, *, r=0.01, v=-1.0, s=0.0, tau=20.0, delta=1.0, H=-5.0, tau_d=10.0)

Bases: Element

Population of quadratic integrate-and-fire neurons in an exact mean field.

The mean field is the one of Montbrió, Pazó, and Roxin.

The excitabilities of the neurons follow a Lorentzian distribution of median H and half-width delta, so the firing rate r and the mean membrane potential v of the population follow dr/dt = delta / (tau^2 pi) + 2 r v / tau and dv/dt = (v^2 + H) / tau - tau (pi r)^2 exactly, with the membrane time constant tau. The synaptic field s filters the rate with exponential synapses, ds/dt = (r - s) / tau_d. The element holds the states and parameters, a NeuralMassInteraction gives these laws, and couplings and inputs add to the rate of v.

Parameters:

Name Type Description Default
label str

The label of the population.

required
r Annotated[float, closed_open(0, oo)]

The initial firing rate, in spikes per millisecond.

0.01
v float

The initial mean membrane potential.

-1.0
s Annotated[float, closed_open(0, oo)]

The initial synaptic field.

0.0
tau Annotated[float, open(0, oo)]

The membrane time constant, in milliseconds.

20.0
delta Annotated[float, open(0, oo)]

The half-width of the Lorentzian excitabilities.

1.0
H float

The median of the Lorentzian excitabilities.

-5.0
tau_d Annotated[float, open(0, oo)]

The decay time of the synapses, in milliseconds.

10.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import NeuralMassElement
>>> NeuralMassElement('excitatory', tau=20.0).tau
20.0
Source code in src/skcomplex/systems/biology/neuroscience/_neural_masses.py
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
def __init__(
    self,
    label: str,
    *,
    r: Annotated[float, RealSet.closed_open(0, oo)] = 0.01,
    v: float = -1.0,
    s: Annotated[float, RealSet.closed_open(0, oo)] = 0.0,
    tau: Annotated[float, RealSet.open(0, oo)] = 20.0,
    delta: Annotated[float, RealSet.open(0, oo)] = 1.0,
    H: float = -5.0,
    tau_d: Annotated[float, RealSet.open(0, oo)] = 10.0,
) -> None:
    super().__init__(label)
    self.r = r
    self.v = v
    self.s = s
    self.tau = tau
    self.delta = delta
    self.H = H
    self.tau_d = tau_d

NeuralMassInteraction(label, *, target)

Bases: Interaction

Exact mean-field dynamics of one population of quadratic integrate-and-fire neurons.

It gives the population of its target the rate dr/dt = delta / (tau^2 pi) + 2 r v / tau, the potential dv/dt = (v^2 + H) / tau - tau (pi r)^2, and the synaptic field ds/dt = (r - s) / tau_d, with the parameters of the target.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the population.

required

Examples:

>>> from skcomplex.systems.biology.neuroscience import NeuralMassInteraction
>>> NeuralMassInteraction('mean_field', target='e').target
'e'
Source code in src/skcomplex/systems/biology/neuroscience/_neural_masses.py
116
117
118
def __init__(self, label: str, *, target: Role) -> None:
    super().__init__(label)
    self.target = target

NextGenerationNeuralMassSystem(setup='ping', *, H_e=1.3, H_i=None, J_ee=8.0, J_ie=10.0, J_ei=10.0, J_ii=None, delta=None, I0=None, nu=5.0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The exact neural mass of quadratic integrate-and-fire neurons.

Its gamma rhythm nests in a theta drive.

In the 'ping' setup an excitatory and an inhibitory population, with membrane time constants of 20 and 10 ms, couple through instantaneous synapses, and the theta current drives the excitatory one. In the 'ing' setup a single inhibitory population inhibits itself through exponential synapses of 10 ms, and the current drives it. Without forcing the populations rest or oscillate collectively in the gamma band, about 45 Hz for H_e = 10, as their excitabilities cross a Hopf bifurcation. A slow theta current sweeps them across it, so gamma bursts appear at every theta peak, theta-nested gamma oscillations. The defaults are those of Segneri et al. (2020, figure 3). The system has the rates excitatory.r and inhibitory.r, in spikes per millisecond, and the potentials excitatory.v and inhibitory.v, or the inhibitory population alone in 'ing'.

Parameters:

Name Type Description Default
setup str

'ping' for excitatory and inhibitory populations or 'ing' for one inhibitory population.

'ping'
H_e float

The median excitability of the excitatory population.

1.3
H_i float | None

The median excitability of the inhibitory population, or None for -5 in 'ping' and 2 in 'ing'.

None
J_ee float

The excitatory self-coupling of 'ping'.

8.0
J_ie float

The inhibition of the excitatory population by the inhibitory one in 'ping'.

10.0
J_ei float

The excitation of the inhibitory population by the excitatory one in 'ping'.

10.0
J_ii float | None

The inhibitory self-coupling, or None for 0 in 'ping' and 21 in 'ing'.

None
delta float | None

The half-width of the excitabilities, or None for 1 in 'ping' and 0.3 in 'ing'.

None
I0 float | None

The peak theta current, or None for 10 in 'ping' and 9 in 'ing'.

None
nu float

The theta frequency, in hertz.

5.0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Raises:

Type Description
ValidationError

The setup is unknown.

Examples:

>>> from skcomplex.systems.biology.neuroscience import NextGenerationNeuralMassSystem
>>> [element.label for element in NextGenerationNeuralMassSystem('ing').prepare().system_.elements]
['inhibitory']
Source code in src/skcomplex/systems/biology/neuroscience/_neural_masses.py
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
def __init__(
    self,
    setup: str = 'ping',
    *,
    H_e: float = 1.3,
    H_i: float | None = None,
    J_ee: float = 8.0,
    J_ie: float = 10.0,
    J_ei: float = 10.0,
    J_ii: float | None = None,
    delta: float | None = None,
    I0: float | None = None,
    nu: float = 5.0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.setup = setup
    self.H_e = H_e
    self.H_i = H_i
    self.J_ee = J_ee
    self.J_ie = J_ie
    self.J_ei = J_ei
    self.J_ii = J_ii
    self.delta = delta
    self.I0 = I0
    self.nu = nu

PhaseUnitElement(label, *, theta=0.0, omega=1.0)

Bases: Element

Neural unit reduced to a phase theta that wraps around, with its natural frequency omega.

Parameters:

Name Type Description Default
label str

The label of the unit or of the group of units.

required
theta Annotated[float, Period(2 * pi)]

The initial phase.

0.0
omega float

The natural frequency.

1.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import PhaseUnitElement
>>> PhaseUnitElement('unit', omega=1.5).omega
1.5
Source code in src/skcomplex/systems/biology/neuroscience/_plastic_networks.py
83
84
85
86
87
88
89
90
91
92
def __init__(
    self,
    label: str,
    *,
    theta: Annotated[float, Period(2 * math.pi)] = 0.0,
    omega: float = 1.0,
) -> None:
    super().__init__(label)
    self.theta = theta
    self.omega = omega

PolyhomeostaticNeuronElement(label, *, x=0.0, a=1.0, b=0.0, mu=0.2, eps_a=0.05, eps_b=0.05, Gamma=1.0, I0=0.0, A=1.0, omega=1.0)

Bases: Element

Rate neuron that adapts its gain and threshold.

The adaptation makes its firing rate exponentially distributed.

The membrane potential x integrates the input I0 + A sin(omega t) with rate Gamma, and the neuron fires at rate y = 1 / (1 + exp(a (b - x))). Stochastic gradient descent on the Kullback-Leibler divergence between the distribution of y and an exponential of mean mu gives a' = eps_a (1/a + (x - b) d) and b' = -eps_b a d with d = 1 - (2 + 1/mu) y + y²/mu. The element holds the states and parameters and has no laws of its own: the relaxation and plasticity interactions of PolyhomeostaticNeuronSystem read its parameters.

Parameters:

Name Type Description Default
label str

The label of the neuron.

required
x float

The initial membrane potential.

0.0
a Annotated[float, open(0, oo)]

The initial gain.

1.0
b float

The initial threshold.

0.0
mu Annotated[float, open(0, oo)]

The target mean firing rate.

0.2
eps_a Annotated[float, closed_open(0, oo)]

The adaptation rate of the gain.

0.05
eps_b Annotated[float, closed_open(0, oo)]

The adaptation rate of the threshold.

0.05
Gamma Annotated[float, open(0, oo)]

The leak rate of the membrane potential.

1.0
I0 float

The mean input.

0.0
A Annotated[float, closed_open(0, oo)]

The amplitude of the periodic input.

1.0
omega Annotated[float, open(0, oo)]

The angular frequency of the periodic input.

1.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import PolyhomeostaticNeuronElement
>>> PolyhomeostaticNeuronElement('neuron').mu
0.2
Source code in src/skcomplex/systems/biology/neuroscience/_populations.py
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
def __init__(
    self,
    label: str,
    *,
    x: float = 0.0,
    a: Annotated[float, RealSet.open(0, oo)] = 1.0,
    b: float = 0.0,
    mu: Annotated[float, RealSet.open(0, oo)] = 0.2,
    eps_a: Annotated[float, RealSet.closed_open(0, oo)] = 0.05,
    eps_b: Annotated[float, RealSet.closed_open(0, oo)] = 0.05,
    Gamma: Annotated[float, RealSet.open(0, oo)] = 1.0,
    I0: float = 0.0,
    A: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    omega: Annotated[float, RealSet.open(0, oo)] = 1.0,
) -> None:
    super().__init__(label)
    self.x = x
    self.a = a
    self.b = b
    self.mu = mu
    self.eps_a = eps_a
    self.eps_b = eps_b
    self.Gamma = Gamma
    self.I0 = I0
    self.A = A
    self.omega = omega

PolyhomeostaticNeuronSystem(*, mu=0.2, eps_a=0.05, eps_b=0.05, I0=0.0, A=1.0, omega=1.0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

A neuron that adapts its gain and threshold.

The adaptation makes its firing rate approach an exponential distribution.

Polyhomeostatic optimization targets the whole distribution of the firing rate, the one of maximal entropy for a given mean mu, rather than its mean alone. The neuron is driven by a periodic input, and the time average of its rate approaches mu as gain and threshold adapt. The system has the potential neuron.x, the gain neuron.a, and the threshold neuron.b.

Parameters:

Name Type Description Default
mu float

The target mean firing rate.

0.2
eps_a float

The adaptation rate of the gain.

0.05
eps_b float

The adaptation rate of the threshold.

0.05
I0 float

The mean input.

0.0
A float

The amplitude of the periodic input.

1.0
omega float

The angular frequency of the periodic input.

1.0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import PolyhomeostaticNeuronSystem
>>> PolyhomeostaticNeuronSystem(mu=0.1).prepare().system_.elements[0].mu
0.1
Source code in src/skcomplex/systems/biology/neuroscience/_populations.py
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
def __init__(
    self,
    *,
    mu: float = 0.2,
    eps_a: float = 0.05,
    eps_b: float = 0.05,
    I0: float = 0.0,
    A: float = 1.0,
    omega: float = 1.0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.mu = mu
    self.eps_a = eps_a
    self.eps_b = eps_b
    self.I0 = I0
    self.A = A
    self.omega = omega

PulseCouplingInteraction(label, *, neurons, kappa=1.0, n=2)

Bases: Interaction

Global coupling of theta neurons through the mean of their pulses.

Every neuron emits smooth pulses.

Every neuron receives the current (1 + cos theta) kappa I, where I = mean_j a_n (1 - cos theta_j)^n is the mean pulse of all neurons at the current state. The pulse peaks when a neuron fires, and a_n gives it a unit mean over the phase. With kappa > 0 the coupling is excitatory.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
neurons Role

The path of the group of theta neurons.

required
kappa float

The coupling strength.

1.0
n int

The sharpness of the pulses, a positive integer.

2

Examples:

>>> from skcomplex.systems.biology.neuroscience import PulseCouplingInteraction
>>> PulseCouplingInteraction('coupling', neurons='neurons', kappa=2.0).kappa
2.0
Source code in src/skcomplex/systems/biology/neuroscience/_populations.py
373
374
375
376
377
378
379
380
381
382
383
384
def __init__(
    self,
    label: str,
    *,
    neurons: Role,
    kappa: float = 1.0,
    n: int = 2,
) -> None:
    super().__init__(label)
    self.neurons = neurons
    self.kappa = kappa
    self.n = n

RateUnitElement(label, *, x=0.1, I=1.0, tau=1.0)

Bases: Element

Neural unit of a competitive network, whose activity grows with its input and saturates.

A SaturatingGrowthInteraction grows it as tau x' = x (I - x).

Parameters:

Name Type Description Default
label str

The label of the unit.

required
x Annotated[float, closed_open(0, oo)]

The initial activity.

0.1
I float

The input.

1.0
tau Annotated[float, open(0, oo)]

The time constant.

1.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import RateUnitElement
>>> RateUnitElement('unit', I=1.2).I
1.2
Source code in src/skcomplex/systems/biology/neuroscience/_populations.py
132
133
134
135
136
137
138
139
140
141
142
143
def __init__(
    self,
    label: str,
    *,
    x: Annotated[float, RealSet.closed_open(0, oo)] = 0.1,
    I: float = 1.0,
    tau: Annotated[float, RealSet.open(0, oo)] = 1.0,
) -> None:
    super().__init__(label)
    self.x = x
    self.I = I
    self.tau = tau

ReservoirInteraction(label, *, target)

Bases: Interaction

Depletion and recovery of the reservoirs of the sites of an associative network.

The reservoir phi of an active site, x > x_c, depletes as dphi/dt = -gamma_minus phi, and the reservoir of an inactive site recovers as dphi/dt = gamma_plus (1 - phi) (1 - x / x_c). The network couples the activities.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the sites, whose values are x, phi, x_c, gamma_plus, and gamma_minus.

required

Examples:

>>> from skcomplex.systems.biology.neuroscience import ReservoirInteraction
>>> ReservoirInteraction('reservoirs', target='sites').target
'sites'
Source code in src/skcomplex/systems/biology/neuroscience/_associative.py
103
104
105
def __init__(self, label: str, *, target: Role) -> None:
    super().__init__(label)
    self.target = target

RotationInteraction(label, *, target)

Bases: Interaction

Rotation of the phase of a unit at its natural frequency, theta' = omega.

Couplings to other units add to the rate of the phase.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the unit, whose values are theta and omega.

required

Examples:

>>> from skcomplex.systems.biology.neuroscience import RotationInteraction
>>> RotationInteraction('rotation', target='unit_0').target
'unit_0'
Source code in src/skcomplex/systems/biology/neuroscience/_plastic_networks.py
115
116
117
def __init__(self, label: str, *, target: Role) -> None:
    super().__init__(label)
    self.target = target

STDPNetworkSystem(n_neurons=20, *, p=0.3, eta=0.5, spread=0.2, epsilon=0.05, A_plus=1.0, A_minus=1.05, tau=2.0, kappa=0.5, seed=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Theta neurons on a random directed network with plastic synapses.

The synapses learn by spike-timing-dependent plasticity.

The neurons fire periodically with excitabilities spread around eta, and every synapse is potentiated when its presynaptic neuron fires shortly before its postsynaptic neuron and depressed when it fires shortly after. Spikes of neurons that fire at different rates fall at all delays, so the mean change of the efficacies follows the integral of the window, (A_plus - A_minus) tau: a window dominated by depression weakens the synapses and one dominated by potentiation strengthens them, while the spread of the efficacies grows. The system has the phases neurons.theta, the traces neurons.a and neurons.b, and the efficacies synapses.kappa on the edges.

Parameters:

Name Type Description Default
n_neurons int

The number of neurons.

20
p float

The probability of every directed synapse.

0.3
eta float

The mean excitability.

0.5
spread float

The half-width of the uniform spread of the excitabilities.

0.2
epsilon float

The learning rate.

0.05
A_plus float

The amplitude of potentiation.

1.0
A_minus float

The amplitude of depression.

1.05
tau float

The time of both windows of the plasticity.

2.0
kappa float

The initial efficacy of every synapse.

0.5
seed int | None

The seed of the network, the excitabilities, and the initial phases.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import STDPNetworkSystem
>>> STDPNetworkSystem(10).prepare().system_.elements[0].theta.shape
(10,)
Source code in src/skcomplex/systems/biology/neuroscience/_plastic_networks.py
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
def __init__(
    self,
    n_neurons: int = 20,
    *,
    p: float = 0.3,
    eta: float = 0.5,
    spread: float = 0.2,
    epsilon: float = 0.05,
    A_plus: float = 1.0,
    A_minus: float = 1.05,
    tau: float = 2.0,
    kappa: float = 0.5,
    seed: int | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_neurons = n_neurons
    self.p = p
    self.eta = eta
    self.spread = spread
    self.epsilon = epsilon
    self.A_plus = A_plus
    self.A_minus = A_minus
    self.tau = tau
    self.kappa = kappa
    self.seed = seed

SaturatingGrowthInteraction(label, *, target)

Bases: Interaction

Self-limited growth of the activity of a neural unit, tau x' = x (I - x).

The input I and the time constant tau are values of the unit, a RateUnitElement.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the unit.

required

Examples:

>>> from skcomplex.systems.biology.neuroscience import SaturatingGrowthInteraction
>>> SaturatingGrowthInteraction('growth', target='unit').target
'unit'
Source code in src/skcomplex/systems/biology/neuroscience/_populations.py
166
167
168
def __init__(self, label: str, *, target: Role) -> None:
    super().__init__(label)
    self.target = target

SpikeResetInteraction(label, *, target, state='v', threshold=1.0, after=0.0, kicked=None, kick=0.0)

Bases: Interaction

Spike of a neuron that resets its potential when it crosses a threshold upwards.

When the potential v rises through threshold, it is set to after, and the state kicked, such as a recovery variable or a synaptic trace, grows by kick. Every spike is an event labelled by the interaction.

Parameters:

Name Type Description Default
label str

The label of the interaction and of its events.

required
target Role

The path of the neuron.

required
state str

The name of the potential.

'v'
threshold float

The potential of a spike.

1.0
after float

The potential after a spike.

0.0
kicked str | None

The name of the state a spike increments, or None for none.

None
kick float

The increment of the kicked state at a spike.

0.0

Raises:

Type Description
ValidationError

The direction is not -1, 0, or 1, or the guard or a new value is not a function.

Examples:

>>> from skcomplex.core.components.elements import Element
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.biology.common.pharmacokinetics import DosingInteraction
>>> from skcomplex.systems.biology.neuroscience import SpikeResetInteraction
>>> drive = DosingInteraction('drive', target='neuron', state='x', dose=1.0)
>>> spike = SpikeResetInteraction('spike', target='neuron', state='x', threshold=1.0, after=0.0)
>>> system = System(elements=[Element('neuron', values={'x': 0.0})], interactions=[drive, spike])
>>> trajectory = system.prepare().simulate(until=2.1, dt=0.25)
>>> [round(event.time, 6) for event in trajectory.events]
[1.0, 2.0]
Source code in src/skcomplex/systems/biology/common/excitable/_spike_reset.py
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
def __init__(
    self,
    label: str,
    *,
    target: Role,
    state: str = 'v',
    threshold: float = 1.0,
    after: float = 0.0,
    kicked: str | None = None,
    kick: float = 0.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.state = state
    self.threshold = threshold
    self.after = after
    self.kicked = kicked
    self.kick = kick

SpikeTimingPlasticityInteraction(label, *, among, k=1.0, epsilon=0.01, A_plus=1.0, A_minus=1.05, kappa_max=1.0, along=True)

Bases: Interaction

Pulse coupling along plastic synapses.

The efficacy of a synapse follows the timing of the spikes at both ends.

The presynaptic neuron at the source of an edge drives the postsynaptic neuron at its target with the current (1 + cos theta_post) kappa P(theta_pre) / k, where k is the mean in-degree. The efficacy grows when the postsynaptic neuron fires after the presynaptic one and shrinks when it fires before, dkappa/dt = epsilon (A_plus a_pre P(theta_post) - A_minus b_post P(theta_pre)), the window W(dt) = A_plus exp(-dt / tau_plus) for dt > 0 and -A_minus exp(dt / tau_minus) for dt < 0 applied to every pair of spikes through the traces. Soft bounds scale potentiation by kappa_max - kappa and depression by kappa, so the efficacy stays between 0 and kappa_max.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
among Role

The path of the group of traced theta neurons on the nodes. The efficacies kappa are values of the group of synapses on the edges.

required
k Annotated[float, open(0, oo)]

The mean in-degree that normalizes the coupling.

1.0
epsilon Annotated[float, closed_open(0, oo)]

The learning rate.

0.01
A_plus Annotated[float, closed_open(0, oo)]

The amplitude of potentiation.

1.0
A_minus Annotated[float, closed_open(0, oo)]

The amplitude of depression.

1.05
kappa_max Annotated[float, open(0, oo)]

The largest efficacy.

1.0
along bool | str

The edges the laws run on, True for the edges of the network the neurons live on.

True

Examples:

>>> from skcomplex.systems.biology.neuroscience import SpikeTimingPlasticityInteraction
>>> SpikeTimingPlasticityInteraction('stdp', among='neurons').A_minus
1.05
Source code in src/skcomplex/systems/biology/neuroscience/_plastic_networks.py
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
def __init__(
    self,
    label: str,
    *,
    among: Role,
    k: Annotated[float, RealSet.open(0, oo)] = 1.0,
    epsilon: Annotated[float, RealSet.closed_open(0, oo)] = 0.01,
    A_plus: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    A_minus: Annotated[float, RealSet.closed_open(0, oo)] = 1.05,
    kappa_max: Annotated[float, RealSet.open(0, oo)] = 1.0,
    along: bool | str = True,
) -> None:
    super().__init__(label, among=among, along=along)
    self.k = k
    self.epsilon = epsilon
    self.A_plus = A_plus
    self.A_minus = A_minus
    self.kappa_max = kappa_max

SpikeTraceInteraction(label, *, target)

Bases: Interaction

Traces of the spikes of theta neurons, which spike-timing-dependent plasticity reads.

A spike is the smooth pulse P(theta) = (1 - cos theta)^2 * 2 / 3, of unit mean over the phase, which peaks as the phase passes π. The presynaptic trace a and the postsynaptic trace b rise with every pulse and decay with the times tau_plus and tau_minus, da/dt = P(theta) - a / tau_plus and db/dt = P(theta) - b / tau_minus, so they hold the recent spikes weighted by the exponential windows of the plasticity.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the neurons, whose values are theta, a, b, tau_plus, and tau_minus.

required

Examples:

>>> from skcomplex.systems.biology.neuroscience import SpikeTraceInteraction
>>> SpikeTraceInteraction('traces', target='neurons').target
'neurons'
Source code in src/skcomplex/systems/biology/neuroscience/_plastic_networks.py
240
241
242
def __init__(self, label: str, *, target: Role) -> None:
    super().__init__(label)
    self.target = target

SpikingNeuronElement(label, *, v=0.0, s=0.0, tau=20.0, mu=25.0, tau_s=2.0)

Bases: Element

Leaky integrate-and-fire neuron with a synaptic trace of its own spikes.

The trace is exponential.

The potential follows tau v' = -v + mu plus synaptic input, and the trace decays as s' = -s / tau_s. A spike reset sets the potential back and raises the trace by 1 / tau_s, so every spike carries a unit area of trace. Units are mV and ms. The element holds the states and parameters and has no laws of its own: the leak and trace interactions of DelayedLIFNetworkSystem read its parameters.

Parameters:

Name Type Description Default
label str

The label of the neuron.

required
v float

The initial potential.

0.0
s Annotated[float, closed_open(0, oo)]

The initial synaptic trace.

0.0
tau Annotated[float, open(0, oo)]

The membrane time constant.

20.0
mu float

The constant external drive, the potential the membrane relaxes to.

25.0
tau_s Annotated[float, open(0, oo)]

The decay time of the synaptic trace.

2.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import SpikingNeuronElement
>>> SpikingNeuronElement('neuron').tau_s
2.0
Source code in src/skcomplex/systems/biology/neuroscience/_networks.py
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
def __init__(
    self,
    label: str,
    *,
    v: float = 0.0,
    s: Annotated[float, RealSet.closed_open(0, oo)] = 0.0,
    tau: Annotated[float, RealSet.open(0, oo)] = 20.0,
    mu: float = 25.0,
    tau_s: Annotated[float, RealSet.open(0, oo)] = 2.0,
) -> None:
    super().__init__(label)
    self.v = v
    self.s = s
    self.tau = tau
    self.mu = mu
    self.tau_s = tau_s

SynapseElement(label, *, kappa=0.5, space=None, on=None)

Bases: Element

Synapse on an edge of a network, with an efficacy that plasticity changes.

Parameters:

Name Type Description Default
label str

The label of the synapse or of the group on the edges.

required
kappa Annotated[float, closed_open(0, oo)]

The initial efficacy.

0.5
space BaseSpace | None

The network whose edges hold one synapse each, or None for one synapse.

None
on str | None

'edges' for one synapse per edge of the network, or None for one synapse.

None

Examples:

>>> from skcomplex.systems.biology.neuroscience import SynapseElement
>>> SynapseElement('synapse', kappa=0.5).kappa
0.5
Source code in src/skcomplex/systems/biology/neuroscience/_plastic_networks.py
152
153
154
155
156
157
158
159
160
161
def __init__(
    self,
    label: str,
    *,
    kappa: Annotated[float, RealSet.closed_open(0, oo)] = 0.5,
    space: BaseSpace | None = None,
    on: str | None = None,
) -> None:
    super().__init__(label, space=space, on=on)
    self.kappa = kappa

SynapticDriveInteraction(label, *, target, source, J=1.0, field='r')

Bases: Interaction

Synaptic drive of a population by another, dv/dt += J x.

The drive is by the rate or the synaptic field of the other population.

Instantaneous synapses pass the firing rate r of the source, and exponential synapses its synaptic field s. A negative strength J is inhibition.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the driven population.

required
source Role

The path of the driving population, which may be the target.

required
J float

The strength of the synapses, negative for inhibition.

1.0
field str

'r' for instantaneous synapses or 's' for exponential synapses.

'r'

Raises:

Type Description
ValidationError

The field is unknown.

Examples:

>>> from skcomplex.systems.biology.neuroscience import SynapticDriveInteraction
>>> SynapticDriveInteraction('ie', target='e', source='i', J=-10.0).J
-10.0
Source code in src/skcomplex/systems/biology/neuroscience/_neural_masses.py
172
173
174
175
176
177
178
179
180
181
182
183
184
185
def __init__(
    self,
    label: str,
    *,
    target: Role,
    source: Role,
    J: float = 1.0,
    field: str = 'r',
) -> None:
    super().__init__(label)
    self.target = target
    self.source = source
    self.J = J
    self.field = field

TermanWangElement(label, *, x=SILENT, y=0.0, I=0.2, m=1.0, W=6.0, epsilon=0.02, gamma=6.0, beta=0.1, theta_x=-0.5, kappa=0.02, space=None)

Bases: Element

Relaxation oscillators of Terman and Wang, one per site of a LEGION lattice.

The parameters m, W, theta_x, and kappa belong to the coupling of a lattice of oscillators, a coupling along its bonds that adds W m (sum_k m_k H(x_k - theta_x)) over the four nearest sites, where H is a smooth step of width kappa and m marks the stimulated sites, so only stimulated neighbours excite each other.

Parameters:

Name Type Description Default
label str

The label of the oscillator or the lattice field.

required
x float | Array

The initial fast variable.

SILENT
y float | Array

The initial slow variable.

0.0
I float | Array

The external input.

0.2
m Annotated[float | Array, closed_open(0, oo)]

1 for a stimulated site and 0 otherwise.

1.0
W Annotated[float | Array, closed_open(0, oo)]

The weight of each excitatory link into the site.

6.0
epsilon Annotated[float | Array, open(0, oo)]

The time scale of the slow variable.

0.02
gamma Annotated[float | Array, open(0, oo)]

The height of the slow nullcline.

6.0
beta Annotated[float | Array, open(0, oo)]

The width of the slow nullcline's step.

0.1
theta_x float

The threshold of the active phase.

-0.5
kappa Annotated[float | Array, open(0, oo)]

The width of the smooth steps.

0.02
space BaseSpace | None

The lattice whose sites hold one oscillator each, or None for one oscillator.

None

Examples:

>>> from skcomplex.systems.biology.neuroscience import TermanWangElement
>>> TermanWangElement('oscillator').gamma
6.0
Source code in src/skcomplex/systems/biology/neuroscience/_networks.py
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
def __init__(
    self,
    label: str,
    *,
    x: float | Array = SILENT,
    y: float | Array = 0.0,
    I: float | Array = 0.2,
    m: Annotated[float | Array, RealSet.closed_open(0, oo)] = 1.0,
    W: Annotated[float | Array, RealSet.closed_open(0, oo)] = 6.0,
    epsilon: Annotated[float | Array, RealSet.open(0, oo)] = 0.02,
    gamma: Annotated[float | Array, RealSet.open(0, oo)] = 6.0,
    beta: Annotated[float | Array, RealSet.open(0, oo)] = 0.1,
    theta_x: float = -0.5,
    kappa: Annotated[float | Array, RealSet.open(0, oo)] = 0.02,
    space: BaseSpace | None = None,
) -> None:
    super().__init__(label, space=space)
    self.x = x
    self.y = y
    self.I = I
    self.m = m
    self.W = W
    self.epsilon = epsilon
    self.gamma = gamma
    self.beta = beta
    self.theta_x = theta_x
    self.kappa = kappa

TermanWangInteraction(label, *, target)

Bases: Interaction

Dynamics of relaxation oscillators of Terman and Wang.

The fast variable follows x' = 3x - x³ + 2 - y + I and the slow one y' = epsilon (gamma (1 + tanh(x / beta)) - y). A positive input I makes the oscillator oscillate and a negative one makes it excitable.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the oscillators, whose values are x, y, I, epsilon, gamma, and beta.

required

Examples:

>>> from skcomplex.systems.biology.neuroscience import TermanWangInteraction
>>> TermanWangInteraction('oscillation', target='oscillators').target
'oscillators'
Source code in src/skcomplex/systems/biology/neuroscience/_networks.py
254
255
256
def __init__(self, label: str, *, target: Role) -> None:
    super().__init__(label)
    self.target = target

ThetaForcingInteraction(label, *, target, I0=10.0, nu=5.0)

Bases: Interaction

Theta forcing of a population by the current I0 (1 - cos(2 pi nu t)) / 2.

The forcing is as in optogenetic stimulation.

The current enters the potential of the population as its excitabilities do, dv/dt += I(t) / tau. Time is in milliseconds and the frequency nu in hertz.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the forced population.

required
I0 float

The peak current.

10.0
nu Annotated[float, closed_open(0, oo)]

The frequency of the forcing, in hertz.

5.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import ThetaForcingInteraction
>>> ThetaForcingInteraction('theta', target='e', nu=8.0).nu
8.0
Source code in src/skcomplex/systems/biology/neuroscience/_neural_masses.py
240
241
242
243
244
245
246
247
248
249
250
251
def __init__(
    self,
    label: str,
    *,
    target: Role,
    I0: float = 10.0,
    nu: Annotated[float, RealSet.closed_open(0, oo)] = 5.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.I0 = I0
    self.nu = nu

ThetaNeuronElement(label, *, theta=0.0, eta=1.0, size=None, space=None)

Bases: Element

Theta neurons, each with a phase theta that wraps around and an excitability eta.

Parameters:

Name Type Description Default
label str

The label of the neuron or the group.

required
theta Annotated[float | Array, Period(2 * pi)]

The initial phase, one per neuron or shared.

0.0
eta float | Array

The excitability, one per neuron or shared.

1.0
size int | None

The number of neurons, or None for one.

None
space BaseSpace | None

The space whose sites hold one neuron each, such as a network, or None for none.

None

Examples:

>>> from skcomplex.systems.biology.neuroscience import ThetaNeuronElement
>>> ThetaNeuronElement('neurons', eta=0.5, size=10).size
10
Source code in src/skcomplex/systems/biology/common/excitable/_theta_neuron.py
47
48
49
50
51
52
53
54
55
56
57
58
def __init__(
    self,
    label: str,
    *,
    theta: Annotated[float | Array, Period(2 * math.pi)] = 0.0,
    eta: float | Array = 1.0,
    size: int | None = None,
    space: BaseSpace | None = None,
) -> None:
    super().__init__(label, size=size, space=space)
    self.theta = theta
    self.eta = eta

ThetaNeuronInteraction(label, *, target)

Bases: Interaction

Phase dynamics of theta neurons, theta' = (1 - cos theta) + (1 + cos theta) eta.

The neuron fires when its phase passes π. With eta > 0 it fires periodically with period π / sqrt(eta), and with eta < 0 it is excitable. The change of variable V = tan(theta / 2) turns it into the quadratic integrate-and-fire neuron V' = V² + eta.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the neurons, whose values are theta and eta.

required

Examples:

>>> from skcomplex.systems.biology.neuroscience import ThetaNeuronInteraction
>>> ThetaNeuronInteraction('phases', target='neurons').target
'neurons'
Source code in src/skcomplex/systems/biology/common/excitable/_theta_neuron.py
83
84
85
def __init__(self, label: str, *, target: Role) -> None:
    super().__init__(label)
    self.target = target

ThetaNeuronsSystem(n_neurons=50, *, eta=-0.2, delta=0.1, kappa=1.5, n=2, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

A network of theta neurons coupled all to all.

Theta neurons are equivalently quadratic integrate-and-fire neurons.

Neuron i follows theta_i' = (1 - cos theta_i) + (1 + cos theta_i)(eta_i + kappa I), where I is the mean pulse a_n (1 - cos theta_j)^n of all neurons at the current state. The excitabilities are evenly spaced quantiles of a Lorentzian distribution of center eta and half-width delta, the distribution for which Ott and Antonsen's ansatz reduces the network exactly to one complex equation. Strong excitatory coupling switches the network from a quiet state to collective firing. The system has the phases neurons.theta as its only state.

Parameters:

Name Type Description Default
n_neurons int

The number of neurons.

50
eta float

The center of the excitabilities.

-0.2
delta float

The half-width of the excitabilities.

0.1
kappa float

The coupling strength.

1.5
n int

The sharpness of the pulses, a positive integer.

2
random_state int | Generator | None

The seed or generator of the initial phases.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import ThetaNeuronsSystem
>>> ThetaNeuronsSystem(20).prepare().system_.elements[0].size
20
Source code in src/skcomplex/systems/biology/neuroscience/_populations.py
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
def __init__(
    self,
    n_neurons: int = 50,
    *,
    eta: float = -0.2,
    delta: float = 0.1,
    kappa: float = 1.5,
    n: int = 2,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_neurons = n_neurons
    self.eta = eta
    self.delta = delta
    self.kappa = kappa
    self.n = n
    self.random_state = random_state

TracedThetaNeuronElement(label, *, theta=0.0, a=0.0, b=0.0, eta=1.0, tau_plus=2.0, tau_minus=2.0, space=None)

Bases: ThetaNeuronElement

Theta neurons with a presynaptic trace a and a postsynaptic trace b of their own spikes.

Parameters:

Name Type Description Default
label str

The label of the neuron or the group.

required
theta Annotated[float | Array, Period(2 * pi)]

The initial phase.

0.0
a Annotated[float | Array, closed_open(0, oo)]

The initial presynaptic trace.

0.0
b Annotated[float | Array, closed_open(0, oo)]

The initial postsynaptic trace.

0.0
eta float | Array

The excitability.

1.0
tau_plus Annotated[float, open(0, oo)]

The time of the potentiation window.

2.0
tau_minus Annotated[float, open(0, oo)]

The time of the depression window.

2.0
space BaseSpace | None

The network whose nodes hold one neuron each, or None for one neuron.

None

Examples:

>>> from skcomplex.systems.biology.neuroscience import TracedThetaNeuronElement
>>> TracedThetaNeuronElement('neuron').tau_plus
2.0
Source code in src/skcomplex/systems/biology/neuroscience/_plastic_networks.py
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
def __init__(
    self,
    label: str,
    *,
    theta: Annotated[float | Array, Period(2 * math.pi)] = 0.0,
    a: Annotated[float | Array, RealSet.closed_open(0, oo)] = 0.0,
    b: Annotated[float | Array, RealSet.closed_open(0, oo)] = 0.0,
    eta: float | Array = 1.0,
    tau_plus: Annotated[float, RealSet.open(0, oo)] = 2.0,
    tau_minus: Annotated[float, RealSet.open(0, oo)] = 2.0,
    space: BaseSpace | None = None,
) -> None:
    super().__init__(label, theta=theta, eta=eta, space=space)
    self.a = a
    self.b = b
    self.tau_plus = tau_plus
    self.tau_minus = tau_minus

WilsonCowanElement(label, *, E=0.1, I=0.05, c1=16.0, c2=12.0, c3=15.0, c4=3.0, a_e=1.3, theta_e=4.0, a_i=2.0, theta_i=3.7, r_e=1.0, r_i=1.0, P=1.25, Q=0.0, tau_e=1.0, tau_i=1.0)

Bases: Element

Excitatory and inhibitory populations of Wilson and Cowan.

The populations are fractions of active cells.

The excitatory activity follows tau_e E' = -E + (k_e - r_e E) S_e(c1 E - c2 I + P) and the inhibitory activity tau_i I' = -I + (k_i - r_i I) S_i(c3 E - c4 I + Q), where S(x) = 1 / (1 + exp(-a (x - theta))) - 1 / (1 + exp(a theta)) is a sigmoid shifted to vanish at zero input and k is its largest value. The element holds the states and parameters and has no laws of its own: the relaxations of WilsonCowanSystem read its parameters.

Parameters:

Name Type Description Default
label str

The label of the populations.

required
E Annotated[float, closed_open(0, oo)]

The initial excitatory activity.

0.1
I Annotated[float, closed_open(0, oo)]

The initial inhibitory activity.

0.05
c1 Annotated[float, closed_open(0, oo)]

The excitatory to excitatory coupling.

16.0
c2 Annotated[float, closed_open(0, oo)]

The inhibitory to excitatory coupling.

12.0
c3 Annotated[float, closed_open(0, oo)]

The excitatory to inhibitory coupling.

15.0
c4 Annotated[float, closed_open(0, oo)]

The inhibitory to inhibitory coupling.

3.0
a_e Annotated[float, open(0, oo)]

The gain of the excitatory response.

1.3
theta_e float

The threshold of the excitatory response.

4.0
a_i Annotated[float, open(0, oo)]

The gain of the inhibitory response.

2.0
theta_i float

The threshold of the inhibitory response.

3.7
r_e Annotated[float, closed_open(0, oo)]

The refractory period of excitatory cells.

1.0
r_i Annotated[float, closed_open(0, oo)]

The refractory period of inhibitory cells.

1.0
P float

The external input to the excitatory population.

1.25
Q float

The external input to the inhibitory population.

0.0
tau_e Annotated[float, open(0, oo)]

The time constant of the excitatory population.

1.0
tau_i Annotated[float, open(0, oo)]

The time constant of the inhibitory population.

1.0

Examples:

>>> from skcomplex.systems.biology.neuroscience import WilsonCowanElement
>>> WilsonCowanElement('cortex', P=1.25).c1
16.0
Source code in src/skcomplex/systems/biology/neuroscience/_populations.py
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
def __init__(
    self,
    label: str,
    *,
    E: Annotated[float, RealSet.closed_open(0, oo)] = 0.1,
    I: Annotated[float, RealSet.closed_open(0, oo)] = 0.05,
    c1: Annotated[float, RealSet.closed_open(0, oo)] = 16.0,
    c2: Annotated[float, RealSet.closed_open(0, oo)] = 12.0,
    c3: Annotated[float, RealSet.closed_open(0, oo)] = 15.0,
    c4: Annotated[float, RealSet.closed_open(0, oo)] = 3.0,
    a_e: Annotated[float, RealSet.open(0, oo)] = 1.3,
    theta_e: float = 4.0,
    a_i: Annotated[float, RealSet.open(0, oo)] = 2.0,
    theta_i: float = 3.7,
    r_e: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    r_i: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    P: float = 1.25,
    Q: float = 0.0,
    tau_e: Annotated[float, RealSet.open(0, oo)] = 1.0,
    tau_i: Annotated[float, RealSet.open(0, oo)] = 1.0,
) -> None:
    super().__init__(label)
    self.E = E
    self.I = I
    self.c1 = c1
    self.c2 = c2
    self.c3 = c3
    self.c4 = c4
    self.a_e = a_e
    self.theta_e = theta_e
    self.a_i = a_i
    self.theta_i = theta_i
    self.r_e = r_e
    self.r_i = r_i
    self.P = P
    self.Q = Q
    self.tau_e = tau_e
    self.tau_i = tau_i

WilsonCowanSystem(E=0.1, I=0.05, *, P=1.25, Q=0.0, c1=16.0, c2=12.0, c3=15.0, c4=3.0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The Wilson-Cowan system of interacting excitatory and inhibitory populations.

The populations are made of neurons.

With the published couplings, a moderate excitatory input P = 1.25 gives a limit cycle of population activity, and no input lets the activity decay to rest. The system has the activities cortex.E and cortex.I.

Parameters:

Name Type Description Default
E float

The initial excitatory activity.

0.1
I float

The initial inhibitory activity.

0.05
P float

The external input to the excitatory population.

1.25
Q float

The external input to the inhibitory population.

0.0
c1 float

The excitatory to excitatory coupling.

16.0
c2 float

The inhibitory to excitatory coupling.

12.0
c3 float

The excitatory to inhibitory coupling.

15.0
c4 float

The inhibitory to inhibitory coupling.

3.0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import WilsonCowanSystem
>>> WilsonCowanSystem(P=0.0).prepare().system_.elements[0].P
0.0
Source code in src/skcomplex/systems/biology/neuroscience/_populations.py
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
def __init__(
    self,
    E: float = 0.1,
    I: float = 0.05,
    *,
    P: float = 1.25,
    Q: float = 0.0,
    c1: float = 16.0,
    c2: float = 12.0,
    c3: float = 15.0,
    c4: float = 3.0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.E = E
    self.I = I
    self.P = P
    self.Q = Q
    self.c1 = c1
    self.c2 = c2
    self.c3 = c3
    self.c4 = c4

WinnersTakeAllSystem(inputs=(1.0, 1.1, 0.9, 1.05, 0.95), *, beta=2.0, tau=1.0, x=0.1, label='system', solver='auto', backend='auto')

Bases: BaseSystem

A winner-take-all network of units.

The units have self-limited growth and mutual inhibition.

Unit i follows tau x_i' = x_i (I_i - x_i - beta sum_{j != i} x_j), the competitive network of Fukai and Tanaka. One inhibition interaction binds every unit as an element set and reads the total activity of the set, so the network holds one interaction whatever the number of units. When the inhibition beta exceeds 1, only the unit with the largest input stays active, at activity I_max. When it is below 1, several winners share the activity. The winners-take-all network of Gros (2015, section 10.4), with reservoir variables and clique encoding, is a different model. The system has the activities unit_<i>.x.

Parameters:

Name Type Description Default
inputs Sequence[float]

The input of every unit.

(1.0, 1.1, 0.9, 1.05, 0.95)
beta float

The strength of the mutual inhibition.

2.0
tau float

The time constant of the units.

1.0
x float

The initial activity of every unit.

0.1
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.biology.neuroscience import WinnersTakeAllSystem
>>> [interaction.label for interaction in WinnersTakeAllSystem((1.0, 2.0)).prepare().system_.interactions]
['growth_unit_0', 'growth_unit_1', 'inhibition']
Source code in src/skcomplex/systems/biology/neuroscience/_populations.py
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
def __init__(
    self,
    inputs: Sequence[float] = (1.0, 1.1, 0.9, 1.05, 0.95),
    *,
    beta: float = 2.0,
    tau: float = 1.0,
    x: float = 0.1,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.inputs = inputs
    self.beta = beta
    self.tau = tau
    self.x = x