Exemple #1
0
def run(gain,iter,rate,freq,front_end, f0,f1, lapse, points, ntones, delay_duration, delay_over):

    try:
        if u.LINE_DELAY[str(int(rate/1e6))]: pass
    except KeyError:

        if delay_over is None:
            print "Cannot find line delay. Measuring line delay before VNA:"

            filename = u.measure_line_delay(rate, freq, front_end, USRP_num=0, tx_gain=0, rx_gain=0, output_filename=None, compensate = True, duration = delay_duration)

            delay = u.analyze_line_delay(filename, True)

            u.write_delay_to_file(filename, delay)

            u.load_delay_from_file(filename)

        else:

            u.set_line_delay(rate, delay_over)

        if ntones ==1:
            ntones = None

    vna_filename = u.Single_VNA(start_f = f0, last_f = f1, measure_t = lapse, n_points = points, tx_gain = gain, Rate=rate, decimation=True, RF=freq, Front_end=front_end,
               Device=None, output_filename=None, Multitone_compensation=ntones, Iterations=iter, verbose=False)

    return vna_filename
Exemple #2
0
                                    tx_gain=0,
                                    rx_gain=0,
                                    output_filename=None,
                                    compensate=True,
                                    duration=0.1)
    delay = u.analyze_line_delay(filename, True)
    u.write_delay_to_file(filename, delay)
    u.load_delay_from_file(filename)

    vna_seed_filename = u.Single_VNA(start_f=seed_start_f,
                                     last_f=seed_end_f,
                                     measure_t=seed_measure_t,
                                     n_points=seed_points,
                                     tx_gain=seed_gain,
                                     Rate=seed_rate,
                                     decimation=True,
                                     RF=seed_rf,
                                     Front_end=str(args.frontend),
                                     Device=None,
                                     output_filename=None,
                                     Multitone_compensation=seed_ntones,
                                     Iterations=1,
                                     verbose=False)
    u.VNA_analysis(vna_seed_filename)
    u.initialize_from_VNA(args.VNA, vna_seed_filename)
    u.vna_fit(vna_seed_filename,
              p0=None,
              fit_range=args.peak_width,
              verbose=False)
    u.plot_VNA(vna_seed_filename, backend="plotly", plot_decim=None)
    u.plot_resonators(vna_seed_filename, reso_freq=None, backend='plotly')
def vna_run(tx_gain,
            rx_gain,
            iter,
            rate,
            freq,
            front_end,
            f0,
            f1,
            lapse,
            points,
            ntones,
            delay_duration,
            delay_over='null',
            output_filename=None,
            subfolder=None):

    if delay_over != 'null':
        delay = delay_over
        u.set_line_delay(rate, delay_over * 1e9)
    else:
        try:
            if u.LINE_DELAY[str(int(rate / 1e6))]:
                delay = u.LINE_DELAY[str(int(rate / 1e6))] * 1e-9
        except KeyError:
            print("Cannot find line delay. Measuring line delay before VNA:")
            delay_filename = None
            if (output_filename != None):
                delay_filename = output_filename + '_delay'
            filename = u.measure_line_delay(rate,
                                            freq,
                                            front_end,
                                            USRP_num=0,
                                            tx_gain=tx_gain,
                                            rx_gain=rx_gain,
                                            output_filename=delay_filename,
                                            compensate=True,
                                            duration=delay_duration)

            print("Analyziung line delay file...")
            delay = u.analyze_line_delay(filename, False)
            print("Done.")

            print("Writing line delay to file...")
            u.write_delay_to_file(filename, delay)
            print("Done.")

            print("Loading line delay from file...")
            u.load_delay_from_file(filename)
            print("Done.")

    if ntones == 1:
        ntones = None

    print("Starting single VNA run...")
    vna_filename = u.Single_VNA(start_f=f0,
                                last_f=f1,
                                measure_t=lapse,
                                n_points=points,
                                tx_gain=tx_gain,
                                rx_gain=rx_gain,
                                Rate=rate,
                                decimation=True,
                                RF=freq,
                                Front_end=front_end,
                                Device=None,
                                output_filename=output_filename,
                                Multitone_compensation=ntones,
                                Iterations=iter,
                                verbose=False,
                                subfolder=subfolder)
    print("Done.")

    return vna_filename, delay
Exemple #4
0
        u.load_delay_from_file(filename)




    for i in range(100):
        blockPrint()
        vna_filename = u.Single_VNA(
            start_f = -args.bandwidth*1e6,
            last_f = args.bandwidth*1e6,
            measure_t = args.time,
            n_points = args.points,
            tx_gain = 0,
            Rate=args.rate*1e6,
            decimation=True,
            RF=(rf_0 + i*2*args.bandwidth)*1e6,
            Front_end=args.frontend,
            Device=None,
            output_filename=None,
            Multitone_compensation=1,
            Iterations=args.iter,
            verbose=False
        )
        enablePrint()
        print "iteration %d done" % i


    u.Disconnect()
    # Data analysis and plotting will be in an other python script