Beispiel #1
0
def fk4_e_terms(equinox):
    """
    Return the e-terms of aberation vector

    Parameters
    ----------
    equinox : Time object
        The equinox for which to compute the e-terms
    """
    # Constant of aberration at J2000; from Explanatory Supplement to the
    # Astronomical Almanac (Seidelmann, 2005).
    k = 0.0056932  # in degrees (v_earth/c ~ 1e-4 rad ~ 0.0057 deg)
    k = np.radians(k)

    # Eccentricity of the Earth's orbit
    e = earth.eccentricity(equinox.jd)

    # Mean longitude of perigee of the solar orbit
    g = earth.mean_lon_of_perigee(equinox.jd)
    g = np.radians(g)

    # Obliquity of the ecliptic
    o = earth.obliquity(equinox.jd, algorithm=1980)
    o = np.radians(o)

    return e * k * np.sin(g), \
           -e * k * np.cos(g) * np.cos(o), \
           -e * k * np.cos(g) * np.sin(o)
Beispiel #2
0
def fk4_e_terms(equinox):
    """
    Return the e-terms of aberation vector

    Parameters
    ----------
    equinox : Time object
        The equinox for which to compute the e-terms
    """
    # Constant of aberration at J2000; from Explanatory Supplement to the
    # Astronomical Almanac (Seidelmann, 2005).
    k = 0.0056932  # in degrees (v_earth/c ~ 1e-4 rad ~ 0.0057 deg)
    k = np.radians(k)

    # Eccentricity of the Earth's orbit
    e = earth.eccentricity(equinox.jd)

    # Mean longitude of perigee of the solar orbit
    g = earth.mean_lon_of_perigee(equinox.jd)
    g = np.radians(g)

    # Obliquity of the ecliptic
    o = earth.obliquity(equinox.jd, algorithm=1980)
    o = np.radians(o)

    return e * k * np.sin(g), \
           -e * k * np.cos(g) * np.cos(o), \
           -e * k * np.cos(g) * np.sin(o)
def ecliptic2equitorial(ecliptic_skycoord,
                        err_lambda,
                        err_beta,
                        epoch,
                        equitorial_coord_frame='fk5'):
    eps = earth_orientation.obliquity(
        epoch.jd, algorithm=2006) * u.deg  # Use IAU 2006 model.
    equitorial_skycoord = ecliptic_skycoord.transform_to(
        equitorial_coord_frame)
    ecl_lambda = ecliptic_skycoord.lon.rad
    beta = ecliptic_skycoord.lat.rad
    ra = equitorial_skycoord.ra.rad
    dec = equitorial_skycoord.dec.rad
    # Error on dec
    term1 = ((np.cos(beta) * np.cos(eps.to('radian')) -
              np.sin(beta) * np.sin(eps.to('radian')) * np.sin(ecl_lambda)) *
             err_beta)**2
    term2 = (np.cos(beta) * np.sin(eps.to('radian')) * np.cos(ecl_lambda) *
             err_lambda)**2
    err_dec = np.sqrt(term1 + term2) / np.abs(np.cos(dec))
    # Error on ra
    term1 = (np.sin(ecl_lambda) * np.cos(beta) * err_lambda / np.cos(dec))**2
    term2 = (np.cos(ecl_lambda) * np.sin(beta) * err_beta / np.cos(dec))**2
    term3 = (np.cos(ecl_lambda) * np.cos(beta) * np.tan(dec) * err_dec /
             np.cos(dec))**2
    err_ra = np.sqrt(term1 + term2 + term3) / np.abs(np.sin(ra))
    return equitorial_skycoord, err_ra, err_dec
Beispiel #4
0
def ra_sun(start):
    # days since 1 Jan 2010 Epoch
    t = Time(start, scale='utc')
    d = (start - datetime(2010, 1, 1)).days
    eg = 279.557208  # ecliptic longitude at epoch 2010
    wg = 283.112438  # ecliptic longitude of perigee at epoch 2010
    e = 0.016705  # eccentricity at 2010 epoch
    N = (360. / 365.242191) * d % 360
    m_sun = N + eg + wg
    if m_sun < 0:
        m_sun += 360.
    Ec = (360. / pi) * e * sin(radians(m_sun))
    l_sun = N + Ec + eg
    obliquity = earth.obliquity(t.jd, algorithm=1980)
    y = sin(radians(l_sun)) * cos(radians(obliquity))
    x = cos(radians(l_sun))
    ra = degrees(arctan2(y, x)) / 15
    return ra
Beispiel #5
0
def ra_sun(start):
    # days since 1 Jan 2010 Epoch
    t = Time(start, scale='utc')
    d = (start - datetime(2010, 1, 1)).days
    eg = 279.557208  # ecliptic longitude at epoch 2010
    wg = 283.112438  # ecliptic longitude of perigee at epoch 2010
    e = 0.016705  # eccentricity at 2010 epoch
    N = (360. / 365.242191) * d % 360
    m_sun = N + eg + wg
    if m_sun < 0:
        m_sun += 360.
    Ec = (360. / pi) * e * sin(radians(m_sun))
    l_sun = N + Ec + eg
    obliquity = earth.obliquity(t.jd, algorithm=1980)
    y = sin(radians(l_sun)) * cos(radians(obliquity))
    x = cos(radians(l_sun))
    ra = degrees(arctan2(y, x)) / 15
    return ra
def equitorial2ecliptic(equitorial_skycoord, err_ra, err_dec, epoch):
    eps = earth_orientation.obliquity(
        epoch.jd, algorithm=2006) * u.deg  # Use IAU 2006 model.
    ecliptic_skycoord = equitorial_skycoord.transform_to(
        'geocentrictrueecliptic')
    ra = equitorial_skycoord.ra.rad
    dec = equitorial_skycoord.dec.rad
    ecl_lambda = ecliptic_skycoord.lon.rad
    beta = ecliptic_skycoord.lat.rad
    # Error on beta
    term1 = ((np.cos(dec) * np.cos(eps.to('radian')) +
              np.sin(dec) * np.sin(eps.to('radian')) * np.sin(ra)) *
             err_dec)**2
    term2 = (np.cos(dec) * np.sin(eps.to('radian')) * np.cos(ra) * err_ra)**2
    err_beta = np.sqrt(term1 + term2) / np.abs(np.cos(beta))
    # Error on lambda
    term1 = (np.sin(ra) * np.cos(dec) * err_ra / np.cos(beta))**2
    term2 = (np.cos(ra) * np.sin(dec) * err_dec / np.cos(beta))**2
    term3 = (np.cos(ra) * np.cos(dec) * np.tan(beta) * err_beta /
             np.cos(beta))**2
    err_lambda = np.sqrt(term1 + term2 + term3) / np.abs(np.sin(ecl_lambda))
    return ecliptic_skycoord, err_lambda, err_beta
Beispiel #7
0
from . import SphericalBody, OrbitingSphericalBody

from astropy import time
from astropy import units as u
from astropy import constants as cnst
from astropy.coordinates import earth_orientation

sun = SphericalBody(cnst.R_sun, 1, cnst.M_sun)
# sneaky trick to use L_sun to compute radiance
sun.radiance = cnst.L_sun / sun.luminosity / u.sr

_J2017 = time.Time('J2017')
ec = earth_orientation.eccentricity(_J2017.jd)
obliq = earth_orientation.obliquity(_J2017.jd) * u.deg
sidday = 23.9344699 * u.hr

earth = OrbitingSphericalBody(cnst.R_earth, 0, cnst.M_earth, obliq, sidday,
                              1 * u.AU, ec, 0 * u.deg, sun)