예제 #1
0
def handle_job_update(msg, methods=['GET', 'POST']):
    if msg['action'] == "connect":
        addr = msg['addr']
        res = u.Connect(timeout=5, addrss=addr)
        connection_lock.acquire()
        INFO['SERVER_CONNECTED'] = res
        connection_lock.release()
        socketio.emit('connect_resopnse', json.dumps({'response': int(res)}))
    elif msg['action'] == "disconnect":
        u.Disconnect()
        connection_lock.acquire()
        INFO['SERVER_CONNECTED'] = False
        connection_lock.release()
        socketio.emit('connect_resopnse', json.dumps({'response': int(False)}))
    elif msg['action'] == "ping":
        pass  # requires server dev
    elif msg['action'] == "restart":
        pass  # requires server dev
예제 #2
0
            return ""

    #replicate the VNA measure (WARNING: DOES NOT SUPPORT ITERATIONS)
    u.print_debug("Replicating seed VNA measure to ensure phase coherency...")
    VNA_seed_info = u.get_rx_info(args.VNA, ant=ant)
    seed_rf, seed_tones = u.get_tones(args.VNA)
    seed_start_f = VNA_seed_info['freq'][0]
    seed_end_f = VNA_seed_info['chirp_f'][0]
    seed_measure_t = VNA_seed_info['chirp_t'][0]
    seed_points = VNA_seed_info['swipe_s'][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)
예제 #3
0
    parser.add_argument('--bandwidth', '-bw', help='Rate in which the single VNA is flat. considered plus/minus', type=float, default = 10)
    parser.add_argument('--start', '-f', help='Starting frequency in MHz', type=float, default = 200)
    parser.add_argument('--to', '-t', help='Ending frequency in MHz', type=float, default = 1000)
    parser.add_argument('--points', '-p', help='Number of points per scan', type=float, default = 10000)
    parser.add_argument('--iter', '-i', help='How many iterations to perform', type=float, default=1)
    parser.add_argument('--frontend', '-fr', help='front-end character: A or B', type=str, default="A")
    parser.add_argument('--time', '-tt', help='Duration of the scan in seconds per iteration', type=float, default=2)
    parser.add_argument('--folder', '-fn', help='Name of the folder in which the data will be stored', type=str, default = "data")
    args = parser.parse_args()
    
    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)