get_hdu_from_hdu_list#

get_hdu_from_hdu_list(hdu_list, hdu_idx=_Unset.UNSET, concatenate_jwst_header=True)[source]#

Get an HDU object from an HDUList object.

JWST data products store the image in the second HDU, with the primary HDU containing metadata about the observation. This function will concatenate the header of the primary HDU with the header of the image HDU if concatenate_jwst_header is True.

Parameters:
  • hdu_list (HDUList) – The HDU list to get the HDU object from.

  • hdu_idx (int | _Unset, optional, default=_UNSET) – The index of the HDU object to get.

  • concatenate_jwst_header (bool, optional, default=True) – Whether to concatenate the header of the JWST primary HDU with the header of the image HDU if concatenate_jwst_header is True.

Returns:

hdu – The HDU object.

Return type:

ImageHDU | PrimaryHDU