def RunScript(filename, dirname, LoadIon, DoScan422, DoOptimize1092, DoMicroMotionMinimization, DoScan674, DoScan1092, DoRabiShort, DoSidebandScan, DoRabiLong, DoCavityResonanceScan, DoCavityStandingWaveScan, DoCavitySidebandScan, DoCavityCoolingDataRun, BlueLockOn, BlueLockLoop, CavLockCheckOn, ProbeLockOn, DoFitAll, DoBlogAll): timestart = time.time() plot = gui_exports['plot'] purgatory = gui_exports['purgatory'] dirname_Lazy = dirname + '/' + filename print "Welcome to the Lazy Physicist! Your one stop shop for all things automatic." print "Saving in:", dirname_Lazy # Putting everything in a separate folder: if (os.access(dirname, os.F_OK) == 0): os.mkdir(dirname) if (os.access(dirname_Lazy, os.F_OK) == 0): os.mkdir(dirname_Lazy) ScanDone = f_set['AudioAlert_scandone'] Say = f_set['AudioAlert_say'] SetBlueCav = f_set['MonoLasers_421'] ReadBlueCav = f_read['MonoLasers_421'] Set1092Cav = f_set['MonoLasers_1091'] Read1092Cav = f_read['MonoLasers_1091'] SetDDS_FREQ1 = f_set['DDS_FREQ1'] SetDDS_AMP1 = f_set['DDS_AMP1'] SetParameter = f_set['DDS_PARAM'] ReadParameter = f_read['DDS_PARAM'] reload(CavityStabilization) reload(Stabilization) Stab = Stabilization.Stabilization(f_set, f_read, gui_exports) CavStab = CavityStabilization.CavityStabilization(f_set, f_read, gui_exports) const = CavStab.LoadConstants(DAQ_HOME + '/scripts/CavityStabilizationConstants') success = 1 ################## List of tasks: ################### # LoadIon: if LoadIon == 1 and __main__.STOP_FLAG == False: AutoloadIon_filename = 'AutoloadIon' + time.strftime('-%H%M') __main__.app.wTree.plotframe.set_label(AutoloadIon_filename) Freq422 = 710.96304 IntTime_Autoload = 1000 Threshold_Autoload = 1500 OvenTime = 120 WaitTime = 15 OvenCurrent = 2.8 LoadingTime = 10 NumberOfLoads = 10 DoScan422 = 1 deltatime, NumberOfIons = AutoloadIon2( AutoloadIon_filename, dirname_Lazy, Freq422, IntTime_Autoload, Threshold_Autoload, OvenTime, WaitTime, OvenCurrent, LoadingTime, NumberOfLoads, DoScan422) if NumberOfIons == 0: __main__.STOP_FLAG = True # DoScan422: if DoScan422 == 1 and __main__.STOP_FLAG == False: timestamp = time.strftime('%H%M') Scan422_filename = 'Scan422-' + timestamp __main__.app.wTree.plotframe.set_label(Scan422_filename) SetDDS_FREQ1(ReadParameter('F_BlueHi')) SetDDS_AMP1(ReadParameter('A_BlueHi')) Stab.BlueLockFreq() plot.clear() BlueCav = ReadBlueCav() ScanPoints = 80 ScanRepeat = 1 DDSFREQ = [ReadParameter('F_BlueHi'), ReadParameter('F_BlueOn')] DDSAMP = [ReadParameter('A_BlueHi'), ReadParameter('A_BlueOn')] daccalibration = 149 # MHz/V delta = 20. / daccalibration # approximate calibration of 20 MHz. (to do both 251 and 231 scans) Width = 0.70 # To get rigth width of scan offset = -0.10 #0.08 # To get right start of scan for i in range(len(DDSFREQ)): if __main__.STOP_FLAG: break StartCav = BlueCav + offset + i * delta EndCav = BlueCav + offset - Width + i * delta FinishCav = BlueCav + offset + i * delta Scan422(Scan422_filename, dirname_Lazy, StartCav, EndCav, FinishCav, ScanPoints, ScanRepeat, DDSFREQ[i], DDSAMP[i]) time.sleep(1) try: reload(hansfit) fit = hansfit.fitScan422s(dirname_Lazy, timestamp) except Exception, e: print "Exception occured while doing hansfit.fitScan422s:", e traceback.print_exc(file=sys.stdout) print "Continuing anyways"
def RunScript(filename, dirname,LoadIon,DoScan422,DoOptimize1092,DoMicroMotionMinimization,DoScan674,DoScan1092,DoRabiShort,DoSidebandScan,DoRabiLong,DoCavityResonanceScan,DoCavityStandingWaveScan,DoCavitySidebandScan,DoCavityCoolingDataRun,BlueLockOn,BlueLockLoop,CavLockCheckOn,ProbeLockOn,DoFitAll,DoBlogAll): timestart=time.time() plot=gui_exports['plot'] purgatory=gui_exports['purgatory'] dirname_Lazy=dirname+'/'+filename print "Welcome to the Lazy Physicist! Your one stop shop for all things automatic." print "Saving in:",dirname_Lazy # Putting everything in a separate folder: if (os.access(dirname, os.F_OK) == 0): os.mkdir(dirname) if (os.access(dirname_Lazy, os.F_OK) == 0): os.mkdir(dirname_Lazy) ScanDone = f_set['AudioAlert_scandone'] Say = f_set['AudioAlert_say'] SetBlueCav = f_set['MonoLasers_421'] ReadBlueCav=f_read['MonoLasers_421'] Set1092Cav = f_set['MonoLasers_1091'] Read1092Cav = f_read['MonoLasers_1091'] SetDDS_FREQ1=f_set['DDS_FREQ1'] SetDDS_AMP1=f_set['DDS_AMP1'] SetParameter = f_set['DDS_PARAM'] ReadParameter = f_read['DDS_PARAM'] reload(CavityStabilization) reload(Stabilization) Stab=Stabilization.Stabilization(f_set,f_read,gui_exports) CavStab = CavityStabilization.CavityStabilization(f_set, f_read, gui_exports) const = CavStab.LoadConstants(DAQ_HOME+'/scripts/CavityStabilizationConstants') success=1 ################## List of tasks: ################### # LoadIon: if LoadIon==1 and __main__.STOP_FLAG==False: AutoloadIon_filename='AutoloadIon'+time.strftime('-%H%M') __main__.app.wTree.plotframe.set_label(AutoloadIon_filename) Freq422=710.96304 IntTime_Autoload=1000 Threshold_Autoload=1500 OvenTime=120 WaitTime=15 OvenCurrent=2.8 LoadingTime=10 NumberOfLoads=10 DoScan422=1 deltatime,NumberOfIons=AutoloadIon2(AutoloadIon_filename,dirname_Lazy,Freq422,IntTime_Autoload,Threshold_Autoload, OvenTime, WaitTime, OvenCurrent, LoadingTime, NumberOfLoads, DoScan422) if NumberOfIons==0: __main__.STOP_FLAG=True # DoScan422: if DoScan422==1 and __main__.STOP_FLAG==False: timestamp=time.strftime('%H%M') Scan422_filename='Scan422-'+timestamp __main__.app.wTree.plotframe.set_label(Scan422_filename) SetDDS_FREQ1(ReadParameter('F_BlueHi')) SetDDS_AMP1(ReadParameter('A_BlueHi')) Stab.BlueLockFreq() plot.clear() BlueCav=ReadBlueCav() ScanPoints=80 ScanRepeat=1 DDSFREQ=[ReadParameter('F_BlueHi'),ReadParameter('F_BlueOn')] DDSAMP=[ReadParameter('A_BlueHi'),ReadParameter('A_BlueOn')] daccalibration=149 # MHz/V delta=20./daccalibration # approximate calibration of 20 MHz. (to do both 251 and 231 scans) Width=0.70 # To get rigth width of scan offset=-0.10#0.08 # To get right start of scan for i in range(len(DDSFREQ)): if __main__.STOP_FLAG: break StartCav=BlueCav+offset+i*delta EndCav=BlueCav+offset-Width+i*delta FinishCav=BlueCav+offset+i*delta Scan422(Scan422_filename,dirname_Lazy,StartCav,EndCav,FinishCav,ScanPoints,ScanRepeat,DDSFREQ[i],DDSAMP[i]) time.sleep(1) try: reload(hansfit) fit=hansfit.fitScan422s(dirname_Lazy,timestamp) except Exception,e: print "Exception occured while doing hansfit.fitScan422s:",e traceback.print_exc(file=sys.stdout) print "Continuing anyways"
Set1092Cav(Detuning1092) Scan422_filename = 'Scan422-IRDF' + str( Detuning1092) + '-' + timestamp for i in range(len(DDSFREQ)): if __main__.STOP_FLAG: break StartCav = BlueCav + offset + i * delta EndCav = BlueCav + offset - Width + i * delta FinishCav = BlueCav + offset + i * delta __main__.app.wTree.plotframe.set_label(Scan422_filename) Scan422(Scan422_filename, dirname_Lazy, StartCav, EndCav, FinishCav, ScanPoints, ScanRepeat, DDSFREQ[i], DDSAMP[i]) time.sleep(1) Set1092Cav(Detuning1092_Saved) try: fit = hansfit.fitScan422s(dirname_Lazy, timestamp) except Exception, e: text = "Exception occured while doing hansfit.fitScan422s:", e print text # DoMicroMotionMinimization: if DoMicroMotionMinimization == 1 and __main__.STOP_FLAG == False: print "MicroMotionMinimization script is disabled! -Hans (2012-04-13)" ''' MicroMotionMinimization_filename='MicroMotionMinimization'+time.strftime('-%H%M') __main__.app.wTree.plotframe.set_label(MicroMotionMinimization_filename) IntTime=1000 acc=0.00001 delta=0.003 Beam=0 MicroMotionMinimization(MicroMotionMinimization_filename,dirname_Lazy,IntTime,acc,delta,Beam)''' if DoScan674 == 1 and __main__.STOP_FLAG == False: Scan674_filename = 'Scan674' + time.strftime('-%H%M')
Detuning1092s=Detuning1092_Saved+sp.linspace(-Delta1092,Delta1092,5) for j in range(len(Detuning1092s)): Detuning1092=Detuning1092s[j] Set1092Cav(Detuning1092) Scan422_filename='Scan422-IRDF'+str(Detuning1092)+'-'+timestamp for i in range(len(DDSFREQ)): if __main__.STOP_FLAG: break StartCav=BlueCav+offset+i*delta EndCav=BlueCav+offset-Width+i*delta FinishCav=BlueCav+offset+i*delta __main__.app.wTree.plotframe.set_label(Scan422_filename) Scan422(Scan422_filename,dirname_Lazy,StartCav,EndCav,FinishCav,ScanPoints,ScanRepeat,DDSFREQ[i],DDSAMP[i]) time.sleep(1) Set1092Cav(Detuning1092_Saved) try: fit=hansfit.fitScan422s(dirname_Lazy,timestamp) except Exception,e: text="Exception occured while doing hansfit.fitScan422s:",e print text # DoMicroMotionMinimization: if DoMicroMotionMinimization==1 and __main__.STOP_FLAG==False: print "MicroMotionMinimization script is disabled! -Hans (2012-04-13)" ''' MicroMotionMinimization_filename='MicroMotionMinimization'+time.strftime('-%H%M') __main__.app.wTree.plotframe.set_label(MicroMotionMinimization_filename) IntTime=1000 acc=0.00001 delta=0.003 Beam=0 MicroMotionMinimization(MicroMotionMinimization_filename,dirname_Lazy,IntTime,acc,delta,Beam)''' if DoScan674==1 and __main__.STOP_FLAG==False: Scan674_filename='Scan674'+time.strftime('-%H%M')