def EOM_test(SpecAn): ## SpecAn.write('LG 10') ## pb.Sequence([(['ch2'], 1*ms)], loop=False) ## sleep(3) ## SpecAn.write('MKPK HI') ## num = SpecAn.query('MKA?') ## print num pb.Sequence([(['ch2', 'ch5'], 1 * ms)], loop=False) sleep(3) SpecAn.write("LG 2") h.run_offset(SpecAn, sweep=2) SpecAn.write('ST 2') filepath = h.create_file(SpecAn, filename='EOM bias test', compensated='Y', n=1, burn_time=0) pb.Sequence([(['ch1'], 4 * s)] + [(['ch2', 'ch4', 'ch5'], 3000 * ms)] + [(['ch2', 'ch5'], 1 * s)], loop=False) filepath = h.record_trace(SpecAn, filepath, compensated='Y', n=1, burn_time=0)
def temp_func(): for i in range(10): filepath = hb.create_file(SpecAn, compensated='Y', n=1, burn_time=0, filename=' 2nd background ' + str(i)) sleep(100 * ms) pb.Sequence( [ (['ch5'], 0.5 * s), (['ch5', 'ch6'], 20 * us), (['ch5'], 5 * ms), (['ch2', 'ch4', 'ch5' ], 50 * ms), #RF Switch, Trigger SpecAn, EOM Bias on (['ch2', 'ch5'], 100 * ms), ], loop=False) hb.record_trace(SpecAn, filepath, filename=' 2nd background ' + str(i), compensated='Y', sweep_again='Y', n=1, burn_time='')
def hardburn(): freq = 1.04 * GHz span = 20 * MHz title_str = '20MHz, 2500ms, 1.8GHz' HP8560E_SpecAn_Trigger('FREE', 'CONTS', SpecAn) spin_pump_seq() mc.setWvfm(2) burn_sequence_AWG_cust(burn=50 * ms, burn_freq=freq, record='True', rec_span=span, f_name=' ' + title_str, sa='N') # ' + str(i)) filepath = hb.create_file(SpecAn, compensated='Y', n=1, burn_time=0, filename=' Spin pumped after ' + title_str) sleep(100 * ms) pb.Sequence( [ (['ch5'], 0.5 * s), (['ch2', 'ch4', 'ch5' ], 50 * ms), #RF Switch, Trigger SpecAn, EOM Bias on (['ch2', 'ch5'], 100 * ms), ], loop=False) hb.record_trace(SpecAn, filepath, filename=' Spin pumped after ' + title_str, compensated='Y', sweep_again='N', n=1, burn_time='')
def spin_jump_record_repeat(burn_f, h_state, file_name, teeth=1, n=1): ''' Spin poliarises the crystal once. Then repeatedly spin jump's and records the anti-hole.''' HP8560E_SpecAn_Trigger('FREE', 'CONTS', SpecAn) spin_pump_seq(spintime=10 * s, SpecAnSweep='N', rec='N') rec_span = 20 * MHz ## state_dict = {'3,2': 0,'1,2': 1,'-1,2': 2,'-3,2': 3,'-5,2': 4,'-7,2': 5} ## num = state_dict[h_state] ## bjt_ext = 5/num #Initial spin jump (longer Burn Jump Time) num_len = int(np.ceil(np.log10(n))) zero = '0' zeros = zero * num_len spin_jump(burn_f, state=h_state, rec='True', span=rec_span, teeth=teeth, f_ext=file_name + ' ' + zeros, bjt=50) #*bjt_ext) for i in range(n - 1): #Each subsequent spin jump should need a much shorter Burn Jump Time spin_jump(burn_f, state=h_state, rec='False', span=rec_span, teeth=teeth, f_ext=file_name + ' ' + str(i + 1).zfill(num_len), bjt=50, rec_offs=False) #Records the 2.9GHz span after all measurements filepath = hb.create_file(SpecAn, compensated='Y', n=1, burn_time=0, filename=' Spin pumped after spinjump ' + h_state) sleep(100 * ms) pb.Sequence( [ (['ch5'], 0.5 * s), (['ch2', 'ch4', 'ch5' ], 50 * ms), #RF Switch, Trigger SpecAn, EOM Bias on (['ch2', 'ch5'], 100 * ms), ], loop=False) hb.record_trace(SpecAn, filepath, filename=' Spin pumped after spinjump ' + h_state, compensated='Y', sweep_again='N', n=1, burn_time='')
def spin_pump_seq(): ## pb.Sequence([(['ch6'], 10*s),(['ch2','ch5'], 1*s)], loop=False) ## time.sleep(11) filepath = hb.create_file(SpecAn, compensated='Y', n=1, burn_time=0) pb.hole_burn(0.1) hb.record_trace(SpecAn, filepath, filename='', compensated='Y', sweep_again='Y', n=1, burn_time='')
def SpinpumpSite2BurnSite1(f_name='Spinpump site2 burn site1', freq=195.162): fg = rigolfg.RigolFG() #Open the Rigol FG ITLA = ITLA_Wrap.ITLA_Class(port="COM6", baudrate=9600) #Open the Photonics Laser #Probe laser and check it's happy ITLA.ProbeLaser() #Disable laser to change parameters ITLA.EnableLaser(False) #Set Laser to usual parameters for Spin Pumping ITLA.SetFrequency(194.9412) #THz ITLA.SetPower(1600) #dBm * 100 fg.setOutputState(bOn=0) ITLA.EnableLaser(True) ITLA.EnableWhisperMode(True) fg.setOutputState(bOn=1) spin_pump_seq(spintime=10 * s, SpecAnSweep='Y', rec='Y') #Spin pump site 2 HP8560E_SpecAn_Trigger('EXT', 'SNGLS', SpecAn) fg.setOutputState(bOn=0) #Turn off Rigol CH2 (sweeping photonics) print("Turning Rigol FG off (stop photonics laser sweeping).") #Turn off laser #Change photonics laser freq to 195.162 THz ITLA.EnableWhisperMode(False) ITLA.EnableLaser(False) ## ITLA.SetFrequency(195.162) #THz site 1 ## ITLA.SetFrequency(194.9437) #THz magnetic sub group ITLA.SetFrequency(freq) #THz site 2 main peak ITLA.SetPower(1600) #dBm * 100 ITLA.EnableLaser(True) ITLA.EnableWhisperMode(True) #Burn site 1 for 5 s pb.Sequence([(['ch6'], 5 * s), (['ch5'], 5 * ms)], loop=False) sleep(5) filepath = hb.create_file( SpecAn, n=1, burn_time=0, filename=f_name) #Record spin pumping after site 1 burn pb.hole_burn(1) filepath = hb.record_trace(SpecAn, filepath, compensated='Y', sweep_again='Y', burn_time=1) fg.setOutputState( bOn=1) #Turns Channel 2 back on so we can spin pump again print("Turning Rigol FG on.")
def burn_sequence_AWG_cust(burn, burn_freq, record='True', rec_freq='', rec_span=10 * MHz, f_name='', nu=2, sa='Y', rec_offs=True, opt_bac='offs1.txt'): ''' Same as burn_sequence_AWG, but uses save custom offset rather than hb.run_offset ''' filepath = '' if rec_freq == '': rec_freq = burn_freq if record == 'True': filepath = hb.create_file(SpecAn, n=1, burn_time=burn, filename=f_name) if rec_offs: save_offset_custom(SpecAn, 5, 'offs1.txt', freq=rec_freq, span=rec_span, res=30 * kHz, sweep=50 * ms) else: SpecAn.write("CF " + str(rec_freq)) SpecAn.write("SP " + str(rec_span)) arr1 = [([], 0.5 * s), (['ch1'], burn)] + [ (['ch5'], 100 * us), (['ch2', 'ch4', 'ch5'], 100 * ms) ] + [(['ch2', 'ch5'], 100 * ms)] pb.Sequence(arr1, loop=False) ## pb.hole_burn(burn) if record == 'True': filepath = hb.record_trace(SpecAn, filepath, compensated='Y', sweep_again=sa, burn_time=burn, opt_bac=opt_bac) sleep(0.5 * s) hb.full_sweep(SpecAn)
def spin_pump_seq(spintime=10 * s, SpecAnSweep='Y', rec='Y'): ''' For spin polarizing the crystal. Triggers pulseblaster CH6 on - off, changes the state of the mems switch which lets the photonics laser to sweep over the dm = 1 & 2 for a given time, default 10s Then allows for the recording of the Spin pumped spectrum if rec 'Y' ''' #Toggle the mems switch for n sec if rec == 'Y': HP8560E_SpecAn_Trigger('FREE', 'CONTS', SpecAn) SpecAn.write('CF ' + str(1.45 * GHz)) SpecAn.write('SP ' + str(2.90 * GHz)) pb.mems_switch_toggle(spintime, n=1, other_ch='', init_state=1) sleep(spintime) #Record full span spectrum, else: just toggle the mems switch again if rec == 'Y': filepath = hb.create_file(SpecAn, compensated='Y', n=1, burn_time=0, filename=' Spin pumped') sleep(100 * ms) pb.Sequence( [ (['ch5'], 0.5 * s), (['ch5', 'ch6'], 20 * us), (['ch5'], 5 * ms), (['ch2', 'ch4', 'ch5' ], 50 * ms), #RF Switch, Trigger SpecAn, EOM Bias on (['ch2', 'ch5'], 100 * ms), ], loop=False) hb.record_trace(SpecAn, filepath, filename=' Spin pumped', compensated='Y', sweep_again=SpecAnSweep, n=1, burn_time='') else: pb.Sequence([ (['ch5', 'ch6'], 20 * us), (['ch5'], 5 * ms), ], loop=False)
def spinpump_delay(f_name='delayed recording of spinpump', delay=20, secondLpath=False, latchT=5): spin_pump_seq(spintime=10 * s, SpecAnSweep='Y', rec='Y') #Spin pump site 2 if secondLpath: pb.toggle_latch_onoff(latchT) sleep(delay) filepath = hb.create_file( SpecAn, n=1, burn_time=0, filename=f_name) #Record spin pumping after site 1 burn pb.hole_burn(1) filepath = hb.record_trace(SpecAn, filepath, compensated='Y', sweep_again='Y', burn_time=1)
def wf_24_cw(wf_freq, wf_power): ''' Similar to wf_13_cw, for the WF V2.4''' fname = "C:\\Users\\Milos\Desktop\\Er_Experiment_Interface_Code\\1.txt" #This is not important #Saves the settings for the WF at the 6th line of ^,a relic from old code. wf_instr = hb.windfreak(wf_freq, wf_power, 'high', filepath=fname, talk='YES', write=1) return wf_instr
def record_dm_1(freq, f_ext='', tn=3): ''' Set up to record the anti-holes made by spin jumping by looking at three places on the Delta m = 1 ''' if freq > 1210 * MHz: print( 'WARNING: Freq set too high, might not be able to see the |5/2> on the Delta m = 1' ) rec_freq = np.array([1557 * MHz, 1472 * MHz, 1529 * MHz]) + freq span = np.array([270, 20, 20]) * MHz f_name = [ ' ' + f_ext + ' dm1', ' ' + f_ext + ' dm 12', ' ' + f_ext + ' dm13' ] opt = [ "C:\\Users\\Milos\Desktop\\Er_Experiment_Interface_Code\\1.txt", "C:\\Users\\Milos\Desktop\\Er_Experiment_Interface_Code\\2.txt", "C:\\Users\\Milos\Desktop\\Er_Experiment_Interface_Code\\3.txt" ] for i in range(1): SpecAn.write('SP ' + str(span[i])) SpecAn.write('CF ' + str(rec_freq[i])) sleep(0.01) filepath = hb.create_file(SpecAn, n=1, burn_time=1 * ms, filename=f_name[i]) pb.Sequence([([], 0.5 * s)] + [(['ch5'], 1000 * ms), (['ch2', 'ch4', 'ch5'], 100 * ms)] + [(['ch2', 'ch5'], 100 * ms)], loop=False) filepath = hb.record_trace(SpecAn, filepath, compensated='Y', sweep_again='N', burn_time=1 * ms, opt_bac=opt[i]) sleep(0.05)
def burn_sequence_AWG(burn, burn_freq, record='True', rec_freq='', rec_span=10 * MHz, f_name='', nu=2, sa='Y'): ''' Copy of the burn sequence function from Holeburn james wf3, but uses the 8GB AWG instead of the WF as the burner''' filepath = '' if rec_freq == '': rec_freq = burn_freq if record == 'True': filepath = hb.create_file(SpecAn, n=1, burn_time=burn, filename=f_name) hb.run_offset(SpecAn, freq=rec_freq, span=rec_span, res=30 * kHz, sweep=50 * ms, full_span='N', show_window='N', n=nu) pb.hole_burn(burn) if record == 'True': filepath = hb.record_trace(SpecAn, filepath, compensated='Y', sweep_again=sa, burn_time=burn) sleep(0.5 * s) hb.full_sweep(SpecAn)
def spin_jump_time_measurement_faster(times, burn_f, state='5,2'): ''' Spin polarizes and spin jumps the ensemble to a given [state]. Then it records the anti-hole after a certain amount of time given by [times] This one is faster because it spin polarizes every n recordings rather than every recording.''' freq = burn_f count = 4 sp = 20 * MHz ## sp = 2.9*GHz state_dict = { '5,2': 0, '3,2': 1, '1,2': 2, '-1,2': 3, '-3,2': 4, '-5,2': 5, '-7,2': 6 } if state not in state_dict: #Check if variable state is valid print('Error, variable state must be in [5,2, 3,2... -5,2]') p = state_dict[state] e_gap = np.array([ -107.60, -218.09, -323.2, -415.50, -488.20, -535.89, 1453.5 ]) * MHz #Gaps in hyperfine energy levels pl.ioff() for i in range(len(times)): count += 1 if count == 5: count = 0 HP8560E_SpecAn_Trigger("FREE", 'CONTS', SpecAn) SpecAn.write('CF ' + str(1.45 * GHz)) SpecAn.write('SP ' + str(2.9 * GHz)) spin_pump_seq(spintime=10 * s, SpecAnSweep='Y', rec='N') #Record background measurements HP8560E_SpecAn_Trigger("FREE", 'CONTS', SpecAn) pb.Sequence([(['ch2', 'ch5'], 1 * ms)], loop=False) hb.run_offset(SpecAn, freq=freq + e_gap[p], span=sp, res=30 * kHz, sweep=50 * ms, full_span='N', show_window='N', n=5) ## hb.run_offset(SpecAn, freq = 1.45*GHz, span = 2.9*GHz, res = 30*kHz, sweep = 50*ms, full_span = 'N', show_window = 'N',n = 5) #Stop SpecAn sweeping over anti hole, burn final anti-hole and then suppresses carrier HP8560E_SpecAn_Trigger('EXT', 'SNGLS', SpecAn) #Spin Jump spin_jump(freq, state, rec='False', span=sp, teeth=1) #Take spectra at time '0' SpecAn.write("CF " + str(freq + e_gap[p])) SpecAn.write("SP " + str(sp)) ## SpecAn.write("CF " + str(1.45*GHz)) ## SpecAn.write("SP " + str(2.9*GHz)) f_name = ' ' + state + ' zero ' + str(times[i]) + 's' filepath = hb.create_file(SpecAn, compensated='Y', filename=f_name) pb.Sequence( [ (['ch5'], 1 * s), (['ch2', 'ch4', 'ch5' ], 70 * ms), #RF Switch, Trigger SpecAn, EOM Bias on ([], 100 * ms), #turn off ch2,ch5, suppress carrier/RF ], loop=False) hb.record_trace(SpecAn, filepath, compensated='Y', sweep_again='N', n=1, burn_time='') HP8560E_SpecAn_Trigger('EXT', 'SNGLS', SpecAn) print 'Waiting ' + str(times[i]) + ' seconds.' sleep(times[i]) #wait else: t = times[i] - times[i - 1] print 'Waiting ' + str(t) + ' seconds.' sleep(t) #Record f_name = ' ' + state + ' ' + str(times[i]) + 's' filepath = hb.create_file(SpecAn, compensated='Y', filename=f_name) pb.Sequence( [ (['ch5'], 1 * s), (['ch2', 'ch4', 'ch5' ], 70 * ms), #RF Switch, Trigger SpecAn, EOM Bias on ([], 100 * ms), ], loop=False) fName = hb.record_trace(SpecAn, filepath, compensated='Y', sweep_again='N', n=1, burn_time='') dat = np.loadtxt(fName, skiprows=10) pl.plot(*dat.T) #pl.draw() plt.pause(0.1) pl.show() sleep(1) HP8560E_SpecAn_Trigger("FREE", 'CONTS', SpecAn)
def spin_jump_time_measurement(freq, times, state='5,2'): ''' OLDER SLOWER VERSION, USE ONLY IF NEW ONE BROKE Preforms spin jump to a certain hyperfine and then records the anti-hole a give time after the hole was originally burnt ''' HP8560E_SpecAn_Trigger('EXT', 'SNGLS', SpecAn) sp = 10 * MHz state_dict = { '5,2': 0, '3,2': 1, '1,2': 2, '-1,2': 3, '-3,2': 4, '-5,2': 5 } if state not in state_dict: #Check if variable state is valid print('Error, variable state must be in [5/2, 3/2... -5/2]') p = state_dict[state] e_gap = np.array([-107.64, -217.98, -323.19, -415.47, -488.22, -536.46 ]) * MHz #Gaps in hyperfine energy levels #Record background measurements HP8560E_SpecAn_Trigger("FREE", 'CONTS', SpecAn) pb.Sequence([(['ch2', 'ch5'], 1 * ms)], loop=False) hb.run_offset(SpecAn, freq=freq + e_gap[p], span=sp, res=30 * kHz, sweep=50 * ms, full_span='N', show_window='N', n=5) #Spin Jump HP8560E_SpecAn_Trigger('EXT', 'SNGLS', SpecAn) spin_jump(freq, state, rec='False', span=sp) #Stop SpecAn sweeping over anti hole, burn final anti-hole and then suppresses carrier #Take spectra at time '0' HP8560E_SpecAn_Trigger("FREE", 'CONTS', SpecAn) #Record SpecAn.write("CF " + str(freq + e_gap[p])) SpecAn.write("SP " + str(sp)) filepath = hb.create_file(SpecAn, compensated='Y', n=1, burn_time=0, filename=' ' + state + ' zero ' + str(time[i]) + 's') pb.Sequence( [ (['ch5'], 1 * s), (['ch2', 'ch4', 'ch5' ], 70 * ms), #RF Switch, Trigger SpecAn, EOM Bias on ([], 100 * ms), #turn off ch2,ch5, suppress carrier/RF ], loop=False) hb.record_trace(SpecAn, filepath, compensated='Y', sweep_again='Y', n=1, burn_time='') HP8560E_SpecAn_Trigger('EXT', 'SNGLS', SpecAn) sleep(times[i]) #wait HP8560E_SpecAn_Trigger("FREE", 'CONTS', SpecAn) #Record filepath = hb.create_file(SpecAn, compensated='Y', n=1, burn_time=0, filename=' ' + state + ' ' + str(time[i]) + 's') pb.Sequence( [ (['ch5'], 1 * s), (['ch2', 'ch4', 'ch5' ], 70 * ms), #RF Switch, Trigger SpecAn, EOM Bias on (['ch2', 'ch5'], 100 * ms), ], loop=False) hb.record_trace(SpecAn, filepath, compensated='Y', sweep_again='Y', n=1, burn_time='') HP8560E_SpecAn_Trigger('EXT', 'SNGLS', SpecAn)