fit_harmonic_oscillator

gala.dynamics.fit_harmonic_oscillator(orbit, omega0=[1.0, 1, 1], minimize_kwargs=None)[source]

Fit the toy harmonic oscillator potential to the sum of the energy residuals relative to the mean energy by minimizing the function

\[f(\boldsymbol{\omega}) = \sum_i (\frac{1}{2}v_i^2 + \Phi_{\rm sho}(x_i\,|\,\boldsymbol{\omega}) - <E>)^2\]
TODO: This should fail if the Hamiltonian associated with the orbit has

a frame other than StaticFrame

Parameters
orbitOrbit
omega0array_like (optional)

Initial frequency guess.

minimize_kwargsdict (optional)

Keyword arguments to pass through to scipy.optimize.minimize.

Returns
omegasfloat

Best-fit harmonic oscillator frequencies.