Skip to main content
`Ctrl`+`K`

# fits_ccddata_reader

astropy.nddata.fits_ccddata_reader(filename, hdu=0, unit=None, hdu_uncertainty='UNCERT', hdu_mask='MASK', hdu_flags=None, key_uncertainty_type='UTYPE', hdu_psf='PSFIMAGE', **kwd)

  Generate a CCDData object from a FITS file.

  Parameters:
    filename `python:str`

      Name of fits file.

    hdu `python:int`, `python:str`, `python:tuple` of (`python:str`, `python:int`), optional

      Index or other identifier of the Header Data Unit of the FITS file from which CCDData should be initialized. If zero and no data in the primary HDU, it will search for the first extension HDU with data. The header will be added to the primary HDU. Default is `0`.

    unit `Unit`, optional

      Units of the image data. If this argument is provided and there is a unit for the image in the FITS header (the keyword `BUNIT` is used as the unit, if present), this argument is used for the unit. Default is `None`.

    hdu_uncertainty `python:str` or `python:None`, optional

      FITS extension from which the uncertainty should be initialized. If the extension does not exist the uncertainty of the CCDData is `None`. Default is `'UNCERT'`.

    hdu_mask `python:str` or `python:None`, optional

      FITS extension from which the mask should be initialized. If the extension does not exist the mask of the CCDData is `None`. Default is `'MASK'`.

    hdu_flags `python:str` or `python:None`, optional

      Currently not implemented. Default is `None`.

    key_uncertainty_type `python:str`, optional

      The header key name where the class name of the uncertainty is stored in the hdu of the uncertainty (if any). Default is `UTYPE`.

      Added in version 3.1.

    hdu_psf `python:str` or `python:None`, optional

      FITS extension from which the psf image should be initialized. If the extension does not exist the psf of the CCDData is `None`.

    kwd

      Any additional keyword parameters are passed through to the FITS reader in `astropy.io.fits`; see Notes for additional discussion.

  Notes

  FITS files that contained scaled data (e.g. unsigned integer images) will be scaled and the keywords used to manage scaled data in `astropy.io.fits` are disabled.