Skip to content

Signal generation

Generate signal functions for system excitation.

dynax.aprbs(key, length, num_jumps, initial_value=None)

Generate an amplitude-modulated pseudo-random binary sequence (APRBS).

The output sequence contains numbers from [0, 1).

PARAMETER DESCRIPTION
key

JAX PRNGKey.

TYPE: PRNGKeyArray

length

Number of samples in the sequence.

TYPE: int

num_jumps

Number of jumps in the sequence.

TYPE: int

initial_value

The inital value of the sequence. If None, it is chosen randomly.

TYPE: float | None DEFAULT: None

RAISES DESCRIPTION
ValueError

If the number of jumps exceeds the number of possible jumping points (length-2).

RETURNS DESCRIPTION
Array

Array with shape (length,) describing the APRBS.

dynax.smooth_noise(key, length, sigma, start_at_zero=False)

Generate smooth noise.

Produces a smoothly varying signal with unit variance by convonvling a Gaussian kernel with white noise.

PARAMETER DESCRIPTION
key

JAX PRNGKey.

TYPE: PRNGKeyArray

length

Number of samples in the sequence.

TYPE: int

sigma

Standard deviation of the Gaussian kernel. Larger values produce smoother outputs.

TYPE: float

start_at_zero

If true starts the sequence at zero. Otherwise it starts with a random normaly distributed value. Defaults to False.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
Array

Array with shape (length,) describing the smooth noise.

dynax.bandlimited_noise(key, length, max_freq=20, dt=None, normalize=True)

Generate 1D band-limited random noise using Fourier synthesis.

Note

The signal is periodic due to the Fourier-based construction.

PARAMETER DESCRIPTION
key

JAX PRNGKey.

TYPE: PRNGKeyArray

length

Number of points

TYPE: int

max_freq

Cutoff frequency (max Fourier mode kept)

TYPE: float DEFAULT: 20

dt

Time increment between samples. If none provided, uses dt=1/length. Defaults to None.

TYPE: float | None DEFAULT: None

normalize

If true, normalizes the signal to zero mean and unit variance.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Array

Smooth noise of length N