This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Total number of HDUs in FITS file


N = getNumHDUs(fptr)


N = getNumHDUs(fptr) returns the number of completely defined HDUs in a FITS file. If a new HDU has just been added to the FITS file, then that last HDU will only be counted if it has been closed, or if data has been written to the HDU. The current HDU remains unchanged by this routine.

This function corresponds to the fits_get_num_hdus (ffthdu) function in the CFITSIO library C API.


fptr = fits.openFile('tst0012.fits');
n = fits.getNumHDUs(fptr);

See Also