FREQCOR_functions.fit_Aslan21

FREQCOR_functions.fit_Aslan21(f, ideal_sp, real_sp, par_bounds, ini_par)[source]

@author: Aslan et al. 2021 Translated by A. Faurès from Matlab to Python on 21/10/2024

Function to fit the equation developed by Aslan et al. 2021 to any spectral case and dataset.

Parameters:
  • f (numpy array) – Natural frequency, binned.

  • ideal_sp (numpy array) – Binned power spectra of sonic temperature (unattenuated, noise-free). Is in the form: f*sp(T)/var(T)

  • real_sp (numpy array) – Binned power spectra of tracer of interest (attenuated, noisy). Is in the form: f*sp(c)/var(c)

  • lim (list of float64) – Thresholds for fitting [Hz]. In the form [Low_lim, Up_lim]

  • ini_par (list of float64) – Starting points for a, b, d parameters. In the form [a0, b0, d0] Reminder: a: filter time constant (s); b: normalisation factor; d: intercept of white noise line with y-axis.

Returns:

  • popt (numpy array) – a, b, d parameters optimised (least-squares).

  • PSA_A21 (numpy array) – Binned power spectra modelled with optimised parameters.

  • r_squared (float64) – Goodness of fit (calculated from residuals).

  • noise (numpy array) – Calculation of the noise term as f*d.