stacie.synthetic module

Generate synthetic time-correlated data for algorithmic testing and validation.

generate(psd, timestep, nseq, nstep=None, rng=None)[source]

Generate sequences with a given power spectral density.

Parameters:
  • psd (ndarray[tuple[Any, ...], dtype[float]]) – The power spectral density. The normalization of the PSD is consistent compute_spectrum when using prefactors=2.0 and the given timestep as arguments. The empirical amplitudes of the spectrum will then be consistent with given PSD. Hence psd[0] is the ground truth of the autocorrelation integral.

  • timestep (float) – The time between two subsequent elements in the sequence.

  • nseq (int) – The number of sequences to generate.

  • nstep (int | None) – The number of time steps in each sequence. When not given, the number of steps is 2 * (len(psd) - 1). This argument can be used to truncate the sequences, which can be useful for creating aperiodic signals.

  • rng (Generator | None) – The random number generator.

Return type:

ndarray[tuple[Any, ...], dtype[float]]

Returns:

sequences – The generated sequences, a 2D array with shape (nseq, nstep), where nstep = 2 * (len(psd) - 1) if not provided.