Skip to content

Excitable

Excitable kinetics shared by the biology packages.

They are FitzHugh-Nagumo kinetics, theta neurons, and spike resets.

FitzHughNagumoInteraction(label, *, target, fast='v', slow='w', a=0.7, b=0.8, epsilon=0.08, I=0.0)

Bases: Interaction

FitzHugh-Nagumo kinetics of a fast variable v and a slow recovery w.

The fast variable and the recovery are states of a target.

The fast variable follows v' = v - v³/3 - w + I and the recovery w' = epsilon (v + a - b w). On a field the kinetics act on every cell, and a diffusion of the fast variable makes the medium excitable.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the element or field whose states follow the kinetics.

required
fast str

The name of the fast state, such as a membrane potential.

'v'
slow str

The name of the slow recovery state.

'w'
a float

The offset of the recovery.

0.7
b Annotated[float, closed_open(0, oo)]

The damping of the recovery.

0.8
epsilon Annotated[float, open(0, oo)]

The time scale of the recovery.

0.08
I float

The applied current.

0.0

Raises:

Type Description
ValidationError

A state name is not a name, or the fast and the slow state are the same.

Examples:

>>> from skcomplex.core.components.elements import Element
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.biology.common.excitable import FitzHughNagumoInteraction
>>> kinetics = FitzHughNagumoInteraction('kinetics', target='cell', I=0.5)
>>> cell = Element('cell', values={'v': -1.2, 'w': -0.6})
>>> system = System(elements=[cell], interactions=[kinetics]).prepare()
>>> trajectory = system.simulate(100.0, dt=0.1)
>>> bool(trajectory.get_values('cell.v').max() > 1.5)
True
Source code in src/skcomplex/systems/biology/common/excitable/_fitzhugh_nagumo.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,
    *,
    target: Role,
    fast: str = 'v',
    slow: str = 'w',
    a: float = 0.7,
    b: Annotated[float, RealSet.closed_open(0, oo)] = 0.8,
    epsilon: Annotated[float, RealSet.open(0, oo)] = 0.08,
    I: float = 0.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.fast = fast
    self.slow = slow
    self.a = a
    self.b = b
    self.epsilon = epsilon
    self.I = I

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

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