diff options
-rw-r--r-- | dpd/src/Dab_Util.py | 19 |
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 |