diff options
author | andreas128 <Andreas> | 2017-08-09 17:50:22 +0100 |
---|---|---|
committer | andreas128 <Andreas> | 2017-08-09 17:50:22 +0100 |
commit | eaeac9c1296ae9a62b1914903877a0d871c19066 (patch) | |
tree | 058cc7f5ca527918d5a8642aef0a861902aaf33b | |
parent | 6ecbd8538a4bd535db7c663a5289f44d1e129276 (diff) | |
download | dabmod-eaeac9c1296ae9a62b1914903877a0d871c19066.tar.gz dabmod-eaeac9c1296ae9a62b1914903877a0d871c19066.tar.bz2 dabmod-eaeac9c1296ae9a62b1914903877a0d871c19066.zip |
Add logging to Model
-rw-r--r-- | dpd/src/Model.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/dpd/src/Model.py b/dpd/src/Model.py index a7bc63b..78445cf 100644 --- a/dpd/src/Model.py +++ b/dpd/src/Model.py @@ -1,5 +1,9 @@ # -*- coding: utf-8 -*- +import numpy as np +import logging +import matplotlib.pyplot as plt + class Model: """Calculates new coefficients using the measurement and the old coefficients""" @@ -8,6 +12,26 @@ class Model: self.coefs = coefs def get_next_coefs(self, txframe_aligned, rxframe_aligned): + txframe_aligned = txframe_aligned / np.median(np.abs(txframe_aligned)) + rxframe_aligned = rxframe_aligned / np.median(np.abs(rxframe_aligned)) + + logging.debug("txframe: min %f, max %f, median %f" % + (np.min(np.abs(txframe_aligned)), + np.max(np.abs(txframe_aligned)), + np.median(np.abs(txframe_aligned)) + )) + + logging.debug("rxframe: min %f, max %f, median %f" % + (np.min(np.abs(rxframe_aligned)), + np.max(np.abs(rxframe_aligned)), + np.median(np.abs(rxframe_aligned)) + )) + + plt.plot(rxframe_aligned[:1024], label="rxframe") + plt.plot(txframe_aligned[:1024], label="txframe") + plt.legend() + plt.savefig("/tmp/") + return self.coefs # The MIT License (MIT) |