def create_dic(udic):
    ddic = udic[udic["ndim"] - 1]   # direct dimension dictionary

    # number of points in direct dimension is R+I
    if ddic["complex"]:
        num_points = ddic["size"] * 2
    else:
        num_points = ddic["size"]

    # number of blocks is product of R+I of all other dimensions
    num_blocks = 1
    for f in [udic[k]["size"] for k in range(udic["ndim"] - 1)]:
        num_blocks = num_blocks * f

    # create the varian dictionary
    dic = dict()

    # default flag bits
    dic["S_DATA"] = 1
    dic["S_SPEC"] = 0
    dic["S_32"] = 0
    dic["S_FLOAT"] = 1
    dic["S_COMPLEX"] = 0
    dic["S_HYPERCOMPLEX"] = 0
    dic["S_ACQPAR"] = 1
    dic["S_SECND"] = 0
    dic["S_TRANSF"] = 0
    dic["S_NP"] = 0
    dic["S_NF"] = 0
    dic["S_NI"] = 0
    dic["S_NI2"] = 0

    # parameters
    dic["nblocks"] = num_blocks
    dic["ntraces"] = 1
    dic["np"] = num_points
    dic["ebytes"] = 4
    dic["tbytes"] = 4 * num_points
    dic["bbytes"] = dic["tbytes"] + 28
    dic["vers_id"] = 0
    dic["status"] = 201     # 6th bit set
    dic["nbheaders"] = 1

    # fake procpar dictionary
    pdic = dict()

    # direct dimension
    ndim = udic["ndim"]
    pdic["np"] = create_pdic_param('np', [str(udic[ndim - 1]['size'] * 2)])

    if ndim >= 2:
        if udic[ndim - 2]['complex']:
            pdic["ni"] = create_pdic_param('ni',
                                           [str(udic[ndim - 2]['size'] // 2)])
            pdic["phase"] = create_pdic_param('phase', ['0', '1'])
        else:
            pdic["ni"] = create_pdic_param('ni', [str(udic[ndim - 2]['size'])])
            pdic["phase"] = create_pdic_param('phase', ['0'])

    if ndim >= 3:
        pdic['array'] = create_pdic_param('array', ['phase,phase2'])
        if udic[ndim - 3]['complex']:
            pdic["ni2"] = create_pdic_param(
                'ni2', [str(udic[ndim - 3]['size'] // 2)])
            pdic["phase2"] = create_pdic_param('phase', ['0', '1'])
        else:
            pdic["ni2"] = create_pdic_param('ni2',
                                            [str(udic[ndim - 3]['size'])])
            pdic["phase2"] = create_pdic_param('phase2', ['0'])

    if ndim >= 4:
        pdic['array'] = create_pdic_param('array', ['phase,phase2,phase3'])
        if udic[ndim - 4]['complex']:
            pdic["ni3"] = create_pdic_param(
                'ni3', [str(udic[ndim - 4]['size'] // 2)])
            pdic["phase3"] = create_pdic_param('phase3', ['0', '1'])
        else:
            pdic["ni3"] = create_pdic_param(
                'ni3', [str(udic[ndim - 4]['size'])])
            pdic["phase3"] = create_pdic_param('phase3', ['0'])

    dic["procpar"] = pdic
    return dic
Create a Agilent/Varian parameter dictionary from a universal dictionary.
dataset/ETHPy150Open jjhelmus/nmrglue/nmrglue/fileio/varian.py/create_dic