コード例 #1
0
ファイル: retriever.py プロジェクト: danisla/PebbleMars
def getOwlt(utc_time):
	'''Uses novas module to compute One Way Light Time at given UTC time.'''
	jd_start, jd_end, number = eph_manager.ephem_open()
	jd_tt = novas.julian_date(utc_time.tm_year, utc_time.tm_mon, utc_time.tm_mday, utc_time.tm_hour) 
	mars = novas.make_object(0, 4, 'Mars', None)
	ra, dec, dis = novas.astro_planet(jd_tt, mars)
	au_sec = 499.0047838061 # Light-time for one astronomical unit (AU) in seconds, from DE-405
	owlt = dis * au_sec
	return owlt
コード例 #2
0
ファイル: nova_test.py プロジェクト: kinketu/Astronomy
def print_planet(planet_name, planet_num):
    # make_object(type, number, name, star)
    # type = 0;major planet, Pluto, Sun, or Moon
    # type = 1; minor planet
    # type = 2; object located outside the soloar system
    # number; Mercury = 1, ..., Pluto = 9, Sun = 10, Moon = 11
    print planet_name
    planet = novas.make_object(0, planet_num, planet_name, None)
    ra, dec, dis = novas.astro_planet(jd_tt, planet)
    print 'R.A. %d:%02f' % (ra, abs(ra) % 1. * 60.)
    print 'dec. %d:%02f' % (dec, abs(dec) % 1. * 60.)
    print 'distance %f AU' % (dis,)
コード例 #3
0
    def test_astro_planet(self):

        for jd_tt, name in product([T0, TA, TB], planets_to_test):
            obj = c.make_object(0, planet_codes[name], 'planet', None)
            ra, dec, dis = c.astro_planet(jd_tt, obj)

            earth = self.e.earth
            planet = getattr(self.e, name)
            jd = JulianDate(tt=jd_tt)
            g = planet.observe_from(earth(jd)).astrometric()

            self.eq(ra * tau / 24.0, g.ra, 0.001 * arcsecond)
            self.eq(dec * tau / 360.0, g.dec, 0.001 * arcsecond)
            self.eq(dis, g.distance, 0.001 * meter)
コード例 #4
0
def test_astro_planet(jd, planet_name_and_code):
    planet_name, planet_code = planet_name_and_code

    obj = c.make_object(0, planet_code, 'planet', None)
    ra0, dec0, distance0 = c.astro_planet(jd.tt, obj)

    earth = de405.earth
    planet = getattr(de405, planet_name)
    e = earth(jd)
    distance = length_of((e - planet(jd)).position.AU)
    ra, dec, d = e.observe(planet).radec()

    eq(ra0, ra.hours(), 1e-3 * arcsecond_in_hours)
    eq(dec0, dec.degrees(), 1e-3 * arcsecond_in_degrees)
    eq(distance0, distance, 0.5 * meter)
コード例 #5
0
def test_astro_planet(timepairs, planets_list):
    jd_tt = timepairs[0]
    planet_name = planets_list[0]
    planet_code = planets_list[1]
    
    obj = c.make_object(0, planet_code, 'planet', None)
    ra, dec, dis = c.astro_planet(jd_tt, obj)
    
    earth = emp.earth
    planet = getattr(emp, planet_name)
    jd = JulianDate(tt=jd_tt)
    g = planet.observe_from(earth(jd)).astrometric()
    
    eq(ra * TAU / 24.0, g.ra, 0.001 * arcsecond)
    eq(dec * TAU / 360.0, g.dec, 0.001 * arcsecond)
    eq(dis, g.distance, 0.001 * meter)