Пример #1
0
def compute_tt_mid(hdrs,debug=False):
    '''Correct a UTC MJD start time to a TT MJD mid time. Also returns the
    TT-UTC offset for later use.'''

    UTC_mid_MJD = hdrs['MJD_UTC'] + (hdrs['EXPTIME'] / 86400.0 / 2.0)
    dtt = S.sla_dtt(UTC_mid_MJD)
    TT_mid_MJD = UTC_mid_MJD + dtt/86400.0
    if debug: print S.sla_dtt(UTC_mid_MJD)
    new_dict = { 'MJD_UTC_mid' : UTC_mid_MJD, 
    	    	 'MJD_TT_mid' : TT_mid_MJD,
		 'TT-UTC' : dtt }
    hdrs.update(new_dict)
    
    return hdrs
Пример #2
0
def datetime2mjd_tdb(date, obsvr_long, obsvr_lat, obsvr_hgt, dbg=False):

    auinkm = 149597870.691
    # Compute MJD_UTC from passed datetime
    mjd_utc = datetime2mjd_utc(date)
    if mjd_utc == None:
        return None

    # Compute MJD_TT
    mjd_tt = mjd_utc2mjd_tt(mjd_utc, dbg)

    # Compute TT->TDB

    # Convert geodetic position to geocentric distance from spin axis (r) and from
    # equatorial plane (z)
    (r, z) = S.sla_geoc(obsvr_lat, obsvr_hgt)

    ut1 = compute_ut1(mjd_utc, dbg)
    if dbg:
        print "UT1=", ut1

    # Compute relativistic clock correction TDB->TT
    tdb_tt = S.sla_rcc(mjd_tt, ut1, -obsvr_long, r * auinkm, z * auinkm)
    if dbg:
        print "(TDB-TT)=", tdb_tt
    if dbg:
        print "(CT-UT)=", S.sla_dtt(mjd_utc) + tdb_tt

    mjd_tdb = mjd_tt + (tdb_tt / 86400.0)

    return mjd_tdb
Пример #3
0
def mjd_utc2mjd_tt(mjd_utc, dbg=False):
    """Converts a MJD in UTC (MJD_UTC) to a MJD in TT (Terrestial Time) which is
    needed for any position/ephemeris-based calculations.
    UTC->TT consists of: UTC->TAI = 10s offset + 26 leapseconds (last one 2015 Jul 1.)
                         TAI->TT  = 32.184s fixed offset"""
    # UTC->TT offset
    tt_utc = S.sla_dtt(mjd_utc)
    if dbg:
        print "TT-UTC(s)=", tt_utc

    # Correct MJD to MJD(TT)
    mjd_tt = mjd_utc + (tt_utc / 86400.0)
    if dbg:
        print "MJD(TT)  =  ", mjd_tt

    return mjd_tt