U
    e»{jü  ã                   @   sL   d Z ddlZddlm  mZ ddlmZmZ d ¡ Z	dd„ Z
d	dd„ZdS )
aç  
``fitsinfo`` is a command-line script based on astropy.io.fits for
printing a summary of the HDUs in one or more FITS files(s) to the
standard output.

Example usage of ``fitsinfo``:

1. Print a summary of the HDUs in a FITS file::

    $ fitsinfo filename.fits

    Filename: filename.fits
    No.    Name         Type      Cards   Dimensions   Format
    0    PRIMARY     PrimaryHDU     138   ()
    1    SCI         ImageHDU        61   (800, 800)   int16
    2    SCI         ImageHDU        61   (800, 800)   int16
    3    SCI         ImageHDU        61   (800, 800)   int16
    4    SCI         ImageHDU        61   (800, 800)   int16

2. Print a summary of HDUs of all the FITS files in the current directory::

    $ fitsinfo *.fits
é    N)Ú__version__Úlogzâ
Print a summary of the HDUs in a FITS file(s).

This script is part of the Astropy package. See
https://docs.astropy.org/en/latest/io/fits/usage/scripts.html#module-astropy.io.fits.scripts.fitsinfo
for further documentation.
c              
   C   sD   zt  | ¡ W n0 tk
r> } zt t|ƒ¡ W 5 d}~X Y nX dS )zˆ
    Print a summary of the HDUs in a FITS file.

    Parameters
    ----------
    filename : str
        The path to a FITS file.
    N)ÚfitsÚinfoÚOSErrorr   ÚerrorÚstr)ÚfilenameÚe© r   ú_/var/www/html/bwave/python/venv/lib/python3.8/site-packages/astropy/io/fits/scripts/fitsinfo.pyÚfitsinfo(   s
    
 r   c                 C   sn   t jtt jd�}|jdddt› �d� |jdddd	� | | ¡} t| jƒD ]\}}|d
kr`t	ƒ  t
|ƒ qJdS )z2The main function called by the `fitsinfo` script.)ÚdescriptionÚformatter_classz	--versionÚversionz	%(prog)s )Úactionr   r	   ú+z8Path to one or more FITS files. Wildcards are supported.)ÚnargsÚhelpr   N)ÚargparseÚArgumentParserÚDESCRIPTIONÚRawDescriptionHelpFormatterÚadd_argumentr   Ú
parse_argsÚ	enumerater	   Úprintr   )ÚargsÚparserÚidxr	   r   r   r   Úmain9   s&     ÿ  ÿý
r    )N)Ú__doc__r   Zastropy.io.fitsÚior   Zastropyr   r   Ústripr   r   r    r   r   r   r   Ú<module>   s   	