cwitools.utils.extract_hdu

cwitools.utils.extract_hdu(fits_in, nhdu=0)

Load a HDU whether the input type is HDUList, PrimaryHDU or ImageHDU.

Parameters:
  • fits_in – An astropy.fits.HDUlist, .ImageHDU or .PrimaryHDU or a string which is the path of a FITS file.
  • nhdu (int) – Which HDU to extract, if HDUList type or file given. Default is 0 (first HDU).
Returns:

The input HDU or the Primary HDU of an input HDUList or FITS file.

Return type:

HDU