From 66c88bf8894ea5fe1c19f12f35acc440c52433ee Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Sat, 30 Mar 2024 22:04:26 +0100 Subject: [PATCH] Improvements to debug scripts --- impl/utils/plot_amp_phase.py | 2 +- impl/utils/plot_spectrum_loop.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/impl/utils/plot_amp_phase.py b/impl/utils/plot_amp_phase.py index a70a40d..cbc2af5 100755 --- a/impl/utils/plot_amp_phase.py +++ b/impl/utils/plot_amp_phase.py @@ -17,7 +17,7 @@ with open(sys.argv[1], 'rb') as infile: t = np.arange(0, T*data.size, T) amp = np.absolute(data) - phase = np.angle(data) + phase = np.unwrap(np.angle(data)) pp.plot(t, amp, 'r-') pp.legend(['Amplitude']) diff --git a/impl/utils/plot_spectrum_loop.py b/impl/utils/plot_spectrum_loop.py index fd82924..aba9ff4 100755 --- a/impl/utils/plot_spectrum_loop.py +++ b/impl/utils/plot_spectrum_loop.py @@ -35,8 +35,11 @@ ax.legend(['Spectrum']) ax.set_xlabel('Frequency [Hz]') def update(*args): - spec, f = load_data() - line.set_ydata(spec) + try: + spec, f = load_data() + line.set_ydata(spec) + except Exception as e: + print(e) return [line]