gammapy/maps/hpx.py
def identify_hpx_format(header):
        """Identify the convention used to write this file."""
        # Hopefully the file contains the HPX_CONV keyword specifying
        # the convention used
        if "HPX_CONV" in header:
            return header["HPX_CONV"].lower()

        # Try based on the EXTNAME keyword
        hduname = header.get("EXTNAME", None)
        if hduname == "HPXEXPOSURES":
            return "fgst-bexpcube"
        elif hduname == "SKYMAP2":
            if "COORDTYPE" in header.keys():
                return "galprop"
            else:
                return "galprop2"

        # Check the name of the first column
        colname = header["TTYPE1"]
        if colname == "PIX":
            colname = header["TTYPE2"]

        if colname == "KEY":
            return "fgst-srcmap-sparse"
        elif colname == "ENERGY1":
            return "fgst-template"
        elif colname == "COSBINS":
            return "fgst-ltcube"
        elif colname == "Bin0":
            return "galprop"
        elif colname == "CHANNEL1" or colname == "CHANNEL0":
            if hduname == "SKYMAP":
                return "fgst-ccube"
            else:
                return "fgst-srcmap"
        else:
            raise ValueError("Could not identify HEALPIX convention")
Identify the convention used to write this file.
Identify the convention used to write this file.
Identify the convention used to write this file .
def identify_hpx_format(header):
        if "HPX_CONV" in header:
            return header["HPX_CONV"].lower()
        hduname = header.get("EXTNAME", None)
        if hduname == "HPXEXPOSURES":
            return "fgst-bexpcube"
        elif hduname == "SKYMAP2":
            if "COORDTYPE" in header.keys():
                return "galprop"
            else:
                return "galprop2"
        colname = header["TTYPE1"]
        if colname == "PIX":
            colname = header["TTYPE2"]
        if colname == "KEY":
            return "fgst-srcmap-sparse"
        elif colname == "ENERGY1":
            return "fgst-template"
        elif colname == "COSBINS":
            return "fgst-ltcube"
        elif colname == "Bin0":
            return "galprop"
        elif colname == "CHANNEL1" or colname == "CHANNEL0":
            if hduname == "SKYMAP":
                return "fgst-ccube"
            else:
                return "fgst-srcmap"
        else:
            raise ValueError("Could not identify HEALPIX convention")
def identify_hpx_format ( header ) : if "HPX_CONV" in header : return header [ "HPX_CONV" ] . lower ( ) hduname = header . get ( "EXTNAME" , None ) if hduname == "HPXEXPOSURES" : return "fgst-bexpcube" elif hduname == "SKYMAP2" : if "COORDTYPE" in header . keys ( ) : return "galprop" else : return "galprop2" colname = header [ "TTYPE1" ] if colname == "PIX" : colname = header [ "TTYPE2" ] if colname == "KEY" : return "fgst-srcmap-sparse" elif colname == "ENERGY1" : return "fgst-template" elif colname == "COSBINS" : return "fgst-ltcube" elif colname == "Bin0" : return "galprop" elif colname == "CHANNEL1" or colname == "CHANNEL0" : if hduname == "SKYMAP" : return "fgst-ccube" else : return "fgst-srcmap" else : raise ValueError ( "Could not identify HEALPIX convention" )
Identify the convention used to write this file.
Identify the convention used to write this file .
"""Identify the convention used to write this file.""" # Hopefully the file contains the HPX_CONV keyword specifying # the convention used # Try based on the EXTNAME keyword # Check the name of the first column
header