Simulations#

TVAR Coefficient Schedules#

NeuralFieldManifold.generators.sinusoid(T, p, rng, freq_jitter=0.15, amp_jitter=0.15)[source]#

Sinusoidal coefficient schedule with per-lag variation.

Each lag gets a distinct base frequency, amplitude, and offset with small random jitter for stochastic diversity across samples.

Parameters:
  • T (int) – Length of the time series.

  • p (int) – AR order (number of lags).

  • rng (np.random.Generator) – NumPy random generator instance.

  • freq_jitter (float, optional) – Relative frequency jitter range. Default is 0.15.

  • amp_jitter (float, optional) – Relative amplitude jitter range. Default is 0.15.

Returns:

a – Time-varying AR coefficients of shape (T, p).

Return type:

np.ndarray

NeuralFieldManifold.generators.fourier(T, p, rng, M=3, amp_jitter=0.2)[source]#

Fourier-series coefficient schedule with decaying harmonics.

Each lag is represented by a truncated Fourier series with M harmonics whose amplitudes decay as 1 / m^1.2.

Parameters:
  • T (int) – Length of the time series.

  • p (int) – AR order (number of lags).

  • rng (np.random.Generator) – NumPy random generator instance.

  • M (int, optional) – Number of Fourier harmonics per lag. Default is 3.

  • amp_jitter (float, optional) – Relative amplitude jitter per harmonic. Default is 0.2.

Returns:

a – Time-varying AR coefficients of shape (T, p).

Return type:

np.ndarray

NeuralFieldManifold.generators.quasiperiodic(T, p, rng, freq_jitter=0.15)[source]#

Quasiperiodic coefficient schedule with two incommensurate frequencies.

Each lag combines two sinusoidal components whose frequency ratio is irrational, producing non-repeating oscillatory patterns.

Parameters:
  • T (int) – Length of the time series.

  • p (int) – AR order (number of lags).

  • rng (np.random.Generator) – NumPy random generator instance.

  • freq_jitter (float, optional) – Relative frequency jitter range. Default is 0.15.

Returns:

a – Time-varying AR coefficients of shape (T, p).

Return type:

np.ndarray

NeuralFieldManifold.generators.polynomial_drift(T, p, rng, degree=3, coef_jitter=0.3)[source]#

Polynomial-drift coefficient schedule.

Each lag’s trajectory is a random polynomial of the given degree centred on the lag-specific offset.

Parameters:
  • T (int) – Length of the time series.

  • p (int) – AR order (number of lags).

  • rng (np.random.Generator) – NumPy random generator instance.

  • degree (int, optional) – Polynomial degree. Default is 3.

  • coef_jitter (float, optional) – Relative jitter on polynomial coefficients. Default is 0.3.

Returns:

a – Time-varying AR coefficients of shape (T, p).

Return type:

np.ndarray

NeuralFieldManifold.generators.logistic_transition(T, p, rng)[source]#

Single logistic-transition coefficient schedule.

Each lag transitions between two distinct levels via a sigmoid whose centre and steepness are randomised.

Parameters:
  • T (int) – Length of the time series.

  • p (int) – AR order (number of lags).

  • rng (np.random.Generator) – NumPy random generator instance.

Returns:

a – Time-varying AR coefficients of shape (T, p).

Return type:

np.ndarray

NeuralFieldManifold.generators.multi_sigmoid(T, p, rng, J=3)[source]#

Multi-sigmoid step coefficient schedule.

Superimposes J sigmoid transitions of random magnitude and steepness around each lag’s baseline offset.

Parameters:
  • T (int) – Length of the time series.

  • p (int) – AR order (number of lags).

  • rng (np.random.Generator) – NumPy random generator instance.

  • J (int, optional) – Number of sigmoid steps per lag. Default is 3.

Returns:

a – Time-varying AR coefficients of shape (T, p).

Return type:

np.ndarray

NeuralFieldManifold.generators.gaussian_bumps(T, p, rng, J=4)[source]#

Gaussian-bump coefficient schedule.

Overlays J Gaussian-shaped bumps of random centre, width, and sign on each lag’s baseline offset.

Parameters:
  • T (int) – Length of the time series.

  • p (int) – AR order (number of lags).

  • rng (np.random.Generator) – NumPy random generator instance.

  • J (int, optional) – Number of Gaussian bumps per lag. Default is 4.

Returns:

a – Time-varying AR coefficients of shape (T, p).

Return type:

np.ndarray

NeuralFieldManifold.generators.smooth_random(T, p, rng)[source]#

Smooth random (GP-like) coefficient schedule.

Generates spectrally shaped Gaussian noise with a long correlation length, producing smooth, aperiodic coefficient trajectories centred on each lag’s baseline.

Parameters:
  • T (int) – Length of the time series.

  • p (int) – AR order (number of lags).

  • rng (np.random.Generator) – NumPy random generator instance.

Returns:

a – Time-varying AR coefficients of shape (T, p).

Return type:

np.ndarray

Dynamical Systems & Noise#

NeuralFieldManifold.generators.tvvar(n_steps: int, burn_in: int = 300, alpha: Array = None, beta: Array = None, rotation_period1: float = 500.0, rotation_period2: float = 900.0, noise_scale: float = 1.0, seed: int = 0) Array[source]#

3D Time-Varying VAR(2) with rotating coupling matrices.

Ensures stability by using orthogonal rotations to preserve eigenvalues while the coupling structure evolves smoothly over time.

Parameters:
  • n_steps (int) – Number of time steps (after burn-in).

  • burn_in (int) – Number of initial samples to discard.

  • alpha (jnp.ndarray or None) – Eigenvalues for first-lag matrix A1 (length 3). Default: [0.45, 0.35, 0.30]

  • beta (jnp.ndarray or None) – Eigenvalues for second-lag matrix A2 (length 3). Negative values help with damping. Default: [-0.10, -0.08, -0.06]

  • rotation_period1 (float) – Period for first rotation (samples).

  • rotation_period2 (float) – Period for second rotation (samples).

  • noise_scale (float) – Scale of innovation noise.

  • seed (int) – Random seed.

Returns:

Signal of shape (n_steps, 3).

Return type:

jnp.ndarray

Example

>>> data = tvvar(5000)  # (5000, 3)
>>> X1, X2, X3 = data[:, 0], data[:, 1], data[:, 2]
NeuralFieldManifold.generators.lorenz(T_steps=12000, dt=0.005, sigma=10.0, rho=28.0, beta=2.6666666666666665, x0=(1.0, 1.0, 1.0))[source]#

Lorenz system generator using 4th order Runge-Kutta integration.

Parameters:
  • T_steps (int) – Number of time steps to simulate.

  • dt (float) – Time step size.

  • sigma (float) – Lorenz system parameter.

  • rho (float) – Lorenz system parameter.

  • beta (float) – Lorenz system parameter.

  • x0 (tuple of floats) – Initial conditions (x0, y0, z0).

Returns:

Arrays containing the x, y, and z coordinates of the Lorenz system trajectory.

Return type:

tuple of np.ndarray

Example

>>> x, y, z = lorenz()
NeuralFieldManifold.generators.ou_exact(n_steps: int, dt: float = 0.005, theta: float = 2.0, mu: float = 0.0, sigma: float = 1.0, x0: float = 0.0, seed: int = 0)[source]#

Ornstein-Uhlenbeck process using exact analytical solution.

The conditional distribution P(x_{t+dt} | x_t) is Gaussian with:

mean = x_t * exp(-θ*dt) + μ * (1 - exp(-θ*dt)) var = σ² / (2θ) * (1 - exp(-2θ*dt))

Parameters:
  • n_steps (int) – Number of time steps.

  • dt (float) – Time step size.

  • theta (float) – Reversion rate. Characteristic time scale τ = 1/θ.

  • mu (float) – Long-term mean.

  • sigma (float) – Noise strength.

  • x0 (float) – Initial state.

  • seed (int) – Random seed.

Returns:

Signal of shape (n_steps,).

Return type:

jnp.ndarray

Example

>>> x = ou_exact(10000, dt=0.005, theta=2.0)
NeuralFieldManifold.generators.ou_euler(n_steps: int, dt: float = 0.005, theta: float = 2.0, mu: float = 0.0, sigma: float = 1.0, x0: float = 0.0, seed: int = 0)[source]#

Ornstein-Uhlenbeck process using Euler-Maruyama approximation.

Approximation (first-order in dt):

x_{t+dt} ≈ x_t - θ*dt*(x_t - μ) + σ*sqrt(dt)*ε

Parameters:
  • n_steps (int) – Number of time steps.

  • dt (float) – Time step size.

  • theta (float) – Reversion rate. Characteristic time scale τ = 1/θ.

  • mu (float) – Long-term mean.

  • sigma (float) – Noise strength.

  • x0 (float) – Initial state.

  • seed (int) – Random seed.

Returns:

Signal of shape (n_steps,).

Return type:

jnp.ndarray

Example

>>> x = ou_euler(10000, dt=0.005, theta=2.0)
NeuralFieldManifold.generators.white_noise(n_steps: int, seed: int = 0)[source]#

Generate white noise (flat PSD).

Parameters:
  • n_steps (int) – Number of samples.

  • seed (int) – Random seed.

Returns:

Noise signal of shape (n_steps,), zero mean, unit variance.

Return type:

jnp.ndarray

Example

>>> x = white_noise(10000)
NeuralFieldManifold.generators.pink_noise(n_steps: int, seed: int = 0)[source]#

Generate pink (1/f) noise.

Parameters:
  • n_steps (int) – Number of samples.

  • seed (int) – Random seed.

Returns:

Noise signal of shape (n_steps,), zero mean, unit variance.

Return type:

jnp.ndarray

Example

>>> x = pink_noise(10000)
NeuralFieldManifold.generators.brown_noise(n_steps: int, seed: int = 0)[source]#

Generate brown/red (1/f²) noise.

Parameters:
  • n_steps (int) – Number of samples.

  • seed (int) – Random seed.

Returns:

Noise signal of shape (n_steps,), zero mean, unit variance.

Return type:

jnp.ndarray

Example

>>> x = brown_noise(10000)
NeuralFieldManifold.generators.colored_noise(n_steps: int, alpha: float = 1.0, seed: int = 0)[source]#

Generate 1/f^α colored noise via spectral shaping.

Parameters:
  • n_steps (int) – Number of samples.

  • alpha (float) – Spectral exponent. - α=0: white noise (flat PSD) - α=1: pink noise (1/f) - α=2: brown/red noise (1/f²)

  • seed (int) – Random seed.

Returns:

Noise signal of shape (n_steps,), zero mean, unit variance.

Return type:

jnp.ndarray

Example

>>> x = colored_noise(10000, alpha=1.5)