Exemplo n.º 1
0
def V_LSR(RA, dec, dss, timedate):
    """
  Computes the velocity of the local standard of rest w.r.t. the observer
  
  @param ra : J2000 right ascension as a float or as "12h34m56.78s"
  @type  ra : float or str
  
  @param dec : J2000 declination as a float or as "-12d34m56.78s"
  @type  dec : float or str
  
  @param observer : DSN station
  @type  observer : int
  
  @param timedate : date/time of the observation
  @type  timedate : datetime object
  """
    logger.debug("V_LSR: entered with coord types %s and %s", type(RA),
                 type(dec))
    if type(RA) == str and type(dec) == str:
        skypos = coord.SkyCoord(RA, dec, unit=(u.hourangle, u.deg))
    elif type(RA) == float and type(dec) == float:
        skypos = coord.SkyCoord(RA * u.hour, dec * u.degree)
    else:
        raise RuntimeError(RA, dec, "cannot be parsed")
    logger.debug("V_LSR: sky pos: %s", skypos)
    ra2000, dec2000 = skypos.ra.hour, skypos.dec.deg
    logger.debug("V_LSR: J2000 coordinates are %f, %f", ra2000, dec2000)
    sourcename = "%5.2f%+5.2f" % (ra2000, dec2000)
    cat_entry = novas.make_cat_entry(sourcename, "", 0, ra2000, dec2000, 0, 0,
                                     0, 0)
    source = novas.make_object(2, 0, sourcename, cat_entry)
    station = Astronomy.DSN_coordinates.DSS(dss)
    logger.debug("V_LSR: station lat=%f", station.lat * 180 / math.pi)
    logger.debug("V_LSR: station long=%f", station.lon * 180 / math.pi)
    if station.long > math.pi:
        longitude = station.long - 2 * math.pi
    elif station.long < math.pi:
        longitude = station.long + 2 * math.pi
    else:
        longitude = station.long
    observer = novas.make_observer_on_surface(station.lat * 180 / math.pi,
                                              longitude * 180 / math.pi,
                                              station.elev, 0, 0)
    jd = novas.julian_date(timedate.year, timedate.month, timedate.day,
                           timedate.hour + timedate.minute / 60.)
    mjd = DatesTimes.MJD(timedate.year, timedate.month, timedate.day)
    earth = novas.make_object(0, 3, 'Earth', None)
    urthpos, urthvel = novas.ephemeris((jd, 0), earth, origin=0)
    (obspos, obsvel) = novas.geo_posvel(jd, 0, observer, 0)
    totvel = tuple(numpy.array(urthvel) + numpy.array(obsvel))
    (srcpos, srcvel) = novas.starvectors(cat_entry)
    V = novas.rad_vel(source, srcpos, srcvel, totvel, 0, 0, 0)
    logger.debug("V_LSR: velocity of observer w.r.t. Sun= %.2f", V)
    return V + Astronomy.v_sun(mjd, ra2000 / 15., dec2000)
Exemplo n.º 2
0
def output_ephemeris_tests():
    code = 3
    cel_obj = novas.make_object(0, code, 'planet{0}'.format(code), None)

    ssb = 0
    full_accuracy = 0
    jd = T0
    pos, vel = novas.ephemeris([jd, 0], cel_obj, ssb, full_accuracy)

    # TODO: why are two uses of exactly the same ephemeris not agreeing
    # any more closely than 10 meters?

    # TODO: are my units meaningful when comparing the velocity?

    output(locals(), """\

    def test_position_and_velocity(de405, ts):
        t = ts.tt_jd({jd!r})
        e = de405['earth'].at(t)
        compare(e.position.au, {pos!r}, 10 * meter)
        compare(e.velocity.au_per_d, {vel!r}, 1e-5 * meter / one_second)

    """)
def output_ephemeris_tests():
    code = 3
    cel_obj = novas.make_object(0, code, 'planet{0}'.format(code), None)

    ssb = 0
    full_accuracy = 0
    jd = T0
    pos, vel = novas.ephemeris([jd, 0], cel_obj, ssb, full_accuracy)

    # TODO: why are two uses of exactly the same ephemeris not agreeing
    # any more closely than 10 meters?

    # TODO: are my units meaningful when comparing the velocity?

    output(locals(), """\

    def test_position_and_velocity(de405, ts):
        t = ts.tt(jd={jd!r})
        e = de405['earth'].at(t)
        compare(e.position.au, {pos!r}, 10 * meter)
        compare(e.velocity.au_per_d, {vel!r}, 1e-5 * meter / one_second)

    """)
Exemplo n.º 4
0
 dthetaTM_O1 = thetaTM_O1 - thetaM_O1
 #total
 dthetaEM_O2 = thetaEM_O2 - thetaE_O2 - thetaM_O2
 dthetaTM_O2 = thetaTM_O2 - thetaM_O2
 #annular
 dthetaEM_O2A = thetaEM_O2 + thetaE_O2 + thetaM_O2 - math.pi
 dthetaTM_O2A = thetaTM_O2 + thetaM_O2 - math.pi
 O2E_re = math.fabs(O2_Elength - re)  #在地球内部设其值为1
 thetaEM = thetaEM_O1  #上一步的地月夹角,食甚时夹角最小
 thetaTM = thetaTM_O1  #上一步的地月夹角,食甚时夹角最小
 jd_utc += 0.1 / 86400  #每次增加0.1秒
 jd_ut1 = jd_utc + ut1_utc / 86400.0  #ut1
 jd_tt = jd_utc + (leap_second + tt_tai) / 86400.0  #tt
 jd = (jd_tt, 0.0)  #tt代替tdb,差别不大
 jd0 = (jd_tt - ta / 86400, 0.0)  #太阳发出光时的时间
 pos_earth0 = novas.ephemeris(jd0, earth)  #太阳发出光时的地球icrs坐标
 pos_earth = novas.ephemeris(jd, earth)  #太阳到达地球时的地球icrs坐标
 pos_moon0 = novas.ephemeris(jd0, moon)  #太阳发出光时的月球icrs坐标
 pos_moon = novas.ephemeris(jd, moon)  #太阳到达地球时的月球icrs坐标
 vpd_O1EM = 0.0  #O1E和O1M矢量积
 vpd_O1TM = 0.0  #O1T和O1M矢量积
 vpd_O2EM = 0.0  #O2E和O2M矢量积
 vpd_O2TM = 0.0  #O2T和O2M矢量积
 O1_Elength = 0.0  #月球半影锥点到地心距离
 O1_Tlength = 0.0  #月球半影锥点到地球某一点距离
 O1_Mlength = 0.0  #月球半影锥点到月心距离
 O2_Elength = 0.0  #月球全影锥点到地心距离
 O2_Tlength = 0.0  #月球全影锥点到地球某一点距离
 O2_Mlength = 0.0  #月球全影锥点到月心距离
 #ITRS->GCRS
 E_TT = novas.ter2cel(jd_ut1, 0.0, delta_t, x_pole, y_pole, E_T, 1, 0, 0)  #