def get_dic(f, dataset="spectrum"):

    # select the data set
    dset = f[dataset]

    dic = {}
    # loop over the attributes
    for key, value in dset.attrs.items():

        if "_" in key:
            # we have an axis key
            axis, subkey = key.split("_", 1)
            axis = int(axis)
            if axis not in dic:
                dic[axis] = {}
            dic[axis][subkey] = value
        else:
            dic[key] = value

    return dic
Get a dictionary from dataset in a HDF5 File
dataset/ETHPy150Open jjhelmus/nmrglue/nmrglue/fileio/glue.py/get_dic