
    IR-e                         d dl Z d dlZd dlmZmZ d dlmZmZ d dl	m
Z
mZ d dlmZ dgZddZ ej        d	ee            ej        d
ee           dS )    N)fitsregistry)MaskedColumnTable)Time	TimeDelta)
TimeSerieskepler_fits_readerwarnc                    t          j        |           }|d         j        d                                         }|dk    r	|d         }n2|dk    r	|d         }n#t	          |d         j        d          d          |j        d         dk    r,t	          d	|j        d
          d|j        d          d          |j        d         dk    r,t	          d	|j        d          d|j        d
          d          t          j        |d|          }d|j        v r|                    dd           |j        D ]}||         j	        }|rCt          ||         t                    r(||                             t          j                  ||<   |dk    rd||         _	        |dk    rd||         _	        |                    ||                                           t          j        |d         j                  }t          j        |          r*t%          j        dt          j        |           d           ||          }t+          |j        d         |j        d         |j        d                                         d          }	|	t-          |d         j        d           z   }
d!|
_        |                    d           |                                 t5          |
|"          S )#a   
    This serves as the FITS reader for KEPLER or TESS files within
    astropy-timeseries.

    This function should generally not be called directly, and instead this
    time series reader should be accessed with the
    :meth:`~astropy.timeseries.TimeSeries.read` method::

        >>> from astropy.timeseries import TimeSeries
        >>> ts = TimeSeries.read('kplr33122.fits', format='kepler.fits')  # doctest: +SKIP

    Parameters
    ----------
    filename : `str` or `pathlib.Path`
        File to load.
    unit_parse_strict : str, optional
        Behaviour when encountering invalid column units in the FITS header.
        Default is "warn", which will emit a ``UnitsWarning`` and create a
        :class:`~astropy.units.core.UnrecognizedUnit`.
        Values are the ones allowed by the ``parse_strict`` argument of
        :class:`~astropy.units.core.Unit`: ``raise``, ``warn`` and ``silent``.

    Returns
    -------
    ts : `~astropy.timeseries.TimeSeries`
        Data converted into a TimeSeries.
    r   telescoptess
LIGHTCURVEkepler   zJ is not implemented, only KEPLER or TESS are supported through this readerEXTVERzSupport for TELESCOPz vz files not yet implementedTIMESYSTDBz# time scale not yet implemented in z readerr   )formatunit_parse_strictTTIMEze-/sz
electron/spixelspixeltimez	Ignoring z rows with NaN timesBJDREFIBJDREFFjd)scaler   )r   isot)r   data)r   openheaderlowerNotImplementedErrorr   readcolnamesrename_columnunit
isinstancer   fillednpnanisnanr"   anywarningsr   sumr   r   r   remove_columncloser	   )filenamer   hdulist	telescopehdutabcolnamer*   nansreference_dater   s              <lib/python3.11/site-packages/astropy/timeseries/io/kepler.pyr
   r
      s   8 i!!G
!*-3355IFl#	h		aj!qz , 1 1 1
 
 	

 z(a!3:j1  SZ5I   
 
 	
 z)%%!03:i0 0 0
:&0 0 0
 
 	

 *S;L
M
M
MC cl#v&&&< 4 47|   	7Js7|\:: 	7w<..rv66CL6>> ,CL8 'CL 	'7==??3333 8CK$%%D	vd|| FD"&,,DDDEEE
te*C 
9
9j#))++	  N Ic&k&6tDDDDDDK fMMOOO4c****    zkepler.fitsz	tess.fits)r   )r1   numpyr-   
astropy.ior   r   astropy.tabler   r   astropy.timer   r   astropy.timeseries.sampledr	   __all__r
   register_reader r>   r=   <module>rG      s         % % % % % % % % - - - - - - - - ( ( ( ( ( ( ( ( 1 1 1 1 1 1
 a+ a+ a+ a+H  
4F G G G  j2D E E E E Er>   