
    R1i2                        d Z ddlmZmZmZmZmZmZmZ ddl	m
Z
mZmZmZmZ ddlmZ e
dz  Z ed      Zed   Zed	   Zed
   Zed   Zed   Zed   Zed   Zed   Zed   Zed   Z	 	 d!dZd Zd Zd Z d Z! eg d      jD                  \  Z#Z$	 	 d!dZ%d Z& ed      jD                  dddddf   \  Z'Z(Z)Z*Z+d"dZ,dZ-dZ.d Z/d  Z0y)#z%Routines that compute Earth nutation.    )arraycosdotfmodsinouterzeros   )ASEC2RADASEC360DEG2RADtauT0)load_bundled_npyg    cAznutation.npzke0_tke1 lunisolar_longitude_coefficients lunisolar_obliquity_coefficientsnals_tnapl_tnutation_coefficients_longitudenutation_coefficients_obliquityse0_t_0se0_t_1c                 d    t        | j                  |||      \  }}|t        z  }|t        z  }||fS )zCReturn the IAU 2000A angles delta-psi and delta-epsilon in radians.)iau2000att_TENTH_USEC_2_RAD)tfundamental_argument_termslunisolar_termsplanetary_termsd_psid_epss         X/home/cursorai/projects/iching/venv/lib/python3.12/site-packages/skyfield/nutationlib.pyiau2000a_radiansr&      s@     ADD"<o+-LE5	E	E%<    c                 ^    t        | j                        \  }}|t        z  }|t        z  }||fS )zCReturn the IAU 2000B angles delta-psi and delta-epsilon in radians.)iau2000br   r   )r   r#   r$   s      r%   iau2000b_radiansr*   #   s3    ADD>LE5	E	E%<r'   c           	      0   t        |       }t        |       }t        |      }t        |      }t        |      }t        |      }t        || |z  | |z  f||z  ||z  |z  ||z  z   ||z  |z  ||z  z
  f||z  ||z  |z  ||z  z
  ||z  |z  ||z  z   ff      S )a  Generate the nutation rotation matrix, given three nutation parameters.

    The input angles can be simple floats.  Or, they can be arrays of
    the same length, in which case the output matrix will have an extra
    dimension of that same length providing *n* rotation matrices.

    )r   r   r   )	mean_obliquity_radianstrue_obliquity_radianspsi_radianscobmsobmcobtsobtcpsispsis	            r%   build_nutation_matrixr5   ,   s     %&D%&D%&D%&D{D{D4%$,%$,  $;$;%t3$;%t35 $;$;%t3$;%t356 7 7r'   c                 ^    | t         z
  dz  }d|z  dz
  |z  dz   |z  dz
  |z  dz
  |z  dz   }|S )ae  Return the mean obliquity of the ecliptic in arcseconds.

    The caller need only supply a single argument:

    `jd_tdb` - TDB time as a Julian date float, or NumPy array of floats

    The formulae used to compute the mean obliquity are based on
    equations 37 and 39 from:

    Capitaine et al. (2003), _Astronomy and Astrophysics_ 412, 567-586.

        @gߧLggg+eS>gb/oi`?g6q'?g? ?kG@g#~֙@)r   )jd_tdbr   epsilons      r%   mean_obliquityr:   G   sw     
"A #q(!"'() !'()    ()) 	 ()	) ,5	5G Nr'   c                    | t         z
  dz  }t        | dd      }t        |dk(  rdnd|d   f      }ddd	d
d|z  z   |z  z   |z  z   |z  z   t        z  d|z  dz  t        z  z   |d<   ddddd|z  z   |z  z   |z  z   |z  z   t        z  d|z  dz  t        z  z   |d<   ddddd|z  z   |z  z   |z  z   |z  z   t        z  d|z  dz  t        z  z   |d<   ddddd |z  z   |z  z   |z  z   |z  z   t        z  d!|z  dz  t        z  z   |d"<   d#d$d%d&d'|z  z   |z  z   |z  z   |z  z   t        z  d(|z  dz  t        z  z   |d)<   d*d+|z  z   |d,<   d-d.|z  z   |d/<   d0d1|z  z   |d2<   d3d4|z  z   |d5<   d6d7|z  z   |d8<   d9d:|z  z   |d;<   d<d=|z  z   |d><   d?d@|z  z   |dA<   dBdC|z  z   |z  |dD<   |t        z  }t
        j                  |      }t        t        |      z  }|t        t        |      z  z  }||z  }t        j                  |      }|t        j                  t        |            z  }|t        j                  t        |            z  }|t        z  }|S )Ea  Compute the complementary terms of the equation of the equinoxes.

    This routine takes a single argument:

    `jd_tt` - Terrestrial Time: Julian date float, or NumPy array of floats

    The formulae used are from:

    Capitaine, N., Wallace, P.T., and McCarthy, D.D. (2003). _Astron. &
    Astrophys._ 406, p. 1135-1149. Table 3.

    _IERS Conventions (2010)_, Chapter 5, p. 60, Table 5.2e.  (Table
    5.2e presented in the printed publication is a truncated series. The
    full series, which is used here, is available on the IERS
    Conventions Center website in file tab5.2e.txt.)
    ftp://tai.bipm.org/iers/conv2010/chapter5/

    r7   shape )   r>   r   KAgJ{o&%A穤N@?@rmo?Qb	0g     @g      ?g13AgHP%3Aݵ|гfLg!?XLg     X@r
   縏~Ag%d{A窂QI)<E~P58߀}>g     @   g(%\0Ag%50A$~{B{?~\ g     P@   ˿yAg
h",*yOe@!?RĖ0#g         ~E@3a@   Nwh	@>@   0R6?u@   L]@Qt@   {"|/?~X|J@	   Co?YuT5@
   gV M@l%˼@   gj_?@gL@   &z?箶&>   )r   getattrr	   r   r   r   r   se1_0r   se1_1r   r   r   r   )jd_ttr   r<   faac_termss         r%   -equation_of_the_equinoxes_complimentary_termsrs   d   s   * 
wA E7B'E	u"eAh	8B    !	!!
 %-- C3&'BqE    !	!!
 %-- a#$%BqE    !	!!
 %-- C3&'BqE    !	!!
 %-- C3&'BqE    !	!!
 %-- a#$%BqE Oa//BFOa//BF^a//BF^a//BFma//BFma//BrF|a//BrF|a//BrF}q00A5BrF#IB 	Ac!fnGus1v~GqLG		"Aw{{3q6""Gw{{3q6""GxGNr'   ))gTϻ-@gXD@)gR@gbgj@)gF[?gx@)g;:@gÇ`[@)g6쮢u@gL@)rT   rU   )rW   rX   )rZ   r[   )r]   r^   )r`   ra   )rc   rd   )gJL@rf   )gCH@g\lo@)ri   rj   c                    | t         z
  dz  }t        ||      }|}t        d| j                  |      j                  }t        |      }t        |      }	t        |t        d|df         }
|
t        |t        d|df         |z  z  }
|
t        |	t        d|df         z  }
t        |	t        d|df         }|t        |	t        d|df         |z  z  }|t        |t        d|df         z  }|s|
|fS t        |dd      dk(  r|t        z  t        z   }n+t        t        |      j                  t        z   j                  }|dxx   |z  cc<   |}t        d| j                  |      j                  }t        |      }t        |      }	|
t        |t        d|df         z  }
|
t        |	t        d|df         z  }
|t        |t        d|df         z  }|t        |	t        d|df         z  }|
|fS )	a  Compute Earth nutation based on the IAU 2000A nutation model.

    ``jd_tt`` - Terrestrial Time: Julian date float, or NumPy array of floats

    Returns a tuple ``(delta_psi, delta_epsilon)`` measured in tenths of
    a micro-arcsecond.  Each value is either a float, or a NumPy array
    with the same dimensions as the input argument.

    Supply smaller integer values for ``fundamental_argument_terms``,
    ``lunisolar_terms``, and ``planetary_terms`` to trade off accuraccy
    for speed.

    r7   Nr   r
   rJ   r<   r=   )r   fundamental_argumentsr   r   Tr   r   r   r   rl   anomaly_coefficientanomaly_constantr   r   r   r   )ro   r    r!   r"   r   rq   cutoffargsargcargdpsidepss               r%   r   r      s&   " 
wA 	a!;<A
 F
&/

a
 
"
"Cs8Ds8Dt5gvgai@ADC6wwqyABQFFDC6wwqyABBDt5gvgai@ADC6wwqyABQFFDC6wwqyABBD Tzq'2"$##&66&*,,/??BBbEQJEF
&/

a
 
"
"Cs8Ds8DC5gvgai@AADC5gvgai@AADC5gvgai@AADC5gvgai@AAD:r'   c                 @    t        | ddd      \  }}|dz  }|dz  }||fS )a  Compute Earth nutation based on the faster IAU 2000B nutation model.

    `jd_tt` - Terrestrial Time: Julian date float, or NumPy array of floats

    Returns a tuple ``(delta_psi, delta_epsilon)`` measured in tenths of
    a micro-arcsecond.  Each is either a float, or a NumPy array with
    the same dimensions as the input argument.  The result will not take
    as long to compute as the full IAU 2000A series, but should still
    agree with ``iau2000a()`` to within a milliarcsecond between the
    years 1995 and 2020.

    rJ   M   r   g     g     P@)r   )ro   r~   r   s      r%   r)   r)   -  s6     %B*JD$KDZD:r'   ))r?   goDTAr@   rA   rB   )g&S3Ag A1ArC   rD   rE   )rF   g[BArG   rH   rI   )g!%\0AgB`M0ArK   rL   rM   )rO   g&¢ZrP   rQ   rR   Nc                    t        t        t        t        t        f| dz   d       }t        |      | z  }|D ]  }||z  }|| z  } |t        z  }t        |t        |       |t        z  }t        | dd      r|S |dddf   S )a  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.

    r
   N)outr<   r=   r   )iterfa4fa3fa2fa1nextfa0r   r   r   rl   )r   termsrp   rq   fa_is        r%   rv   rv   S  s    $ 
sCc"E6!89-	.BR1A	T		Q  HAGMAq'2QqS6Mr'   gy;>1g        c                     | j                   S )z4Deprecated: this is now a method on the Time object.)N)r   s    r%   compute_nutationr   y  s    33Jr'   c                     | j                   \  }}| j                  }||z   }t        | j                        }|t	        |      z  |z   }|t
        z  |t
        z  |t        z  dz  |t        z  |t        z  fS )zADeprecated: these are now computed separately on the Time object.g      .@)_nutation_angles_radians_mean_obliquity_radiansrs   r   r   r   r   )r   r#   r$   mean_obtrue_obrr   eq_eqs          r%   
earth_tiltr   }  sz    --LE5''GoG;ADDAGCL 7*Egw0%(2BT2IHeh.0 0r'   )rV     r   )rV   )1__doc__numpyr   r   r   r   r   r   r	   	constantsr   r   r   r   r   	functionsr   r   _arraysr   r   r   r   r   r   r   r   r   r   r&   r*   r5   r:   rs   rw   ry   rx   r   r)   r   r   r   r   r   rv   rm   rn   r   r   r=   r'   r%   <module>r      s@   + : : : : : 'sN 
>
*en#*+M#N  #*+M#N  				")*K"L ")*K"L 
)

)
 GJ%(76:gR ). / ): 	q; & %> CF ?B$   ! $ 	q1T% S#sC(@ 	
0r'   