component_model.analytic¶
Collect analytic models in this module, as facility to perform simple verifications on simulation models.
Functions
|
Fit a general sine function f(t) = a* sin(w*t + phi) to the data and return (a,omega,phi). |
Classes
|
Calculate the expected (analytic) position and speed of a harmonic oscillator in one dimension with the given parameter settings. |
- component_model.analytic.sine_fit(times: list[float] | ndarray, vals: list[float] | ndarray, max_pcov: float = 1e-2)¶
Fit a general sine function f(t) = a* sin(w*t + phi) to the data and return (a,omega,phi).
The last two upward zero-crossings of the data set are detected and a full sine wave is fit to that.
Error is issued if zero-crossings are not found.
Warning is provided if the fit to the sine function is bad (diag(pcov) > max_pcov).
The phase angle is returned in the range ]-pi, pi]