σ
ίΘ[c           @` so   d  Z  d d l m Z m Z m Z m Z d d l Z d d l j j	 Z	 d d l
 m Z d   Z d d  Z d S(   uη  
``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
i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   logc         C` s>   y t  j |   Wn& t k
 r9 } t j t |   n Xd S(   u   
    Print a summary of the HDUs in a FITS file.

    Parameters
    ----------
    filename : str
        The path to a FITS file.
    N(   t   fitst   infot   IOErrorR   t   errort   str(   t   filenamet   e(    (    s?   lib/python2.7/site-packages/astropy/io/fits/scripts/fitsinfo.pyt   fitsinfo!   s
    
c         C` s~   t  j d d  } | j d d d d d | j |   }  x= t |  j  D], \ } } | d k rl t   n  t |  qJ Wd	 S(
   u2   The main function called by the `fitsinfo` script.t   descriptionu.   Print a summary of the HDUs in a FITS file(s).u   filenamet   nargsu   +t   helpu8   Path to one or more FITS files. Wildcards are supported.i    N(   t   argparset   ArgumentParsert   add_argumentt
   parse_argst	   enumerateR
   t   printR   (   t   argst   parsert   idxR
   (    (    s?   lib/python2.7/site-packages/astropy/io/fits/scripts/fitsinfo.pyt   main2   s    		
(   t   __doc__t
   __future__R    R   R   R   R   t   astropy.io.fitst   ioR   t   astropyR   R   t   NoneR   (    (    (    s?   lib/python2.7/site-packages/astropy/io/fits/scripts/fitsinfo.pyt   <module>   s   "	