summaryrefslogtreecommitdiffstats
path: root/dpd
diff options
context:
space:
mode:
authorandreas128 <Andreas>2017-09-14 14:21:17 +0200
committerandreas128 <Andreas>2017-09-14 14:21:17 +0200
commitbf32d4e1efb87eb7a51207281f2565ee54e1aee2 (patch)
tree9c70a8d1117d81a202fa934c8d4edca59b3ffe2d /dpd
parent594fcefc353fec548ace0b431355121478aa4c1e (diff)
downloaddabmod-bf32d4e1efb87eb7a51207281f2565ee54e1aee2.tar.gz
dabmod-bf32d4e1efb87eb7a51207281f2565ee54e1aee2.tar.bz2
dabmod-bf32d4e1efb87eb7a51207281f2565ee54e1aee2.zip
Add report in main
Diffstat (limited to 'dpd')
-rwxr-xr-xdpd/main.py18
-rw-r--r--dpd/src/Symbol_align.py3
2 files changed, 19 insertions, 2 deletions
diff --git a/dpd/main.py b/dpd/main.py
index 528f59c..208a4ff 100755
--- a/dpd/main.py
+++ b/dpd/main.py
@@ -162,9 +162,25 @@ while i < num_iter:
# Adapt
elif state == "adapt":
adapt.set_coefs(coefs_am, coefs_pm)
- state = "measure"
+ state = "report"
i += 1
+ # Report
+ elif state == "report":
+ try:
+ off = SA.calc_offset(txframe_aligned)
+ tx_mer = MER.calc_mer(txframe_aligned[off:off+c.T_U], debug=True)
+ rx_mer = MER.calc_mer(rxframe_aligned[off:off+c.T_U], debug=True)
+ mse = np.mean(np.abs((txframe_aligned - rxframe_aligned)**2))
+ logging.info("It {}: TX_MER {}, RX_MER {}," \
+ " MSE {}, coefs_am {}, coefs_pm {}".
+ format(i, tx_mer, rx_mer, mse, coefs_am, coefs_pm))
+ state = "measure"
+ except:
+ logging.warning("Iteration {}: Report failed.".format(i))
+ logging.warning(traceback.format_exc())
+ state = "measure"
+
except Exception as e:
logging.warning("Iteration {} failed.".format(i))
logging.warning(traceback.format_exc())
diff --git a/dpd/src/Symbol_align.py b/dpd/src/Symbol_align.py
index 05a9049..6c814a8 100644
--- a/dpd/src/Symbol_align.py
+++ b/dpd/src/Symbol_align.py
@@ -147,7 +147,8 @@ class Symbol_align:
delta_sample_int = np.round(delta_sample).astype(int)
error = np.abs(delta_sample_int - delta_sample)
if error > 0.1:
- raise RuntimeError("Could not calculate sample offset")
+ raise RuntimeError("Could not calculate " \
+ "sample offset. Error {}".format(error))
return delta_sample_int
def calc_offset(self, tx):