fix
This commit is contained in:
@ -219,7 +219,11 @@ def process_main(main_ch1, main_ch2, ref_amplitude, ref_phase_aligned):
|
|||||||
dist_step = C_M_S / (2.0 * FFT_LEN * df_hz)
|
dist_step = C_M_S / (2.0 * FFT_LEN * df_hz)
|
||||||
fft_dist = np.arange(FFT_LEN // 2) * dist_step
|
fft_dist = np.arange(FFT_LEN // 2) * dist_step
|
||||||
|
|
||||||
return main_amp, ref_amplitude, amp_norm, phase_norm, fft_mag, fft_dist
|
# Normalized ch1/ch2 (real/imag parts of z_norm)
|
||||||
|
norm_ch1 = np.real(z_norm)
|
||||||
|
norm_ch2 = np.imag(z_norm)
|
||||||
|
|
||||||
|
return main_amp, ref_amplitude, norm_ch1, norm_ch2, amp_norm, phase_norm, fft_mag, fft_dist
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@ -240,37 +244,47 @@ def build_gui():
|
|||||||
c_main_amp = p_raw.plot(pen=pg.mkPen((80, 120, 255), width=1), name="Main (0a00)")
|
c_main_amp = p_raw.plot(pen=pg.mkPen((80, 120, 255), width=1), name="Main (0a00)")
|
||||||
c_ref_amp = p_raw.plot(pen=pg.mkPen((255, 80, 80), width=1), name="Ref (a800)")
|
c_ref_amp = p_raw.plot(pen=pg.mkPen((255, 80, 80), width=1), name="Ref (a800)")
|
||||||
|
|
||||||
# Row 1: normalized amplitude
|
# Row 1: normalized CH1 / CH2 (Re/Im of main/ref)
|
||||||
p_norm = win.addPlot(row=1, col=0, title="Нормированная амплитуда |S|")
|
p_ch = win.addPlot(row=1, col=0, title="Main нормированный: CH1 (Re), CH2 (Im)")
|
||||||
|
p_ch.showGrid(x=True, y=True, alpha=0.3)
|
||||||
|
p_ch.setLabel("bottom", "Частота", units="ГГц")
|
||||||
|
p_ch.setLabel("left", "Значение")
|
||||||
|
p_ch.setXLink(p_raw)
|
||||||
|
p_ch.addLegend(offset=(10, 10))
|
||||||
|
c_norm_ch1 = p_ch.plot(pen=pg.mkPen((80, 120, 255), width=1), name="CH1 (Re)")
|
||||||
|
c_norm_ch2 = p_ch.plot(pen=pg.mkPen((255, 80, 80), width=1), name="CH2 (Im)")
|
||||||
|
|
||||||
|
# Row 2: normalized amplitude
|
||||||
|
p_norm = win.addPlot(row=2, col=0, title="Нормированная амплитуда |S|")
|
||||||
p_norm.showGrid(x=True, y=True, alpha=0.3)
|
p_norm.showGrid(x=True, y=True, alpha=0.3)
|
||||||
p_norm.setLabel("bottom", "Частота", units="ГГц")
|
p_norm.setLabel("bottom", "Частота", units="ГГц")
|
||||||
p_norm.setLabel("left", "Амплитуда")
|
p_norm.setLabel("left", "Амплитуда")
|
||||||
p_norm.setXLink(p_raw)
|
p_norm.setXLink(p_raw)
|
||||||
c_norm_amp = p_norm.plot(pen=pg.mkPen((80, 120, 255), width=1))
|
c_norm_amp = p_norm.plot(pen=pg.mkPen((80, 120, 255), width=1))
|
||||||
|
|
||||||
# Row 2: normalized phase
|
# Row 3: normalized phase
|
||||||
p_ph = win.addPlot(row=2, col=0, title="Нормированная фаза arg(S)")
|
p_ph = win.addPlot(row=3, col=0, title="Нормированная фаза arg(S)")
|
||||||
p_ph.showGrid(x=True, y=True, alpha=0.3)
|
p_ph.showGrid(x=True, y=True, alpha=0.3)
|
||||||
p_ph.setLabel("bottom", "Частота", units="ГГц")
|
p_ph.setLabel("bottom", "Частота", units="ГГц")
|
||||||
p_ph.setLabel("left", "Фаза", units="рад")
|
p_ph.setLabel("left", "Фаза", units="рад")
|
||||||
p_ph.setXLink(p_raw)
|
p_ph.setXLink(p_raw)
|
||||||
c_ph = p_ph.plot(pen=pg.mkPen((230, 180, 40), width=1))
|
c_ph = p_ph.plot(pen=pg.mkPen((230, 180, 40), width=1))
|
||||||
|
|
||||||
# Row 3: FFT distance
|
# Row 4: FFT distance
|
||||||
p_fft = win.addPlot(row=3, col=0, title="FFT — расстояние")
|
p_fft = win.addPlot(row=4, col=0, title="FFT — расстояние")
|
||||||
p_fft.showGrid(x=True, y=True, alpha=0.3)
|
p_fft.showGrid(x=True, y=True, alpha=0.3)
|
||||||
p_fft.setLabel("bottom", "Расстояние", units="м")
|
p_fft.setLabel("bottom", "Расстояние", units="м")
|
||||||
p_fft.setLabel("left", "Магнитуда", units="дБ")
|
p_fft.setLabel("left", "Магнитуда", units="дБ")
|
||||||
c_fft = p_fft.plot(pen=pg.mkPen((60, 200, 80), width=1))
|
c_fft = p_fft.plot(pen=pg.mkPen((60, 200, 80), width=1))
|
||||||
|
|
||||||
return app, win, (c_main_amp, c_ref_amp, c_norm_amp, c_ph, c_fft)
|
return app, win, (c_main_amp, c_ref_amp, c_norm_ch1, c_norm_ch2, c_norm_amp, c_ph, c_fft)
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Update loop
|
# Update loop
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
def make_update(reader, accumulator, curves):
|
def make_update(reader, accumulator, curves):
|
||||||
c_main_amp, c_ref_amp, c_norm_amp, c_ph, c_fft = curves
|
c_main_amp, c_ref_amp, c_norm_ch1, c_norm_ch2, c_norm_amp, c_ph, c_fft = curves
|
||||||
state = {"ref_phase_first": None}
|
state = {"ref_phase_first": None}
|
||||||
|
|
||||||
def update():
|
def update():
|
||||||
@ -294,12 +308,14 @@ def make_update(reader, accumulator, curves):
|
|||||||
sweep["ref_ch1"], sweep["ref_ch2"], state["ref_phase_first"], freqs_hz
|
sweep["ref_ch1"], sweep["ref_ch2"], state["ref_phase_first"], freqs_hz
|
||||||
)
|
)
|
||||||
|
|
||||||
main_amp, ref_amplitude, norm_amp, phase, fft_mag, fft_dist = process_main(
|
main_amp, ref_amplitude, norm_ch1, norm_ch2, norm_amp, phase, fft_mag, fft_dist = process_main(
|
||||||
sweep["main_ch1"], sweep["main_ch2"], ref_amp, ref_phase
|
sweep["main_ch1"], sweep["main_ch2"], ref_amp, ref_phase
|
||||||
)
|
)
|
||||||
|
|
||||||
c_main_amp.setData(freqs_ghz, main_amp)
|
c_main_amp.setData(freqs_ghz, main_amp)
|
||||||
c_ref_amp.setData(freqs_ghz, ref_amplitude)
|
c_ref_amp.setData(freqs_ghz, ref_amplitude)
|
||||||
|
c_norm_ch1.setData(freqs_ghz, norm_ch1)
|
||||||
|
c_norm_ch2.setData(freqs_ghz, norm_ch2)
|
||||||
c_norm_amp.setData(freqs_ghz, norm_amp)
|
c_norm_amp.setData(freqs_ghz, norm_amp)
|
||||||
c_ph.setData(freqs_ghz, phase)
|
c_ph.setData(freqs_ghz, phase)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user