a
    ߙfb,                     @   sz   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dee ed	ee dS )
    N)registryfits)TableMaskedColumn)Time	TimeDelta)
TimeSerieskepler_fits_readerc           
      C   s  t | }|d jd  }|dkr.|d }n*|dkr@|d }ntd|d jd |jd dkrtd	|jd
 |jd |jd dkrtd|jd |jd
 tj|dd}d|jv r|	dd |jD ]p}|| j
}|rt|| tr|| tj||< |dkr"d|| _
|dkr6d|| _
|	||  qt|d j}t|r|tdt| d ||  }t|jd |jd |jd  dd}|t|d j }	d|	_|d |  t|	|dS )at  
    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.

    Returns
    -------
    ts : `~astropy.timeseries.TimeSeries`
        Data converted into a TimeSeries.
    r   ZtelescopZtessZ
LIGHTCURVEZkepler   zL{} is not implemented, only KEPLER or TESS are supported through this readerZEXTVERz,Support for {} v{} files not yet implementedZTELESCOPZTIMESYSZTDBz:Support for {} time scale not yet implemented in {} readerr   )formatTZTIMEze-/sz
electron/sZpixelsZpixeltimez	Ignoring z rows with NaN timesZBJDREFIZBJDREFFZjd)Zscaler   Zisot)r   data)r   openheaderlowerNotImplementedErrorr   r   readZcolnamesZrename_columnunit
isinstancer   ZfillednpnanZisnanr   anywarningswarnsumr   r   Zremove_columncloser   )
filenameZhdulistZ	telescopeZhduZtabZcolnamer   ZnansZreference_dater    r   ;lib/python3.9/site-packages/astropy/timeseries/io/kepler.pyr	      sR    











zkepler.fitsz	tess.fits)r   Znumpyr   Z
astropy.ior   r   Zastropy.tabler   r   Zastropy.timer   r   Zastropy.timeseries.sampledr   __all__r	   Zregister_readerr   r   r   r   <module>   s   T