# Path: skyfield/constants.py
# AU_M = 149597870700             # per IAU 2012 Resolution B2
# AU_KM = 149597870.700
# ASEC360 = 1296000.0
# DAY_S = 86400.0
# ASEC2RAD = 4.848136811095359935899141e-6
# DEG2RAD = 0.017453292519943296
# RAD2DEG = 57.295779513082321
# C = 299792458.0                            # m/s
# ANGVEL = 7.2921150e-5           # radians/s
# ERAD = 6378136.6                # meters
# IERS_2010_INVERSE_EARTH_FLATTENING = 298.25642
# GS = 1.32712440017987e+20
# T0 = 2451545.0
# B1950 = 2433282.4235
# C_AUDAY = C * DAY_S / AU_M
# 
# Path: skyfield/functions.py
# def load_bundled_npy(filename):
#     """Load a binary NumPy array file that is bundled with Skyfield."""
#     data = get_data('skyfield', 'data/{0}'.format(filename))
#     return load(BytesIO(data))


from numpy import array, cos, dot, fmod, sin, outer, zeros
from .constants import ASEC2RAD, ASEC360, DEG2RAD, tau, T0
from .functions import load_bundled_npy

    # Mean Longitude of the Ascending Node of the Moon.
    (450160.398036, - 6962890.5431, 7.4722, 0.007702, - 0.00005939),

    )).T[:,:,None]

def fundamental_arguments(t, terms=5):
    """Compute the fundamental arguments (mean elements) of Sun and Moon.

    ``t`` - TDB time in Julian centuries since J2000.0, as float or NumPy array

    Outputs fundamental arguments, in radians:
          a[0] = l (mean anomaly of the Moon)
          a[1] = l' (mean anomaly of the Sun)
          a[2] = F (mean argument of the latitude of the Moon)
          a[3] = D (mean elongation of the Moon from the Sun)
          a[4] = Omega (mean longitude of the Moon's ascending node);
                 from Simon section 3.4(b.3),
                 precession = 5028.8200 arcsec/cy)

    Pass a smaller value for the number of polynomial ``terms`` if you
    want to trade accuracy for speed.

    """
    fa = iter((fa4, fa3, fa2, fa1)[-terms+1:])
    a = next(fa) * t
    for fa_i in fa:
        a += fa_i
        a *= t
    a += fa0

# Path: skyfield/constants.py
# AU_M = 149597870700             # per IAU 2012 Resolution B2
# AU_KM = 149597870.700
# ASEC360 = 1296000.0
# DAY_S = 86400.0
# ASEC2RAD = 4.848136811095359935899141e-6
# DEG2RAD = 0.017453292519943296
# RAD2DEG = 57.295779513082321
# C = 299792458.0                            # m/s
# ANGVEL = 7.2921150e-5           # radians/s
# ERAD = 6378136.6                # meters
# IERS_2010_INVERSE_EARTH_FLATTENING = 298.25642
# GS = 1.32712440017987e+20
# T0 = 2451545.0
# B1950 = 2433282.4235
# C_AUDAY = C * DAY_S / AU_M
# 
# Path: skyfield/functions.py
# def load_bundled_npy(filename):
#     """Load a binary NumPy array file that is bundled with Skyfield."""
#     data = get_data('skyfield', 'data/{0}'.format(filename))
#     return load(BytesIO(data))


# Path: skyfield/nutationlib.py
from numpy import array, cos, dot, fmod, sin, outer, zeros
from .constants import ASEC2RAD, ASEC360, DEG2RAD, tau, T0
from .functions import load_bundled_npy


    # Mean Longitude of the Ascending Node of the Moon.
    (450160.398036, - 6962890.5431, 7.4722, 0.007702, - 0.00005939),

    )).T[:,:,None]

def fundamental_arguments(t, terms=5):
    """Compute the fundamental arguments (mean elements) of Sun and Moon.

    ``t`` - TDB time in Julian centuries since J2000.0, as float or NumPy array

    Outputs fundamental arguments, in radians:
          a[0] = l (mean anomaly of the Moon)
          a[1] = l' (mean anomaly of the Sun)
          a[2] = F (mean argument of the latitude of the Moon)
          a[3] = D (mean elongation of the Moon from the Sun)
          a[4] = Omega (mean longitude of the Moon's ascending node);
                 from Simon section 3.4(b.3),
                 precession = 5028.8200 arcsec/cy)

    Pass a smaller value for the number of polynomial ``terms`` if you
    want to trade accuracy for speed.

    """
    fa = iter((fa4, fa3, fa2, fa1)[-terms+1:])
    a = next(fa) * t
    for fa_i in fa:
        a += fa_i
        a *= t
    a += fa0

    fmod(a, ASEC360, out=a)