
    R1i3                     D    d Z ddlZddlZ G d de      Z G d de      Zy)a%  Compute positions from an ephemeris installed as a Python package.

Note: This entire module is DEPRECATED.  The idea of distributing JPL
ephemerides as Python packages proved to be impractical (they were much
too large for the Python Package Index to easily store and distribute),
and it forced `jplephem` users get their ephemerides from a different
source than mainline astronomers, who use SPICE files.  This package's
documentation now recommends avoiding this old code, and using the
features now build directly into the `SPK` class instead.

    Nc                       e Zd ZdZy)	DateErrorz9Date input is outside the range covered by the ephemeris.N)__name__
__module____qualname____doc__     R/home/cursorai/projects/iching/venv/lib/python3.12/site-packages/jplephem/ephem.pyr   r      s    Cr
   r   c                   L    e Zd ZdZd Zd Zd ZddZddZd Z	ddZ
d	 Zd
 Zy)	EphemeriszF[DEPRECATED] JPL planetary ephemeris for computing positions on dates.c                 "   |j                   j                         | _        t        j                  j                  |j                        | _        t        t        d t        j                  | j                        D                    | _        | j	                  d      }| j                  j                  d t        j                  |      D               dd| j                   z   z  | _        | j                   d| j                   z   z  | _        i | _        y )Nc              3      K   | ]L  }|j                  d       s9|j                  d      r(|j                  d      d   j                  d      d    N yw)	constantsz.npy-.r   N)
startswithendswithsplit).0names     r   	<genexpr>z%Ephemeris.__init__.<locals>.<genexpr>   sL      "0??;/DMM&4I JJsOB%%c*1-0s   AAzconstants.npyc              3   H   K   | ]  \  }}|j                  d       |f  yw)asciiN)decode)r   kvs      r   r   z%Ephemeris.__init__.<locals>.<genexpr>    s#     N1ahhw/3s    "      ?)r   upperr   ospathdirname__file__dirpathtuplesortedlistdirnames__dict__updatenploadEMRATearth_share
moon_sharesets)selfmoduler"   s      r   __init__zEphemeris.__init__   s    OO))+	wwv76 "

4<<0"  

 yy)NNN#

"23**djj(89	r
   c                 V    t         j                  j                  | j                  |      S )zD[DEPRECATED] Compute the path to a particular file in the ephemeris.)r!   r"   joinr%   )r2   filenames     r   r"   zEphemeris.path%   s    ww||DLL(33r
   c                     | j                   j                  |      }|6t        j                  | j	                  d|z              x| j                   |<   }|S )zA[DEPRECATED] Load the polynomial series for `name` and return it.z
jpl-%s.npy)r1   getr,   r-   r"   )r2   r   ss      r   r-   zEphemeris.load)   sG    IIMM$9"$''$))L44G*H"IIDIIdOar
   c                 J    | j                  |||      }| j                  |      S )a1  [DEPRECATED] Compute the position of `name` at time ``tdb [+ tdb2]``.

        The position is returned as a NumPy array ``[x y z]``.

        The barycentric dynamical time `tdb` argument should be a float.
        If there are many dates you want computed, then make `tdb` an
        array, which is more efficient than calling this method multiple
        times; the return value will be a two-dimensional array giving a
        row of values for each coordinate.

        For extra precision, the time can be split into two floats; a
        popular choice is to use `tdb` for the integer or half-integer
        date, and `tdb2` to hold the remaining fraction.

        Consult the `names` attribute of this ephemeris for the values
        of `name` it supports, such as ``'mars'`` or ``'earthmoon'``.

        )compute_bundleposition_from_bundle)r2   r   tdbtdb2bundles        r   positionzEphemeris.position0   s)    & $$T35((00r
   c                 t    | j                  |||      }| j                  |      }| j                  |      }||fS )aa  [DEPRECATED] Compute the position and velocity of `name` at ``tdb [+ tdb2]``.

        The position and velocity are returned in a 2-tuple::

            ([x y z], [xdot ydot zdot])

        The barycentric dynamical time `tdb` argument should be a float.
        If there are many dates you want computed, then make `tdb` an
        array, which is more efficient than calling this method multiple
        times; the return values will be two-dimensional arrays giving a
        row of values for each coordinate.

        For extra precision, the time can be split into two floats; a
        popular choice is to use `tdb` for the integer or half-integer
        date, and `tdb2` to hold the remaining fraction.

        Consult the `names` attribute of this ephemeris for the values
        of `name` it supports, such as ``'mars'`` or ``'earthmoon'``.

        )r<   r=   velocity_from_bundle)r2   r   r>   r?   r@   rA   velocitys          r   position_and_velocityzEphemeris.position_and_velocityF   sC    * $$T35,,V4,,V4!!r
   c                     | j                  ||d      }| j                  |      }| j                  |      }t        j                  ||f      S )ay  [DEPRECATED] Legacy routine that concatenates position and velocity vectors.

        This routine is deprecated.  Use the methods `position()` and
        `position_and_velocity()` instead.  This method follows the same
        calling convention, but incurs extra copy operations in order to
        return a single NumPy array::

            [x y z xdot ydot zdot]

                )r<   r=   rC   r,   concatenate)r2   r   r>   r@   rA   rD   s         r   computezEphemeris.compute`   sL     $$T34,,V4,,V4~~x233r
   c                    t        |dd      dk(  }|rt        j                  |f      }| j                  |      }|j                  \  }}}| j
                  | j                  }
}	|
|	z
  |z  }t        ||	z
  |z   |      \  }}|j                  t              }|dk  j                         s||k  j                         rt        d| j                  |	|
fz        ||k(  }||xx   dz  cc<   ||xx   |z  cc<   t        j                  ||   d      }t        j                  |t        |      f      }d|d<   d|z  |z  dz
  x|d<   }||z   }t!        d|      D ]  }|||dz
     z  ||dz
     z
  ||<    ||||f}|S )	a  [DEPRECATED] Return a tuple of coefficients and parameters for `tdb`.

        The return value is a tuple that bundles together the
        coefficients and other Chebyshev intermediate values that are
        needed for the computation of either the position or velocity.
        The bundle can then be passed to either `position_from_bundle()`
        or `velocity_from_bundle()` to finish the computation.  See the
        package-level documentation for details; most users will simply
        call `position()` or `position_and_velocity()` instead.

        The barycentric dynamical time `tdb` argument should be a float.
        If there are many dates you want computed, then make `tdb` an
        array, which is more efficient than calling this method multiple
        times; the return values will be arrays providing a value for
        each time in `tdb`.

        For extra precision, the time can be split into two floats; a
        popular choice is to use `tdb` for the integer or half-integer
        date, and `tdb2` to hold the remaining fraction.

        Consult the `names` attribute of this ephemeris for the values
        of `name` it supports, such as ``'mars'`` or ``'earthmoon'``.

        shaper	   r   z0ephemeris %s only covers dates %.1f through %.1f   r          @   )getattrr,   arrayr-   rK   jalphajomegadivmodastypeintanyr   r   rollaxisemptylenrange)r2   r   r>   r?   input_was_scalarcoefficient_setsnumber_of_sets
axis_countcoefficient_countrQ   rR   days_per_setindexoffsetomegascoefficientsTt1twot1ir@   s                        r   r<   zEphemeris.compute_bundlep   s   2 #34:((C6"C  99T?8H8N8N5
$5dkk>9f4lCvS!AI??%!7 < < >N#yy&&9: ; ; >)fv,&{{#3E#:A> HH'U45!&L</#55!rRq+,A1QqS6>AacF*AaD - |Q5r
   c                 N    |\  }}}}|j                   |z  j                  d      S )zL[DEPRECATED] Return position, given the `coefficient_bundle()` return value.rN   axis)re   sum)r2   r@   rd   r`   re   rg   s         r   r=   zEphemeris.position_from_bundle   s/     06,lAul"''Q'//r
   c                 B   |\  }}}}|j                   d   }t        j                  |      }d|d<   d|d<   ||z   |d<   t        d|      D ]+  }|||dz
     z  ||dz
     z
  ||dz
     z   ||dz
     z   ||<   - |dz  }||z  }|j                  |z  j                  d      S )	zL[DEPRECATED] Return velocity, given the `coefficient_bundle()` return value.rN   rG   r   r   rL      rM   rj   )rK   r,   
empty_likerZ   re   rl   )	r2   r@   rd   r`   re   rg   r_   dTrh   s	            r   rC   zEphemeris.velocity_from_bundle   s     06,lAu(..q1 ]]1111q+,ABqsGOb1g-!A#61Q3?BqE -
c	
l|#((a(00r
   N)rG   )r   r   r   r   r4   r"   r-   rA   rE   rI   r<   r=   rC   r	   r
   r   r   r      s3    P41,"44 ;z01r
   r   )r   r!   numpyr,   
ValueErrorr   objectr   r	   r
   r   <module>rt      s.   
 
 D
 Dp1 p1r
   