def _generate_time_values(self, nu_vals): # Subtract current anomaly to start from the desired point ecc = self.ecc.value nu = self.nu.to(u.rad).value M_vals = [nu_to_M_fast(nu_val, ecc) - nu_to_M_fast(nu, ecc) for nu_val in nu_vals.to(u.rad).value] * u.rad time_values = (M_vals / self.n).decompose() return time_values
def _generate_time_values(self, nu_vals): # Subtract current anomaly to start from the desired point ecc = self.ecc.value nu = self.nu.to(u.rad).value M_vals = [ nu_to_M_fast(nu_val, ecc) - nu_to_M_fast(nu, ecc) for nu_val in nu_vals.to(u.rad).value ] * u.rad time_values = (M_vals / self.n).decompose() return time_values
def nu_to_M(nu, ecc, delta=1e-2): """Mean anomaly from true anomaly. .. versionadded:: 0.4.0 Parameters ---------- nu : float True anomaly (rad). ecc : float Eccentricity. Returns ------- M : float Mean anomaly (rad). """ return nu_to_M_fast(nu.to(u.rad).value, ecc.value, delta) * u.rad
def nu_to_M(nu, ecc, delta=1e-2): """Mean anomaly from true anomaly. .. versionadded:: 0.4.0 Parameters ---------- nu : ~astropy.units.Quantity True anomaly. ecc : ~astropy.units.Quantity Eccentricity. delta : float (optional) threshold of near-parabolic regime definition (from Davide Farnocchia et al) Returns ------- M : ~astropy.units.Quantity Mean anomaly. """ return (nu_to_M_fast(nu.to(u.rad).value, ecc.value, delta) * u.rad).to(nu.unit)