scope.fourier package
Submodules
scope.fourier.fit_fourier module
- scope.fourier.fit_fourier.broken_power_law(freq, freq0, N_c, pl_index, N_w)[source]
Model of the broken power law.
A piecewise function joining two models of power law: COLOURED NOISE and WHITE NOISE.
- Parameters:
freq (numpy array) – Fourier frequencies
freq0 (float) – X-coordinate of the knot
N_c (float) – Energy (coefficient) of the coloured-noise model
pl_index (float) – Index of the coloured-noise model
N_w (float) – Energy (coefficient) of the white-noise model
- Returns:
The function
- Return type:
numpy array
- scope.fourier.fit_fourier.continuous_power_law(freq, N_c, pl_index, N_w)[source]
Model of the continuous power law.
Superposition of two models of power law: COLOURED NOISE + WHITE NOISE.
- Parameters:
freq (numpy array) – Fourier frequencies
N_c (float) – Energy (coefficient) of the coloured-noise model
pl_index (float) – Index of the coloured-noise model
N_w (float) – Energy (coefficient) of the white-noise model
- Returns:
The function
- Return type:
numpy array
- scope.fourier.fit_fourier.fit_fourier(x, dt, fap, plot_spectrum=False)[source]
A debiased least squares fitting algorithm.
This function fits the input signal with the continuous power law using debiased least squares fitting, and calculates the frequency-dependent confidence limit based on a user-defined false alarm probability.
The method of debiased least squares fitting is based on [1].
[1] ‘https://www.aanda.org/articles/aa/abs/2005/07/aa1453/aa1453.html’
- Parameters:
x (numpy array) – Noise signal
dt (float) – Interval of the time series
fap (float) – False alarm probability
plot_spectrum (bool, optional) – Plot the power spectrum, with fittings by the broken power law and continuous power law. The confidence limits of the continous power law fit are also plotted. The default is False.
- Returns:
fit_fourier_result –
- scope.fourier.fit_fourier.power
FFT power
- Type:
numpy array
- scope.fourier.fit_fourier.frequency
Fourier frequencies
- Type:
numpy array
- scope.fourier.fit_fourier.frequency0
Frequency at which the signal varies from coloured noise to white noise
- Type:
float
- scope.fourier.fit_fourier.expectation_broken
Frequency dependent expectation of the FFT power calculated from the broken power law model
- Type:
numpy array
- scope.fourier.fit_fourier.expectation_continuous
Frequency dependent expectation of the FFT power calculated from the continuous power law model
- Type:
numpy array
- scope.fourier.fit_fourier.white_energy
Energy of the white-noise component
- Type:
float
- scope.fourier.fit_fourier.color_energy
Energy of the coloured-noise component
- Type:
float
- scope.fourier.fit_fourier.pl_index
Index of the coloured-noise component
- Type:
float
- scope.fourier.fit_fourier.confidence_limit
Frequency dependent confidence limit based on the provided false alarm probability
- Type:
numpy array
- Return type:
dict
- scope.fourier.fit_fourier.log_power(freq, N_c, pl_index, N_w)[source]
Function describing the logarithm (base 10) of the power spectrum.
Calculates the logarithm (base 10) of the continuous power law + bias. The bias term originates from the fact that the power spectrum is scattered around the true spectrum with a chi-squared distribution with 2 degrees of freedom.
- Parameters:
freq (numpy array) – Fourier frequencies
N_c (float) – Energy (coefficient) of the coloured-noise model
pl_index (float) – Index of the coloured-noise model
N_w (float) – Energy (coefficient) of the white-noise model
- Returns:
The function
- Return type:
numpy array
- scope.fourier.fit_fourier.piecewise_linear(x, x0, y0, k1)[source]
A piecewise linear function to be fitted.
The piecewise linear function consists of the function of a straight line and a flat line.
- Parameters:
x (numpy array) – Fourier frequency
x0 (float) – X-coordinate of the knot
y0 (float) – Y-coordinate of the knot
k1 (float) – Gradient of the straight line
- Returns:
The function
- Return type:
numpy array
Module contents
Created on Wed Dec 18 13:06:42 2024
@author: u2273880