Skip to content

Excitable

Excitable kinetics shared by the biology packages: the FitzHugh-Nagumo fast-slow kinetics.

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 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 Annotated[str, RoleSpec()]

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 Annotated[float, ParameterSpec()]

The offset of the recovery.

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

The damping of the recovery.

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

The time scale of the recovery.

0.08
I Annotated[float, ParameterSpec()]

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 typing import Annotated
>>> from skcomplex.core.elements import Element
>>> from skcomplex.core.system import System
>>> from skcomplex.engine.runtime import Simulation
>>> from skcomplex.models.biology.common.excitable import FitzHughNagumoInteraction
>>> from skcomplex.specs import StateSpec
>>> class CellElement(Element):
...     def __init__(
...         self, label, visual=None, *, v: Annotated[float, StateSpec()] = -1.2,
...         w: Annotated[float, StateSpec()] = -0.6,
...     ):
...         super().__init__(label, visual=visual)
...         self.v = v
...         self.w = w
>>> kinetics = FitzHughNagumoInteraction('kinetics', target='cell', I=0.5)
>>> system = System(elements=[CellElement('cell')], interactions=[kinetics])
>>> trajectory = Simulation(system, dt=0.1).check().prepare().run(until=100.0).trajectory_
>>> bool(trajectory.values('cell.v').max() > 1.5)
True
Source code in src/skcomplex/models/biology/common/excitable/_fitzhugh_nagumo.py
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __init__(
    self,
    label: str,
    *,
    target: Annotated[str, RoleSpec()],
    fast: str = 'v',
    slow: str = 'w',
    a: Annotated[float, ParameterSpec()] = 0.7,
    b: Annotated[float, ParameterSpec(domain=RealSet.closed_open(0, oo))] = 0.8,
    epsilon: Annotated[float, ParameterSpec(domain=RealSet.open(0, oo))] = 0.08,
    I: Annotated[float, ParameterSpec()] = 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