Mirollo-Strogatz pulse-coupled oscillators
Integrate-and-fire oscillators coupled by pulses.
- Class:
MirolloStrogatzSystem - Import:
from skcomplex.systems.physics.synchronization import MirolloStrogatzSystem - Field:
physics/synchronization - Topics:
synchronization,events,pulse coupling,integrate and fire - References:
- Mirollo and Strogatz 1990
- Arenas et al. 2008
Use this system
The block imports the class and simulates the system with its default parameters and its tuned run settings.
from skcomplex.systems.physics.synchronization import MirolloStrogatzSystem
trajectory = MirolloStrogatzSystem().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
n_oscillators |
5 |
S |
2.0 |
gamma |
1.0 |
epsilon |
0.1 |
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, update |
| Randomness | deterministic |
| Domains | real |
| Structure | fixed |
Class
The source of the class shows how it builds its components from its model parameters.
class MirolloStrogatzSystem(BaseSystem):
"""Integrate-and-fire oscillators coupled by pulses.
The oscillators end up firing in unison.
Every oscillator of the group charges as `x' = S - gamma x`, a concave rise, and fires when it reaches 1. Firing is
an event whose guard is the group maximum of the charges, and it resets the most charged oscillators to 0 and lifts
every other one by `epsilon`. An oscillator lifted to 1 fires at the same instant and is absorbed into the group
that fired, so the groups merge until all oscillators fire together. The system has the charges `oscillators.x` of
the group members and the firings as `fire` events.
Args:
n_oscillators:
The number of oscillators.
S:
The charging input.
gamma:
The leak rate, below `S` so that the oscillators fire.
epsilon:
The strength of a pulse.
seed:
The seed of the initial charges.
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.physics.synchronization import MirolloStrogatzSystem
>>> MirolloStrogatzSystem(3).prepare().system_.elements[0].size
3
"""
field = 'physics/synchronization'
topics = ('synchronization', 'events', 'pulse coupling', 'integrate and fire')
references = ('Mirollo and Strogatz 1990', 'Arenas et al. 2008')
until = 20.0
dt = 0.1
def __init__(
self,
n_oscillators: int = 5,
*,
S: float = 2.0,
gamma: float = 1.0,
epsilon: float = 0.1,
seed: int = 0,
label: str = 'system',
solver: BaseSolver | str = 'auto',
backend: BaseBackend | str = 'auto',
) -> None:
super().__init__(label, solver=solver, backend=backend)
self.n_oscillators = n_oscillators
self.S = S
self.gamma = gamma
self.epsilon = epsilon
self.seed = seed
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set the system of integrate-and-fire oscillators coupled by pulses.
Args:
context:
The observables to compile with the problem, or `None` for none.
"""
super()._prepare(context)
charges = np.random.default_rng(self.seed).uniform(0.0, 1.0, self.n_oscillators)
self.system_ = System(
self.label,
elements=[IntegrateAndFireOscillatorElement('oscillators', x=charges, size=self.n_oscillators)],
interactions=[
ChargingInteraction('charging', target='oscillators', S=self.S, gamma=self.gamma),
PulseFiringInteraction('fire', target='oscillators', epsilon=self.epsilon),
],
)
Components
The system uses these element and interaction classes, each with its nearest class of the core.
Elements:
IntegrateAndFireOscillatorElement, fromElement
Interactions:
ChargingInteraction, fromInteractionPulseFiringInteraction, fromInteraction
class IntegrateAndFireOscillatorElement(Element):
"""Integrate-and-fire oscillator with the charge `x`, alone or in a group of `size` members.
`ChargingInteraction` charges the oscillator and `PulseFiringInteraction` fires it at 1.
Args:
label:
The label of the oscillator or the group.
x:
The initial charge, or one charge per member.
size:
The number of members of the group, or `None` for one oscillator.
Examples:
>>> from skcomplex.systems.physics.synchronization import IntegrateAndFireOscillatorElement
>>> IntegrateAndFireOscillatorElement('oscillators', x=[0.1, 0.5], size=2).size
2
"""
def __init__(self, label: str, *, x: object = 0.0, size: int | None = None) -> None:
super().__init__(label, size=size)
self.x = x
class ChargingInteraction(Interaction):
"""Leaky charging `x' = S - gamma x` towards the level `S / gamma`.
It charges a capacitor through a resistor, the membrane of a neuron, or the clock of a firefly.
Args:
label:
The label of the interaction.
target:
The path of the oscillator or the group whose charge `x` rises.
S:
The charging input.
gamma:
The leak rate.
Examples:
>>> from skcomplex.systems.physics.synchronization import ChargingInteraction
>>> ChargingInteraction('charging', target='oscillators', S=3.0).S
3.0
"""
law_classes = (RateLaw,)
def __init__(
self,
label: str,
*,
target: Role,
S: Annotated[float, RealSet.open(0, oo)] = 2.0,
gamma: Annotated[float, RealSet.open(0, oo)] = 1.0,
) -> None:
super().__init__(label)
self.target = target
self.S = S
self.gamma = gamma
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the rate of the charge of the target.
Args:
context:
The namespace of the target, the time `t`, and the parameters.
"""
super()._prepare(context)
x = context.target.x
self.laws_ = [RateLaw(x.diff(context.t), context.S - context.gamma * x)]
class PulseFiringInteraction(Interaction):
"""Firing of a group of integrate-and-fire oscillators when the most charged one reaches 1.
The firing resets the most charged oscillators to 0 and lifts every other one by the pulse `epsilon`. An oscillator
lifted to 1 fires at the same instant and resets to 0 with the others, as fireflies that flash together or
pacemaker cells of a heart.
Args:
label:
The label of the interaction, which also names the firings in the trajectory.
target:
The path of the group of oscillators.
epsilon:
The strength of a pulse.
Examples:
>>> from skcomplex.systems.physics.synchronization import PulseFiringInteraction
>>> PulseFiringInteraction('fire', target='oscillators', epsilon=0.2).epsilon
0.2
"""
law_classes = (EventLaw,)
def __init__(
self,
label: str,
*,
target: Role,
epsilon: Annotated[float, RealSet.closed_open(0, oo)] = 0.1,
) -> None:
super().__init__(label)
self.target = target
self.epsilon = epsilon
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the firing of the group as an event at the crossing of 1 by its largest charge.
Args:
context:
The namespace of the target, the time `t`, and the parameters.
"""
super()._prepare(context)
x, epsilon = context.target.x, context.epsilon
reset = where(x >= maximum(x), 0, where(x + epsilon >= 1, 0, x + epsilon))
self.laws_ = [EventLaw(maximum(x) - 1, {x: reset}, direction=1, label=self.label)]
Equations
The equations are those that symbolic returns for the system with its default parameters.
oscillators.x[i]: diff(x_oscillators(t), t) == -gamma_charging*x_oscillators(t) + S_charging
