freq_range = np.linspace(fstart, fstop, len(spectra_data)) stopT = time() print( f"Averages = {AVERAGE}, time = {stopT-startT:2.2f} sec, len = {len(spectra_data)}" ) plt.plot(freq_range, spectra_data, label='Sweep capture') # %% dut.scpiset(':sweep:list:stop') dut.abort() dut.flush() dut.flush_captures() dut.connect(addr) #%% dut.attenuator() # %% from pyrf.util import collect_data_and_context collect_data_and_context(dut) # %% dut.reset() # %% dut.flush_captures() # %% dut.scpiget(':syst:capt:mode?') # %% dut.scpiset(':SYSTEM:ABORT') # %% data = dut.read() # %% print(data) # %%
dut.freq(CENTER_FREQ) dut.decimation(DECIMATION) dut.attenuator(ATTENUATOR) dut.rfe_mode(RFE_MODE) # initialize plot win = MainApplication(dut) win.resize(1000,600) win.setWindowTitle("PYRF FFT Plot Example - " + ip) fft_plot = win.addPlot(title="Power Vs. Frequency") # initialize x-axes limits BANDWIDTH = dut.properties.FULL_BW[RFE_MODE] # for SH/SHN mode, spectral inversion and IF centred at 35 MHz (not 62.5 MHz/ 2) affect the display if ((RFE_MODE == 'SH') | (RFE_MODE == 'SHN')): spec_inv = int(dut.scpiget("FREQ:INV? %d" % CENTER_FREQ)) if spec_inv: plot_xmin = (CENTER_FREQ) - (62.5 - 35) * MHZ plot_xmax = (CENTER_FREQ) + (35 * MHZ) else: plot_xmin = (CENTER_FREQ) - (35 * MHZ) plot_xmax = (CENTER_FREQ) + (62.5 - 35) * MHZ else: plot_xmin = (CENTER_FREQ) - (BANDWIDTH / 2) plot_xmax = (CENTER_FREQ) + (BANDWIDTH / 2) fft_plot.setLabel('bottom', text='Frequency', units='Hz', unitPrefix=None) # initialize the y-axis of the plot plot_ymin = -130 plot_ymax = 20
dut.freq(CENTER_FREQ) dut.decimation(DECIMATION) dut.attenuator(ATTENUATOR) dut.rfe_mode(RFE_MODE) # initialize plot win = MainApplication(dut) win.resize(1000, 600) win.setWindowTitle("PYRF FFT Plot Example - " + ip) fft_plot = win.addPlot(title="Power Vs. Frequency") # initialize x-axes limits BANDWIDTH = dut.properties.FULL_BW[RFE_MODE] # for SH/SHN mode, spectral inversion and IF centred at 35 MHz (not 62.5 MHz/ 2) affect the display if ((RFE_MODE == 'SH') | (RFE_MODE == 'SHN')): spec_inv = int(dut.scpiget("FREQ:INV? %d" % CENTER_FREQ)) if spec_inv: plot_xmin = (CENTER_FREQ) - (62.5 - 35) * MHZ plot_xmax = (CENTER_FREQ) + (35 * MHZ) else: plot_xmin = (CENTER_FREQ) - (35 * MHZ) plot_xmax = (CENTER_FREQ) + (62.5 - 35) * MHZ else: plot_xmin = (CENTER_FREQ) - (BANDWIDTH / 2) plot_xmax = (CENTER_FREQ) + (BANDWIDTH / 2) fft_plot.setLabel('bottom', text='Frequency', units='Hz', unitPrefix=None) # initialize the y-axis of the plot plot_ymin = -130 plot_ymax = 20