def blockheader2dic(head):
    dic = dict()

    dic["scale"] = head[0]
    dic["status"] = head[1]
    dic["index"] = head[2]
    dic["mode"] = head[3]
    dic["ctcount"] = head[4]
    dic["lpval"] = head[5]
    dic["rpval"] = head[6]
    dic["lvl"] = head[7]
    dic["tlt"] = head[8]

    # unpack the status parameters
    dic["S_DATA"] = (dic["status"] & 0x1) // 0x1
    dic["S_SPEC"] = (dic["status"] & 0x2) // 0x2
    dic["S_32"] = (dic["status"] & 0x4) // 0x4
    dic["S_FLOAT"] = (dic["status"] & 0x8) // 0x8
    dic["S_COMPLEX"] = (dic["status"] & 0x10) // 0x10
    dic["S_HYPERCOMPLEX"] = (dic["status"] & 0x20) // 0x20

    dic["MORE_BLOCKS"] = (dic["status"] & 0x80) // 0x80
    dic["NP_CMPLX"] = (dic["status"] & 0x100) // 0x100
    dic["NF_CMPLX"] = (dic["status"] & 0x200) // 0x200
    dic["NI_CMPLX"] = (dic["status"] & 0x400) // 0x400
    dic["NI2_CMPLX"] = (dic["status"] & 0x800) // 0x800

    # unpack the mode parameter
    dic["NP_PHMODE"] = (dic["mode"] & 0x1) // 0x1
    dic["NP_AVMODE"] = (dic["mode"] & 0x2) // 0x2
    dic["NP_PWRMODE"] = (dic["mode"] & 0x4) // 0x4

    dic["NF_PHMODE"] = (dic["mode"] & 0x10) // 0x10
    dic["NF_AVMODE"] = (dic["mode"] & 0x20) // 0x20
    dic["NF_PWRMODE"] = (dic["mode"] & 0x40) // 0x40

    dic["NI_PHMODE"] = (dic["mode"] & 0x100) // 0x100
    dic["NI_AVMODE"] = (dic["mode"] & 0x200) // 0x200
    dic["NI_PWRMODE"] = (dic["mode"] & 0x400) // 0x400

    dic["NI2_PHMODE"] = (dic["mode"] & 0x1000) // 0x1000
    dic["NI2_AVMODE"] = (dic["mode"] & 0x2000) // 0x2000
    dic["NI2_PWRMODE"] = (dic["mode"] & 0x4000) // 0x4000

    return dic
Convert a block header list into a Python dictionary.
dataset/ETHPy150Open jjhelmus/nmrglue/nmrglue/fileio/varian.py/blockheader2dic