fix method

This commit is contained in:
awe
2026-06-09 19:07:27 +03:00
parent 41274b6e39
commit 52575e8312

View File

@ -136,7 +136,7 @@ def process_main(main_ch1, main_ch2, ref_amplitude, ref_phase_aligned):
# Normalize by ref amplitude and subtract ref phase of first point
ref_amp_safe = np.where(ref_amplitude > 1e-12, ref_amplitude, 1e-12)
z_norm = (ch1_v / ref_amp_safe + 1j * ch2_v / ref_amp_safe) * np.exp(-1j * ref_phase_aligned[0])
z_norm = (ch1_v / ref_amp_safe + 1j * ch2_v / ref_amp_safe) * np.exp(-1j * ref_phase_aligned)
norm_ch1 = np.real(z_norm)
norm_ch2 = np.imag(z_norm)
@ -239,7 +239,7 @@ def build_gui():
# ---------------------------------------------------------------------------
def make_update(reader, parser, assembler, curves, plots):
c_main_amp, c_ref_amp, c_norm_ch1, c_norm_ch2, c_norm_amp, c_ph, c_ph_line, c_ph_dev, c_fft = curves
state = {"axes_locked": False}
state = {"ref_phase_first": None, "axes_locked": False}
queue = deque(maxlen=64)
def update():
@ -272,8 +272,12 @@ def make_update(reader, parser, assembler, curves, plots):
sweep["ref_ch1"], sweep["ref_ch2"]
)
# Fix reference phase from the first sweep
if state["ref_phase_first"] is None:
state["ref_phase_first"] = ref_phase[0]
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, state["ref_phase_first"]
)
c_main_amp.setData(freqs_ghz, main_amp)