def precession(cls, tee): """Return the precession at moment tee using 0,0 as J2000 coordinates. Adapted from "Astronomical Algorithms" by Jean Meeus, Willmann-Bell, Inc., 1991.""" c = cls.julian_centuries(tee) eta = mod(poly(c, [0, secs(mpf(47.0029)), secs(mpf(-0.03302)), secs(mpf(0.000060))]), 360) cap_P = mod(poly(c, [mpf(174.876384), secs(mpf(-869.8089)), secs(mpf(0.03536))]), 360) p = mod(poly(c, [0, secs(mpf(5029.0966)), secs(mpf(1.11113)), secs(mpf(0.000006))]), 360) cap_A = cos_degrees(eta) * sin_degrees(cap_P) cap_B = cos_degrees(cap_P) arg = arctan_degrees(cap_A, cap_B) return mod(p + cap_P - arg, 360)
def direction(self, focus): """Return the angle (clockwise from North) to face focus when standing in location, location. Subject to errors near focus and its antipode.""" y = sin_degrees(focus.longitude - self.longitude) x = ((cos_degrees(self.latitude) * tan_degrees(focus.latitude)) - (sin_degrees(self.latitude) * cos_degrees(self.longitude - focus.longitude))) if x == y == 0 or focus.latitude == 90: return 0 elif focus.latitude == -90: return 180 else: return arctan_degrees(y, x)
def right_ascension(cls, tee, beta, lam): """Return right ascension at moment UT 'tee' of object at latitude 'lam' and longitude 'beta'.""" varepsilon = cls.obliquity(tee) return arctan_degrees((sin_degrees(lam) * cos_degrees(varepsilon)) - (tan_degrees(beta) * sin_degrees(varepsilon)), cos_degrees(lam))