{ } Raw JSON

bundles / astropy latest / astropy / io / fits / hdu / base / _hdu_class_from_header

function

astropy.io.fits.hdu.base:_hdu_class_from_header

source: /astropy/io/fits/hdu/base.py :85

Signature

def   _hdu_class_from_header ( cls header )

Summary

Iterates through the subclasses of _BaseHDU and uses that class's match_header() method to determine which subclass to instantiate.

Extended Summary

It's important to be aware that the class hierarchy is traversed in a depth-last order. Each match_header() should identify an HDU type as uniquely as possible. Abstract types may choose to simply return False or raise NotImplementedError to be skipped.

If any unexpected exceptions are raised while evaluating match_header(), the type is taken to be _CorruptedHDU.

Used primarily by _BaseHDU._readfrom_internal and _BaseHDU._from_data to find an appropriate HDU class to use based on values in the header.

Aliases

  • astropy.io.fits.hdu.base._hdu_class_from_header