#!/usr/bin/env python import sys from pyrf.devices.thinkrf import WSA # connect to wsa dut = WSA() dut.connect(sys.argv[1]) # setup test conditions dut.reset() dut.request_read_perm() dut.freq(2450e6) # capture 1 packet dut.capture(1024, 1) # read until I get 1 data packet while not dut.eof(): pkt = dut.read() if pkt.is_data_packet(): break # print I/Q data into i and q for i, q in pkt.data: print "%d,%d" % (i, q)
dut.reset() dut.request_read_perm() dut.flush() dut.pll_reference('EXT') dut.rfe_mode(RFE_MODE) dut.freq(CENTER_FREQ) dut.decimation(DECIMATION) dut.spp(SPP) dut.ppb(PPB) dut.flush() time.sleep(0.25) dut.capture(SPP, PPB) for i in range(PPB): data, context = collect_data_and_context(dut) print(data.data.__len__()) i = np.array([z[0] for z in data.data.numpy_array()], dtype=float) q = np.array([z[1] for z in data.data.numpy_array()], dtype=float) t = np.arange(0, len(i), 1) / 125e0 fig, axes = plt.subplots(2, 1, sharex=True) axes[0].plot(t, 20 * np.log10((i * i + q * q) / 2**13 / len(i))) axes[1].plot(t, np.arctan2(q, i)) plt.xlabel('time (us)') # %%