Phase units with activity-dependent conduction delays
Phase units coupled all to all through adaptive conduction delays.
- Class:
AdaptiveDelayNetworkSystem - Import:
from skcomplex.systems.biology.neuroscience import AdaptiveDelayNetworkSystem - Field:
biology/neuroscience - Topics:
adaptive delays,myelination,phase oscillators,adaptive network,dde - References:
- Park and Lefebvre 2020
- Berner et al. 2023
Use this system
The block imports the class and simulates the system with its default parameters and its tuned run settings.
from skcomplex.systems.biology.neuroscience import AdaptiveDelayNetworkSystem
trajectory = AdaptiveDelayNetworkSystem().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
n_units |
5 |
omega |
1.0 |
spread |
0.1 |
kappa |
1.0 |
epsilon |
0.1 |
rho |
1.0 |
tau0 |
3.0 |
seed |
0 |
solver |
'auto' |
backend |
'auto' |
Tags
The system with its default parameters has these capability tags, which solvers and analyses check.
| Tag | Values |
|---|---|
| Time | continuous |
| Space | none |
| Laws | rate |
| Randomness | deterministic |
| Domains | real |
| Structure | fixed |
Class
The source of the class shows how it builds its components from its model parameters.
class AdaptiveDelayNetworkSystem(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`.
Args:
n_units:
The number of units.
omega:
The mean natural frequency.
spread:
The standard deviation of the natural frequencies.
kappa:
The coupling strength, divided by the number of units.
epsilon:
The adaptation rate of the delays.
rho:
The strength of the push of the phase difference on the delays.
tau0:
The baseline delay of every edge.
seed:
The seed of the frequencies and the initial phases.
label:
The label of the system, which names it when it is nested in another one.
solver:
The solver of the problem, or `'auto'` for the one the system chooses.
backend:
The backend that evaluates the compiled functions, or `'auto'` for the one the system chooses.
Examples:
>>> from skcomplex.systems.biology.neuroscience import AdaptiveDelayNetworkSystem
>>> len(AdaptiveDelayNetworkSystem(4).prepare().system_.interactions)
16
"""
field = 'biology/neuroscience'
topics = ('adaptive delays', 'myelination', 'phase oscillators', 'adaptive network', 'dde')
references = ('Park and Lefebvre 2020', 'Berner et al. 2023')
until = 300.0
dt = 0.5
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
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set the system of phase units coupled all to all through adaptive delays.
Args:
context:
The observables to compile with the problem, or `None` for none.
"""
super()._prepare(context)
rng = np.random.default_rng(self.seed)
phases, frequencies = rng.uniform(0, 2 * np.pi, self.n_units), rng.normal(self.omega, self.spread, self.n_units)
units = [
PhaseUnitElement(f'unit_{index}', theta=float(phases[index]), omega=float(frequencies[index]))
for index in range(self.n_units)
]
pairs = list(permutations(range(self.n_units), 2))
axons = [AxonElement(f'axon_{source}_{target}', tau=self.tau0, tau0=self.tau0) for source, target in pairs]
adaptations = [
DelayAdaptationInteraction(
f'myelination_{source}_{target}',
source=f'unit_{source}',
target=f'unit_{target}',
axon=f'axon_{source}_{target}',
kappa=self.kappa / self.n_units,
epsilon=self.epsilon,
rho=self.rho,
)
for source, target in pairs
]
rotations = [RotationInteraction(f'rotation_{index}', target=f'unit_{index}') for index in range(self.n_units)]
self.system_ = System(self.label, elements=[*units, *axons], interactions=[*rotations, *adaptations])
Components
The system uses these element and interaction classes, each with its nearest class of the core.
Elements:
Interactions:
RotationInteraction, fromInteractionDelayAdaptationInteraction, fromInteraction
class PhaseUnitElement(Element):
"""Neural unit reduced to a phase `theta` that wraps around, with its natural frequency `omega`.
Args:
label:
The label of the unit or of the group of units.
theta:
The initial phase.
omega:
The natural frequency.
Examples:
>>> from skcomplex.systems.biology.neuroscience import PhaseUnitElement
>>> PhaseUnitElement('unit', omega=1.5).omega
1.5
"""
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
class AxonElement(Element):
"""Axon on an edge of a network, whose conduction delay myelination changes.
Args:
label:
The label of the axon or of the group on the edges.
tau:
The initial conduction delay.
tau0:
The baseline delay that the delay relaxes to.
Examples:
>>> from skcomplex.systems.biology.neuroscience import AxonElement
>>> AxonElement('axon', tau0=2.0).tau0
2.0
"""
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
class RotationInteraction(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.
Args:
label:
The label of the interaction.
target:
The path of the unit, whose values are `theta` and `omega`.
Examples:
>>> from skcomplex.systems.biology.neuroscience import RotationInteraction
>>> RotationInteraction('rotation', target='unit_0').target
'unit_0'
"""
law_classes = (RateLaw,)
def __init__(self, label: str, *, target: Role) -> None:
super().__init__(label)
self.target = target
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the rotation of the phase of the target.
Args:
context:
The namespace of the target, the time `t`, and the parameters.
"""
super()._prepare(context)
self.laws_ = [RateLaw(context.target.theta, context.target.omega)]
class DelayAdaptationInteraction(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.
Args:
label:
The label of the interaction.
source:
The path of the unit that sends the signal.
target:
The path of the unit that receives the signal.
axon:
The path of the axon that conducts it.
kappa:
The coupling strength of an edge.
epsilon:
The adaptation rate of the delays.
rho:
The strength of the push of the phase difference on the delay.
width:
The width of the smooth step.
shortest:
The shortest delay the coupling reads.
Examples:
>>> from skcomplex.systems.biology.neuroscience import DelayAdaptationInteraction
>>> DelayAdaptationInteraction('myelination', source='a', target='b', axon='ab', rho=0.5).rho
0.5
"""
law_classes = (RateLaw,)
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
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the delayed coupling of the target and the adaptation of the delay.
Args:
context:
The namespace of the units and the axon.
"""
super()._prepare(context)
s, t = context, context.t
source, target, tau = s.source.theta, s.target.theta, s.axon.tau
step = (1 + tanh(tau / s.width)) / 2
self.laws_ = [
RateLaw(target.diff(t), s.kappa * sin(source(t=t - clip(tau, low=self.shortest)) - target)),
RateLaw(tau.diff(t), s.epsilon * step * (-(tau - s.axon.tau0) + s.rho * sin(source - target))),
]
Equations
The equations are those that symbolic returns for the system with its default parameters.
unit_0.theta: diff(theta_unit_0(t), t) == kappa_myelination_1_0*sin(-theta_unit_0(t) + theta_unit_1(t - where(tau_axon_1_0(t) < 0.1, 0.1, tau_axon_1_0(t)))) + kappa_myelination_2_0*sin(-theta_unit_0(t) + theta_unit_2(t - where(tau_axon_2_0(t) < 0.1, 0.1, tau_axon_2_0(t)))) + kappa_myelination_3_0*sin(-theta_unit_0(t) + theta_unit_3(t - where(tau_axon_3_0(t) < 0.1, 0.1, tau_axon_3_0(t)))) + kappa_myelination_4_0*sin(-theta_unit_0(t) + theta_unit_4(t - where(tau_axon_4_0(t) < 0.1, 0.1, tau_axon_4_0(t)))) + omega_unit_0
unit_1.theta: diff(theta_unit_1(t), t) == kappa_myelination_0_1*sin(theta_unit_0(t - where(tau_axon_0_1(t) < 0.1, 0.1, tau_axon_0_1(t))) - theta_unit_1(t)) + kappa_myelination_2_1*sin(-theta_unit_1(t) + theta_unit_2(t - where(tau_axon_2_1(t) < 0.1, 0.1, tau_axon_2_1(t)))) + kappa_myelination_3_1*sin(-theta_unit_1(t) + theta_unit_3(t - where(tau_axon_3_1(t) < 0.1, 0.1, tau_axon_3_1(t)))) + kappa_myelination_4_1*sin(-theta_unit_1(t) + theta_unit_4(t - where(tau_axon_4_1(t) < 0.1, 0.1, tau_axon_4_1(t)))) + omega_unit_1
unit_2.theta: diff(theta_unit_2(t), t) == kappa_myelination_0_2*sin(theta_unit_0(t - where(tau_axon_0_2(t) < 0.1, 0.1, tau_axon_0_2(t))) - theta_unit_2(t)) + kappa_myelination_1_2*sin(theta_unit_1(t - where(tau_axon_1_2(t) < 0.1, 0.1, tau_axon_1_2(t))) - theta_unit_2(t)) + kappa_myelination_3_2*sin(-theta_unit_2(t) + theta_unit_3(t - where(tau_axon_3_2(t) < 0.1, 0.1, tau_axon_3_2(t)))) + kappa_myelination_4_2*sin(-theta_unit_2(t) + theta_unit_4(t - where(tau_axon_4_2(t) < 0.1, 0.1, tau_axon_4_2(t)))) + omega_unit_2
unit_3.theta: diff(theta_unit_3(t), t) == kappa_myelination_0_3*sin(theta_unit_0(t - where(tau_axon_0_3(t) < 0.1, 0.1, tau_axon_0_3(t))) - theta_unit_3(t)) + kappa_myelination_1_3*sin(theta_unit_1(t - where(tau_axon_1_3(t) < 0.1, 0.1, tau_axon_1_3(t))) - theta_unit_3(t)) + kappa_myelination_2_3*sin(theta_unit_2(t - where(tau_axon_2_3(t) < 0.1, 0.1, tau_axon_2_3(t))) - theta_unit_3(t)) + kappa_myelination_4_3*sin(-theta_unit_3(t) + theta_unit_4(t - where(tau_axon_4_3(t) < 0.1, 0.1, tau_axon_4_3(t)))) + omega_unit_3
unit_4.theta: diff(theta_unit_4(t), t) == kappa_myelination_0_4*sin(theta_unit_0(t - where(tau_axon_0_4(t) < 0.1, 0.1, tau_axon_0_4(t))) - theta_unit_4(t)) + kappa_myelination_1_4*sin(theta_unit_1(t - where(tau_axon_1_4(t) < 0.1, 0.1, tau_axon_1_4(t))) - theta_unit_4(t)) + kappa_myelination_2_4*sin(theta_unit_2(t - where(tau_axon_2_4(t) < 0.1, 0.1, tau_axon_2_4(t))) - theta_unit_4(t)) + kappa_myelination_3_4*sin(theta_unit_3(t - where(tau_axon_3_4(t) < 0.1, 0.1, tau_axon_3_4(t))) - theta_unit_4(t)) + omega_unit_4
axon_0_1.tau: diff(tau_axon_0_1(t), t) == 1/2*(rho_myelination_0_1*sin(theta_unit_0(t) - theta_unit_1(t)) + tau0_axon_0_1 - tau_axon_0_1(t))*epsilon_myelination_0_1*(tanh(tau_axon_0_1(t)/width_myelination_0_1) + 1)
axon_0_2.tau: diff(tau_axon_0_2(t), t) == 1/2*(rho_myelination_0_2*sin(theta_unit_0(t) - theta_unit_2(t)) + tau0_axon_0_2 - tau_axon_0_2(t))*epsilon_myelination_0_2*(tanh(tau_axon_0_2(t)/width_myelination_0_2) + 1)
axon_0_3.tau: diff(tau_axon_0_3(t), t) == 1/2*(rho_myelination_0_3*sin(theta_unit_0(t) - theta_unit_3(t)) + tau0_axon_0_3 - tau_axon_0_3(t))*epsilon_myelination_0_3*(tanh(tau_axon_0_3(t)/width_myelination_0_3) + 1)
axon_0_4.tau: diff(tau_axon_0_4(t), t) == 1/2*(rho_myelination_0_4*sin(theta_unit_0(t) - theta_unit_4(t)) + tau0_axon_0_4 - tau_axon_0_4(t))*epsilon_myelination_0_4*(tanh(tau_axon_0_4(t)/width_myelination_0_4) + 1)
axon_1_0.tau: diff(tau_axon_1_0(t), t) == 1/2*(rho_myelination_1_0*sin(-theta_unit_0(t) + theta_unit_1(t)) + tau0_axon_1_0 - tau_axon_1_0(t))*epsilon_myelination_1_0*(tanh(tau_axon_1_0(t)/width_myelination_1_0) + 1)
axon_1_2.tau: diff(tau_axon_1_2(t), t) == 1/2*(rho_myelination_1_2*sin(theta_unit_1(t) - theta_unit_2(t)) + tau0_axon_1_2 - tau_axon_1_2(t))*epsilon_myelination_1_2*(tanh(tau_axon_1_2(t)/width_myelination_1_2) + 1)
axon_1_3.tau: diff(tau_axon_1_3(t), t) == 1/2*(rho_myelination_1_3*sin(theta_unit_1(t) - theta_unit_3(t)) + tau0_axon_1_3 - tau_axon_1_3(t))*epsilon_myelination_1_3*(tanh(tau_axon_1_3(t)/width_myelination_1_3) + 1)
axon_1_4.tau: diff(tau_axon_1_4(t), t) == 1/2*(rho_myelination_1_4*sin(theta_unit_1(t) - theta_unit_4(t)) + tau0_axon_1_4 - tau_axon_1_4(t))*epsilon_myelination_1_4*(tanh(tau_axon_1_4(t)/width_myelination_1_4) + 1)
axon_2_0.tau: diff(tau_axon_2_0(t), t) == 1/2*(rho_myelination_2_0*sin(-theta_unit_0(t) + theta_unit_2(t)) + tau0_axon_2_0 - tau_axon_2_0(t))*epsilon_myelination_2_0*(tanh(tau_axon_2_0(t)/width_myelination_2_0) + 1)
axon_2_1.tau: diff(tau_axon_2_1(t), t) == 1/2*(rho_myelination_2_1*sin(-theta_unit_1(t) + theta_unit_2(t)) + tau0_axon_2_1 - tau_axon_2_1(t))*epsilon_myelination_2_1*(tanh(tau_axon_2_1(t)/width_myelination_2_1) + 1)
axon_2_3.tau: diff(tau_axon_2_3(t), t) == 1/2*(rho_myelination_2_3*sin(theta_unit_2(t) - theta_unit_3(t)) + tau0_axon_2_3 - tau_axon_2_3(t))*epsilon_myelination_2_3*(tanh(tau_axon_2_3(t)/width_myelination_2_3) + 1)
axon_2_4.tau: diff(tau_axon_2_4(t), t) == 1/2*(rho_myelination_2_4*sin(theta_unit_2(t) - theta_unit_4(t)) + tau0_axon_2_4 - tau_axon_2_4(t))*epsilon_myelination_2_4*(tanh(tau_axon_2_4(t)/width_myelination_2_4) + 1)
axon_3_0.tau: diff(tau_axon_3_0(t), t) == 1/2*(rho_myelination_3_0*sin(-theta_unit_0(t) + theta_unit_3(t)) + tau0_axon_3_0 - tau_axon_3_0(t))*epsilon_myelination_3_0*(tanh(tau_axon_3_0(t)/width_myelination_3_0) + 1)
axon_3_1.tau: diff(tau_axon_3_1(t), t) == 1/2*(rho_myelination_3_1*sin(-theta_unit_1(t) + theta_unit_3(t)) + tau0_axon_3_1 - tau_axon_3_1(t))*epsilon_myelination_3_1*(tanh(tau_axon_3_1(t)/width_myelination_3_1) + 1)
axon_3_2.tau: diff(tau_axon_3_2(t), t) == 1/2*(rho_myelination_3_2*sin(-theta_unit_2(t) + theta_unit_3(t)) + tau0_axon_3_2 - tau_axon_3_2(t))*epsilon_myelination_3_2*(tanh(tau_axon_3_2(t)/width_myelination_3_2) + 1)
axon_3_4.tau: diff(tau_axon_3_4(t), t) == 1/2*(rho_myelination_3_4*sin(theta_unit_3(t) - theta_unit_4(t)) + tau0_axon_3_4 - tau_axon_3_4(t))*epsilon_myelination_3_4*(tanh(tau_axon_3_4(t)/width_myelination_3_4) + 1)
axon_4_0.tau: diff(tau_axon_4_0(t), t) == 1/2*(rho_myelination_4_0*sin(-theta_unit_0(t) + theta_unit_4(t)) + tau0_axon_4_0 - tau_axon_4_0(t))*epsilon_myelination_4_0*(tanh(tau_axon_4_0(t)/width_myelination_4_0) + 1)
axon_4_1.tau: diff(tau_axon_4_1(t), t) == 1/2*(rho_myelination_4_1*sin(-theta_unit_1(t) + theta_unit_4(t)) + tau0_axon_4_1 - tau_axon_4_1(t))*epsilon_myelination_4_1*(tanh(tau_axon_4_1(t)/width_myelination_4_1) + 1)
axon_4_2.tau: diff(tau_axon_4_2(t), t) == 1/2*(rho_myelination_4_2*sin(-theta_unit_2(t) + theta_unit_4(t)) + tau0_axon_4_2 - tau_axon_4_2(t))*epsilon_myelination_4_2*(tanh(tau_axon_4_2(t)/width_myelination_4_2) + 1)
axon_4_3.tau: diff(tau_axon_4_3(t), t) == 1/2*(rho_myelination_4_3*sin(-theta_unit_3(t) + theta_unit_4(t)) + tau0_axon_4_3 - tau_axon_4_3(t))*epsilon_myelination_4_3*(tanh(tau_axon_4_3(t)/width_myelination_4_3) + 1)