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 consistentcompute_spectrum
when usingprefactors=2.0
and the giventimestep
as arguments. The empirical amplitudes of the spectrum will then be consistent with given PSD. Hencepsd[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 is2 * (len(psd) - 1)
. This argument can be used to truncate the sequences, which can be useful for creating aperiodic signals.
- Return type:
- Returns:
sequences – The generated sequences, a 2D array with shape
(nseq, nstep)
, wherenstep = 2 * (len(psd) - 1)
if not provided.