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)