def pm_take_fringe(reck_heaters, heater_index, min_voltage, max_voltage, N, int_time, metadata): pm=powermeter() keys = ['a','b','c','d','e','f'] #global output_file output_file = ctx('C:/Users/Qubit/Code/lab_code/Calibration/Calibration/data/', metadata=metadata) output_file_name = output_file.filename parameter_space=np.linspace(min_voltage, max_voltage, N) for index, parameter in enumerate(parameter_space): print 'Setting voltage %s' % str(parameter) reck_heaters.send_one_voltage(heater_index, parameter) time.sleep(1) total=np.zeros(6) print reck_heaters.query_v(heater_index) print pm.read() for i in range(int_time): total += np.array(pm.read()) print total counts_dict = dict(zip(keys, total.tolist())) output_file.write('count_rates', counts_dict) current_context=reck_heaters.vip_heater(heater_index) output_file.write('context', current_context) pm.kill() return output_file_name
def pm_take_fringe(reck_heaters, heater_index, min_voltage, max_voltage, N, int_time, metadata): pm = powermeter() keys = ['a', 'b', 'c', 'd', 'e', 'f'] #global output_file output_file = ctx( 'C:/Users/Qubit/Code/lab_code/Calibration/Calibration/data/', metadata=metadata) output_file_name = output_file.filename parameter_space = np.linspace(min_voltage, max_voltage, N) for index, parameter in enumerate(parameter_space): print 'Setting voltage %s' % str(parameter) reck_heaters.send_one_voltage(heater_index, parameter) time.sleep(1) total = np.zeros(6) print reck_heaters.query_v(heater_index) print pm.read() for i in range(int_time): total += np.array(pm.read()) print total counts_dict = dict(zip(keys, total.tolist())) output_file.write('count_rates', counts_dict) current_context = reck_heaters.vip_heater(heater_index) output_file.write('context', current_context) pm.kill() return output_file_name
if __name__=='__main__': def check_gui(): ''' Check the state of the gui ''' for key, value in interface.collect(): if key=='gui_quit': sys.exit(0) elif key=='log_now': data_file.write('powers', total.tolist()) print 'wrote ', total # The GUI interface=gui() # The meter powermeter=powermeter() # Output file data_file=ctx('data/%s.ctx' % qy.util.timestamp()) data_file.write_metadata({'scan_label':'Looking at bright light'}) total=np.zeros(6) print data_file while True: total=np.zeros(6) for i in range(10): total += np.array(powermeter.read()) data=dict(zip('abcdefg', total)) interface.send('count_rates', data) check_gui()