noise_lib.py, and higher-level signal models are in simple_synth_data_models.py.
Import
ColoredNoiseGenerator (Class)
ColoredNoiseGenerator generates time-series of different spectral colors by shaping white Gaussian noise in the frequency domain. Instantiate it with the desired number of samples N, then call any color method.
The method for Brownian (red) noise is
brownian(), not red(). When you pass 'red' to noiselist in compute_imgbank_dict(), the pipeline internally calls gen.brownian() on your behalf.All
ColoredNoiseGenerator methods return a numpy array of length N. The output is not amplitude-normalized by default. If you need unit-scale signals for spectrogram generation, normalize with sklearn.preprocessing.MinMaxScaler(feature_range=(-1, 1)) before computing the STFT or CWT.white_noise_series (function)
Generates a simple white noise time-series drawn from a normal distribution. This is a standalone function — use it when you need a quick white noise segment without instantiatingColoredNoiseGenerator.
Parameters
Returns
ar_driven_noise_series (function)
Generates a noise time-series from a linear autoregressive (AR) system driven by white noise. The AR coefficientsa_k define the resonant structure of the output signal. You can use this to synthesize signals with known spectral shapes (e.g., narrow-band resonances) for testing your pipeline.
Parameters
Autoregressive coefficients. The first element must be
1. The roots of the characteristic polynomial defined by a_k must all lie inside the unit circle for the system to be stable.Maximum frequency (Hz) for PSD computation. When
None, defaults to the Nyquist frequency.Returns
Power Spectral Density array at the returned frequency bins. Compare this against the empirical spectrogram as a sanity check.
psd_driven_noise_series (function)
Synthesizes a noise time-series directly from a custom PSD curve you supply. Use this when you have a measured or modeled PSD and want to generate realizations of a signal with that exact spectral shape.Parameters
Maximum frequency to compute. Defaults to the Nyquist frequency when
None.Returns
Building a Noise Bank
Pairwise metric extraction requires a noise reference bank: a collection of spectrogram images computed from multiple realizations of different noise types. The bank defines the statistical “background” against which your target signal’s amplitude distribution is aligned before GMM labeling and GLSZM zone metric computation. UseGISQAPipeline.compute_imgbank_dict() to build a bank programmatically. Pass spec_types=['stft'] and a list of noise color strings in noiselist. The method generates total_realizations independent noise realizations per noise color and STFT parameter combination, converts each to a spectrogram, and stores all images in a structured dictionary.
Simple Synthetic Signal Models
simple_synth_data_models.py provides functions for constructing controlled synthetic time-series. These are useful for generating labeled training sets, validating your pipeline on signals with known properties, and designing sensitivity tests.
Additive processes
An additive signal is the superposition of multiple sinusoidal components:Multiplicative processes
A multiplicative signal encodes amplitude modulation between frequency components. Two formulations are available:- Type 1:
x(t) = sin(A) · sin(B) · ··· · sin(N)— pure product of sinusoids - Type 2:
x(t) = sin(A) · (1 + ε · sin(B))— carrier modulated by a low-frequency envelope (requires exactly two frequencies withw[0] > w[1])
gen_multiplicative_synthetic_signal requires w and a to be numpy arrays (not plain lists) and type is a positional argument.Autoregressive processes
Autoregressive (AR) signals are generated from a linear filter driven by white noise, where the denominator polynomialA(z) determines the resonant frequencies and decay rates of the system. Use ar_driven_noise_series() from noise_lib.py for this purpose.
a_k must define a stable system (all roots of the characteristic polynomial inside the unit circle). The function also returns the theoretical PSD, which you can compare against the empirical spectrogram as a sanity check.