Beispiel #1
0
def prenut(epoch, mjd):
    """
    Form the matrix of precession and nutation (IAU1976/fk5)
    
    Inputs:
    - epoch     Julian Epoch for mean coordinates
    - mjd       Modified Julian Date (jd-2400000.5) for true coordinates
    
    Returns:
    - pnMat     the combined precession/nutation matrix, a 3x3 numpy.array.
    
    Notes:
    - The epoch and MJD are TDB (loosely ET).
    - The matrix is in the sense V(true) = pnMat * V(mean)
    """
    precMat = prec(epoch, epj(mjd))

    # Nutation
    nutMat = nut(mjd)

    # Combine the matrices:  pn = N x P
    return numpy.dot(nutMat, precMat)
Beispiel #2
0
def prenut(epoch, mjd):
    """
    Form the matrix of precession and nutation (IAU1976/fk5)
    
    Inputs:
    - epoch     Julian Epoch for mean coordinates
    - mjd       Modified Julian Date (jd-2400000.5) for true coordinates
    
    Returns:
    - pnMat     the combined precession/nutation matrix, a 3x3 numpy.array.
    
    Notes:
    - The epoch and MJD are TDB (loosely ET).
    - The matrix is in the sense V(true) = pnMat * V(mean)
    """
    precMat = prec(epoch, epj(mjd))

    # Nutation
    nutMat = nut(mjd)

    # Combine the matrices:  pn = N x P
    return numpy.dot(nutMat, precMat)
Beispiel #3
0
def evp(tdb, deqx = 0.0):
    """
    Barycentric and heliocentric velocity and position of the Earth
    
    Inputs:
    - tdb   TDB date (loosely et) as a Modified Julian Date
    - deqx  Julian Epoch (e.g. 2000.0) of mean equator and
            equinox of the vectors returned. If deqx <= 0.0,
            all vectors are referred to the mean equator and
            equinox (fk5) of epoch date.
    
    Returns a tuple consisting of (all numpy.array(3)):
    - Barycentric velocity of Earth (au/s)
    - Barycentric position of Earth (au)
    - Heliocentric velocity of Earth (au/s)
    - Heliocentric position of Earth (au)
    
    Accuracy:
    
    The maximum deviations from the JPL DE96 ephemeris are as
    follows:
    
    barycentric velocity    0.42  m/s
    barycentric position    6900  km
    
    heliocentric velocity   0.42  m/s
    heliocentric position   1600  km
    
    This routine is adapted from the barvel and barcor
    subroutines of P.Stumpff, which are described in
    Astron. Astrophys. Suppl. Ser. 41, 1-8 (1980).  Most of the
    changes are merely cosmetic and do not affect the results at
    all.  However, some adjustments have been made so as to give
    results that refer to the new (IAU 1976 'fk5') equinox
    and precession, although the differences these changes make
    relative to the results from Stumpff's original 'fk4' version
    are smaller than the inherent accuracy of the algorithm.  One
    minor shortcoming in the original routines that has not been
    corrected is that better numerical accuracy could be achieved
    if the various polynomial evaluations were nested.  Note also
    that one of Stumpff's precession constants differs by 0.001 arcsec
    from the value given in the Explanatory Supplement to the A.E.
    """
    
    # note: in the original code, E was a shortcut for sorbel[0]
    # and G was a shortcut for forbel[0]

    # time arguments
    t = (tdb-15019.5)/36525.0
    tsq = t*t

    # Values of all elements for the instant date
    forbel = [0.0]*7
    for k in range(8):
        dlocal = fmod(DCFEL[k,0]+t*DCFEL[k,1]+tsq*DCFEL[k,2], TWOPI)
        if k == 0:
            dml = dlocal
        else:
            forbel[k-1] = dlocal
    deps = fmod(DCEPS[0]+t*DCEPS[1]+tsq*DCEPS[2], TWOPI)
    sorbel = [fmod(CCSEL[k,0]+t*CCSEL[k,1]+tsq*CCSEL[k,2], TWOPI)
                for k in range(17)]

    # Secular perturbations in longitude
    sn = [sin(fmod(CCSEC[k,1]+t*CCSEC[k,2], TWOPI))
            for k in range(4)]

    # Periodic perturbations of the emb (Earth-Moon barycentre)
    pertl =  CCSEC[0,0]      *sn[0] +CCSEC[1,0]*sn[1]+  \
        (CCSEC[2,0]+t*CCSEC3)*sn[2] +CCSEC[3,0]*sn[3]
    pertld = 0.0
    pertr = 0.0
    pertrd = 0.0
    for k in range(15):
        A = fmod(DCARGS[k,0]+t*DCARGS[k,1], TWOPI)
        cosa = cos(A)
        sina = sin(A)
        pertl = pertl + CCAMPS[k,0]*cosa+CCAMPS[k,1]*sina
        pertr = pertr + CCAMPS[k,2]*cosa+CCAMPS[k,3]*sina
        if k < 11:
            pertld = pertld+  \
                (CCAMPS[k,1]*cosa-CCAMPS[k,0]*sina)*CCAMPS[k,4]
            pertrd = pertrd+  \
                (CCAMPS[k,3]*cosa-CCAMPS[k,2]*sina)*CCAMPS[k,4]

    # Elliptic part of the motion of the emb
    esq = sorbel[0]*sorbel[0]
    dparam = 1.0-esq
    param = dparam
    twoe = sorbel[0]+sorbel[0]
    twog = forbel[0]+forbel[0]
    phi = twoe*((1.0-esq*0.125)*sin(forbel[0])+sorbel[0]*0.625*sin(twog)  \
        +esq*0.5416667*sin(forbel[0]+twog) )
    F = forbel[0]+phi
    sinf = sin(F)
    cosf = cos(F)
    dpsi = dparam/(1.0+(sorbel[0]*cosf))
    phid = twoe*CCSGD*((1.0+esq*1.5)*cosf+sorbel[0]*(1.25-sinf*sinf*0.5))
    psid = CCSGD*sorbel[0]*sinf/sqrt(param)

    # Perturbed heliocentric motion of the emb
    d1pdro = 1.0+pertr
    drd = d1pdro*(psid+dpsi*pertrd)
    drld = d1pdro*dpsi*(DCSLD+phid+pertld)
    dtl = fmod(dml+phi+pertl, TWOPI)
    dsinls = sin(dtl)
    dcosls = cos(dtl)
    dxhd = drd*dcosls-drld*dsinls
    dyhd = drd*dsinls+drld*dcosls

    # Influence of eccentricity, evection and variation on the
    # geocentric motion of the Moon
    pertl = 0.0
    pertld = 0.0
    pertp = 0.0
    pertpd = 0.0
    for k in range(3):
        A = fmod(DCARGM[k,0]+t*DCARGM[k,1], TWOPI)
        sina = sin(A)
        cosa = cos(A)
        pertl = pertl +CCAMPM[k,0]*sina
        pertld = pertld+CCAMPM[k,1]*cosa
        pertp = pertp +CCAMPM[k,2]*cosa
        pertpd = pertpd-CCAMPM[k,3]*sina

    # Heliocentric motion of the Earth
    tl = forbel[1]+pertl
    sinlm = sin(tl)
    coslm = cos(tl)
    sigma = CCKM/(1.0+pertp)
    A = sigma*(CCMLD+pertld)
    B = sigma*pertpd
    dxhd = dxhd+(A*sinlm)+(B*coslm)
    dyhd = dyhd-(A*coslm)+(B*sinlm)
    dzhd =    -(sigma*CCFDI*cos(forbel[2]))

    # Barycentric motion of the Earth
    dxbd = dxhd*DC1MME
    dybd = dyhd*DC1MME
    dzbd = dzhd*DC1MME
    sinlp = [0.0] * 4
    coslp = [0.0] * 4
    for k in range(4):
        plon = forbel[k+3]
        pomg = sorbel[k+1]
        pecc = sorbel[k+9]
        tl = fmod(plon+2.0*pecc*sin(plon-pomg), TWOPI)
        sinlp[k] = sin(tl)
        coslp[k] = cos(tl)
        dxbd = dxbd+(CCPAMV[k]*(sinlp[k]+pecc*sin(pomg)))
        dybd = dybd-(CCPAMV[k]*(coslp[k]+pecc*cos(pomg)))
        dzbd = dzbd-(CCPAMV[k]*sorbel[k+13]*cos(plon-sorbel[k+5]))

    # Transition to mean equator of date
    dcosep = cos(deps)
    dsinep = sin(deps)
    dyahd = dcosep*dyhd-dsinep*dzhd
    dzahd = dsinep*dyhd+dcosep*dzhd
    dyabd = dcosep*dybd-dsinep*dzbd
    dzabd = dsinep*dybd+dcosep*dzbd

    # Heliocentric coordinates of the Earth
    dr = dpsi*d1pdro
    flatm = CCIM*sin(forbel[2])
    A = sigma*cos(flatm)
    dxh = dr*dcosls-(A*coslm)
    dyh = dr*dsinls-(A*sinlm)
    dzh =   -(sigma*sin(flatm))

    # Barycentric coordinates of the Earth
    dxb = dxh*DC1MME
    dyb = dyh*DC1MME
    dzb = dzh*DC1MME
    for k in range(4):
        flat = sorbel[k+13]*sin(forbel[k+3]-sorbel[k+5])
        A = CCPAM[k]*(1.0-sorbel[k+9]*cos(forbel[k+3]-sorbel[k+1]))
        B = A*cos(flat)
        dxb = dxb-(B*coslp[k])
        dyb = dyb-(B*sinlp[k])
        dzb = dzb-(A*sin(flat))

    # Transition to mean equator of date
    dyah = dcosep*dyh-dsinep*dzh
    dzah = dsinep*dyh+dcosep*dzh
    dyab = dcosep*dyb-dsinep*dzb
    dzab = dsinep*dyb+dcosep*dzb

    # Copy result components into vectors, correcting for fk4 equinox
    depj=epj(tdb)
    deqcor = DS2R*(0.035+0.00085*(depj-B1950))
    helVel = numpy.array((
        dxhd-deqcor*dyahd,
        dyahd+deqcor*dxhd,
        dzahd,
    ))
    barVel = numpy.array((
        dxbd-deqcor*dyabd,
        dyabd+deqcor*dxbd,
        dzabd,
    ))
    helPos = numpy.array((
        dxh-deqcor*dyah,
        dyah+deqcor*dxh,
        dzah,
    ))
    barPos = numpy.array((
        dxb-deqcor*dyab,
        dyab+deqcor*dxb,
        dzab,
    ))

    # Was precession to another equinox requested?
    if deqx > 0.0:

        # Yes: compute precession matrix from mjd date to Julian epoch deqx
        dprema = prec(depj,deqx)
    
        # Rotate helVel
        helVel = numpy.dot(dprema, helVel)
    
        # Rotate barVel
        barVel = numpy.dot(dprema, barVel)
    
        # Rotate helPos
        helPos = numpy.dot(dprema, helPos)
    
        # Rotate barPos
        barPos = numpy.dot(dprema, barPos)
    
    return (barVel, barPos, helVel, helPos)
Beispiel #4
0
def mappa(eq, tdb):
    """
    Compute star-independent parameters in preparation for
    conversions between mean place and geocentric apparent place.
    
    The parameters produced by this routine are required in the
    parallax, light deflection, aberration, and precession/nutation
    parts of the mean/apparent transformations.
    
    The reference frames and timescales used are post IAU 1976.
    
    Inputs:
    - eq    epoch of mean equinox to be used (Julian)
    - tdb   TDB as a modified Julian date (JD-2400000.5)
    
    Returned a tuple containing the following
    star-independent mean-to-apparent parameters:
    - time interval for proper motion (Julian years)
    - barycentric position of the Earth (au)
    - heliocentric direction of the Earth (unit vector)
    - (grav rad Sun)*2/(Sun-Earth distance)
    - bvc: barycentric velocity of Earth in units of c
    - sqrt(1-v**2) where v=modulus(bvc)
    - precession/nutation (3,3) matrix
    
    References:
    1984 Astronomical Almanac, pp b39-b41.
    (also Lederle & Schwan, Astron. Astrophys. 134,
    1-6, 1984)
    
    Notes:
    
    1)  For tdb, the distinction between the required TDB and TT
    is always negligible.  Moreover, for all but the most
    critical applications UTC is adequate.
    
    2)  The accuracy of the routines using the parameters amprms is
    limited by the routine EVP, used here to compute the
    Earth position and velocity by the methods of Stumpff.
    The maximum error in the resulting aberration corrections is
    about 0.3 milliarcsecond.
    
    3)  The barycentric position of the Earth and
    heliocentric direction of the Earth are referred to
    the mean equinox and equator of epoch eq.
    """
    # Get Earth barycentric and heliocentric position and velocity
    bVel, bPos, hVel, hPos = evp(tdb, eq)

    # Heliocentric direction of earth (normalised) and modulus
    hDir, hDist = vn(hPos)

    # Aberration parameters
    vbc = bVel * _CR
    vbcDir, vbcMag = vn(vbc)

    return (
        # Time interval for proper motion correction (years)
        epj(tdb) - eq,

        # Barycentric position of Earth (au)
        bPos,

        # Heliocentric direction of earth
        hDir,

        # Light deflection parameter
        _GR2 / hDist,

        # Barycentric velocity of Earth, in units of C
        vbc,

        # sqrt(1-v**2) where v=modulus(bvc)
        sqrt(1.0 - (vbcMag * vbcMag)),

        # Precession/nutation matrix
        prenut(eq, tdb),
    )
Beispiel #5
0
def mappa (eq, tdb):
    """
    Compute star-independent parameters in preparation for
    conversions between mean place and geocentric apparent place.
    
    The parameters produced by this routine are required in the
    parallax, light deflection, aberration, and precession/nutation
    parts of the mean/apparent transformations.
    
    The reference frames and timescales used are post IAU 1976.
    
    Inputs:
    - eq    epoch of mean equinox to be used (Julian)
    - tdb   TDB as a modified Julian date (JD-2400000.5)
    
    Returned a tuple containing the following
    star-independent mean-to-apparent parameters:
    - time interval for proper motion (Julian years)
    - barycentric position of the Earth (au)
    - heliocentric direction of the Earth (unit vector)
    - (grav rad Sun)*2/(Sun-Earth distance)
    - bvc: barycentric velocity of Earth in units of c
    - sqrt(1-v**2) where v=modulus(bvc)
    - precession/nutation (3,3) matrix
    
    References:
    1984 Astronomical Almanac, pp b39-b41.
    (also Lederle & Schwan, Astron. Astrophys. 134,
    1-6, 1984)
    
    Notes:
    
    1)  For tdb, the distinction between the required TDB and TT
    is always negligible.  Moreover, for all but the most
    critical applications UTC is adequate.
    
    2)  The accuracy of the routines using the parameters amprms is
    limited by the routine EVP, used here to compute the
    Earth position and velocity by the methods of Stumpff.
    The maximum error in the resulting aberration corrections is
    about 0.3 milliarcsecond.
    
    3)  The barycentric position of the Earth and
    heliocentric direction of the Earth are referred to
    the mean equinox and equator of epoch eq.
    """
    # Get Earth barycentric and heliocentric position and velocity
    bVel, bPos, hVel, hPos = evp(tdb, eq)

    # Heliocentric direction of earth (normalised) and modulus
    hDir, hDist = vn(hPos)

    # Aberration parameters
    vbc = bVel * _CR
    vbcDir, vbcMag = vn(vbc)

    return (
        # Time interval for proper motion correction (years)
        epj(tdb)-eq,
    
        # Barycentric position of Earth (au)
        bPos,
    
        # Heliocentric direction of earth
        hDir,

        # Light deflection parameter
        _GR2/hDist,
        
        # Barycentric velocity of Earth, in units of C
        vbc,
        
        # sqrt(1-v**2) where v=modulus(bvc)
        sqrt(1.0 - (vbcMag * vbcMag)),
    
        # Precession/nutation matrix
        prenut(eq,tdb),
    )