コード例 #1
0
def run_offset(SpecAn, freq = 1.45*GHz, span = 2.9*GHz, res = 30*kHz, sweep = 50*ms, full_span = 'Y', show_window = 'N'):
    ''' Sets desired SpecAn settings and runs Milos's background and free run
        programs.'''
    SpecAn.write("CF " + str(freq))
    SpecAn.write("SP " + str(span))
    SpecAn.write("RB " + str(res))
    SpecAn.write("ST " + str(sweep))
    SpecAn.write('VB ' + str(1000))
    
    sleep(0.5)
    SIH.save_offset(20, full_span)
        
    if show_window == 'Y':
        SIH.free_run_plot_window('Y', freq, span, full_span)
コード例 #2
0
def background(SpecAn, freq, span, res = 10*kHz, sweep = 1*s):
    ''' Semi automates the background measurements on the HP8560E '''
    
    #First step laser off the absorption
    #Set SpecAn to be a desired freq, span...
    SpecAn.write('CF ' + freq)
    SpecAn.write('SP ' + span)
    SpecAn.write('RB ' + res)
    SpecAn.write('ST ' + sweep)
    
    #Run background measurement.
    SIH.save_offset(3)
    
    #Set span back to full so laser can be stepped back to absorption
    full_sweep(SpecAn)
コード例 #3
0
def holeburn(offset = 'N', args = [1.45*GHz, 2.9*GHz, 30*kHz, 1*s]):
    ''' No longer use this '''
    if offset != ('Y' or 'N'):
        raise error('argument must be "Y" or "N"')
        
    elif offset == 'Y':
        #Set SpecAn stuff
        SpecAn.write("CF " + str(args[0]))
        SpecAn.write("SP " + str(args[1]))
        SpecAn.write("RB " + str(args[2]))
        SpecAn.write("ST " + str(args[3]))
        sleep(0.5)
        SIH.save_offset(20)
        
    pb.hole_burn(3*s)
    SIH.free_run_plot_window('Y')
コード例 #4
0
def run_offset(SpecAn,
               freq=1.45 * GHz,
               span=2.9 * GHz,
               res=30 * kHz,
               sweep=50 * ms,
               full_span='Y',
               show_window='N',
               n=20):
    ''' Sets desired SpecAn settings and runs Milos's background and free run
        programs.'''
    SpecAn.write("CF " + str(freq))
    SpecAn.write("SP " + str(span))
    SpecAn.write("RB " + str(res))
    SpecAn.write("ST " + str(sweep))

    #This sequence ensures that atleast one sweep is taken once the Span and Center
    #Frequecies are changed, before the offsets are saved
    pb.Sequence([(['ch2', 'ch4', 'ch5'], 50 * ms), ([], 0.4 * s)], loop=False)
    sleep(0.5)
    SIH.save_offset(n, full_span)

    if show_window == 'Y':
        SIH.free_run_plot_window('Y', freq, span, full_span)
コード例 #5
0
def laser_stability_measure(freq,
                            t_space=100 * ms,
                            t=4 * s,
                            f_name='',
                            show='Y'):
    [SpecAn, SpecAn_Bool] = Initialise_HP8560E_SpecAn()
    SpecAn.write('ST 0.05')  #Sweep Time 50ms
    n = int(t / t_space)  #Amount of times scans needed
    ##     mc.setup(centerFreqL = freq, widthL = 10e4, sweepTimeL = 1e-4)

    if t_space < 50 * ms:
        raise RuntimeError, "SpecAn's fastest sweep time & reset is 100ms, t_space cannot be faster."
    file = make_file(f_name)

    span = 5 * MHz
    freq_sit = freq
    SpecAn.write('CF ' + str(freq_sit))
    SpecAn.write('SP ' + str(span))
    time.sleep(0.5)

    #Take Background measurement
    SIH.save_offset(10, 'n')

    #Burn a hole
    pb.Sequence([(['ch1'], 50 * ms), (['ch2', 'ch4', 'ch5'], 1 * ms)],
                loop=False)
    HP8560E_SpecAn_Trigger('EXT', 'CONTS', SpecAn)

    print "Recording for {}s at {} Hz".format(t, 1 / t_space)

    #Get raw data
    l = []
    for k in range(n):
        l.append([time.time(), getTrace(SpecAn, t_space)])

    HP8560E_SpecAn_Trigger('FREE', 'CONTS', SpecAn)

    t_init = l[0][0]
    t_arr = []
    center = []
    freq_arr = np.linspace(freq_sit - span / 2, freq_sit + span / 2, 601)

    for i in range(n):
        #Convert to dB and background subtract post data collection
        dat = SIH.convert2db(SpecAn, l[i][1])
        dat = hb.compensate(dat, span)
        #Make time and freq peak array
        t_arr.append(l[i][0] - t_init)
        index = np.argmax(
            dat[50:])  #The carrier also makes a hole, this should ignore it
        center.append(freq_arr[index])

    data = np.vstack([t_arr, center]).T
    np.savetxt(file, data, fmt='%.10e')

    ##
    pb.Sequence([(['ch2', 'ch5', 'ch4'], 1 * ms)], loop=False)
    #Plot
    if show == 'Y':
        plt.plot(t_arr, center)
        plt.show()

    return l, t_arr, center, data