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
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
Exemple #3
0
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 17 17:24:21 2015

@author: HatLab_Xi Cao
"""

#mixer test
import qt
import create_waveform


AWG = qt.instruments['AWG']
#create_waveform.waitblock('zeropulse',1000,0,'yes')
create_waveform.sinwave('sinwave',1000,'yes')
create_waveform.coswave('coswave',1000,'yes')

AWG.set_sequence_length(0)
AWG.set_sequence_length(1)

AWG.addwaveform(1,1,'sinwave')
AWG.addwaveform(1,2,'coswave')