def test_altaz(jd, planet_name_and_code): """ Tests of generating a full position in altaz coordinates. Uses fixtures to iterate through date pairs and planets to generate individual tests. """ planet_name, planet_code = planet_name_and_code position = c.make_on_surface(45.0, -75.0, 0.0, 10.0, 1010.0) ggr = positionlib.Topos('45 N', '75 W', 0.0, temperature=10.0, pressure=1010.0) ggr.ephemeris = de405 xp = yp = 0.0 obj = c.make_object(0, planet_code, 'planet', None) ra, dec, dis = c.topo_planet(jd.tt, jd.delta_t, obj, position) (zd0, az0), (ra, dec) = c.equ2hor(jd.ut1, jd.delta_t, xp, yp, position, ra, dec) alt0 = 90.0 - zd0 planet = getattr(de405, planet_name) g = ggr(jd) distance = length_of((g - planet(jd)).position.AU) alt, az, d = g.observe(planet).apparent().altaz() eq(az0, az.degrees(), 0.001 * arcsecond_in_degrees) eq(alt0, alt.degrees(), 0.001 * arcsecond_in_degrees) eq(dis, distance, 0.5 * meter)
def test_new_horizontal(timepairs, planets_list): """ Tests of generating a full position in horizontal coordinates. Uses fixtures to iterate through date pairs and planets to generate individual tests. """ jd_tt = timepairs[0] delta_t = timepairs[1] planet_name = planets_list[0] planet_code = planets_list[1] position = c.make_on_surface(45.0, -75.0, 0.0, 10.0, 1010.0) ggr = coordinates.Topos('75 W', '45 N', 0.0, temperature=10.0, pressure=1010.0) ggr.earth = emp.earth ggr.ephemeris = emp xp = yp = 0.0 # replaces the for loop obj = c.make_object(0, planet_code, 'planet', None) ra, dec, dis = c.topo_planet(jd_tt, delta_t, obj, position) jd_ut1 = jd_tt - delta_t / 86400.0 (zd, az), (ra, dec) = c.equ2hor( jd_ut1, delta_t, xp, yp, position, ra, dec, ref_option=0) planet = getattr(emp, planet_name) jd = JulianDate(tt=jd_tt, delta_t=delta_t) h = ggr(jd).observe(planet).apparent().horizontal() eq(zd * TAU / 360.0, h.zd, 0.001 * arcsecond) eq(az * TAU / 360.0, h.az, 0.001 * arcsecond) eq(0.25 * TAU - zd * TAU / 360.0, h.alt, 0.001 * arcsecond) eq(dis, h.distance, 0.001 * meter)
def _compute_local_coords(self, jd): delta_t = jd.tt_minus_ut jd_tt = jd.as_tt() jd_ut1 = jd.as_ut1() rat, dect, dist = topo_planet(jd_tt, delta_t, ss_body=self._sun, position=self._geo_loc) (zd, az), (rar, decr) = equ2hor(jd_ut1, delta_t, xp=0.0, yp=0.0, location = self._geo_loc, ra = rat, dec = dect, ref_option = 2 ) el = 90 - zd return (el,az)
def calc_target_and_sun_zenith_distance(jd, tt, delta_t, lsst_site, target, sun): accuracy = 0 # Full accuracy = 0, reduced accuracy = 1 error = 0 # Coordinates of the CIO with respect to the ITRS pole for 2008 April 24 # to be revised!!!! x_pole = -0.002 y_pole = +0.529 (topo_ra, topo_dec) = topo_star(tt, delta_t, target, lsst_site, accuracy) (zd_target, az_target), (rar, decr) = equ2hor(jd, delta_t, x_pole, y_pole, lsst_site, topo_ra, topo_dec, 0, 0) (topo_sun_ra, topo_sun_dec, sun_dist) = app_planet(tt, sun) (zd_sun, az_sun), (rar1, decr1) = equ2hor(jd, delta_t, x_pole, y_pole, lsst_site, topo_sun_ra, topo_sun_dec, 1, 0) return zd_target, zd_sun
def test_horizontal(self): position = c.make_on_surface(45.0, -75.0, 0.0, 10.0, 1010.0) ggr = coordinates.Topos('75 W', '45 N', 0.0, temperature=10.0, pressure=1010.0) ggr.earth = self.e.earth ggr.ephemeris = self.e xp = yp = 0.0 for (jd_tt, delta_t), name in product([P0, PA, PB], planets_to_test): obj = c.make_object(0, planet_codes[name], 'planet', None) ra, dec, dis = c.topo_planet(jd_tt, delta_t, obj, position) jd_ut1 = jd_tt - delta_t / 86400.0 (zd, az), (ra, dec) = c.equ2hor( jd_ut1, delta_t, xp, yp, position, ra, dec, ref_option=0) planet = getattr(self.e, name) jd = JulianDate(tt=jd_tt, delta_t=delta_t) h = ggr(jd).observe(planet).apparent().horizontal() self.eq(zd * tau / 360.0, h.zd, 0.001 * arcsecond) self.eq(az * tau / 360.0, h.az, 0.001 * arcsecond) self.eq(0.25 * tau - zd * tau / 360.0, h.alt, 0.001 * arcsecond) self.eq(dis, h.distance, 0.001 * meter)
def altaz_maneuver(jd, place, ra, dec, ref=0): """Wrapper that simplifies a complicated USNO call.""" xp = yp = 0.0 (zd, az), (ra, dec) = novas.equ2hor(jd, 0.0, xp, yp, place, ra, dec, ref) return 90.0 - zd, az
def altaz_maneuver(jd, obj, place): """Simplify a pair of complicated USNO calls to a single callable.""" xp = yp = 0.0 ra, dec, distance = novas.topo_planet(jd, 0.0, obj, place) (zd, az), (ra, dec) = novas.equ2hor(jd, 0.0, xp, yp, place, ra, dec) return 90.0 - zd, az