Esempio n. 1
0
    def mean_longitude_perigee(self, jd):
        """Return mean longitude of lunar perigee

        """
        T = jd_to_jcent(jd)
        X = polynomial(
            (d_to_r(83.3532465), d_to_r(4069.0137287), d_to_r(-0.0103200),
             d_to_r(-1. / 80053), d_to_r(1. / 18999000)), T)
        return modpi2(X)
Esempio n. 2
0
    def mean_longitude_perigee(self, jd):
        """Return mean longitude of lunar perigee

        """
        T = jd_to_jcent(jd)
        X = polynomial(
            (d_to_r(83.3532465), 
             d_to_r(4069.0137287), 
             d_to_r(-0.0103200), 
             d_to_r(-1./80053), 
             d_to_r(1./18999000)
            ), 
            T)
        return modpi2(X)
Esempio n. 3
0
def nutation_in_obliquity(jd):
    """Return the nutation in obliquity.

    High precision. [Meeus-1998: pg 144]

    Arguments:
      - `jd` : Julian Day in dynamical time

    Returns:
      - nutation in obliquity, in radians

    """
    #
    # Future optimization: factor the /1e5 and /1e6 adjustments into the table.
    #
    # Could turn the loop into a generator expression. Too messy?
    #
    T = jd_to_jcent(jd)
    D, M, M1, F, omega = _constants(T)
    deltaEps = 0.0
    for tD, tM, tM1, tF, tomega, tpsiK, tpsiT, tepsK, tepsT in _tbl:
        arg = D*tD + M*tM + M1*tM1 + F*tF + omega*tomega
        deltaEps = deltaEps + (tepsK/10000.0 +
                               tepsT/100000.0 * T) * np.cos(arg)
    deltaEps = deltaEps / 3600
    deltaEps = d_to_r(deltaEps)
    return deltaEps
Esempio n. 4
0
def equinox_approx(yr, season):
    """Returns the approximate time of a solstice or equinox event.
    
    The year must be in the range -1000...3000. Within that range the
    the error from the precise instant is at most 2.16 minutes.
    
    Parameters:
        yr     : year
        season : one of ("spring", "summer", "autumn", "winter")
    
    Returns:
        Julian Day of the event in dynamical time
    
    """
    if not (-1000 <= yr <= 3000):
        raise Error, "year is out of range"
    if season not in astronomia.globals.season_names:
        raise Error, "unknown season =" + season
        
    yr = int(yr)
    if -1000 <= yr <= 1000:
        Y = yr / 1000.0
        tbl = _approx_1000
    else:
        Y = (yr - 2000) / 1000.0
        tbl = _approx_3000

    jd = polynomial(tbl[season], Y)
    T = jd_to_jcent(jd)
    W = d_to_r(35999.373 * T - 2.47)
    delta_lambda = 1 + 0.0334 * cos(W) + 0.0007 * cos(2 * W)

    jd += 0.00001 * sum([A * cos(B + C * T) for A, B, C in _terms]) / delta_lambda

    return jd
Esempio n. 5
0
    def _latitude(self, jd):
        """Return the geocentric ecliptic latitude in radians.

        A subset of the logic in dimension3()

        """
        T = jd_to_jcent(jd)
        L1, D, M, M1, F, A1, A2, A3, E, E2 = _constants(T)

        bsum = 0.0
        for tD, tM, tM1, tF, tb in _tblB:
            arg = tD * D + tM * M + tM1 * M1 + tF * F
            if abs(tM) == 1:
                tb *= E
            elif abs(tM) == 2:
                tb *= E2
            bsum += tb * sin(arg)

        bsum += -2235 * sin(L1) +      \
                  382 * sin(A3) +      \
                  175 * sin(A1 - F) +  \
                  175 * sin(A1 + F) +  \
                  127 * sin(L1 - M1) - \
                  115 * sin(L1 + M1)

        latitude = d_to_r(bsum / 1000000)
        return latitude
Esempio n. 6
0
def nut_in_lon(jd):
    """Return the nutation in longitude. 
    
    High precision. [Meeus-1998: pg 144]
    
    Parameters:
        jd : Julian Day in dynamical time
        
    Returns:
        nutation in longitude, in radians
    
    """
    # 
    # Future optimization: factor the /1e5 and /1e6 adjustments into the table.
    #
    # Could turn the loop into a generator expression. Too messy?
    #
    T = jd_to_jcent(jd)
    D, M, M1, F, omega = _constants(T)
    deltaPsi = 0.0
    for tD, tM, tM1, tF, tomega, tpsiK, tpsiT, tepsK, tepsT in _tbl:
        arg = D*tD + M*tM + M1*tM1 + F*tF + omega*tomega
        deltaPsi += (tpsiK/10000.0 + tpsiT/100000.0 * T) * sin(arg)

    deltaPsi /= 3600
    deltaPsi = d_to_r(deltaPsi)
    return deltaPsi
Esempio n. 7
0
def nutation_in_longitude(jd):
    """Return the nutation in longitude.

    High precision. [Meeus-1998: pg 144]

    Arguments:
      - `jd` : Julian Day in dynamical time

    Returns:
      - nutation in longitude, in radians

    """
    #
    # Future optimization: factor the /1e5 and /1e6 adjustments into the table.
    #
    # Could turn the loop into a generator expression. Too messy?
    #
    T = jd_to_jcent(jd)
    D, M, M1, F, omega = _constants(T)
    deltaPsi = 0.0
    for tD, tM, tM1, tF, tomega, tpsiK, tpsiT, tepsK, tepsT in _tbl:
        arg = D * tD + M * tM + M1 * tM1 + F * tF + omega * tomega
        deltaPsi += (tpsiK / 10000.0 + tpsiT / 100000.0 * T) * np.sin(arg)

    deltaPsi /= 3600
    deltaPsi = d_to_r(deltaPsi)
    return deltaPsi
Esempio n. 8
0
def nut_in_obl(jd):
    """Return the nutation in obliquity. 
    
    High precision. [Meeus-1998: pg 144]
    
    Parameters:
        jd : Julian Day in dynamical time
        
    Returns:
        nutation in obliquity, in radians

    """
    # 
    # Future optimization: factor the /1e5 and /1e6 adjustments into the table.
    #
    # Could turn the loop into a generator expression. Too messy?
    #
    T = jd_to_jcent(jd)
    D, M, M1, F, omega = _constants(T)
    deltaEps = 0.0;
    for tD, tM, tM1, tF, tomega, tpsiK, tpsiT, tepsK, tepsT in _tbl:
        arg = D*tD + M*tM + M1*tM1 + F*tF + omega*tomega
        deltaEps = deltaEps + (tepsK/10000.0 + tepsT/100000.0 * T) * cos(arg)
    deltaEps = deltaEps / 3600
    deltaEps = d_to_r(deltaEps)
    return deltaEps
Esempio n. 9
0
    def _latitude(self, jd):
        """Return the geocentric ecliptic latitude in radians.

        A subset of the logic in dimension3()

        """
        T = jd_to_jcent(jd)
        L1, D, M, M1, F, A1, A2, A3, E, E2 = _constants(T)

        bsum = 0.0
        for tD, tM, tM1, tF, tb in _tblB:
            arg = tD * D + tM * M + tM1 * M1 + tF * F
            if abs(tM) == 1:
                tb *= E
            elif abs(tM) == 2:
                tb *= E2
            bsum += tb * sin(arg)

        bsum += -2235 * sin(L1) +      \
                  382 * sin(A3) +      \
                  175 * sin(A1 - F) +  \
                  175 * sin(A1 + F) +  \
                  127 * sin(L1 - M1) - \
                  115 * sin(L1 + M1)

        latitude = d_to_r(bsum / 1000000)
        return latitude
Esempio n. 10
0
    def mean_longitude_ascending_node(self, jd):
        """Return mean longitude of ascending node

        Another equation from:
            *  This routine is part of the International Astronomical Union's
            *  SOFA (Standards of Fundamental Astronomy) software collection.
            *  Fundamental (Delaunay) arguments from Simon et al. (1994)
        *  Arcseconds to radians
           DOUBLE PRECISION DAS2R
           PARAMETER ( DAS2R = 4.848136811095359935899141D-6 )

        *  Milliarcseconds to radians
           DOUBLE PRECISION DMAS2R
           PARAMETER ( DMAS2R = DAS2R / 1D3 )

        *  Arc seconds in a full circle
           DOUBLE PRECISION TURNAS
           PARAMETER ( TURNAS = 1296000D0 )

        *  Mean longitude of the ascending node of the Moon.
           OM  = MOD ( 450160.398036D0  -6962890.5431D0*T, TURNAS ) * DAS2R

        Current implemention in astronomia is from:
            PJ Naughter (Web: www.naughter.com, Email: [email protected])

            Look in nutation.py for calculation of omega
            _ko  = (d_to_r(125.04452), d_to_r( -1934.136261), d_to_r( 0.0020708), d_to_r( 1.0/450000))
            Though the last term was left off...
            Will have to incorporate better...
        """

        T = jd_to_jcent(jd)
        X = polynomial(
            (d_to_r(125.0445479), 
             d_to_r(-1934.1362891), 
             d_to_r(0.0020754), 
             d_to_r(1.0/467441.0), 
             d_to_r(1.0/60616000.0)
            ), 
            T)
        return modpi2(X)
Esempio n. 11
0
    def mean_longitude(self, jd):
        """Return mean longitude.
        
        Parameters:
            jd : Julian Day in dynamical time

        Returns:
            Longitude in radians
                
        """
        T = jd_to_jcent(jd)

        # From astrolabe
        #X = polynomial((d_to_r(100.466457), d_to_r(36000.7698278), d_to_r(0.00030322), d_to_r(0.000000020)), T)

        # From AA, Naughter
        # Takes T/10.0
        X = polynomial((d_to_r(100.4664567), d_to_r(360007.6982779), d_to_r(0.03032028), d_to_r(1.0/49931), d_to_r(-1.0/15300), d_to_r(-1.0/2000000)), T/10.0)

        X = modpi2(X + pi)
        return X
Esempio n. 12
0
    def mean_longitude(self, jd):
        """Return mean longitude.

        Arguments:
          - `jd` : Julian Day in dynamical time

        Returns:
          - Longitude in radians

        """
        jd = np.atleast_1d(jd)
        T = jd_to_jcent(jd)

        # From astrolabe
        #X = polynomial((d_to_r(100.466457),
        #                d_to_r(36000.7698278),
        #                d_to_r(0.00030322),
        #                d_to_r(0.000000020)), T)

        # From AA, Naughter
        # Takes T/10.0
        X = polynomial(
            (d_to_r(100.4664567), d_to_r(360007.6982779), d_to_r(0.03032028),
             d_to_r(1.0 / 49931), d_to_r(-1.0 / 15300), d_to_r(
                 -1.0 / 2000000)), T / 10.0)

        X = modpi2(X + np.pi)
        return _scalar_if_one(X)
Esempio n. 13
0
    def mean_longitude(self, jd):
        """Return mean longitude.

        Arguments:
          - `jd` : Julian Day in dynamical time

        Returns:
          - Longitude in radians

        """
        jd = np.atleast_1d(jd)
        T = jd_to_jcent(jd)

        # From astrolabe
        #X = polynomial((d_to_r(100.466457),
        #                d_to_r(36000.7698278),
        #                d_to_r(0.00030322),
        #                d_to_r(0.000000020)), T)

        # From AA, Naughter
        # Takes T/10.0
        X = polynomial((d_to_r(100.4664567),
                        d_to_r(360007.6982779),
                        d_to_r(0.03032028),
                        d_to_r(1.0/49931),
                        d_to_r(-1.0/15300),
                        d_to_r(-1.0/2000000)), T/10.0)

        X = modpi2(X + np.pi)
        return _scalar_if_one(X)
Esempio n. 14
0
    def mean_longitude_ascending_node(self, jd):
        """Return mean longitude of ascending node

        Another equation from:
            *  This routine is part of the International Astronomical Union's
            *  SOFA (Standards of Fundamental Astronomy) software collection.
            *  Fundamental (Delaunay) arguments from Simon et al. (1994)
        *  Arcseconds to radians
           DOUBLE PRECISION DAS2R
           PARAMETER ( DAS2R = 4.848136811095359935899141D-6 )

        *  Milliarcseconds to radians
           DOUBLE PRECISION DMAS2R
           PARAMETER ( DMAS2R = DAS2R / 1D3 )

        *  Arc seconds in a full circle
           DOUBLE PRECISION TURNAS
           PARAMETER ( TURNAS = 1296000D0 )

        *  Mean longitude of the ascending node of the Moon.
           OM  = MOD ( 450160.398036D0  -6962890.5431D0*T, TURNAS ) * DAS2R

        Current implemention in astronomia is from:
            PJ Naughter (Web: www.naughter.com, Email: [email protected])

            Look in nutation.py for calculation of omega
            _ko  = (d_to_r(125.04452), d_to_r( -1934.136261), d_to_r( 0.0020708), d_to_r( 1.0/450000))
            Though the last term was left off...
            Will have to incorporate better...
        """

        T = jd_to_jcent(jd)
        X = polynomial(
            (d_to_r(125.0445479), d_to_r(-1934.1362891), d_to_r(0.0020754),
             d_to_r(1.0 / 467441.0), d_to_r(1.0 / 60616000.0)), T)
        return modpi2(X)
Esempio n. 15
0
    def mean_longitude_perigee(self, jd):
        """Return mean longitude of solar perigee.
        
        Parameters:
            jd : Julian Day in dynamical time

        Returns:
            Longitude of solar perigee in radians
                
        """
        T = jd_to_jcent(jd)

        X = polynomial((1012395.0, 6189.03, 1.63, 0.012), (T + 1)) / 3600.0
        X = d_to_r(X)

        X = modpi2(X)
        return X
Esempio n. 16
0
def sidereal_time_greenwich(jd):
    """Return the mean sidereal time at Greenwich.

    The Julian Day number must represent Universal Time.

    Parameters:
        jd : Julian Day number

    Return:
        sidereal time in radians (2pi radians = 24 hrs)

    """
    T = jd_to_jcent(jd)
    T2 = T * T
    T3 = T2 * T
    theta0 = 280.46061837 + 360.98564736629*(jd - 2451545.0) + 0.000387933*T2 - T3/38710000
    result = d_to_r(theta0)
    return modpi2(result)
Esempio n. 17
0
def sidereal_time_greenwich(julian_day):
    """Return the mean sidereal time at Greenwich.

    The Julian Day number must represent Universal Time.

    Arguments:
      - `julian_day` : (int) Julian Day number

    Returns:
      - sidereal time in radians : (float) 2pi radians = 24 hours

    """
    T = jd_to_jcent(julian_day)
    T2 = T * T
    T3 = T2 * T
    theta0 = 280.46061837 + 360.98564736629 * (julian_day - 2451545.0) + 0.000387933 * T2 - T3 / 38710000
    result = d_to_r(theta0)
    return modpi2(result)
Esempio n. 18
0
    def mean_longitude_perigee(self, jd):
        """Return mean longitude of solar perigee.

        Arguments:
          - `jd` : Julian Day in dynamical time

        Returns:
          - Longitude of solar perigee in radians

        """
        jd = np.atleast_1d(jd)
        T = jd_to_jcent(jd)

        X = polynomial((1012395.0, 6189.03, 1.63, 0.012), (T + 1)) / 3600.0
        X = d_to_r(X)

        X = modpi2(X)
        return _scalar_if_one(X)
Esempio n. 19
0
def sidereal_time_greenwich(jd):
    """Return the mean sidereal time at Greenwich.

    The Julian Day number must represent Universal Time.

    Parameters:
        jd : Julian Day number

    Return:
        sidereal time in radians (2pi radians = 24 hrs)

    """
    T = jd_to_jcent(jd)
    T2 = T * T
    T3 = T2 * T
    theta0 = 280.46061837 + 360.98564736629 * (
        jd - 2451545.0) + 0.000387933 * T2 - T3 / 38710000
    result = d_to_r(theta0)
    return modpi2(result)
Esempio n. 20
0
    def mean_longitude_perigee(self, jd):
        """Return mean longitude of solar perigee.

        Arguments:
          - `jd` : Julian Day in dynamical time

        Returns:
          - Longitude of solar perigee in radians

        """
        jd = np.atleast_1d(jd)
        T = jd_to_jcent(jd)

        X = polynomial((1012395.0,
                        6189.03,
                        1.63,
                        0.012), (T + 1))/3600.0
        X = d_to_r(X)

        X = modpi2(X)
        return _scalar_if_one(X)
Esempio n. 21
0
    def _longitude(self, jd):
        """Return the geocentric ecliptic longitude in radians.
        """
        from astronomia.nutation import nutation_in_longitude

        T = jd_to_jcent(jd)
        L1, D, M, M1, F, A1, A2, A3, E, E2 = _constants(T)
        lsum = 0.0
        for tD, tM, tM1, tF, tl, tr in _tblLR:
            arg = tD * D + tM * M + tM1 * M1 + tF * F
            if abs(tM) == 1:
                tl *= E
            elif abs(tM) == 2:
                tl *= E2
            lsum += tl * np.sin(arg)

        lsum += 3958 * np.sin(A1) + 1962 * np.sin(L1 - F) + 318 * np.sin(A2)

        nutinlong = nutation_in_longitude(jd)
        longitude = L1 + d_to_r(lsum / 1000000) + nutinlong
        return longitude
Esempio n. 22
0
    def mean_longitude_perigee(self, jd):
        """Return mean longitude of solar perigee.
        
        Parameters:
            jd : Julian Day in dynamical time

        Returns:
            Longitude of solar perigee in radians
                
        """
        T = jd_to_jcent(jd)

        X = polynomial((1012395.0, 
                        6189.03  ,
                        1.63     , 
                        0.012    ), (T + 1))/3600.0
        X = d_to_r(X)


        X = modpi2(X)
        return X
Esempio n. 23
0
def sidereal_time_greenwich(julian_day):
    """Return the mean sidereal time at Greenwich.

    The Julian Day number must represent Universal Time.

    Arguments:
      - `julian_day` : (int) Julian Day number

    Returns:
      - sidereal time in radians : (float) 2pi radians = 24 hours

    """
    T = jd_to_jcent(julian_day)
    T2 = T * T
    T3 = T2 * T
    theta0 = 280.46061837 + \
        360.98564736629*(julian_day - 2451545.0) + \
        0.000387933*T2 - \
        T3/38710000
    result = d_to_r(theta0)
    return modpi2(result)
Esempio n. 24
0
    def _longitude(self, jd):
        """Return the geocentric ecliptic longitude in radians.
        """
        from astronomia.nutation import nutation_in_longitude

        T = jd_to_jcent(jd)
        L1, D, M, M1, F, A1, A2, A3, E, E2 = _constants(T)
        lsum = 0.0
        for tD, tM, tM1, tF, tl, tr in _tblLR:
            arg = tD * D + tM * M + tM1 * M1 + tF * F
            if abs(tM) == 1:
                tl *= E
            elif abs(tM) == 2:
                tl *= E2
            lsum += tl * np.sin(arg)

        lsum += 3958*np.sin(A1) + 1962*np.sin(L1 - F) + 318*np.sin(A2)

        nutinlong = nutation_in_longitude(jd)
        longitude = L1 + d_to_r(lsum / 1000000) + nutinlong
        return longitude
Esempio n. 25
0
def equinox_approx(yr, season):
    """Returns the approximate time of a solstice or equinox event.
    
    The year must be in the range -1000...3000. Within that range the
    the error from the precise instant is at most 2.16 minutes.
    
    Parameters:
        yr     : year
        season : one of ("spring", "summer", "autumn", "winter")
    
    Returns:
        Julian Day of the event in dynamical time
    
    """
    if not (-1000 <= yr <= 3000):
        raise Error, "year is out of range"
    if season not in astronomia.globals.season_names:
        raise Error, "unknown season =" + season

    yr = int(yr)
    if -1000 <= yr <= 1000:
        Y = yr / 1000.0
        tbl = _approx_1000
    else:
        Y = (yr - 2000) / 1000.0
        tbl = _approx_3000

    jd = polynomial(tbl[season], Y)
    T = jd_to_jcent(jd)
    W = d_to_r(35999.373 * T - 2.47)
    delta_lambda = 1 + 0.0334 * cos(W) + 0.0007 * cos(2 * W)

    jd += 0.00001 * sum([A * cos(B + C * T)
                         for A, B, C in _terms]) / delta_lambda

    return jd
Esempio n. 26
0
    def _longitude(self, jd):
        """Return the geocentric ecliptic longitude in radians.

        A subset of the logic in dimension3()

        """
        T = jd_to_jcent(jd)
        L1, D, M, M1, F, A1, A2, A3, E, E2 = _constants(T)

        lsum = 0.0
        for tD, tM, tM1, tF, tl, tr in _tblLR:
            arg = tD * D + tM * M + tM1 * M1 + tF * F
            if abs(tM) == 1:
                tl *= E
            elif abs(tM == 2):
                tl *= E2
            lsum += tl * sin(arg)

        lsum += 3958 * sin(A1) +      \
                1962 * sin(L1 - F) +  \
                 318 * sin(A2)

        longitude = L1 + d_to_r(lsum / 1000000)
        return longitude
Esempio n. 27
0
    def _longitude(self, jd):
        """Return the geocentric ecliptic longitude in radians.

        A subset of the logic in dimension3()

        """
        T = jd_to_jcent(jd)
        L1, D, M, M1, F, A1, A2, A3, E, E2 = _constants(T)

        lsum = 0.0
        for tD, tM, tM1, tF, tl, tr in _tblLR:
            arg = tD * D + tM * M +tM1 * M1 + tF * F
            if abs(tM) == 1:
                tl *= E
            elif abs(tM == 2):
                tl *= E2
            lsum += tl * sin(arg)

        lsum += 3958 * sin(A1) +      \
                1962 * sin(L1 - F) +  \
                 318 * sin(A2)

        longitude = L1 + d_to_r(lsum / 1000000)
        return longitude
Esempio n. 28
0
    def mean_longitude(self, jd):
        """Return mean longitude.
        
        Parameters:
            jd : Julian Day in dynamical time

        Returns:
            Longitude in radians
                
        """
        T = jd_to_jcent(jd)

        # From astrolabe
        #X = polynomial((d_to_r(100.466457), d_to_r(36000.7698278), d_to_r(0.00030322), d_to_r(0.000000020)), T)

        # From AA, Naughter
        # Takes T/10.0
        X = polynomial(
            (d_to_r(100.4664567), d_to_r(360007.6982779), d_to_r(0.03032028),
             d_to_r(1.0 / 49931), d_to_r(-1.0 / 15300), d_to_r(
                 -1.0 / 2000000)), T / 10.0)

        X = modpi2(X + pi)
        return X
Esempio n. 29
0
    def dimension3(self, jd):
        """Return geocentric ecliptic longitude, latitude and radius.

        When we need all three dimensions it is more efficient to combine the
        calculations in one routine.

        Parameters:
            jd : Julian Day in dynamical time

        Returns:
            longitude in radians
            latitude in radians
            radius in km, Earth's center to Moon's center

        """
        T = jd_to_jcent(jd)
        L1, D, M, M1, F, A1, A2, A3, E, E2 = _constants(T)

        #
        # longitude and radius
        #
        lsum = 0.0
        rsum = 0.0
        for tD, tM, tM1, tF, tl, tr in _tblLR:
            arg = tD * D + tM * M + tM1 * M1 + tF * F
            if abs(tM) == 1:
                tl *= E
                tr *= E
            elif abs(tM == 2):
                tl *= E2
                tr *= E2
            lsum += tl * sin(arg)
            rsum += tr * cos(arg)

        #
        # latitude
        #
        bsum = 0.0
        for tD, tM, tM1, tF, tb in _tblB:
            arg = tD * D + tM * M + tM1 * M1 + tF * F
            if abs(tM) == 1:
                tb *= E
            elif abs(tM) == 2:
                tb *= E2
            bsum += tb * sin(arg)

        lsum += 3958 * sin(A1) +       \
                1962 * sin(L1 - F) +   \
                 318 * sin(A2)

        bsum += -2235 * sin(L1) +      \
                  382 * sin(A3) +      \
                  175 * sin(A1 - F) +  \
                  175 * sin(A1 + F) +  \
                  127 * sin(L1 - M1) - \
                  115 * sin(L1 + M1)

        longitude = L1 + d_to_r(lsum / 1000000)
        latitude = d_to_r(bsum / 1000000)
        dist = 385000.56 + rsum / 1000
        return longitude, latitude, dist
Esempio n. 30
0
    T = jd_to_jcent(jd)
    D, M, M1, F, omega = _constants(T)
    deltaEps = 0.0
    for tD, tM, tM1, tF, tomega, tpsiK, tpsiT, tepsK, tepsT in _tbl:
        arg = D * tD + M * tM + M1 * tM1 + F * tF + omega * tomega
        deltaEps = deltaEps + (tepsK / 10000.0 +
                               tepsT / 100000.0 * T) * np.cos(arg)
    deltaEps = deltaEps / 3600
    deltaEps = d_to_r(deltaEps)
    return deltaEps


#
# Constant terms
#
_el0 = (d_to_r(dms_to_d(23, 26, 21.448)), d_to_r(dms_to_d(0, 0, -46.8150)),
        d_to_r(dms_to_d(0, 0, -0.00059)), d_to_r(dms_to_d(0, 0, 0.001813)))


def obliquity(jd):
    """Return the mean obliquity of the ecliptic.

    Low precision, but good enough for most uses. [Meeus-1998: equation 22.2].
    Accuracy is 1" over 2000 years and 10" over 4000 years.

    Arguments:
      - `jd` : Julian Day in dynamical time

    Returns:
      - obliquity, in radians
Esempio n. 31
0
    "winter": (1721414.39987, 365242.88257, -0.00769, -0.00933, -0.00006)}

#
# Meeus-1998 Table 27.B
#
_approx_3000 = {
    "spring": (2451623.80984, 365242.37404,  0.05169, -0.00411, -0.00057),
    "summer": (2451716.56767, 365241.62603,  0.00325,  0.00888, -0.00030),
    "autumn": (2451810.21715, 365242.01767, -0.11575,  0.00337,  0.00078),
    "winter": (2451900.05952, 365242.74049, -0.06223, -0.00823,  0.00032)}

#
# Meeus-1998 Table 27.C
#
_terms = [
    (485, d_to_r(324.96),  d_to_r(  1934.136)),
    (203, d_to_r(337.23),  d_to_r( 32964.467)),
    (199, d_to_r(342.08),  d_to_r(    20.186)),
    (182, d_to_r( 27.85),  d_to_r(445267.112)),
    (156, d_to_r( 73.14),  d_to_r( 45036.886)),
    (136, d_to_r(171.52),  d_to_r( 22518.443)),
    ( 77, d_to_r(222.54),  d_to_r( 65928.934)),
    ( 74, d_to_r(296.72),  d_to_r(  3034.906)),
    ( 70, d_to_r(243.58),  d_to_r(  9037.513)),
    ( 58, d_to_r(119.81),  d_to_r( 33718.147)),
    ( 52, d_to_r(297.17),  d_to_r(   150.678)),
    ( 50, d_to_r( 21.02),  d_to_r(  2281.226)),
    ( 45, d_to_r(247.54),  d_to_r( 29929.562)),
    ( 44, d_to_r(325.15),  d_to_r( 31555.956)),
    ( 29, d_to_r( 60.93),  d_to_r(  4443.417)),
    ( 18, d_to_r(155.12),  d_to_r( 67555.328)),
Esempio n. 32
0
    (1,  1,  0, -1,     223),
    (1,  1,  0,  1,     223),
    (0,  1, -2, -1,    -220),
    (2,  1, -1, -1,    -220),
    (1,  0,  1,  1,    -185),
    (2, -1, -2, -1,     181),
    (0,  1,  2,  1,    -177),
    (4,  0, -2, -1,     176),
    (4, -1, -1, -1,     166),
    (1,  0,  1, -1,    -164),
    (4,  0,  1, -1,     132),
    (1,  0, -1, -1,    -119),
    (4, -1,  0, -1,     115),
    (2, -2,  0,  1,     107))

_kA1 = (d_to_r(119.75), d_to_r(131.849))
_kA2 = (d_to_r(53.09), d_to_r(479264.290))
_kA3 = (d_to_r(313.45), d_to_r(481266.484))


def _constants(T):
    """Calculate values required by several other functions"""
    L1 = modpi2(polynomial(kL1, T))
    D = modpi2(polynomial(kD, T))
    M = modpi2(polynomial(kM, T))
    M1 = modpi2(polynomial(kM1, T))
    F = modpi2(polynomial(kF, T))

    A1 = modpi2(polynomial(_kA1, T))
    A2 = modpi2(polynomial(_kA2, T))
    A3 = modpi2(polynomial(_kA3, T))
Esempio n. 33
0
 def test_ecl_to_equ(self):
     ra, dec = ecl_to_equ(d_to_r(113.215630), d_to_r(6.684170), d_to_r(23.4392911))
     self.assertAlmostEqual(r_to_d(ra), 116.328942, places=5)
     self.assertAlmostEqual(r_to_d(dec), 28.026183, places=6)
Esempio n. 34
0
    #
    T = jd_to_jcent(jd)
    D, M, M1, F, omega = _constants(T)
    deltaEps = 0.0
    for tD, tM, tM1, tF, tomega, tpsiK, tpsiT, tepsK, tepsT in _tbl:
        arg = D*tD + M*tM + M1*tM1 + F*tF + omega*tomega
        deltaEps = deltaEps + (tepsK/10000.0 +
                               tepsT/100000.0 * T) * np.cos(arg)
    deltaEps = deltaEps / 3600
    deltaEps = d_to_r(deltaEps)
    return deltaEps

#
# Constant terms
#
_el0 = (d_to_r(dms_to_d(23, 26, 21.448)),
        d_to_r(dms_to_d(0, 0, -46.8150)),
        d_to_r(dms_to_d(0, 0, -0.00059)),
        d_to_r(dms_to_d(0, 0, 0.001813)))


def obliquity(jd):
    """Return the mean obliquity of the ecliptic.

    Low precision, but good enough for most uses. [Meeus-1998: equation 22.2].
    Accuracy is 1" over 2000 years and 10" over 4000 years.

    Arguments:
      - `jd` : Julian Day in dynamical time

    Returns:
Esempio n. 35
0
 def test_ell_to_geo(self):
     phi, theta, r = ell_to_geo(d_to_r(0), d_to_r(0), 10000)
     self.assertAlmostEqual(r_to_d(modpi2(phi)), 203.23542197)
     self.assertAlmostEqual(r_to_d(modpi2(theta)), 90.0)
     self.assertAlmostEqual(r, 0.0)
Esempio n. 36
0
        Returns:
          - longitude in radians
          - latitude in radians
          - radius in au

        """
        L = self.dimension(jd, "L")
        B = self.dimension(jd, "B")
        R = self.dimension(jd, "R")
        return L, B, R


#
# Constant terms
#
_kL0 = (d_to_r(280.46646), d_to_r(36000.76983), d_to_r(0.0003032))
_kM = (d_to_r(357.5291092), d_to_r(35999.0502909), d_to_r(-0.0001536),
       d_to_r(1.0 / 24490000))
_kC = (d_to_r(1.914602), d_to_r(-0.004817), d_to_r(-0.000014))

_ck3 = d_to_r(0.019993)
_ck4 = d_to_r(-0.000101)
_ck5 = d_to_r(0.000289)


def longitude_radius_low(jd):
    """Return geometric longitude and radius vector.

    Low precision. The longitude is accurate to 0.01 degree.  The latitude
    should be presumed to be 0.0. [Meeus-1998: equations 25.2 through 25.5
Esempio n. 37
0
}

#
# Meeus-1998 Table 27.B
#
_approx_3000 = {
    "spring": (2451623.80984, 365242.37404, 0.05169, -0.00411, -0.00057),
    "summer": (2451716.56767, 365241.62603, 0.00325, 0.00888, -0.00030),
    "autumn": (2451810.21715, 365242.01767, -0.11575, 0.00337, 0.00078),
    "winter": (2451900.05952, 365242.74049, -0.06223, -0.00823, 0.00032)
}

#
# Meeus-1998 Table 27.C
#
_terms = [(485, d_to_r(324.96), d_to_r(1934.136)),
          (203, d_to_r(337.23), d_to_r(32964.467)),
          (199, d_to_r(342.08), d_to_r(20.186)),
          (182, d_to_r(27.85), d_to_r(445267.112)),
          (156, d_to_r(73.14), d_to_r(45036.886)),
          (136, d_to_r(171.52), d_to_r(22518.443)),
          (77, d_to_r(222.54), d_to_r(65928.934)),
          (74, d_to_r(296.72), d_to_r(3034.906)),
          (70, d_to_r(243.58), d_to_r(9037.513)),
          (58, d_to_r(119.81), d_to_r(33718.147)),
          (52, d_to_r(297.17), d_to_r(150.678)),
          (50, d_to_r(21.02), d_to_r(2281.226)),
          (45, d_to_r(247.54), d_to_r(29929.562)),
          (44, d_to_r(325.15), d_to_r(31555.956)),
          (29, d_to_r(60.93), d_to_r(4443.417)),
          (18, d_to_r(155.12), d_to_r(67555.328)),
Esempio n. 38
0
 def test_geocentric_planet(self):
     ra, dec = geocentric_planet(2448976.5, "Venus", d_to_r(dms_to_d(0, 0, 16.749)), d_to_r(23.439669), days_per_second)
     np.testing.assert_array_almost_equal(r_to_d(ra), r_to_d(hms_to_fday(21, 4, 41.454) * pi2), decimal=5)
     np.testing.assert_almost_equal(r_to_d(dec), dms_to_d(-18, 53, 16.84), decimal=5)
Esempio n. 39
0
        Returns:
          - longitude in radians
          - latitude in radians
          - radius in au

        """
        L = self.dimension(jd, "L")
        B = self.dimension(jd, "B")
        R = self.dimension(jd, "R")
        return L, B, R

#
# Constant terms
#
_kL0 = (d_to_r(280.46646),
        d_to_r(36000.76983),
        d_to_r(0.0003032))
_kM = (d_to_r(357.5291092),
       d_to_r(35999.0502909),
       d_to_r(-0.0001536),
       d_to_r(1.0/24490000))
_kC = (d_to_r(1.914602),
       d_to_r(-0.004817),
       d_to_r(-0.000014))

_ck3 = d_to_r(0.019993)
_ck4 = d_to_r(-0.000101)
_ck5 = d_to_r(0.000289)

Esempio n. 40
0
    def dimension3(self, jd):
        """Return geocentric ecliptic longitude, latitude and radius.

        When we need all three dimensions it is more efficient to combine the
        calculations in one routine.

        Parameters:
            jd : Julian Day in dynamical time

        Returns:
            longitude in radians
            latitude in radians
            radius in km, Earth's center to Moon's center

        """
        T = jd_to_jcent(jd)
        L1, D, M, M1, F, A1, A2, A3, E, E2 = _constants(T)

        #
        # longitude and radius
        #
        lsum = 0.0
        rsum = 0.0
        for tD, tM, tM1, tF, tl, tr in _tblLR:
            arg = tD * D + tM * M + tM1 * M1 + tF * F
            if abs(tM) == 1:
                tl *= E
                tr *= E
            elif abs(tM == 2):
                tl *= E2
                tr *= E2
            lsum += tl * sin(arg)
            rsum += tr * cos(arg)

        #
        # latitude
        #
        bsum = 0.0
        for tD, tM, tM1, tF, tb in _tblB:
            arg = tD * D + tM * M + tM1 * M1 + tF * F
            if abs(tM) == 1:
                tb *= E
            elif abs(tM) == 2:
                tb *= E2
            bsum += tb * sin(arg)

        lsum += 3958 * sin(A1) +       \
                1962 * sin(L1 - F) +   \
                 318 * sin(A2)

        bsum += -2235 * sin(L1) +      \
                  382 * sin(A3) +      \
                  175 * sin(A1 - F) +  \
                  175 * sin(A1 + F) +  \
                  127 * sin(L1 - M1) - \
                  115 * sin(L1 + M1)

        longitude = L1 + d_to_r(lsum / 1000000)
        latitude = d_to_r(bsum / 1000000)
        dist = 385000.56 + rsum / 1000
        return longitude, latitude, dist
Esempio n. 41
0
    (-1,  0,  1,  0,  0,      -4,     0,     0,   0),
    (-2,  1,  0,  0,  0,      -4,     0,     0,   0),
    ( 1,  0,  0,  0,  0,      -4,     0,     0,   0),
    ( 0,  0,  1,  2,  0,       3,     0,     0,   0),
    ( 0,  0, -2,  2,  2,      -3,     0,     0,   0),
    (-1, -1,  1,  0,  0,      -3,     0,     0,   0),
    ( 0,  1,  1,  0,  0,      -3,     0,     0,   0),
    ( 0, -1,  1,  2,  2,      -3,     0,     0,   0),
    ( 2, -1, -1,  2,  2,      -3,     0,     0,   0),
    ( 0,  0,  3,  2,  2,      -3,     0,     0,   0),
    ( 2, -1,  0,  2,  2,      -3,     0,     0,   0))

#
# Constant terms.
# 
_kD  = (d_to_r(297.85036), d_to_r(445267.111480), d_to_r(-0.0019142), d_to_r( 1.0/189474))
_kM  = (d_to_r(357.52772), d_to_r( 35999.050340), d_to_r(-0.0001603), d_to_r(-1.0/300000))
_kM1 = (d_to_r(134.96298), d_to_r(477198.867398), d_to_r( 0.0086972), d_to_r( 1.0/ 56250))
_kF  = (d_to_r( 93.27191), d_to_r(483202.017538), d_to_r(-0.0036825), d_to_r( 1.0/327270))
_ko  = (d_to_r(125.04452), d_to_r( -1934.136261), d_to_r( 0.0020708), d_to_r( 1.0/450000))

def _constants(T):
    """Return some values needed for both nut_in_lon() and nut_in_obl()"""
    D     = modpi2(polynomial(_kD,  T))
    M     = modpi2(polynomial(_kM,  T))
    M1    = modpi2(polynomial(_kM1, T))
    F     = modpi2(polynomial(_kF,  T))
    omega = modpi2(polynomial(_ko,  T))
    return D, M, M1, F, omega
    
Esempio n. 42
0
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Astronomia; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    """
"""Useful constants terms.

Don't change these unless you are moving to a new universe.

"""
from astronomia.util import d_to_r

#
# Constant terms.
#
kL1 = (d_to_r(218.3164477), d_to_r(481267.88123421), d_to_r(-0.0015786),
       d_to_r(1.0 / 538841), d_to_r(-1.0 / 65194000))
kD = (d_to_r(297.8501921), d_to_r(445267.1114034), d_to_r(-0.0018819),
      d_to_r(1.0 / 545868), d_to_r(-1.0 / 113065000))
kM = (d_to_r(357.5291092), d_to_r(35999.0502909), d_to_r(-0.0001536),
      d_to_r(1.0 / 24490000))
kM1 = (d_to_r(134.9633964), d_to_r(477198.8675055), d_to_r(0.0087414),
       d_to_r(1.0 / 69699), d_to_r(-1.0 / 14712000))
kF = (d_to_r(93.2720950), d_to_r(483202.0175233), d_to_r(-0.0036539),
      d_to_r(-1.0 / 3526000), d_to_r(1.0 / 863310000))
ko = (d_to_r(125.0445479), d_to_r(-1934.1362891), d_to_r(0.0020754),
      d_to_r(1.0 / 467441.0), d_to_r(1.0 / 60616000.0))
Esempio n. 43
0
from astronomia.calendar import sidereal_time_greenwich
from astronomia.constants import seconds_per_day, pi2, earth_equ_radius, \
    standard_rst_altitude
from astronomia.dynamical import deltaT_seconds
from astronomia.util import d_to_r, interpolate_angle3, diff_angle,  \
    modpi2, interpolate3
from astronomia.coordinates import equ_to_horiz
import astronomia.globals


class Error(Exception):
    """local exception class"""
    pass


_k1 = d_to_r(360.985647)


def _riseset(jd, raList, decList, h0, delta, mode,
             longitude=astronomia.globals.longitude,
             latitude=astronomia.globals.latitude):
    # Private function since rise/set so similar

    THETA0 = sidereal_time_greenwich(jd)
    deltaT_days = deltaT_seconds(jd) / seconds_per_day

    cosH0 = (np.sin(h0) - np.sin(latitude)*np.sin(decList[1])) / (
        np.cos(latitude)*np.cos(decList[1]))
    #
    # future: return some indicator when the object is circumpolar or always
    # below the horizon.
Esempio n. 44
0
    def test_equ_to_ecl(self):
        longitude, latitude = equ_to_ecl(d_to_r(116.328942), d_to_r(28.026183), d_to_r(23.4392911))

        self.assertAlmostEqual(r_to_d(longitude), 113.215630, places=6)
        self.assertAlmostEqual(r_to_d(latitude), 6.684170, places=6)
Esempio n. 45
0
from math import *

from astronomia.calendar import sidereal_time_greenwich
from astronomia.constants import seconds_per_day, pi2, earth_equ_radius, standard_rst_altitude
from astronomia.dynamical import deltaT_seconds
from astronomia.util import d_to_r, interpolate_angle3, diff_angle, r_to_d, modpi2, interpolate3, equ_to_horiz
import astronomia.globals


class Error(Exception):
    """local exception class"""
    pass


_k1 = d_to_r(360.985647)


def rise(jd, raList, decList, h0, delta):
    """Return the Julian Day of the rise time of an object.
    
    Parameters:
        jd      : Julian Day number of the day in question, at 0 hr UT
        raList  : a sequence of three right accension values, in radians,
            for (jd-1, jd, jd+1)
        decList : a sequence of three right declination values, in radians,
            for (jd-1, jd, jd+1)
        h0      : the standard altitude in radians
        delta   : desired accuracy in days. Times less than one minute are
            infeasible for rise times because of atmospheric refraction.
            
Esempio n. 46
0
        Returns:
          - longitude in radians
          - latitude in radians
          - radius in au

        """
        L = self.dimension(jd, planet, "L")
        B = self.dimension(jd, planet, "B")
        R = self.dimension(jd, planet, "R")
        return L, B, R


#
# Constant terms
#
_k0 = d_to_r(-1.397)
_k1 = d_to_r(-0.00031)
_k2 = d_to_r(dms_to_d(0, 0, -0.09033))
_k3 = d_to_r(dms_to_d(0, 0, 0.03916))


def vsop_to_fk5(jd, L, B):
    """Convert VSOP to FK5 coordinates.

    This is required only when using the full precision of the
    VSOP model.  [Meeus-1998: pg 219]

    Arguments:
      - `jd` : Julian Day in dynamical time
      - `L`  : longitude in radians
      - `B`  : latitude in radians
Esempio n. 47
0
    (2,  1, -1, -1,    -220),
    (1,  0,  1,  1,    -185),
    (2, -1, -2, -1,     181),
    (0,  1,  2,  1,    -177),
    (4,  0, -2, -1,     176),
    (4, -1, -1, -1,     166),
    (1,  0,  1, -1,    -164),
    (4,  0,  1, -1,     132),
    (1,  0, -1, -1,    -119),
    (4, -1,  0, -1,     115),
    (2, -2,  0,  1,     107))

#
# Constant terms.
#
_kL1 = (d_to_r(218.3164477), d_to_r(481267.88123421), d_to_r(-0.0015786),
        d_to_r(1.0 / 538841), d_to_r(-1.0 / 65194000))
_kD = (d_to_r(297.8501921), d_to_r(445267.1114034), d_to_r(-0.0018819),
       d_to_r(1.0 / 545868), d_to_r(-1.0 / 113065000))
_kM = (d_to_r(357.5291092), d_to_r(35999.0502909), d_to_r(-0.0001536),
       d_to_r(1.0 / 24490000))
_kM1 = (d_to_r(134.9633964), d_to_r(477198.8675055), d_to_r(0.0087414),
        d_to_r(1.0 / 69699), d_to_r(-1.0 / 14712000))
_kF = (d_to_r(93.2720950), d_to_r(483202.0175233), d_to_r(-0.0036539),
       d_to_r(-1.0 / 3526000), d_to_r(1.0 / 863310000))

_kA1 = (d_to_r(119.75), d_to_r(131.849))
_kA2 = (d_to_r(53.09), d_to_r(479264.290))
_kA3 = (d_to_r(313.45), d_to_r(481266.484))

Esempio n. 48
0
        Returns:
          - longitude in radians
          - latitude in radians
          - radius in au

        """
        L = self.dimension(jd, planet, "L")
        B = self.dimension(jd, planet, "B")
        R = self.dimension(jd, planet, "R")
        return L, B, R


#
# Constant terms
#
_k0 = d_to_r(-1.397)
_k1 = d_to_r(-0.00031)
_k2 = d_to_r(dms_to_d(0, 0, -0.09033))
_k3 = d_to_r(dms_to_d(0, 0,  0.03916))


def vsop_to_fk5(jd, L, B):
    """Convert VSOP to FK5 coordinates.

    This is required only when using the full precision of the
    VSOP model.  [Meeus-1998: pg 219]

    Arguments:
      - `jd` : Julian Day in dynamical time
      - `L`  : longitude in radians
      - `B`  : latitude in radians
Esempio n. 49
0
         (2, 0, -2, 1, -451), (0, 0, 3, -1, 439), (2, 0, 2, 1, 422), (2, 0, -3,
                                                                      -1, 421),
         (2, 1, -1, 1, -366), (2, 1, 0, 1, -351), (4, 0, 0, 1, 331), (2, -1, 1,
                                                                      1, 315),
         (2, -2, 0, -1, 302), (0, 0, 1, 3, -283), (2, 1, 1, -1,
                                                   -229), (1, 1, 0, -1, 223),
         (1, 1, 0, 1, 223), (0, 1, -2, -1, -220), (2, 1, -1, -1,
                                                   -220), (1, 0, 1, 1, -185),
         (2, -1, -2, -1, 181), (0, 1, 2, 1, -177), (4, 0, -2, -1,
                                                    176), (4, -1, -1, -1, 166),
         (1, 0, 1, -1, -164), (4, 0, 1, -1, 132), (1, 0, -1, -1,
                                                   -119), (4, -1, 0, -1,
                                                           115), (2, -2, 0, 1,
                                                                  107))

_kA1 = (d_to_r(119.75), d_to_r(131.849))
_kA2 = (d_to_r(53.09), d_to_r(479264.290))
_kA3 = (d_to_r(313.45), d_to_r(481266.484))


def _constants(T):
    """Calculate values required by several other functions"""
    L1 = modpi2(polynomial(kL1, T))
    D = modpi2(polynomial(kD, T))
    M = modpi2(polynomial(kM, T))
    M1 = modpi2(polynomial(kM1, T))
    F = modpi2(polynomial(kF, T))

    A1 = modpi2(polynomial(_kA1, T))
    A2 = modpi2(polynomial(_kA2, T))
    A3 = modpi2(polynomial(_kA3, T))
Esempio n. 50
0
    You should have received a copy of the GNU General Public License
    along with Astronomia; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    """

"""Useful constants terms.

Don't change these unless you are moving to a new universe.

"""
from astronomia.util import d_to_r

#
# Constant terms.
#
kL1 = (d_to_r(218.3164477),
       d_to_r(481267.88123421),
       d_to_r(-0.0015786),
       d_to_r(1.0/538841),
       d_to_r(-1.0/65194000))
kD = (d_to_r(297.8501921),
      d_to_r(445267.1114034),
      d_to_r(-0.0018819),
      d_to_r(1.0/545868),
      d_to_r(-1.0/113065000))
kM = (d_to_r(357.5291092),
      d_to_r(35999.0502909),
      d_to_r(-0.0001536),
      d_to_r(1.0/24490000))
kM1 = (d_to_r(134.9633964),
       d_to_r(477198.8675055),
Esempio n. 51
0
    (2,  1, -1, -1,    -220),
    (1,  0,  1,  1,    -185),
    (2, -1, -2, -1,     181),
    (0,  1,  2,  1,    -177),
    (4,  0, -2, -1,     176),
    (4, -1, -1, -1,     166),
    (1,  0,  1, -1,    -164),
    (4,  0,  1, -1,     132),
    (1,  0, -1, -1,    -119),
    (4, -1,  0, -1,     115),
    (2, -2,  0,  1,     107))

#
# Constant terms.
#
_kL1 = (d_to_r(218.3164477), d_to_r(481267.88123421), d_to_r(-0.0015786), d_to_r(1.0/538841), d_to_r(-1.0/65194000))
_kD  = (d_to_r(297.8501921), d_to_r(445267.1114034),  d_to_r(-0.0018819), d_to_r(1.0/545868), d_to_r(-1.0/113065000))
_kM  = (d_to_r(357.5291092), d_to_r( 35999.0502909),  d_to_r(-0.0001536), d_to_r(1.0/24490000))
_kM1 = (d_to_r(134.9633964), d_to_r(477198.8675055),  d_to_r(0.0087414), d_to_r(1.0/69699), d_to_r(-1.0/14712000))
_kF  = (d_to_r( 93.2720950), d_to_r(483202.0175233),  d_to_r(-0.0036539), d_to_r(-1.0/3526000), d_to_r( 1.0/863310000))

_kA1 = (d_to_r(119.75), d_to_r(   131.849))
_kA2 = (d_to_r( 53.09), d_to_r(479264.290))
_kA3 = (d_to_r(313.45), d_to_r(481266.484))


def _constants(T):
    """Calculate values required by several other functions"""
    L1 = modpi2(polynomial(_kL1, T))
    D  = modpi2(polynomial(_kD,  T))
    M  = modpi2(polynomial(_kM,  T))