fix second graph

This commit is contained in:
awe
2026-06-09 18:56:40 +03:00
parent 8104ba6581
commit 1fd0f05d66

View File

@ -134,13 +134,12 @@ 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 ch1/ch2 individually by ref amplitude
# Normalize by ref amplitude and subtract ref phase
ref_amp_safe = np.where(ref_amplitude > 1e-12, ref_amplitude, 1e-12)
norm_ch1 = ch1_v / ref_amp_safe
norm_ch2 = ch2_v / ref_amp_safe
z_norm = (ch1_v / ref_amp_safe + 1j * ch2_v / ref_amp_safe) * np.exp(-1j * ref_phase_aligned)
# Build normalized complex signal and subtract ref phase
z_norm = (norm_ch1 + 1j * norm_ch2) * np.exp(-1j * ref_phase_aligned)
norm_ch1 = np.real(z_norm)
norm_ch2 = np.imag(z_norm)
amp_norm = np.abs(z_norm)
phase_norm = np.unwrap(np.angle(z_norm))