def create_from_hdu(cls, hdu, ebins=None):
        """ Creates an HPX object from a FITS header.

        hdu    : The FITS hdu
        ebins  : Energy bin edges [optional]
        """
        convname = HPX.identify_HPX_convention(hdu.header)
        conv = HPX_FITS_CONVENTIONS[convname]
        try:
            pixels = hdu.data[conv.idxstring]
        except KeyError:
            pixels = None
        return cls.create_from_header(hdu.header, ebins, pixels)