skg.sin_fit

skg.sin_fit(t, y, sorted=True, _debug=False)[source]

Compute estimated initial parameters for noisy sinusoidal data.

The result will have a very accurate approximation of the frequency, which is the crucial parameter for non-linear estimator initial values.

Parameters:
  • t (array-like) – The x-values of the data points. The fit will be performed on a raveled version of this array.
  • y (array-like) – The y-values of the data points corresponding to x. Must be the same size as x. The fit will be performed on a raveled version of this array.
  • sorted (bool) – Set to True if x is already monotonically increasing or decreasing. If False, x will be sorted into increasing order, and y will be sorted along with it.
Returns:

  • a (float) – Amplitude.
  • omega (float) – Angular frequency: \omega = \frac{2\pi}{\lambda}.
  • phi (float) – Angular phase-shift.
  • b (float) – Additive bias.

References

  • Currently none. This function, and the underlying clustering algorithm are entirely the work of the author. A peer reviewed paper is currently in the works.