def LoadControls(Slines, data):
    """Read values from a .imctrl (Image Controls) file"""
    cntlList = ['color', 'wavelength', 'distance', 'tilt', 'invert_x',
        'invert_y', 'type', 'Oblique', 'fullIntegrate', 'outChannels',
        'outAzimuths', 'LRazimuth', 'IOtth', 'azmthOff', 'DetDepth',
        'calibskip', 'pixLimit', 'cutoff', 'calibdmin', 'Flat Bkg',
        'varyList', 'setdist', 'PolaVal', 'SampleAbs', 'dark image',
        'background image', 'twoth']
    save = {}
    for S in Slines:
        if S[0] == '#':
            continue
        [key, val] = S.strip().split(':', 1)
        if key in ['type', 'calibrant', 'binType', 'SampleShape', 'color']:
            save[key] = val
        elif key in ['varyList']:
            save[key] = eval(val)
        elif key in ['rotation']:
            save[key] = float(val)
        elif key in ['center']:
            if ',' in val:
                save[key] = eval(val)
            else:
                vals = val.strip('[] ').split()
                save[key] = [float(vals[0]), float(vals[1])]
        elif key in cntlList:
            save[key] = eval(val)
    data.update(save)
