def __init__(self, filepath1, filename1): self.filepath=filepath1 self.filename=filename1 self.header='time temp_ru temp_cx Ux1 Uy1 Ux2 Uy2 hps_mag hps_curr hps_switch vps_mag vps_curr vps_switch angle heater_pw he_level\n' self.stable_crit=0.01 self.start_time=time.time() self.log_switch=threading.Event() # data gets logged to file self.log_switch.clear() self.logging_switch=threading.Event() # data gets logged at all self.logging_switch.set() ########################################################## ## Instantiate Devices as child classes of measure() self.egg1=egg7265(egg1_addr) self.egg2=egg7265(egg2_addr) self.lm=lm500(lm_addr) #self.ls_th=ls370(ls370_th_addr) #ru_channel=1 #cx_channel=2 # whatever self.hps=cs4(hps_addr) self.vps=model4g(mod4g_addr) self.rot=rotator(rot_addr) ############################################################# j=0 files=os.listdir(self.filepath) for file in files: if self.filename==file: # look for a datafile with the same name, set j as a switch j=1 if j==1: # if there was a datafile with the same name, call method again with new filename self.filename=self.filename+str(int(time.time())) self.handler=open(self.filepath+self.filename+'.dat','a')
from egg7265_driver import egg7265 import time import numpy as np from matplotlib import pyplot as plt sleep_time=10 start_time=time.time() result=np.zeros((1,6)) result1=np.zeros((1,6)) lockin1=egg7265(12) lockin2=egg7265(14) while True: dummy1=lockin1.get_xy() dummy2=lockin2.get_xy() result1[0,0]=time.time()-start_time result1[0,1]=dummy1[0] result1[0,2]=dummy1[1] result1[0,3]=dummy2[0]*np.sqrt(2) result1[0,4]=dummy2[1]*np.sqrt(2) result1[0,5]=100*result1[0,1]/(result1[0,3]) print result1[0,5]