From 9fa77f1cd8e0eda8229afc6e0ddffc4862c56554 Mon Sep 17 00:00:00 2001 From: andreas128 Date: Fri, 18 Aug 2017 16:37:11 +0200 Subject: Add logging plot for correlation --- dpd/src/Dab_Util.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'dpd/src') diff --git a/dpd/src/Dab_Util.py b/dpd/src/Dab_Util.py index 212175c..974d4cf 100644 --- a/dpd/src/Dab_Util.py +++ b/dpd/src/Dab_Util.py @@ -30,15 +30,16 @@ class Dab_Util: sig_rec: The signal that has been recored """ off = sig_rec.shape[0] - c = signal.correlate(sig_orig, sig_rec) - - corr_path = ('/tmp/tx_rx_corr_' + - datetime.datetime.now().isoformat() + - '.pdf') - plt.plot(np.real(c[:10000]), label="corr") - plt.legend() - plt.savefig(corr_path) - plt.clf() + c = np.abs(signal.correlate(sig_orig, sig_rec)) + + if logging.getLogger().getEffectiveLevel() == logging.DEBUG: + corr_path = ('/tmp/tx_rx_corr_' + + datetime.datetime.now().isoformat() + + '.pdf') + plt.plot(c, label="corr") + plt.legend() + plt.savefig(corr_path) + plt.clf() return np.argmax(c) - off + 1 -- cgit v1.2.3