Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@reify
def semi_latus_rectum(self):
p = semi_latus_rectum(self._h_vec, self._mu)
return Distance(km=p)
@reify
def _mean_obliquity_radians(self):
# Cached because it is used to compute both gast and N.
return mean_obliquity(self.tdb) * ASEC2RAD
@reify
def argument_of_periapsis(self):
w = argument_of_periapsis(self._n_vec, self._e_vec, self._pos_vec, self._vel_vec)
return Angle(radians=w)
@reify
def tdb_fraction(self):
fr = self.tt_fraction
return fr + tdb_minus_tt(self.whole, fr) / DAY_S
@reify
def true_longitude(self):
Om = self.longitude_of_ascending_node.radians
w = self.argument_of_periapsis.radians
v = self.true_anomaly.radians
l = (Om + w + v)%tau
return Angle(radians=l)
@reify
def eccentric_anomaly(self):
E = eccentric_anomaly(self.true_anomaly.radians,
self.eccentricity,
self.semi_latus_rectum.km)
return Angle(radians=E)
@reify
def mean_motion_per_day(self):
n = mean_motion(self.semi_major_axis.km,
self._mu)
return Angle(radians=n*DAY_S)
@reify
def J(self):
"""Decimal Julian years centered on J2000.0 = TT 2000 January 1 12h."""
return (self.whole - 1721045.0 + self.tt_fraction) / 365.25
@reify
def gast(self):
"""Greenwich Apparent Sidereal Time as decimal hours."""
d_psi, _ = self._nutation_angles_radians
tt = self.tt
# TODO: move this into an eqeq function?
c_terms = equation_of_the_equinoxes_complimentary_terms(tt)
eq_eq = d_psi * cos(self._mean_obliquity_radians) + c_terms
# TODO: constrain to 24 hours?
return self.gmst + eq_eq / tau * 24.0
@reify
def _hours(self):
return self.radians * 24.0 / tau