Esempio n. 1
0
def restore_from_data(path):
    """
    Main function: has a variable 'RESTORE', which is a dictionary in the form
    of {'instrument_name' : ['property', ...], ...}. The function walks through,
    and tries to set the listed properties via the .set-file specified in
    the argument.
    """
    RESTORE = {
        'pos_stage' : [
            'x_position',
            'y_position',
            ],
        'pos_det_sm' : [
            'x_position',
            'y_position',
            ],
        'pos_back_sm' : [
            'x_position',
            'y_position',
            ],
        'pos_z_front' : [
            'position',
            ],
        'pos_z_back' : [
            'position',
            ]
        }

    settings = SettingsFile(path)

    for ins in RESTORE:
        for param in RESTORE[ins]:
            print 'Try to restore %s from %s...' % (param, ins)

            try:
                instruments[ins].set(param,
                                     settings.get(ins, param))
                print ' ... restored to %s.' % str(settings.get(ins, param))
            except:
                print ' ... could not restore!'

    return
Esempio n. 2
0
data.add_value('Y')
data.create_file()

# This plots the data as points are added.
# In general however, it's better to plot your data in
# an entirely separate process from the main qtlab instance
# controlling your measurement hardware.
# See other plotting examples and the "dataview" example.
p = plot.get_plot('test measurement plot',
                  replace_if_exists=True)
p.add_data(data)
p.set_default_labels()
p.get_plot().set_xrange(-8,8)

for x in x_vec:

    result = sinc(x)
    data.add_data_point(x, result)
    qt.msleep(0.05) # simulate a real measurement with this delay

data.close_file()
qt.mend()

st = SettingsFile(data.get_filepath())
print '\n Get the list of instruments with "get_instruments()": \n'
pprint( st.get_instruments() )
print '\n Get the full dictionary of settings with "get_settings()": \n'
pprint( st.get_settings() )
print '\n Get a single instrument setting with "get(ins, param)": \n'
print st.get('example1', 'gain')
from lib.file_support.settingsfile import SettingsFile
from pprint import pprint

x_vec = linspace(-2 * pi, 2 * pi, 200)

qt.mstart()

data = qt.Data(name='testmeasurement')
data.add_coordinate('X')
data.add_value('Y')
data.create_file()

plot3d = qt.Plot2D(data, name='measure2D', coorddims=0, valdim=1)

for x in x_vec:

    result = sinc(x)
    data.add_data_point(x, result)
    qt.msleep(0.02)

data.close_file()
qt.mend()

st = SettingsFile(data.get_filepath())
print '\n Get the list of instruments with "get_instruments()": \n'
pprint(st.get_instruments())
print '\n Get the full dictionary of settings with "get_settings()": \n'
pprint(st.get_settings())
print '\n Get a single instrument setting with "get(ins, param)": \n'
print st.get('example1', 'gain')