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
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)
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
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, RF=seed_rf, Front_end=str(args.frontend), Device=None, output_filename=None, Multitone_compensation=seed_ntones,
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