pass ##################################################### # START HERE ##################################################### # Get a file ready to store data metadata = {"label": "This is a test!", "mood": "hungry for knowledge"} output_file = ctx("C:/Users/Qubit/Desktop/data_from_example_scripts/", metadata=metadata) # Dip parameters parameter_space = np.linspace(0, 10, 11) which_motor = 3 # Connect to the motor controllers motor_controller = smc100(callback=None) # Connect to the counting gear and configure it counter = coincidence_counter(callback=handle_data) counter.set_integration_time(1) # Loop over a dip for position in parameter_space: print "Moving to position %.3f" % position motor_controller.actuators[which_motor].move(position) current_context = motor_controller.dict() counter.count(context=current_context) # Collect and log the last piece of data from the postprocessor counter.collect()
##################################################### # Dip parameters parameter_space = np.linspace(0, 10, 11) which_motor = 3 # Get a file ready to store data md = {'label': 'This is a test!', 'mood': 'hungry for knowledge'} output_file = ctx('C:/Users/Qubit/Desktop/data_from_example_scripts/', metadata=md) # Make the GUI interface = gui() # Connect to the motor controllers motor_controller = smc100(callback=None) # Connect to the counting gear and configure it counter = coincidence_counter(callback=handle_data) counter.set_integration_time(1) # Loop over a dip for position in parameter_space: print 'Moving to position %.3f' % position motor_controller.actuators[which_motor].move(position) current_context = motor_controller.dict() counter.count(context=current_context) # Collect and log the last piece of data from the postprocessor counter.collect()
if __name__=='__main__': def check_gui(): ''' Handles messages from the GUI ''' for key, value in interface.collect(): if key=='move': address=value['controller_address'] position=value['position'] motor_controller.actuators[address].move(position) elif key=='gui_quit': motor_controller.kill() sys.exit(0) # Make the GUI interface=gui() # Boot up the motor controllers motor_controller=smc100(callback=lambda x: interface.send(x[0], x[1])) # Populate the GUI according to the current motor controller situation interface.send('populate', motor_controller.dict()) # Loop forever while True: check_gui() time.sleep(.1)
from qy.hardware import smc100 from qy.gui.smc100 import gui from qy.formats import ctx if __name__ == '__main__': def check_gui(): ''' Handles messages from the GUI ''' for key, value in interface.collect(): if key == 'move': address = value['controller_address'] position = value['position'] motor_controller.actuators[address].move(position) elif key == 'gui_quit': motor_controller.kill() sys.exit(0) # Make the GUI interface = gui() # Boot up the motor controllers motor_controller = smc100(callback=lambda x: interface.send(x[0], x[1])) # Populate the GUI according to the current motor controller situation interface.send('populate', motor_controller.dict()) # Loop forever while True: check_gui() time.sleep(.1)