U
    d»{j  ã                   @   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)ÚfitsÚregistry)ÚMaskedColumnÚTable)ÚTimeÚ	TimeDelta)Ú
TimeSeriesÚkepler_fits_readerc           
      C   sî  t  | ¡}|d jd  ¡ }|dkr.|d }n*|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�}d|jkrÜ| dd¡ |jD ]p}|| j	}|�rt
|| tƒ�r||  tj¡||< |dk�r.d|| _	|dk�rBd|| _	| || ¡ ¡ qât |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é   zJ is not implemented, only KEPLER or TESS are supported through this readerZEXTVERzSupport for ZTELESCOPz vz files not yet implementedZTIMESYSZTDBz# time scale not yet implemented in z readerr   )ÚformatÚTZTIMEze-/sz
electron/sZpixelsZpixelÚtimez	Ignoring z rows with NaN timesZBJDREFIZBJDREFFZjd)Úscaler   Zisot)r   Údata)r   ÚopenÚheaderÚlowerÚNotImplementedErrorr   ÚreadZcolnamesZrename_columnÚunitÚ
isinstancer   ZfilledÚnpÚnanÚisnanr   ÚanyÚwarningsÚwarnÚsumr   r   r   Zremove_columnÚcloser   )
ÚfilenameZhdulistÚ	telescopeZhduÚtabZcolnamer   ZnansZreference_dater   © r"   ú[/var/www/html/bwave/python/venv/lib/python3.8/site-packages/astropy/timeseries/io/kepler.pyr	      sX    


ÿÿÿ







ü
zkepler.fitsz	tess.fits)r   Ú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   ^