def fileheader2dic(head):
    dic = dict()
    dic["nblocks"] = head[0]
    dic["ntraces"] = head[1]
    dic["np"] = head[2]
    dic["ebytes"] = head[3]
    dic["tbytes"] = head[4]
    dic["bbytes"] = head[5]
    dic["vers_id"] = head[6]
    dic["status"] = head[7]
    dic["nbheaders"] = head[8]

    # unpack the status parameter
    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["S_ACQPAR"] = (dic["status"] & 0x80) // 0x80
    dic["S_SECND"] = (dic["status"] & 0x100) // 0x100
    dic["S_TRANSF"] = (dic["status"] & 0x200) // 0x200
    dic["S_NP"] = (dic["status"] & 0x800) // 0x800
    dic["S_NF"] = (dic["status"] & 0x1000) // 0x1000
    dic["S_NI"] = (dic["status"] & 0x2000) // 0x2000
    dic["S_NI2"] = (dic["status"] & 0x4000) // 0x4000

    return dic
Convert fileheader list into a Python dictionary
dataset/ETHPy150Open jjhelmus/nmrglue/nmrglue/fileio/varian.py/fileheader2dic