From d2562d60af9f5d32c4e5ff89a1085962a9089d23 Mon Sep 17 00:00:00 2001 From: andreas128 Date: Wed, 13 Sep 2017 16:55:13 +0200 Subject: Add FSM to main.py --- dpd/main.py | 57 ++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 19 deletions(-) (limited to 'dpd/main.py') diff --git a/dpd/main.py b/dpd/main.py index 5e67c90..99bcf31 100755 --- a/dpd/main.py +++ b/dpd/main.py @@ -42,6 +42,8 @@ import numpy as np import traceback import src.Measure as Measure import src.Model as Model +import src.Model_AM as Model_AM +import src.ExtractStatistic as ExtractStatistic import src.Adapt as Adapt import src.Agc as Agc import src.TX_Agc as TX_Agc @@ -64,7 +66,7 @@ parser.add_argument('--samplerate', default='8192000', parser.add_argument('--coefs', default='poly.coef', help='File with DPD coefficients, which will be read by ODR-DabMod', required=False) -parser.add_argument('--txgain', default=71, +parser.add_argument('--txgain', default=73, help='TX Gain', required=False, type=int) @@ -103,17 +105,21 @@ MER = src.MER.MER(samplerate) c = src.const.const(samplerate) meas = Measure.Measure(samplerate, port, num_req) - +extStat = ExtractStatistic.ExtractStatistic(c, plot=True) adapt = Adapt.Adapt(port_rc, coef_path) -coefs_am, coefs_pm = adapt.get_coefs() + if cli_args.load_poly: + coefs_am, coefs_pm = adapt.get_coefs() model = Model.Model(c, SA, MER, coefs_am, coefs_pm, plot=True) else: - model = Model.Model(c, SA, MER, [1.0, 0, 0, 0, 0], [0, 0, 0, 0, 0], plot=True) + coefs_am, coefs_pm = [[1.0, 0, 0, 0, 0], [0, 0, 0, 0, 0]] + model = Model.Model(c, SA, MER, coefs_am, coefs_pm, plot=True) +model_am = Model_AM.Model_AM(c, plot=True) adapt.set_coefs(model.coefs_am, model.coefs_pm) adapt.set_digital_gain(digital_gain) adapt.set_txgain(txgain) adapt.set_rxgain(rxgain) +print(coefs_am) tx_gain = adapt.get_txgain() rx_gain = adapt.get_rxgain() @@ -132,23 +138,36 @@ tx_agc = TX_Agc.TX_Agc(adapt) agc = Agc.Agc(meas, adapt) agc.run() -for i in range(num_iter): +state = "measure" +i = 0 +while i < num_iter: try: - txframe_aligned, tx_ts, rxframe_aligned, rx_ts, rx_median = meas.get_samples() - logging.debug("tx_ts {}, rx_ts {}".format(tx_ts, rx_ts)) - assert tx_ts - rx_ts < 1e-5, "Time stamps do not match." - - if tx_agc.adapt_if_necessary(txframe_aligned): - continue - - coefs_am, coefs_pm = model.get_next_coefs(txframe_aligned, rxframe_aligned) - adapt.set_coefs(coefs_am, coefs_pm) + # Measure + if state == "measure": + txframe_aligned, tx_ts, rxframe_aligned, rx_ts, rx_median = meas.get_samples() + tx, rx, n_per_bin = extStat.extract(txframe_aligned, rxframe_aligned) + n_use = int(len(n_per_bin) * 0.6) + tx = tx[:n_use] + rx = rx[:n_use] + if all(c.ES_n_per_bin == np.array(n_per_bin)[0:n_use]): + state = "model" + else: + state = "measure" + + # Model + elif state == "model": + coefs_am = model_am.get_next_coefs(tx, rx, coefs_am) + del extStat + extStat = ExtractStatistic.ExtractStatistic(c, plot=True) + state = "adapt" + + # Adapt + elif state == "adapt": + print(coefs_am) + adapt.set_coefs(coefs_am, coefs_pm) + state = "measure" + i += 1 - off = SA.calc_offset(txframe_aligned) - tx_mer = MER.calc_mer(txframe_aligned[off:off + c.T_U]) - rx_mer = MER.calc_mer(rxframe_aligned[off:off + c.T_U], debug=True) - logging.info("MER with lag in it. {}: TX {}, RX {}". - format(i, tx_mer, rx_mer)) except Exception as e: logging.warning("Iteration {} failed.".format(i)) logging.warning(traceback.format_exc()) -- cgit v1.2.3 From 0718c0390d9f05ef21ec202be2ce7ea6e2a6a31d Mon Sep 17 00:00:00 2001 From: andreas128 Date: Thu, 14 Sep 2017 11:21:10 +0200 Subject: Add Model_PM --- dpd/main.py | 6 ++- dpd/src/ExtractStatistic.py | 5 ++ dpd/src/Model_AM.py | 2 +- dpd/src/Model_PM.py | 118 ++++++++++++++++++++++++++++++++++++++++++++ dpd/src/const.py | 2 +- 5 files changed, 130 insertions(+), 3 deletions(-) create mode 100644 dpd/src/Model_PM.py (limited to 'dpd/main.py') diff --git a/dpd/main.py b/dpd/main.py index 99bcf31..320c291 100755 --- a/dpd/main.py +++ b/dpd/main.py @@ -43,6 +43,7 @@ import traceback import src.Measure as Measure import src.Model as Model import src.Model_AM as Model_AM +import src.Model_PM as Model_PM import src.ExtractStatistic as ExtractStatistic import src.Adapt as Adapt import src.Agc as Agc @@ -115,6 +116,7 @@ else: coefs_am, coefs_pm = [[1.0, 0, 0, 0, 0], [0, 0, 0, 0, 0]] model = Model.Model(c, SA, MER, coefs_am, coefs_pm, plot=True) model_am = Model_AM.Model_AM(c, plot=True) +model_pm = Model_PM.Model_PM(c, plot=True) adapt.set_coefs(model.coefs_am, model.coefs_pm) adapt.set_digital_gain(digital_gain) adapt.set_txgain(txgain) @@ -145,10 +147,11 @@ while i < num_iter: # Measure if state == "measure": txframe_aligned, tx_ts, rxframe_aligned, rx_ts, rx_median = meas.get_samples() - tx, rx, n_per_bin = extStat.extract(txframe_aligned, rxframe_aligned) + tx, rx, phase_diff, n_per_bin = extStat.extract(txframe_aligned, rxframe_aligned) n_use = int(len(n_per_bin) * 0.6) tx = tx[:n_use] rx = rx[:n_use] + phase_diff = phase_diff[:n_use] if all(c.ES_n_per_bin == np.array(n_per_bin)[0:n_use]): state = "model" else: @@ -157,6 +160,7 @@ while i < num_iter: # Model elif state == "model": coefs_am = model_am.get_next_coefs(tx, rx, coefs_am) + coefs_pm = model_pm.get_next_coefs(tx, phase_diff, coefs_pm) del extStat extStat = ExtractStatistic.ExtractStatistic(c, plot=True) state = "adapt" diff --git a/dpd/src/ExtractStatistic.py b/dpd/src/ExtractStatistic.py index 6139e1d..897ec0a 100644 --- a/dpd/src/ExtractStatistic.py +++ b/dpd/src/ExtractStatistic.py @@ -169,8 +169,13 @@ class ExtractStatistic: n_per_bin = [len(values) for values in self.rx_values_lists] + # TODO cleanup + phase_diffs_values_lists = self._phase_diff_list_per_bin() + phase_diffs_values = self._phase_diff_value_per_bin(phase_diffs_values_lists) + return np.array(self.tx_values, dtype=np.float32), \ np.array(self.rx_values, dtype=np.float32), \ + np.array(phase_diffs_values, dtype=np.float32), \ n_per_bin # The MIT License (MIT) diff --git a/dpd/src/Model_AM.py b/dpd/src/Model_AM.py index bdf55c6..5c307ef 100644 --- a/dpd/src/Model_AM.py +++ b/dpd/src/Model_AM.py @@ -22,7 +22,7 @@ def check_input_get_next_coefs(tx_dpd, rx_received): x.flags.contiguous) assert is_float32(tx_dpd), \ "tx_dpd is not float32 but {}".format(tx_dpd[0].dtype) - assert is_float32(tx_dpd), \ + assert is_float32(rx_received), \ "rx_received is not float32 but {}".format(tx_dpd[0].dtype) diff --git a/dpd/src/Model_PM.py b/dpd/src/Model_PM.py new file mode 100644 index 0000000..6639382 --- /dev/null +++ b/dpd/src/Model_PM.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- +# +# DPD Calculation Engine, model implementation for Amplitude and not Phase +# +# http://www.opendigitalradio.org +# Licence: The MIT License, see notice at the end of this file + +import datetime +import os +import logging + +logging_path = os.path.dirname(logging.getLoggerClass().root.handlers[0].baseFilename) + +import numpy as np +import matplotlib.pyplot as plt +from sklearn import linear_model + + +def check_input_get_next_coefs(tx_dpd, phase_diff): + is_float32 = lambda x: (isinstance(x, np.ndarray) and + x.dtype == np.float32 and + x.flags.contiguous) + assert is_float32(tx_dpd), \ + "tx_dpd is not float32 but {}".format(tx_dpd[0].dtype) + assert is_float32(phase_diff), \ + "phase_diff is not float32 but {}".format(tx_dpd[0].dtype) + assert tx_dpd.shape == phase_diff.shape, \ + "tx_dpd.shape {}, phase_diff.shape {}".format( + tx_dpd.shape, phase_diff.shape) + + +class Model_PM: + """Calculates new coefficients using the measurement and the previous + coefficients""" + + def __init__(self, + c, + learning_rate_pm=0.1, + plot=False): + self.c = c + + self.learning_rate_pm = learning_rate_pm + self.plot = plot + + def _plot(self, tx_dpd, phase_diff, coefs_pm, coefs_pm_new): + if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot: + tx_range, phase_diff_est = self.calc_line(coefs_pm, 0, 0.6) + tx_range_new, phase_diff_est_new = self.calc_line(coefs_pm_new, 0, 0.6) + + dt = datetime.datetime.now().isoformat() + fig_path = logging_path + "/" + dt + "_Model_PM.svg" + sub_rows = 1 + sub_cols = 1 + fig = plt.figure(figsize=(sub_cols * 6, sub_rows / 2. * 6)) + i_sub = 0 + + i_sub += 1 + ax = plt.subplot(sub_rows, sub_cols, i_sub) + ax.plot(tx_range, phase_diff_est, + label="Estimated Phase Diff", + alpha=0.3, + color="gray") + ax.plot(tx_range_new, phase_diff_est_new, + label="New Estimated Phase Diff", + color="red") + ax.scatter(tx_dpd, phase_diff, + label="Binned Data", + color="blue", + s=0.1) + ax.set_title("Model_PM") + ax.set_xlabel("TX Amplitude") + ax.set_ylabel("Phase DIff") + ax.legend(loc=4) + + fig.tight_layout() + fig.savefig(fig_path) + plt.close(fig) + + def poly(self, sig): + return np.array([sig ** i for i in range(0, 5)]).T + + def fit_poly(self, tx_abs, phase_diff): + return np.linalg.lstsq(self.poly(tx_abs), phase_diff)[0] + + def calc_line(self, coefs, min_amp, max_amp): + tx_range = np.linspace(min_amp, max_amp) + phase_diff = np.sum(self.poly(tx_range) * coefs, axis=1) + return tx_range, phase_diff + + def get_next_coefs(self, tx_dpd, phase_diff, coefs_pm): + check_input_get_next_coefs(tx_dpd, phase_diff) + + coefs_pm_new = self.fit_poly(tx_dpd, phase_diff) + self._plot(tx_dpd, phase_diff, coefs_pm, coefs_pm_new) + + return coefs_pm_new + +# The MIT License (MIT) +# +# Copyright (c) 2017 Andreas Steger +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/dpd/src/const.py b/dpd/src/const.py index 6cf1537..75ff819 100644 --- a/dpd/src/const.py +++ b/dpd/src/const.py @@ -41,4 +41,4 @@ class const: self.ES_start = 0.0 self.ES_end = 1.0 self.ES_n_bins = 64 - self.ES_n_per_bin = 1024 + self.ES_n_per_bin = 256 -- cgit v1.2.3 From e7e7e81730961bba6c8910c21f34616a7548afcb Mon Sep 17 00:00:00 2001 From: andreas128 Date: Thu, 14 Sep 2017 12:09:38 +0200 Subject: Simplify argparse --- dpd/main.py | 10 +++++----- dpd/src/Model_Poly.py | 0 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 dpd/src/Model_Poly.py (limited to 'dpd/main.py') diff --git a/dpd/main.py b/dpd/main.py index 320c291..e17cd5a 100755 --- a/dpd/main.py +++ b/dpd/main.py @@ -55,13 +55,13 @@ import argparse parser = argparse.ArgumentParser( description="DPD Computation Engine for ODR-DabMod") -parser.add_argument('--port', default='50055', +parser.add_argument('--port', default=50055, type=int, help='port of DPD server to connect to (default: 50055)', required=False) -parser.add_argument('--rc-port', default='9400', +parser.add_argument('--rc-port', default=9400, type=int, help='port of ODR-DabMod ZMQ Remote Control to connect to (default: 9400)', required=False) -parser.add_argument('--samplerate', default='8192000', +parser.add_argument('--samplerate', default=8192000, type=int, help='Sample rate', required=False) parser.add_argument('--coefs', default='poly.coef', @@ -79,10 +79,10 @@ parser.add_argument('--digital_gain', default=1, help='Digital Gain', required=False, type=float) -parser.add_argument('--samps', default='81920', +parser.add_argument('--samps', default='81920', type=int, help='Number of samples to request from ODR-DabMod', required=False) -parser.add_argument('-i', '--iterations', default='1', +parser.add_argument('-i', '--iterations', default=1, type=int, help='Number of iterations to run', required=False) parser.add_argument('-l', '--load-poly', diff --git a/dpd/src/Model_Poly.py b/dpd/src/Model_Poly.py new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3 From 594fcefc353fec548ace0b431355121478aa4c1e Mon Sep 17 00:00:00 2001 From: andreas128 Date: Thu, 14 Sep 2017 12:10:16 +0200 Subject: Pack Model_AM and Model_PM into new Model_Poly --- dpd/main.py | 33 +++++++--------- dpd/src/Model_Poly.py | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 20 deletions(-) (limited to 'dpd/main.py') diff --git a/dpd/main.py b/dpd/main.py index e17cd5a..528f59c 100755 --- a/dpd/main.py +++ b/dpd/main.py @@ -42,9 +42,8 @@ import numpy as np import traceback import src.Measure as Measure import src.Model as Model -import src.Model_AM as Model_AM -import src.Model_PM as Model_PM import src.ExtractStatistic as ExtractStatistic +import src.Model_Poly import src.Adapt as Adapt import src.Agc as Agc import src.TX_Agc as TX_Agc @@ -91,15 +90,15 @@ parser.add_argument('-l', '--load-poly', cli_args = parser.parse_args() -port = int(cli_args.port) -port_rc = int(cli_args.rc_port) +port = cli_args.port +port_rc = cli_args.rc_port coef_path = cli_args.coefs digital_gain = cli_args.digital_gain txgain = cli_args.txgain rxgain = cli_args.rxgain -num_req = int(cli_args.samps) -samplerate = int(cli_args.samplerate) -num_iter = int(cli_args.iterations) +num_req = cli_args.samps +samplerate = cli_args.samplerate +num_iter = cli_args.iterations SA = src.Symbol_align.Symbol_align(samplerate) MER = src.MER.MER(samplerate) @@ -109,19 +108,15 @@ meas = Measure.Measure(samplerate, port, num_req) extStat = ExtractStatistic.ExtractStatistic(c, plot=True) adapt = Adapt.Adapt(port_rc, coef_path) -if cli_args.load_poly: - coefs_am, coefs_pm = adapt.get_coefs() - model = Model.Model(c, SA, MER, coefs_am, coefs_pm, plot=True) -else: - coefs_am, coefs_pm = [[1.0, 0, 0, 0, 0], [0, 0, 0, 0, 0]] - model = Model.Model(c, SA, MER, coefs_am, coefs_pm, plot=True) -model_am = Model_AM.Model_AM(c, plot=True) -model_pm = Model_PM.Model_PM(c, plot=True) -adapt.set_coefs(model.coefs_am, model.coefs_pm) +coefs_am, coefs_pm = adapt.get_coefs() +model_poly = src.Model_Poly.Model_Poly(c, coefs_am, coefs_pm, plot=True) +if not cli_args.load_poly: + coefs_am, coefs_pm = model_poly.get_default_coefs() + +adapt.set_coefs(model_poly.coefs_am, model_poly.coefs_pm) adapt.set_digital_gain(digital_gain) adapt.set_txgain(txgain) adapt.set_rxgain(rxgain) -print(coefs_am) tx_gain = adapt.get_txgain() rx_gain = adapt.get_rxgain() @@ -159,15 +154,13 @@ while i < num_iter: # Model elif state == "model": - coefs_am = model_am.get_next_coefs(tx, rx, coefs_am) - coefs_pm = model_pm.get_next_coefs(tx, phase_diff, coefs_pm) + coefs_am, coefs_pm = model_poly.get_next_coefs(tx, rx, phase_diff) del extStat extStat = ExtractStatistic.ExtractStatistic(c, plot=True) state = "adapt" # Adapt elif state == "adapt": - print(coefs_am) adapt.set_coefs(coefs_am, coefs_pm) state = "measure" i += 1 diff --git a/dpd/src/Model_Poly.py b/dpd/src/Model_Poly.py index e69de29..1faff24 100644 --- a/dpd/src/Model_Poly.py +++ b/dpd/src/Model_Poly.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +# +# DPD Calculation Engine, model implementation using polynomial +# +# http://www.opendigitalradio.org +# Licence: The MIT License, see notice at the end of this file + +import datetime +import os +import logging + +logging_path = os.path.dirname(logging.getLoggerClass().root.handlers[0].baseFilename) + +import numpy as np +import matplotlib.pyplot as plt +from sklearn import linear_model + +import src.Model_AM as Model_AM +import src.Model_PM as Model_PM + + +def assert_np_float32(x): + assert isinstance(x, np.ndarray) + assert x.dtype == np.float32 + assert x.flags.contiguous + +def _check_input_get_next_coefs(tx_abs, rx_abs, phase_diff): + assert_np_float32(tx_abs) + assert_np_float32(rx_abs) + assert_np_float32(phase_diff) + + assert tx_abs.shape == rx_abs.shape, \ + "tx_abs.shape {}, rx_abs.shape {}".format( + tx_abs.shape, rx_abs.shape) + assert tx_abs.shape == phase_diff.shape, \ + "tx_abs.shape {}, phase_diff.shape {}".format( + tx_abs.shape, phase_diff.shape) + + +class Model_Poly: + """Calculates new coefficients using the measurement and the previous + coefficients""" + + def __init__(self, + c, + coefs_am, + coefs_pm, + learning_rate_am=1.0, + learning_rate_pm=1.0, + plot=False): + assert_np_float32(coefs_am) + assert_np_float32(coefs_pm) + + self.c = c + + self.learning_rate_am = learning_rate_am + self.learning_rate_pm = learning_rate_pm + + self.coefs_am = coefs_am + self.coefs_pm = coefs_pm + + self.model_am = Model_AM.Model_AM(c, plot=True) + self.model_pm = Model_PM.Model_PM(c, plot=True) + + self.plot = plot + + def get_default_coefs(self): + self.coefs_am[:] = 0 + self.coefs_am[0] = 1 + self.coefs_pm[:] = 0 + return self.coefs_am, self.coefs_pm + + def get_next_coefs(self, tx_abs, rx_abs, phase_diff): + _check_input_get_next_coefs(tx_abs, rx_abs, phase_diff) + + coefs_am_new = self.model_am.get_next_coefs(tx_abs, rx_abs, self.coefs_am) + coefs_pm_new = self.model_pm.get_next_coefs(tx_abs, phase_diff, self.coefs_pm) + + self.coefs_am = self.coefs_am + (coefs_am_new - self.coefs_am) * self.learning_rate_am + self.coefs_pm = self.coefs_pm + (coefs_pm_new - self.coefs_pm) * self.learning_rate_pm + + return self.coefs_am, self.coefs_pm + +# The MIT License (MIT) +# +# Copyright (c) 2017 Andreas Steger +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. -- cgit v1.2.3 From bf32d4e1efb87eb7a51207281f2565ee54e1aee2 Mon Sep 17 00:00:00 2001 From: andreas128 Date: Thu, 14 Sep 2017 14:21:17 +0200 Subject: Add report in main --- dpd/main.py | 18 +++++++++++++++++- dpd/src/Symbol_align.py | 3 ++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'dpd/main.py') 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): -- cgit v1.2.3