bundles / astropy latest / astropy / io / fits / hdu / hdulist / HDUList / index_of
function
astropy.io.fits.hdu.hdulist:HDUList.index_of
source: /astropy/io/fits/hdu/hdulist.py :772
Signature
def index_of ( self , key ) Summary
Get the index of an HDU from the HDUList.
Parameters
key: int, str, tuple of (string, int) or BaseHDUThe key identifying the HDU. If
keyis a tuple, it is of the form(name, ver)whereveris anEXTVERvalue that must match the HDU being searched for.If the key is ambiguous (e.g. there are multiple 'SCI' extensions) the first match is returned. For a more precise match use the
(name, ver)pair.If even the
(name, ver)pair is ambiguous (it shouldn't be but it's not impossible) the numeric index must be used to index the duplicate HDU.When
keyis an HDU object, this function returns the index of that HDU object in theHDUList.
Returns
index: intThe index of the HDU in the HDUList.
Raises
: ValueErrorIf
keyis an HDU object and it is not found in theHDUList.: KeyErrorIf an HDU specified by the
keythat is an extension number, extension name, or a tuple of extension name and version is not found in theHDUList.
Aliases
-
astropy.io.fits.HDUList.index_of