summaryrefslogtreecommitdiffstats
path: root/dpd/src/Dab_Util.py
diff options
context:
space:
mode:
authorandreas128 <Andreas>2017-08-18 16:37:11 +0200
committerandreas128 <Andreas>2017-08-18 16:37:11 +0200
commit9fa77f1cd8e0eda8229afc6e0ddffc4862c56554 (patch)
tree63200d5fd53a03f941695e2e0fa132c5d24f9fe3 /dpd/src/Dab_Util.py
parentb75afc42c95b76a0b789874f853ca8b49a290dd4 (diff)
downloaddabmod-9fa77f1cd8e0eda8229afc6e0ddffc4862c56554.tar.gz
dabmod-9fa77f1cd8e0eda8229afc6e0ddffc4862c56554.tar.bz2
dabmod-9fa77f1cd8e0eda8229afc6e0ddffc4862c56554.zip
Add logging plot for correlation
Diffstat (limited to 'dpd/src/Dab_Util.py')
-rw-r--r--dpd/src/Dab_Util.py19
1 files changed, 10 insertions, 9 deletions
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