From 5976e6bddda81432c5a0814f6dd7428d5b0d564b Mon Sep 17 00:00:00 2001 From: Eric Kooistra <kooistra@astron.nl> Date: Thu, 31 Oct 2024 10:28:26 +0100 Subject: [PATCH] Better not use unwrap in phase plots. --- applications/lofar2/model/rtdsp/plotting.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/applications/lofar2/model/rtdsp/plotting.py b/applications/lofar2/model/rtdsp/plotting.py index 3239917635..a3b729d8fe 100644 --- a/applications/lofar2/model/rtdsp/plotting.py +++ b/applications/lofar2/model/rtdsp/plotting.py @@ -146,7 +146,8 @@ def plot_spectra(fn, HF, fs=1.0, fLim=None, dbLim=None, aLim=None): . fs: sample frequency in Hz """ Hmag = np.abs(HF) - Hphs = np.unwrap(np.angle(HF)) + # Hphs = np.unwrap(np.angle(HF)) + Hphs = np.angle(HF) Hpow_dB = pow_db(HF) # power response f = fn * fs # scale fn by fs flabel = 'Frequency [fs = %f]' % fs @@ -209,7 +210,9 @@ def plot_phase_spectrum(fn, HF, fmt='r', fs=1.0, fLim=None, aLim=None): f = fn * fs # scale fn by fs flabel = 'Frequency [fs = %f]' % fs - plt.plot(f, np.unwrap(np.angle(HF)), fmt) + # Hphs = np.unwrap(np.angle(HF)) + Hphs = np.angle(HF) + plt.plot(f, Hphs, fmt) plt.title('Phase spectrum') plt.ylabel('Pase [rad]') plt.xlabel(flabel) -- GitLab