(t)
Get the FITS convention format string of data type t.

    Parameters
    ----------
    t : data type
      The data type for which the FITS type is requested

    Returns
    -------
    fits_type : str or None
      The FITS string code describing the data type, or None if unknown type.
Get the FITS convention format string of data type t.
Get the FITS convention format string of data type t .
def getformat(t):
    """Get the FITS convention format string of data type t.

    Parameters
    ----------
    t : data type
      The data type for which the FITS type is requested

    Returns
    -------
    fits_type : str or None
      The FITS string code describing the data type, or None if unknown type.
    """
    conv = {
        np.dtype(np.bool_): "L",
        np.dtype(np.uint8): "B",
        np.dtype(np.int16): "I",
        np.dtype(np.int32): "J",
        np.dtype(np.int64): "K",
        np.dtype(np.float32): "E",
        np.dtype(np.float64): "D",
        np.dtype(np.complex64): "C",
        np.dtype(np.complex128): "M",
    }
    try:
        if t in conv:
            return conv[t]
    except:
        pass
    try:
        if np.dtype(t) in conv:
            return conv[np.dtype(t)]
    except:
        pass
    try:
        if np.dtype(type(t)) in conv:
            return conv[np.dtype(type(t))]
    except:
        pass
    try:
        if np.dtype(type(t[0])) in conv:
            return conv[np.dtype(type(t[0]))]
    except:
        pass
    try:
        if t is str:
            return "A"
    except:
        pass
    try:
        if type(t) is str:
            return "A%d" % (len(t))
    except:
        pass
    try:
        if type(t[0]) is str:
            l = max(len(s) for s in t)
            return "A%d" % (l)
    except:
        pass
    try:
        if np.dtype(t.type) in conv:
            return conv[np.dtype(t.type)]
    except:
        pass
    try:
        if np.dtype(t[0].type) in conv:
            return conv[np.dtype(t[0].type)]
    except:
        pass

    raise ValueError(
        "healpy could not understand the equivalent FITS datatype of {}, please open an issue on the healpy Github repository".format(
            str(t)
        )
    )
def getformat ( t ) : conv = { np . dtype ( np . bool_ ) : "L" , np . dtype ( np . uint8 ) : "B" , np . dtype ( np . int16 ) : "I" , np . dtype ( np . int32 ) : "J" , np . dtype ( np . int64 ) : "K" , np . dtype ( np . float32 ) : "E" , np . dtype ( np . float64 ) : "D" , np . dtype ( np . complex64 ) : "C" , np . dtype ( np . complex128 ) : "M" , } try : if t in conv : return conv [ t ] except : pass try : if np . dtype ( t ) in conv : return conv [ np . dtype ( t ) ] except : pass try : if np . dtype ( type ( t ) ) in conv : return conv [ np . dtype ( type ( t ) ) ] except : pass try : if np . dtype ( type ( t [ 0 ] ) ) in conv : return conv [ np . dtype ( type ( t [ 0 ] ) ) ] except : pass try : if t is str : return "A" except : pass try : if type ( t ) is str : return "A%d" % ( len ( t ) ) except : pass try : if type ( t [ 0 ] ) is str : l = max ( len ( s ) for s in t ) return "A%d" % ( l ) except : pass try : if np . dtype ( t . type ) in conv : return conv [ np . dtype ( t . type ) ] except : pass try : if np . dtype ( t [ 0 ] . type ) in conv : return conv [ np . dtype ( t [ 0 ] . type ) ] except : pass raise ValueError ( "healpy could not understand the equivalent FITS datatype of {}, please open an issue on the healpy Github repository" . format ( str ( t ) ) )