component_model.utils.analysis

Functions

extremum(x, y[, aerr])

Check whether the provided (3) points contain an extremum.

extremum_series(t, y[, which])

Estimate the extrema from the time series defined by y(t).

sine_fit(times, vals[, eps])

Fit a general sine function f(t) = y0 + a* sin(w*t + phi) to the data end and return (y0, a,omega,phi).

component_model.utils.analysis.extremum(x: tuple[float, ...] | list[float] | ndarray, y: tuple[float, ...] | list[float] | ndarray, aerr: float = 0.0)

Check whether the provided (3) points contain an extremum. Return 0 (no extremum), -1 (low point), 1 (top point) and the point, or (0,0).

component_model.utils.analysis.extremum_series(t: tuple[float, ...] | list[float] | ndarray, y: tuple[float, ...] | list[float] | ndarray, which: str = 'max')

Estimate the extrema from the time series defined by y(t). which can be ‘max’, ‘min’ or ‘all’.

component_model.utils.analysis.sine_fit(times: list[float] | ndarray, vals: list[float] | ndarray, eps: float = 1e-2)

Fit a general sine function f(t) = y0 + a* sin(w*t + phi) to the data end and return (y0, a,omega,phi).

  • The last two maximum points of the data set are detected and a full sine wave is fit to that.

  • Error is issued if maximum points are not found.

  • Warning is provided if the fit to the sine function is bad (diag(pcov) > eps).

  • If the curve starts with maxima (cos(…)), it is accepted if the first points fit a 2nd order within eps.

  • The phase angle is returned in the range ]-pi, pi]

  • Returns the zero-line, the amplitude, the angualar frequency, the phase and the mid-time of the wave.