
    R1i                        d Z ddlmZ ddlmZmZmZmZ ddlm	Z
 ddlmZmZmZ d Z e       Z[ eg d      Z G d	 d
e      Zd Z G d de      Z e       Z edeez  dfe ez  ddfdf      Z G d de      Z e       Z G d de      Z e       Z G d de      Z e       Z G d de      Z ede
d         Z ede
d         Z ede
d         Zy)z<Raw transforms between coordinate frames, as NumPy matrices.    )array   )ANGVELASEC2RADDAY_Stau)inertial_frames)mxmrot_xrot_zc                      dt         z  } dt         z  }dt         z  }| }| }|}|}|  }| }dd||z  ||z  z   z  z
  }	dd||z  ||z  z   z  z
  }
dd||z  ||z  z   z  z
  }t        |	||f||
|f|||ff      S )Ng;gs{g<,Ԛ捿g      ?g      ?)r   r   )xi0eta0da0yxzxxyzyxzyzxxyyzzs               U/home/cursorai/projects/iching/venv/lib/python3.12/site-packages/skyfield/framelib.pybuild_matrixr   	   s      C D C B
B
B
B
B
B 
sb2gR'(	(B	sb2gR'(	(B	sb2gR'(	(B2r2,Rr2rl;<<    ))r   r   r   )r   r   r   )r   r   r   c                        e Zd ZdZed        Zy)ICRSa;  The International Coordinate Reference System (ICRS).

    The ICRS is a permanent reference frame which has replaced J2000,
    with which its axes agree to within 0.02 arcseconds (closer than the
    precision of J2000 itself).  The ICRS also supersedes older
    equinox-based systems like B1900 and B1950.

    c                     t         S N)	_identityts    r   rotation_atzICRS.rotation_at0   s    r   N__name__
__module____qualname____doc__staticmethodr$    r   r   r   r   '   s      r   r   c                 ~    | j                   \  }}| j                  |z   }t        t        |       | j                        S r    )_nutation_angles_radians_mean_obliquity_radiansr
   r   M)r#   _d_epstrue_obliquitys       r   build_ecliptic_matrixr3   4   s:    ))HAu..6Nu~%&,,r   c                        e Zd ZdZed        Zy) true_equator_and_equinox_of_dateu  The dynamical frame of the Earth’s true equator and equinox of date.

    This is supplied as an explicit reference frame in case you want
    |xyz| coordinates; if you want angles, it’s better to use the
    standard position method ``radec(epoch='date')`` since that will
    return the conventional units of hours-of-right-ascension instead of
    the degrees-of-longitude that ``frame_latlon()`` would return.

    This reference frame combines current theories of the Earth’s
    precession and nutation with a small offset between the ITRS and
    J2000 systems to produce right ascension and declination for a given
    date relative to the Earth’s axis and equator of rotation.

    c                     | j                   S r    )r/   r"   s    r   r$   z,true_equator_and_equinox_of_date.rotation_atI   s    ss
r   Nr%   r+   r   r   r5   r5   :   s      r   r5           )r7   r7   r7   c                   0    e Zd ZdZed        Zed        Zy)tirsu  The Terrestrial Intermediate Reference System (TIRS).

    Coordinates in this Earth-centered Earth-fixed (ECEF) system are
    measured from the axis and equator of the Earth’s rotation, ignoring
    the few tenths of an arcsecond by which the Earth’s actual crust and
    continents might be askance from the axis.  (More precisely: like
    the ITRS this frame accounts for precession and nutation, but
    neglects polar motion and the TIO locator.)

    c                 j    t        t        | j                   t        z  dz        | j                        S Ng      8@)r
   r   gastr   r/   r"   s    r   r$   ztirs.rotation_at`   s'    5!&&3-.44r   c                     t         S r    _itrs_angvel_matrixr"   s    r   _dRdt_times_RT_atztirs._dRdt_times_RT_atd   
     #"r   Nr&   r'   r(   r)   r*   r$   r@   r+   r   r   r9   r9   U   s/    	 5 5 # #r   r9   c                   0    e Zd ZdZed        Zed        Zy)itrsu  The International Terrestrial Reference System (ITRS).

    This is the IAU standard for an Earth-centered Earth-fixed (ECEF)
    coordinate system, anchored to the Earth’s crust and continents.
    This reference frame combines three other reference frames: the
    Earth’s true equator and equinox of date, the Earth’s rotation with
    respect to the stars, and (if your ``Timescale`` has polar offsets
    loaded) the polar wobble of the crust with respect to the Earth’s
    pole of rotation.

    .. versionadded:: 1.34

    c                     t        t        | j                   t        z  dz        | j                        }| j
                  j                  t        | j                         |      }|S r;   )r
   r   r<   r   r/   tspolar_motion_tablepolar_motion_matrix)r#   Rs     r   r$   zitrs.rotation_atz   sP    qvvgmd*+QSS144"".A))+Q/Ar   c                     t         S r    r>   r"   s    r   r@   zitrs._dRdt_times_RT_at   rA   r   NrB   r+   r   r   rD   rD   l   s/       # #r   rD   c                       e Zd ZdZd Zy)ecliptic_framez9Reference frame of the true ecliptic and equinox of date.c                     t        |      S r    )r3   selfr#   s     r   r$   zecliptic_frame.rotation_at   s    $Q''r   N)r&   r'   r(   r)   r$   r+   r   r   rL   rL      s
    C(r   rL   c                       e Zd Zd Zd Zy)InertialFramec                      || _         || _        y r    )r)   _matrix)rO   docmatrixs      r   __init__zInertialFrame.__init__   s    r   c                     | j                   S r    )rS   rN   s     r   r$   zInertialFrame.rotation_at   s    ||r   N)r&   r'   r(   rV   r$   r+   r   r   rQ   rQ      s    r   rQ   uC   Reference frame of the Earth’s mean equator and equinox at B1950.B1950z:Reference frame of the true ecliptic and equinox at J2000.
ECLIPJ2000z#Galactic System II reference frame.GALACTICN)r)   numpyr   	constantsr   r   r   r   
data.spicer	   _inertial_frames	functionsr
   r   r   r   ICRS_to_J2000r!   objectr   r3   r5   r?   r9   rD   rL   rQ   equatorial_B1950_frameecliptic_J2000_framegalactic_framer+   r   r   <module>re      s#   B  3 3 ; ( (=2 -.	6 -v & $D#E  %&.#Vf_c3  #6 #* v#6 #6 v(V (
  !F  'IW 
 %@\"  )Z r   