lib.Fitting.QnoisePSD module

QnoisePSD.py

Tools for computing and fitting noise power spectral densities (PSD).

This module provides utilities to estimate power spectra from time-domain data and to fit common noise models such as white noise, 1/f noise, and generalized power-law spectra.

Author

Tom Laclavère

lib.Fitting.QnoisePSD.combined_noise(f, A_white, f_knee, alpha)[source]

Combination of white noise + 1/f^alpha noise.

PSD = white + 1/f^alpha

Parameters:
  • f (array_like) – Frequencies.

  • A_white (float) – Amplitude of white noise.

  • f_knee (float) – “Knee” frequency where the 1/f^alpha noise equals the white noise level (Hz).

  • alpha (float) – Exponent of 1/f noise.

Returns:

psd – Combined PSD.

Return type:

ndarray

lib.Fitting.QnoisePSD.compute_ps(data, timestep)[source]

Compute the two-sided Power Spectral Density (PSD) of a time-domain signal.

Parameters:
  • data (array_like) – Input time-domain signal. Must be one-dimensional.

  • timestep (float) – Sampling interval of the signal (seconds per sample).

Returns:

  • freq (ndarray) – Frequencies corresponding to the PSD values (Hz). Ranges from -Nyquist to +Nyquist.

  • ps (ndarray) – Two-sided power spectral density of the signal. Units are [signal units]^2 / Hz.

lib.Fitting.QnoisePSD.compute_real_ps(data, timestep)[source]

Compute the one-sided Power Spectral Density (PSD) of a real-valued signal.

Parameters:
  • data (array_like) – Real-valued time-domain signal. Must be one-dimensional.

  • timestep (float) – Sampling interval of the signal (seconds per sample).

Returns:

  • freq (ndarray) – Positive frequencies corresponding to the PSD values (Hz), from 0 to Nyquist.

  • ps (ndarray) – One-sided power spectral density of the signal. Units are [signal units]^2 / Hz.

Notes

  • One-sided correction is applied: all bins except the first and last are multiplied by 2.

lib.Fitting.QnoisePSD.fit_minuit_ll(data, timestep, model, x0, param_names, nbins=300, plot=False, log=True)[source]
lib.Fitting.QnoisePSD.fit_minuit_ll_from_ps(freq, ps, model, x0, param_names, nbins=300, plot=False, log=True)[source]
lib.Fitting.QnoisePSD.make_minuit(nll, param_names, x0)[source]

Create Minuit object with named parameters.

lib.Fitting.QnoisePSD.nll_gauss_model(model, freq, ps, sigma)[source]

Return a Minuit-compatible function for any model.

modelcallable

model(freq, *params)

lib.Fitting.QnoisePSD.one_over_f_noise(f, A_f, alpha)[source]

1/f^alpha noise PSD.

Parameters:
  • f (array_like) – Frequencies (should be >0 to avoid division by zero).

  • A_f (float) – Amplitude of 1/f noise at f=1 Hz.

  • alpha (float) – Exponent of 1/f noise.

Returns:

psd – Power spectral density of 1/f^alpha noise.

Return type:

ndarray

lib.Fitting.QnoisePSD.white_noise(f, A_white)[source]

White noise PSD.

Parameters:
  • f (array_like) – Frequencies.

  • A_white (float) – Amplitude of the white noise (rms).

Returns:

psd – Power spectral density of white noise.

Return type:

ndarray