コード例 #1
0
def topocentric(jd, lon, lat, correct=True):
    '''topocentric libration of Moon'''
    ra, dec, lon1, lat1, dist, par = moon.position(jd, full=True)

    sid = sidereal.sid_time(jd)

    ha = math.radians(sid - ra)
    dec = math.radians(dec)
    par = math.radians(par)

    Q = math.atan2(
        math.cos(lat) * math.sin(ha),
        math.cos(dec) * math.sin(lat) -
        math.sin(dec) * math.cos(lat) * math.cos(ha))
    z = math.acos(
        math.sin(dec) * math.sin(lat) +
        math.cos(dec) * math.cos(lat) * math.cos(ha))
    pi = par * (math.sin(z) + 0.0084 * math.sin(2 * z))

    T = (jd - 2451545) / 36525.

    D = math.radians(297.8501921 + 445267.1114034 * T - 0.0018819 * T**2 +
                     T**3 / 545868. - T**4 / 113065000.)
    Mm = math.radians(134.9633964 + 477198.8675055 * T + 0.0087414 * T**2 +
                      T**3 / 69699. - T**4 / 14712000.)
    F = math.radians(93.2720950 + 483202.0175233 * T - 0.0036539 * T**2 -
                     T**3 / 3526000. + T**4 / 863310000.)
    W = math.radians(125.0445479 - 1934.1362891 * T + 0.0020754 * T**2 +
                     T**3 / 467441. - T**4 / 60616000.)

    E = 1 - 0.002516 * T - 0.0000047 * T**2

    rho=-0.02752*math.cos(Mm)-0.02245*math.sin(F)+0.00684*math.cos(Mm-2*F)-0.00293*math.cos(2*F)-0.00085*math.cos(2*F-2*D)-0.00054*math.cos(Mm-2*D)-0.00020*math.sin(Mm+F)-0.00020*math.cos(Mm+2*F)\
        -0.00020*math.cos(Mm-F)+0.00014*math.cos(Mm+2*F-2*D)
    sig=-0.02816*math.sin(Mm)+0.02244*math.cos(F)-0.00682*math.sin(Mm-2*F)-0.00279*math.sin(2*F)-0.00083*math.sin(2*F-2*D)+0.00069*math.sin(Mm-2*D)+0.00040*math.cos(Mm+F)-0.00025*math.sin(2*Mm)\
        -0.00023*math.sin(Mm+2*F)+0.00020*math.cos(Mm-F)+0.00019*math.sin(Mm-F)+0.00013*math.sin(Mm+2*F-2*D)-0.00010*math.cos(Mm-3*F)

    psi, eps = nutation_ecliptic.nutation(jd)
    eps = math.radians(eps + nutation_ecliptic.ecliptic(jd))

    V = W + math.radians(psi + sig / math.sin(I))
    X = math.sin(I + rho) * math.sin(V)
    Y = math.sin(I + rho) * math.cos(V) * math.cos(eps) - math.cos(
        I + rho) * math.sin(eps)

    l, b = optical(jd)
    l1, b1 = physical(jd)

    w = math.atan2(X, Y)
    P = math.asin(
        math.sqrt(X**2 + Y**2) * math.cos(math.radians(ra) - w) /
        math.cos(math.radians(b + b1)))

    dl = -pi * math.sin(Q - P) / math.cos(b)
    db = pi * math.cos(Q - P)

    if correct: return l + l1 + dl, b + b1 + db

    return dl, db
コード例 #2
0
ファイル: sun.py プロジェクト: row5is/AstroAlgorithms4Python
def coordinates(jd):
    '''equatorial coordinates of Sun'''
    lon=math.radians(longitude(jd))
    
    eps=math.radians(ecliptic(jd))
    
    ra=math.degrees(math.atan2(math.cos(eps)*math.sin(lon),math.cos(lon)))
    dec=math.degrees(math.asin(math.sin(eps)*math.sin(lon)))
    
    return ra,dec
コード例 #3
0
def coordinates(jd):
    '''rectangular coordinates of Sun to mean equinox'''
    LE,BE,r=position.Earth(jd)
    
    L=math.radians(LE+180)
    B=-math.radians(BE)
    eps=math.radians(nutation_ecliptic.ecliptic(jd))
    
    X=r*math.cos(B)*math.cos(L)
    Y=r*(math.cos(B)*math.sin(L)*math.cos(eps)-math.sin(B)*math.sin(eps))
    Z=r*(math.cos(B)*math.sin(L)*math.sin(eps)+math.sin(B)*math.cos(eps))
    
    return X,Y,Z
コード例 #4
0
def nutation(jd, ra, dec, correction=False):
    '''correction due to nutation (with optional correction of coordinates)'''

    #type of output (same as input - number, list, numpy.array)
    out_type = 'lst'
    if (isinstance(ra, int) or isinstance(ra, float)) and (isinstance(
            dec, int) or isinstance(dec, float)):
        #all input args are numbers
        out_type = 'num'

    if isinstance(ra, np.ndarray) or isinstance(dec, np.ndarray):
        #numpy.array
        out_type = 'np'

    if isinstance(ra, list): ra = np.array(ra)
    if isinstance(dec, list): dec = np.array(dec)

    if out_type == 'num': ra = np.array([ra])

    dpsi, deps = nut.nutation(jd)
    eps = nut.ecliptic(jd)

    eps = np.deg2rad(eps)
    ra = np.deg2rad(ra)
    dec = np.deg2rad(dec)

    dra = (np.cos(eps) + np.sin(eps) * np.sin(ra) * np.tan(dec)) * dpsi - (
        np.cos(ra) * np.tan(dec)) * deps
    ddec = (np.sin(eps) * np.cos(ra)) * dpsi + np.sin(ra) * deps

    if correction:
        dra += np.rad2deg(ra)
        ddec += np.rad2deg(dec)

    if out_type == 'num':
        dra = dra[0]
        ddec = ddec[0]
    elif out_type == 'lst':
        dra = dra.tolist()
        ddec = ddec.tolist()

    return dra, ddec
コード例 #5
0
def PBL(jd):
    '''calculate position angle P, heliographic lat. of center L0, hel. long. of center B0'''
    th = (jd - 2398220) * 360 / 25.38
    I = math.radians(7.25)
    K = math.radians(73.6667 + 1.3958333 * (jd - 2396758) / 36525.)

    psi, eps = nutation(jd)
    eps = math.radians(eps + ecliptic(jd))
    psi = math.radians(psi)

    lon = math.radians(longitude(jd))

    x = math.degrees(math.atan(-math.cos(lon + psi) * math.tan(eps)))
    y = math.degrees(math.atan(-math.cos(lon - K) * math.tan(I)))

    P = x + y
    B = math.degrees(math.asin(math.sin(lon - K) * math.sin(I)))
    nu = math.degrees(
        math.atan2(-math.sin(lon - K) * math.cos(I), -math.cos(lon - K)))

    L = (nu - th) % 360

    return P, B, L