Example #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
Example #2
0
def run(rate, freq, front_end, duration):
    '''
    Basic test of the line delay functionality.
    :param rate: USRP sampling rate.
    :param freq: LO frequncy.
    :param front_end: A or B front end.
    :return: None
    '''

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

    delay = u.analyze_line_delay(filename, True)

    try:
        delay += u.LINE_DELAY[str(int(rate / 1e6))] * 1e-9
    except KeyError:
        pass

    u.write_delay_to_file(filename, delay)

    u.load_delay_from_file(filename)
Example #3
0
def run(rate,freq_a,freq_b, f0a,f1a,f0b,f1b, lapse, points, gain_a, gain_b):


    try:
        if u.LINE_DELAY[str(int(rate/1e6))]: pass
    except KeyError:
        print "Cannot find line delay. Measuring line delay before VNA:"

        front_end = 'A'

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

        delay = u.analyze_line_delay(filename, True)

        u.write_delay_to_file(filename, delay)

        u.load_delay_from_file(filename)

        vna_filename = u.Dual_VNA(
            start_f_A = f0a,
            last_f_A = f1a,
            start_f_B = f0b,
            last_f_B = f1b,
            measure_t = lapse,
            n_points = points,
            tx_gain_A = gain_a,
            tx_gain_B = gain_b,
            Rate = None,
            decimation = True,
            RF_A = freq_a,
            RF_B = freq_b,
            Device = None,
            output_filename = None,
            Multitone_compensation_A = None,
            Multitone_compensation_B = None,
            Iterations = 1,
            verbose = False
        )

    return vna_filename
Example #4
0
    seed_gain = VNA_seed_info['gain']
    seed_rate = VNA_seed_info['rate']
    seed_ntones = len(seed_tones) + len(guard_tones)
    u.print_debug("Adjusting power for %d tone readout..." % seed_ntones)

    if not u.Connect():
        u.print_error("Cannot find the GPU server!")
        exit()

    #measure line delay

    filename = u.measure_line_delay(seed_rate,
                                    seed_rf,
                                    str(args.frontend),
                                    USRP_num=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,
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
Example #6
0
    run = True
    duration = 4
    rx_gain = 17.5
    tx_gain = 0
    rate = 200e6

    power = -40
    N_power = 10**(((-1 * power) - 14) / 20)
    print round(-14 - 20 * np.log10(N_power), 2), ' dBm'
    print N_power

    delay_filename = u.measure_line_delay(rate,
                                          LO,
                                          'A',
                                          USRP_num=0,
                                          tx_gain=tx_gain,
                                          rx_gain=rx_gain,
                                          output_filename=None,
                                          compensate=True,
                                          duration=0.01)
    delay = u.analyze_line_delay(delay_filename, True)
    print(delay)
    os.remove(delay_filename + '.h5')
    while run == True:
        try:
            #file0, delay0 = vna_run(gain=0,iter=1,rate=200e6,freq=LO,front_end='A',f0=f0,f1=f1,lapse=1,points=450000,ntones=3+0.5*ntones_exp,delay_duration=0.01,delay_over=0)
            #file0, delay0 = vna_run(gain=ntones_exp,iter=1,rate=200e6,freq=LO,front_end='A',f0=f0,f1=f1,lapse=1,points=450000,ntones=1,delay_duration=0.01,delay_over=0)

            file0, _ = puf2.vna_run(tx_gain=tx_gain,
                                    rx_gain=rx_gain,
                                    iter=1,
Example #7
0
    os.chdir(args.folder)
    
    #find number of intervals:
    n_int = np.abs(args.start - args.to)/args.bandwidth + 1
    rf_0 = args.start + args.bandwidth
    u.Connect()
    print "initializing delay..."
    blockPrint()
    try:
        if u.LINE_DELAY[str(int(args.rate))]: pass
    except KeyError:


        print "Cannot find line delay. Measuring line delay before VNA:"

        filename = u.measure_line_delay(
            args.rate*1e6, rf_0, args.frontend, USRP_num=0, tx_gain=0, rx_gain=0, output_filename=None, compensate = True, duration = 0.01)

        delay = u.analyze_line_delay(filename, True)

        u.write_delay_to_file(filename, delay)

        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,