
    R1iS                         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mZ ddlmZ ddlmZ ddlmZ ddlmZ  G d	 d
e      Zd Zy)z?Python class for a distant object with, at most, proper motion.    )arraycosemptyisnanoutersinwhere   )AU_KMASEC2RADCC_AUDAYDAY_ST0)	length_of)light_time_difference)Time)Anglec            
       V    e Zd ZdZeZdZdddddddddef
dZd Z	e
d        Zd Zd	 Zy)
Starah  The position in the sky of a star or other fixed object.

    Each `Star` object specifies the position of a distant object.  You
    should provide as a right ascension and declination relative to the
    ICRS (the recent improvement upon J2000).  You can specify the
    coordinates using either floating point hours and degrees, or tuples
    that specify hour and degree fractions as minutes and seconds, or
    even full Skyfield :class:`~skyfield.units.Angle` objects (which can
    themselves be initialized using hours, degrees, or radians):

    >>> barnard = Star(ra_hours=17.963471675, dec_degrees=4.69339088889)
    >>> barnard = Star(ra_hours=(17, 57, 48.49), dec_degrees=(4, 41, 36.20))
    >>> barnard = Star(ra=Angle(hours=17.963471675),
    ...                dec=Angle(degrees=4.69339088889))

    For objects whose proper motion across the sky has been detected,
    you can supply velocities in milliarcseconds (mas) per year, and
    even a parallax and radial velocity if those are known:

    >>> barnard = Star(ra_hours=(17, 57, 48.49803),
    ...                dec_degrees=(4, 41, 36.2072),
    ...                ra_mas_per_year=-798.71,
    ...                dec_mas_per_year=+10337.77,
    ...                parallax_mas=545.4,
    ...                radial_km_per_s=-110.6)

    See `stars` for a guide to using a `Star` once you have created it.

    N         c                    |t        |      | _        n#t        |t               r|| _        nt        d      |t        |      | _        n#t        |t               r|| _        nt        d      t        |
t
              r|
j                  }
|| _        || _        || _	        || _
        |
| _        |	| _        | j                          y )N)hourszOplease provide either ra_hours=<float> or else ra=<skyfield.units.Angle object>)degreeszSplease provide either dec_degrees=<float> or else dec=<skyfield.units.Angle object>)r   ra
isinstance	TypeErrordecr   ttra_mas_per_yeardec_mas_per_yearparallax_masradial_km_per_sepochnames_compute_vectors)selfr   r   ra_hoursdec_degreesr!   r"   r#   r$   r&   r%   s              T/home/cursorai/projects/iching/venv/lib/python3.12/site-packages/skyfield/starlib.py__init__zStar.__init__+   s     (+DGE"DG @ A A "[1DHU#DH A B B eT"HHE  / 0(.

    c                 ~   g }dD ]  }t        | |      }t        |t              r|j                  }t        |dd       }|r:dj	                  d |D              }|j                  dj                  ||             t|sw|j                  dj                  ||              dj                  dj	                  |            S )	N)r   r   r!   r"   r#   r$   r&   r%   shape,c              3   2   K   | ]  }t        |        y w)N)str).0ns     r+   	<genexpr>z Star.__repr__.<locals>.<genexpr>[   s     !8%Q#a&%s   z{0} shape={1}z	{0}={1!r}z	Star({0})z, )getattrr   r   _degreesjoinappendformat)r(   optsnamevaluer/   shapess         r+   __repr__zStar.__repr__P   s    'D D$'E%'E7D1E!8%!88O224@AK..tU;<' !!$))D/22r-   c                    dt        |d         dz  z   } | t        |d         t        |d         t        |j                  dd            t        |j                  dd            t        |j                  d	d            |
      S )Ng    B:A
epoch_year     v@r)   r*   r!   r   r"   r#   )r)   r*   r!   r"   r#   r%   )_unwrapget)clsdfr%   s      r+   from_dataframezStar.from_dataframea   s    GB|$45>>R
^,= 12#BFF+<a$@A$RVV,>%BC !:;
 	
r-   c                    | j                   | j                  }}|j                  }t        ||j                  j
                        }|j                  r>t        ||j                  |z   | j                  z
        j                  |z   j                  }n"|||j                  |z   | j                  z
  z  z   }t        |j                        dkD  rt        |j                  j
                  j                        dkD  rG||j                  j
                  z
  }|j                  j                  j                  |z
  j                  }n|j                  |j                  j
                  z
  j                  }|j                  j                  |j                  z
  j                  }nF||j                  j
                  z
  }|j                  j                  j                  |z
  j                  }t        |      }|t        z  }	t        |j                        dkD  rZ|j                  sNt!        |j                  dd        }
|
j#                  |j$                         |j&                  j)                  |
      }||||	fS )Nr
   )_position_au_velocity_au_per_dtr   positionaur/   r   tdbr%   Tlenvelocityau_per_dr   r   r   fillr    tstt_jd)r(   observerrL   rQ   rK   dtvectorveldistance
light_timer    s              r+   _observe_from_bcrszStar._observe_from_bcrsm   s   !..0G0G(JJ"8X->->-A-AB77h
TZZ(?@BBXMPPH(aeebj4::.E"FFHx~~"8$$''--.2!H$5$5$8$88((1133h>AA"**x'8'8';';;>>((11HJJ>AA 1 1 4 44F$$--//(:==CV$'
x~~"177x~~ab)*BGGADDM

2AsAz))r-   c                 
   | j                   }t        |dd      }|rt        t        |      d|      }d||dk  <   n|dk  rd}dt	        |dz  t
        z        z  }| j                  j                  }| j                  j                  }t        |      }t	        |      }t        |      }t	        |      }	t        ||z  |z  ||z  |z  ||	z  f      | _        dd| j                  t        z  dz  z
  z  }
| j                  |dz  z  |
z  }| j                  |dz  z  |
z  }| j                  t         z  | j"                  z  |
z  }t        | |z  ||	z  |z  z
  ||z  |z  z   ||z  ||	z  |z  z
  ||z  |z  z   ||z  ||	z  z   f      | _        y)	z=Compute the star's position as an ICRF position and velocity.r/   Nr   gư>g      ?gMbP?g     @@rB   )r#   r6   r	   r   r   r   r   radiansr   r   r   rI   r$   r   r!   r"   r   au_kmrJ   )r(   parallaxr/   distrdcrasracdcsdckpmrpmdrvls                 r+   r'   zStar._compute_vectors   s   
 $$'40U8_c8<H(.HX_%_H
 SF*X566GGOOHH!f!f!f!f!3J3J3J#  3--1F::;
 ""h&781<##x&'89A=""U*TZZ7!; #(ECK#)c/)C#IO;Ci#)c/)C#IO;Ci#)#) #r-   )__name__
__module____qualname____doc__r   r_   targetr   r,   r?   classmethodrG   r\   r'   r   r-   r+   r   r   
   sS    : EFD4T!$s!3b# J3" 	
 	
*40r-   r   c                     t        | d|       S )z?Return floats untouched, but ask Series for their NumPy arrays.values)r6   )r=   s    r+   rC   rC      s    5(E**r-   N)ro   numpyr   r   r   r   r   r   r	   	constantsr   r   r   r   r   r   	functionsr   
relativityr   timelibr   unitsr   objectr   rC   r   r-   r+   <module>r{      s7    E = = = = =   -  m6 m^+r-   