From 41274b6e39db6146f9f0736ca82b1d99cd7d6271 Mon Sep 17 00:00:00 2001 From: awe Date: Tue, 9 Jun 2026 19:00:40 +0300 Subject: [PATCH] fix first point --- rfg_vna_viewer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rfg_vna_viewer.py b/rfg_vna_viewer.py index 1555bb3..8739963 100644 --- a/rfg_vna_viewer.py +++ b/rfg_vna_viewer.py @@ -134,9 +134,9 @@ def process_main(main_ch1, main_ch2, ref_amplitude, ref_phase_aligned): z_main = ch1_v + 1j * ch2_v main_amp = np.abs(z_main) - # Normalize by ref amplitude and subtract ref phase + # 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) + z_norm = (ch1_v / ref_amp_safe + 1j * ch2_v / ref_amp_safe) * np.exp(-1j * ref_phase_aligned[0]) norm_ch1 = np.real(z_norm) norm_ch2 = np.imag(z_norm)