def sidereal_time(jd, m): ephem = MuserEphem() tt, deltat, ut1offset = ephem.delta_t(jd.tdb) jd_tt = jd.tdb + tt / 86400. jd_ut1 = jd.tdb + ut1offset / 86400. gmst = novas.SiderealTime(jd_ut1, 0.0, deltat, m, 1, 0) if (gmst >= 24.0): gmst -= 24.0 if (gmst < 0.0): gmst += 24.0 return gmst
def compute(self, cobs, cdate='2013-10-10', ctime='0:0:0'): cat = novas.Cat() cat.catalog = 'FK6' cat.starname = self.name cat.starnumber = 1 cat.ra = self.ra cat.dec = self.dec cat.promora = 0.0 cat.promodec = 0.0 cat.parallax = 0.0 cat.radialvelocity = 0.0 JD, mjd = self.ephem.convert_date(cdate, ctime) tt, deltat, ut1offset = self.ephem.delta_t(JD) jd_tt = JD + tt / 86400 jd_ut1 = JD + ut1offset / 86400. loc = novas.On_surface() # Emmen, The Netherlands loc.latitude = float(cobs.latitude) loc.longitude = float(cobs.longitude) loc.height = float(cobs.altitude) loc.temperature = 10.0 loc.pressure = 1010.0 # AppPlanet returns a tuple (RA (h), Decl (deg), Dist (AU)) # See almanac.py eqeq = self.ephem.eq_of_equinox(jd_tt) #fpath = os.path.split(os.path.realpath(__file__))[0] #fpath = os.path.join(self.ephem.env.get_home_dir()+'/data','JPLEPH') # print "FPATH:", fpath fil = novas.EphemOpen() # TopoPlanet returns a tuple (RA (h), Decl (deg), Dist (AU)) obj_tupapp = novas.AppStar(jd_tt, cat, 0) obj_tuptopo = novas.TopoStar(jd_tt, deltat, cat, loc, 0) gast = novas.SiderealTime(jd_ut1, 0.0, deltat, 1, 1, 0) last = gast + float(cobs.longitude) / 15.0 if (last >= 24.0): last -= 24.0 if (last < 0.0): last += 24.0 #theta = era (jd_ut1,0.0); novas.EphemClose() return JD, deltat, eqeq, obj_tupapp, obj_tuptopo, gast, last
def format(obj): "Returns a formatted string" eq_eq = eq_of_equinox(tjd) ast = novas.SiderealTime(math.floor(JD), JD - math.floor(JD), eq_eq) obj_tup = novas.AppPlanet(tjd, obj, earth) sha = 360.0 - obj_tup[0] * 15.0 eadst = (0.0 + obj_tup[2]) * novas.KMAU gha = mod360(sha + 360 * ast / 24.0) gha_s = "%3d %5.2f " % d_to_dm(gha) decl_s = "%3d %5.2f " % d_to_dm(obj_tup[1]) if obj.number == 11: radius = 1737.4 else: radius = 695500.0 sd_s = "%2d %5.2f " % d_to_dm(180 * math.atan(radius / eadst) / math.pi) str_buf = gha_s + decl_s + sd_s return str_buf
def compute(self, cobs, cdate='2013-10-10', ctime='0:0:0'): cat = novas.Cat() cat.catalog = 'STAR' cat.starname = self.name cat.starnumber = 1 cat.ra = self.ra cat.dec = self.dec cat.promora = self.promotionra cat.promodec = self.promotiondec cat.parallax = self.parallax cat.radialvelocity = self.radialvelocity JD, mjd = self.ephem.convert_date(cdate, ctime) tt, deltat, ut1offset = self.ephem.delta_t(JD) jd_tt = JD + tt / 86400 jd_ut1 = JD + ut1offset / 86400. loc = novas.On_surface() # Emmen, The Netherlands loc.latitude = float(cobs.latitude) loc.longitude = float(cobs.longitude) loc.height = float(cobs.altitude) loc.temperature = 10.0 loc.pressure = 1010.0 # AppPlanet returns a tuple (RA (h), Decl (deg), Dist (AU)) # See almanac.py eqeq = self.ephem.eq_of_equinox(jd_tt) # TopoPlanet returns a tuple (RA (h), Decl (deg), Dist (AU)) obj_tupapp = novas.AppStar(jd_tt, cat, 0) obj_tuptopo = novas.TopoStar(jd_tt, cat, deltat, loc, 0) gast = novas.SiderealTime(jd_ut1, 0.0, deltat, 1, 1, 0) last = gast + float(cobs.longitude) / 15.0 if (last >= 24.0): last -= 24.0 if (last < 0.0): last += 24.0 #theta = era (jd_ut1,0.0); return JD, deltat, eqeq, obj_tupapp, obj_tuptopo, gast, last
# Earth earth = novas.Object() earth.type = 0 earth.number = 3 earth.star = cat print "Test 1 AppPlanet returns a tuple (RA (h), Decl (deg), Dist (AU))" # AppPlanet returns a tuple (RA (h), Decl (deg), Dist (AU)) # See almanac.py print "tjd", tjd eqeq = eq_of_equinox(tjd) print "equation of equinox ", eqeq ast = 0.0 deltat = 34.0 eqeq = novas.SiderealTime(math.floor(JD), JD - math.floor(JD), deltat, 1, 1, 0) print "eqeq", eqeq fil = novas.EphemOpen('JPLEPH') obj_tup = novas.AppPlanet(tjd, moon, 0) print obj_tup sha = 360.0 - obj_tup[0] * 15.0 eadst = (0.0 + obj_tup[2]) # * novas.KMAU gha = mod360(sha + 360 * ast / 24.0) gha_s = "%3d %5.2f " % d_to_dm(gha) decl_s = "" # "%3d %5.2f " % d_to_dm(obj_tup[1]) #sd_s = "%2d %5.2f " % d_to_dm(180 * math.atan(moon.radius/eadst)/ math.pi) #str_buf = gha_s + decl_s + sd_s #print str_buf
def compute(self, cobs, cdate='2013-10-10', ctime='0:0:0'): try: cat = novas.Cat() cat.catalog = 'xxx' cat.starname = 'DUMMY' cat.starnumber = 0 cat.ra = 0.0 cat.dec = 0.0 cat.promora = 0.0 cat.promodec = 0.0 cat.parallax = 0.0 cat.radialvelocity = 0.0 fil = novas.EphemOpen() JD, mjd = self.ephem.convert_date(cdate, ctime) tt, deltat, ut1offset = self.ephem.delta_t(JD) jd_tt = JD + tt / 86400 jd_ut1 = JD + ut1offset / 86400. loc = novas.On_surface() # Emmen, The Netherlands loc.latitude = float(cobs.latitude) loc.longitude = float(cobs.longitude) loc.height = float(cobs.altitude) loc.temperature = 10.0 loc.pressure = 1010.0 # Sun sun = novas.Object() sun.type = 0 #print 'NAME:', self.name sun.number = planetmember[self.name.lower()] sun.name = self.name.upper() sun.star = cat # AppPlanet returns a tuple (RA (h), Decl (deg), Dist (AU)) # See almanac.py eqeq = self.ephem.eq_of_equinox(jd_tt) #obj_tup = novas.AppPlanet(tjd, sun, 0) #print obj_tup #sha = 360.0 - obj_tup[0] * 15.0 #eadst = (0.0 + obj_tup[2]) # TopoPlanet returns a tuple (RA (h), Decl (deg), Dist (AU)) obj_tupapp = novas.AppPlanet(jd_tt, sun, 0) obj_tuptopo = novas.TopoPlanet(jd_tt, sun, deltat, loc, 0) gast = novas.SiderealTime(jd_ut1, 0.0, deltat, 1, 1, 0) last = gast + float(cobs.longitude) / 15.0 if (last >= 24.0): last -= 24.0 if (last < 0.0): last += 24.0 #theta = era (jd_ut1,0.0); finally: novas.EphemClose() return JD, deltat, eqeq, obj_tupapp, obj_tuptopo, gast, last