Skip to content

generate

Functions:

NameDescription
chuaVector field of Chua’s circuit, with the piecewise-linear diode “h(x) = m1 x + (m0 - m1) (
ctrnnVector field of a continuous-time recurrent neural network dx/dt = -x + g J tanh(x).
double_pendulumVector field of the double pendulum.
duffingVector field of the forced Duffing oscillator.
euler_spiralVector field of the Euler spiral (clothoid).
fitzhugh_nagumoVector field of the FitzHugh-Nagumo neuron model.
hindmarsh_roseVector field of the Hindmarsh-Rose neuron model.
kuramotoVector field of the Kuramoto model dθ_i/dt = ω_i + Σ_j K_ij sin(θ_j - θ_i).
lorenzVector field of the Lorenz system.
lorenz96Vector field of the Lorenz 96 system.
lotka_volterraVector field of the generalized Lotka-Volterra system dx/dt = x (sigma - rho x) + S.
mackey_glassGenerate a Mackey-Glass chaotic time series via forward Euler integration.
morris_lecarVector field of the Morris-Lecar neuron model.
pyloricVector field of the three-neuron pyloric circuit of the crustacean stomatogastric ganglion (Prinz, Bucher & Marder 2004), in ms and mV.
rk45Integrate dx/dt = f(t, x) via the adaptive Dormand-Prince RK45 method.
rosslerVector field of the Rössler system.
rulkov_mapGenerate a time series of globally coupled Rulkov map neurons.
three_scrollVector field of Li’s three-scroll system.
to_xyConvert double pendulum angles to Cartesian coordinates.
chua(alpha: float, beta: float, m0: float, m1: float)

Vector field of Chua’s circuit, with the piecewise-linear diode h(x) = m1 x + (m0 - m1) (|x + 1| - |x - 1|) / 2.

Parameters:

NameTypeDescriptionDefault
alphafloatRatio of capacitances (typical: 15.6).required
betafloatRatio of inductance to resistance (typical: 28).required
m0floatDiode slope for “x
m1floatDiode slope for “x

Returns:

NameTypeDescription
fCallable[[float, ndarray], ndarray]Right-hand side f(t, x) for a state (x, y, z) of shape (3,), or (B, 3) for a batch.
ctrnn(g: float, J: np.ndarray)

Vector field of a continuous-time recurrent neural network dx/dt = -x + g J tanh(x).

Parameters:

NameTypeDescriptionDefault
gfloatGain (chaos for g > 1 when J is large and random with variance 1 / N).required
JndarrayConnectivity of shape (N, N); J[i, j] is the weight with which unit j drives unit i.required

Returns:

NameTypeDescription
fCallable[[float, ndarray], ndarray]Right-hand side f(t, x) for a state of shape (N,), or (B, N) for a batch.
double_pendulum(m1: float, m2: float, L1: float, L2: float, g: float)

Vector field of the double pendulum.

Parameters:

NameTypeDescriptionDefault
m1floatMass of first pendulum.required
m2floatMass of second pendulum.required
L1floatLength of first pendulum.required
L2floatLength of second pendulum.required
gfloatGravitational acceleration.required

Returns:

NameTypeDescription
fCallable[[float, ndarray], ndarray]Right-hand side f(t, x) for a state (theta1, theta2, omega1, omega2) of shape (4,), or (B, 4) for a batch.
duffing(alpha: float, beta: float, delta: float, gamma: float, omega: float)

Vector field of the forced Duffing oscillator.

Parameters:

NameTypeDescriptionDefault
alphafloatLinear stiffness (typical: -1).required
betafloatCubic stiffness (typical: 1).required
deltafloatDamping coefficient (typical: 0.3).required
gammafloatForcing amplitude (typical: 0.5 for chaos).required
omegafloatForcing angular frequency (typical: 1.2).required

Returns:

NameTypeDescription
fCallable[[float, ndarray], ndarray]Right-hand side f(t, x) for a state (x, v) of shape (2,), or (B, 2) for a batch.
euler_spiral(a: float)

Vector field of the Euler spiral (clothoid).

Parameters:

NameTypeDescriptionDefault
afloatRate at which the curvature grows (typical: 1).required

Returns:

NameTypeDescription
fCallable[[float, ndarray], ndarray]Right-hand side f(t, x) for a state (x, y, theta) of shape (3,), or (B, 3) for a batch.
fitzhugh_nagumo(a: float, b: float, epsilon: float, I: float)

Vector field of the FitzHugh-Nagumo neuron model.

Parameters:

NameTypeDescriptionDefault
afloatOffset of the recovery variable (typical: 0.7).required
bfloatDamping of the recovery variable (typical: 0.8).required
epsilonfloatTime scale of the recovery variable (typical: 0.08).required
IfloatApplied current (typical: 0.5 for spiking).required

Returns:

NameTypeDescription
fCallable[[float, ndarray], ndarray]Right-hand side f(t, x) for a state (v, w) of shape (2,), or (B, 2) for a batch.
hindmarsh_rose(a: float, b: float, c: float, d: float, r: float, s: float, x_R: float, I: float)

Vector field of the Hindmarsh-Rose neuron model.

Parameters:

NameTypeDescriptionDefault
afloatCubic coefficient of the membrane potential (typical: 1).required
bfloatQuadratic coefficient of the membrane potential (typical: 3).required
cfloatConstant drive of the recovery variable (typical: 1).required
dfloatQuadratic coupling of the potential into the recovery variable (typical: 5).required
rfloatTime scale of the slow adaptation current (typical: 0.006).required
sfloatAdaptation strength (typical: 4).required
x_RfloatResting potential (typical: -1.6).required
IfloatApplied current (typical: 3.25 for chaotic bursting).required

Returns:

NameTypeDescription
fCallable[[float, ndarray], ndarray]Right-hand side f(t, x) for a state (x, y, z) of shape (3,), or (B, 3) for a batch: membrane potential, recovery variable and adaptation current.
kuramoto(omega: np.ndarray, K: np.ndarray)

Vector field of the Kuramoto model dθ_i/dt = ω_i + Σ_j K_ij sin(θ_j - θ_i).

Parameters:

NameTypeDescriptionDefault
omegandarrayNatural frequencies of shape (N,).required
KndarrayCoupling of shape (N, N); K[i, j] is the strength with which oscillator j drives oscillator i (typical: k / N everywhere).required

Returns:

NameTypeDescription
fCallable[[float, ndarray], ndarray]Right-hand side f(t, x) for unwrapped phases of shape (N,), or (B, N) for a batch.
lorenz(sigma: float, rho: float, beta: float)

Vector field of the Lorenz system.

Parameters:

NameTypeDescriptionDefault
sigmafloatPrandtl number (typical: 10).required
rhofloatRayleigh number (typical: 28).required
betafloatGeometric factor (typical: 8/3).required

Returns:

NameTypeDescription
fCallable[[float, ndarray], ndarray]Right-hand side f(t, x) for a state (x, y, z) of shape (3,), or (B, 3) for a batch.
lorenz96(F: float)

Vector field of the Lorenz 96 system.

Parameters:

NameTypeDescriptionDefault
FfloatForcing constant (typical: 8 for chaos).required

Returns:

NameTypeDescription
fCallable[[float, ndarray], ndarray]Right-hand side f(t, x) for a state of shape (D,), or (B, D) for a batch, with D >= 4.
lotka_volterra(rho: np.ndarray, sigma: float | np.ndarray, S: float | np.ndarray)

Vector field of the generalized Lotka-Volterra system dx/dt = x (sigma - rho x) + S.

Parameters:

NameTypeDescriptionDefault
rhondarrayInteraction matrix of shape (N, N); rho[i, j] is the effect of species j on species i.required
sigmafloat | ndarrayGrowth rate, scalar or of shape (N,) (typical: 1).required
Sfloat | ndarrayConstant input, scalar or of shape (N,) (typical: 0; small positive values keep winnerless competition switching).required

Returns:

NameTypeDescription
fCallable[[float, ndarray], ndarray]Right-hand side f(t, x) for a state of shape (N,), or (B, N) for a batch.
mackey_glass(tau: float, n: int, beta: float, gamma: float, x0: float, dt: float, t_max: int)

Generate a Mackey-Glass chaotic time series via forward Euler integration.

Parameters:

NameTypeDescriptionDefault
taufloatDelay parameter (typical: 17 for chaos).required
nintNonlinearity exponent (typical: 10).required
betafloatFeedback strength (typical: 0.2).required
gammafloatDecay rate (typical: 0.1).required
x0floatInitial condition.required
dtfloatIntegration time step.required
t_maxintMaximum time.required

Returns:

NameTypeDescription
tndarrayTime array.
xndarray1D time series.
morris_lecar(C: float, g_L: float, g_Ca: float, g_K: float, V_L: float, V_Ca: float, V_K: float, V1: float, V2: float, V3: float, V4: float, phi: float, I: float)

Vector field of the Morris-Lecar neuron model.

Parameters:

NameTypeDescriptionDefault
CfloatMembrane capacitance (typical: 20).required
g_LfloatLeak conductance (typical: 2).required
g_CafloatCalcium conductance (typical: 4.4).required
g_KfloatPotassium conductance (typical: 8).required
V_LfloatLeak reversal potential (typical: -60).required
V_CafloatCalcium reversal potential (typical: 120).required
V_KfloatPotassium reversal potential (typical: -84).required
V1floatHalf-activation voltage of the calcium channel (typical: -1.2).required
V2floatSlope of the calcium activation (typical: 18).required
V3floatHalf-activation voltage of the potassium channel (typical: 2).required
V4floatSlope of the potassium activation (typical: 30).required
phifloatRate of the potassium activation (typical: 0.04).required
IfloatApplied current (typical: 100 for spiking).required

Returns:

NameTypeDescription
fCallable[[float, ndarray], ndarray]Right-hand side f(t, x) for a state (V, n) of shape (2,), or (B, 2) for a batch: membrane potential and potassium activation.
pyloric(g_mem: np.ndarray, g_glu: np.ndarray, g_ach: np.ndarray)

Vector field of the three-neuron pyloric circuit of the crustacean stomatogastric ganglion (Prinz, Bucher & Marder 2004), in ms and mV.

Parameters:

NameTypeDescriptionDefault
g_memndarrayMaximal conductances in mS/cm^2 of shape (3, 8): rows are AB/PD, LP, PY and columns are Na, CaT, CaS, A, KCa, Kd, H, leak (typical: [[400, 2.5, 6, 50, 10, 100, 0.01, 0], [100, 0, 8, 40, 5, 75, 0.05, 0.02], [100, 2.5, 2, 50, 0, 125, 0.05, 0.01]]).required
g_glundarrayFast glutamatergic synapse strengths in nS of shape (3, 3); g_glu[i, j] is the synapse from neuron j onto neuron i (typical: g_glu[1, 0] = 30 (AB to LP), g_glu[2, 0] = 3 (AB to PY), g_glu[0, 1] = 10 (LP to AB/PD), g_glu[2, 1] = 3 (LP to PY), g_glu[1, 2] = 3 (PY to LP), the rest 0, for a PD, LP, PY rhythm of period about 1.7 s).required
g_achndarraySlow cholinergic synapse strengths in nS of shape (3, 3), indexed like g_glu (typical: g_ach[1, 0] = 3 (PD to LP), g_ach[2, 0] = 30 (PD to PY), the rest 0).required

Returns:

NameTypeDescription
fCallable[[float, ndarray], ndarray]Right-hand side f(t, x) for a state of shape (45,), or (B, 45) for a batch; x.reshape(15, 3) has one column per neuron and rows: membrane potential, intracellular [Ca] in uM, the gates m and h of Na, m and h of CaT, m and h of CaS, m and h of A, m of KCa, n of Kd, m of H, and the glutamatergic and cholinergic synaptic activations of the neuron as presynaptic cell (typical initial state: V = -50, [Ca] = 0.05, all gates and synaptic activations 0, discard the first 3 s as transient).
rk45(f: Callable[[float, np.ndarray], np.ndarray], X0: np.ndarray, dt: float, t_max: float, rtol: float = 1e-06, atol: float = 1e-09)

Integrate dx/dt = f(t, x) via the adaptive Dormand-Prince RK45 method.

Steps are chosen by the error alone, and the uniform grid of spacing dt is filled in by the method’s dense output. A batch of initial conditions is integrated together, with steps that keep every member within the tolerance.

Parameters:

NameTypeDescriptionDefault
fCallable[[float, ndarray], ndarray]Right-hand side of the system, called with states of the shape of X0.required
X0ndarrayInitial condition of shape (D,), or (B, D) for a batch.required
dtfloatSampling time step.required
t_maxfloatEnd time, excluded from the grid.required
rtolfloatRelative tolerance of the local error.1e-06
atolfloatAbsolute tolerance of the local error.1e-09

Returns:

NameTypeDescription
tndarrayTime array of shape (N,).
XndarrayTrajectory of shape (N, D), or (B, N, D) for a batch.

Raises:

TypeDescription
ValueErrorIf X0 is not of shape (D,) or (B, D).
rossler(a: float, b: float, c: float)

Vector field of the Rössler system.

Parameters:

NameTypeDescriptionDefault
afloatSpiral growth rate (typical: 0.2).required
bfloatConstant injection into z (typical: 0.2).required
cfloatFolding threshold (typical: 5.7).required

Returns:

NameTypeDescription
fCallable[[float, ndarray], ndarray]Right-hand side f(t, x) for a state (x, y, z) of shape (3,), or (B, 3) for a batch.
rulkov_map(alpha: float, mu: float, sigma: float, epsilon: float, X0: np.ndarray, n_max: int)

Generate a time series of globally coupled Rulkov map neurons.

Parameters:

NameTypeDescriptionDefault
alphafloatNonlinearity of the fast variable (typical: 4.1 for chaotic bursting).required
mufloatTime scale of the slow variable (typical: 0.001).required
sigmafloatDrive of the slow variable (typical: -1.5).required
epsilonfloatCoupling through the mean of the fast variables (typical: 0).required
X0ndarrayInitial condition of shape (N, 2), one (x, y) per unit.required
n_maxintNumber of steps.required

Returns:

NameTypeDescription
nndarrayStep array.
XndarrayTime series of shape (n_max, N, 2).
three_scroll(a: float, k: float, c: float, d: float, e: float, f: float)

Vector field of Li’s three-scroll system.

Parameters:

NameTypeDescriptionDefault
afloatCoupling of x towards y (typical: 40).required
kfloatGain of x in dy/dt (typical: 55).required
cfloatGain of z in dz/dt (typical: 1.9 for chaos; Li’s 11/6 gives a limit cycle).required
dfloatCoefficient of x z in dx/dt (typical: 0.16).required
efloatCoefficient of x^2 in dz/dt (typical: 0.65).required
ffloatGain of y in dy/dt (typical: 20).required

Returns:

NameTypeDescription
rhsCallable[[float, ndarray], ndarray]Right-hand side rhs(t, x) for a state (x, y, z) of shape (3,), or (B, 3) for a batch.
to_xy(L1: float, L2: float, theta1: np.ndarray, theta2: np.ndarray)

Convert double pendulum angles to Cartesian coordinates.

Parameters:

NameTypeDescriptionDefault
L1floatLength of first pendulum.required
L2floatLength of second pendulum.required
theta1ndarrayAngle of first pendulum.required
theta2ndarrayAngle of second pendulum.required

Returns:

NameTypeDescription
x1ndarrayx-coordinate of first pendulum.
y1ndarrayy-coordinate of first pendulum.
x2ndarrayx-coordinate of second pendulum.
y2ndarrayy-coordinate of second pendulum.