def t1_seq(): #set a wave sequence that can do the t1 measurement #first we create the pluses we need for this measurement create_waveform.pi_pulse('Pi_1000',1000,50) create_waveform.testtrigger('testtrigger_1000',1000,50) create_waveform.waitblock('waitblock_T',1000,0,'yes') create_waveform.waitblock('waitblock_deltaT',1000,0,'yes') #second we write the sequence we need seqlength = 28 t1_sequence = [[] for index in range(0,seqlength)] for x in range(0,seqlength): t1_sequence[x] = [[] for index in range(0,6)] for x in range(0,seqlength,4): looptimes = 1 t1_sequence[x][0] = 'wait' t1_sequence[x][1] = 'no_loop' t1_sequence[x][2] = 'Pi_1000' t1_sequence[x+1][0] = 'no_wait' t1_sequence[x+1][1] = 'no_loop' t1_sequence[x+1][2] = 'waitblock_T' t1_sequence[x+2][0] = 'no_wait' t1_sequence[x+2][1] = str((x/4+1)*looptimes) t1_sequence[x+2][2] = 'waitblock_deltaT' t1_sequence[x+3][0] = 'no_wait' t1_sequence[x+3][1] = 'no_loop' t1_sequence[x+3][2] = 'testtrigger_1000' for x in range(0,seqlength): for y in range(3,6): t1_sequence[x][y] = 'empty' #third we write the sequence into the AWG AWG.setmode('SEQUENCE') #set AWG to sequence mode AWG.set_sequence_length(seqlength) #create a empty sequence for x in range(0,seqlength): if (t1_sequence[x][0] == 'wait' ): AWG.waittrigger(x+1,1) else: AWG.waittrigger(x+1,0) if (t1_sequence[x][1] == 'no_loop'): pass else: AWG.setloop(x+1,int(t1_sequence[x][1])) for y in range(1,5): if (t1_sequence[x][y] == 'empty'): pass else: AWG.addwaveform(x+1,y-1,t1_sequence[x][y])
def alazar_test(): AWG.set_sequence_length(0) seqlength = 40 create_waveform.waitblock('waitblock_T',100,0,'yes') create_waveform.waitblock_marker('waitblock_marker',1000,0,'yes') for x in range(seqlength/2): create_waveform.sinwave('Sinewave%i' %x, 2000, 0.001, 1, 4.0*np.pi*x/seqlength,'yes') create_waveform.sinwave('Sinewave_inverse%i' %x, 2000, 0.001, 1, -4.0*np.pi*x/seqlength,'yes') alazar_sequence = [[] for index in range(0,seqlength)] for x in range(0,seqlength): alazar_sequence[x] = [[] for index in range(0,6)] for x in range(0,seqlength,2): temp = x/2 alazar_sequence[x][0] = 'no_wait' alazar_sequence[x][1] = 'no_loop' alazar_sequence[x+1][2] = 'Sinewave%i' % temp alazar_sequence[x+1][3] = 'Sinewave_inverse%i' % temp alazar_sequence[x+1][0] = 'no_wait' alazar_sequence[x+1][1] = 'no_loop' alazar_sequence[x][2] = 'waitblock_T' alazar_sequence[x][3] = 'waitblock_T' for y in range(4,6): alazar_sequence[x][y] = 'empty' alazar_sequence[0][2] = 'waitblock_marker' alazar_sequence[0][3] = 'waitblock_marker' AWG.setmode('SEQUENCE') #set AWG to sequence mode AWG.set_sequence_length(seqlength) #create a empty sequence for x in range(0,seqlength): if (alazar_sequence[x][0] == 'wait' ): AWG.waittrigger(x+1,1) else: AWG.waittrigger(x+1,0) if (alazar_sequence[x][1] == 'no_loop'): pass else: AWG.setloop(x+1,int(alazar_sequence[x][1])) for y in range(1,5): if (alazar_sequence[x][y] == 'empty'): pass else: AWG.addwaveform(x+1,y-1,alazar_sequence[x][y]) AWG.channel_on(1) AWG.channel_on(2)
def calibration_min(center_freq,sideband_freq): #Input is frequency in GHz markernum = 1 MXA.marker_off(markernum) result = np.zeros((1,4)) #First, do the calibration for DC offset create_waveform.waitblock('zeropulse',1000,0,'yes') #create zero value pulse for I and Q signal AWG.addwaveform_nonseq(1,'zeropulse') #add the waveform to the channels AWG.addwaveform_nonseq(2,'zeropulse') qt.msleep(1) AWG.channel_on(1) #turn on the channels AWG.channel_on(2) AWG.run() #turn on the AWG MXA.marker_off(markernum) MXA.new_peak(markernum) #put a marker on the peak for the calibration result[0][(range(0,2))] = offset_calibration() #do the calibration MXA.marker_off(markernum) #turn off the marker AWG.stop() #turn off the AWG #Then, do the calibration for Amplitude ratio and skew time create_waveform.sinwave('test_sin',1000,'yes') #create sin and cos wave for I and Q signal create_waveform.coswave('test_cos',1000,'yes') AWG.addwaveform_nonseq(1,'test_sin') #add the waveform to the channels AWG.addwaveform_nonseq(2,'test_cos') qt.msleep(1) AWG.channel_on(1) #turn on the channels AWG.channel_on(2) AWG.run() #turn on the AWG MXA.marker_off(markernum) MXA.new_peak(markernum) #put a marker on the peak for the calibration marker_value = MXA.marker_X_value(markernum) sideband(center_freq,sideband_freq,marker_value,markernum,'up') temp = amp_skew_calibration() result[0][2] = temp[2][1] result[0][3] = temp[2][3] plt.plot(temp[0][...],temp[1][...]) plt.show() return result
def calibration_fit(center_freq,sideband_freq): markernum = 1 test = True #First, do the calibration for DC offset create_waveform.waitblock('zeropulse',1000,0,'yes') #create zero value pulse for I and Q signal AWG.addwaveform_nonseq(1,'zeropulse') #add the waveform to the channels AWG.addwaveform_nonseq(2,'zeropulse') qt.msleep(1) AWG.channel_on(1) #turn on the channels AWG.channel_on(2) AWG.run() #turn on the AWG MXA.marker_off(markernum) MXA.new_peak(markernum) #put a marker on the peak for the calibration while (test == True): offset1_result = offset(-2.2,2.3,0.1,1) offset1 = datafit(offset1_result[0][...],offset1_result[1][...],'offset') AWG.set_ch_offset(1,offset1) qt.msleep(0.1) offset2_result = offset(-2.2,2.3,0.1,2) offset2 = datafit(offset2_result[0][...],offset2_result[1][...],'offset') AWG.set_ch_offset(2,offset2) qt.msleep(0.1) marker_value = MXA.marker_Y_value() if (marker_value < -75): test = False MXA.marker_off(markernum) #turn off the marker AWG.stop() #turn off the AWG #start ratio and skew calibration: create_waveform.sinwave('test_sin',1000,'yes') #create sin and cos wave for I and Q signal create_waveform.coswave('test_cos',1000,'yes') AWG.addwaveform_nonseq(1,'test_sin') #add the waveform to the channels AWG.addwaveform_nonseq(2,'test_cos') qt.msleep(1) AWG.channel_on(1) #turn on the channels AWG.channel_on(2) AWG.run() #turn on the AWG MXA.marker_off(markernum) MXA.new_peak(markernum) #put a marker on the peak for the calibration marker_value = MXA.marker_X_value(markernum) sideband(center_freq,sideband_freq,marker_value,markernum,'up') ratio = 0.0 skew_time = 0.0 ch2_amp = 1.0 test = True while (test == True): ratio_result = amp_ratio(0.2,4.51,0.1,ch2_amp) ratio = datafit(ratio_result[0][...],ratio_result[1][...],'ratio') #if you are using skew calibration, please change the sideband_freq in functon skew_fitfunc skew_result = skew(-5.0,5.1,0.1) skew_time = datafit(skew_result[0][...],skew_result[1][...],'skew') marker_value = MXA.marker_Y_value() #if (((np.fabs(temp1-ratio)<0.001)&(np.fabs(temp2-skew_time)<0.003))|(marker_value<-70)): if (marker_value < -75): test = False print 'best offset for ch1 is %f' % offset1 print 'best offset for ch2 is %f' % offset2 print 'best ratio is %f' % ratio print 'best skew time is %f' % skew_time
def alazar_test2(): AWG.set_sequence_length(0) seqlength = 4 create_waveform.waitblock_marker('waitblock_test',1000,0,'yes') create_waveform.waitblock('wait',1000,0,'yes') create_waveform.sinwave('Sinewave_test0' , 2048, 0.001, 1, 0,'yes') create_waveform.sinwave('Sinewave_test1' , 2048, 0.001, 1, 45,'yes') create_waveform.sinwave('Sinewave_test2', 2048, 0.001, 1, 90,'yes') alazar_sequence = [[] for index in range(0,seqlength)] for x in range(0,seqlength): alazar_sequence[x] = [[] for index in range(0,6)] for x in range(1,seqlength): alazar_sequence[x][0] = 'no_wait' alazar_sequence[x][1] = 'no_loop' alazar_sequence[x][2] = 'Sinewave_test%i' %x alazar_sequence[x][3] = 'Sinewave_test0' for y in range(4,6): alazar_sequence[x][y] = 'empty' alazar_sequence[0][0] = 'no_wait' alazar_sequence[0][1] = 'no_loop' alazar_sequence[0][2] = 'waitblock_test' alazar_sequence[0][3] = 'waitblock_test' alazar_sequence[2][0] = 'no_wait' alazar_sequence[2][1] = 'no_loop' alazar_sequence[2][2] = 'wait' alazar_sequence[2][3] = 'wait' alazar_sequence[3][0] = 'no_wait' alazar_sequence[3][1] = 'no_loop' alazar_sequence[3][2] = 'Sinewave_test2' alazar_sequence[3][3] = 'Sinewave_test0' AWG.setmode('SEQUENCE') #set AWG to sequence mode AWG.set_sequence_length(seqlength) #create a empty sequence for x in range(0,seqlength): if (alazar_sequence[x][0] == 'wait' ): AWG.waittrigger(x+1,1) else: AWG.waittrigger(x+1,0) if (alazar_sequence[x][1] == 'no_loop'): pass else: AWG.setloop(x+1,int(alazar_sequence[x][1])) for y in range(1,5): if (alazar_sequence[x][y] == 'empty'): pass else: AWG.addwaveform(x+1,y-1,alazar_sequence[x][y]) AWG.channel_on(1) AWG.channel_on(2)