From e0abfc3728fb56519fa2507d2468214e2a633c98 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 23 Jan 2019 10:58:36 +0100 Subject: DPDCE: present model in a nicer way --- python/dpd/Adapt.py | 4 ++-- python/dpdce.py | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/python/dpd/Adapt.py b/python/dpd/Adapt.py index 8023a53..a30f0c8 100644 --- a/python/dpd/Adapt.py +++ b/python/dpd/Adapt.py @@ -44,12 +44,12 @@ def dpddata_to_str(dpddata) -> str: if dpddata[0] == "poly": coefs_am = dpddata[1] coefs_pm = dpddata[2] - return "dpd_coefs_am {}, dpd_coefs_pm {}".format( + return "Poly: AM/AM {}, AM/PM {}".format( coefs_am, coefs_pm) elif dpddata[0] == "lut": scalefactor = dpddata[1] lut = dpddata[2] - return "LUT scalefactor {}, LUT {}".format( + return "LUT: scalefactor {}, LUT {}".format( scalefactor, lut) else: raise ValueError("Unknown dpddata type {}".format(dpddata[0])) diff --git a/python/dpdce.py b/python/dpdce.py index 89b01c4..cf98aa0 100755 --- a/python/dpdce.py +++ b/python/dpdce.py @@ -142,7 +142,7 @@ results = { 'adapt_dumps': [], 'statplot': None, 'modelplot': None, - 'modeldata': repr(dpddata), + 'modeldata': dpddata_to_str(dpddata), 'tx_median': 0, 'rx_median': 0, 'state': 'Idle', @@ -218,7 +218,7 @@ def engine_worker(): results['state'] = 'Idle' results['stateprogress'] = 0 results['summary'] = ["Reset"] - results['modeldata'] = repr(model.get_dpd_data()) + results['modeldata'] = dpddata_to_str(model.get_dpd_data()) clear_pngs(results) extStat = None elif cmd == "trigger_run": @@ -288,7 +288,7 @@ def engine_worker(): internal_data['dpddata'] = dpddata internal_data['n_runs'] = 0 - results['modeldata'] = repr(dpddata) + results['modeldata'] = dpddata_to_str(dpddata) results['state'] = 'Capture + Model' results['stateprogress'] = 90 results['summary'] += ["Reset statistics"] @@ -337,10 +337,11 @@ def engine_worker(): summary = [f"Set predistorter:", f"Signal measurements after iteration {iteration} with learning rate {lr}", - f"TX MER {tx_mer}, RX MER {rx_mer}", - "Shoulders: TX {!r}, RX {!r}".format(tx_shoulder_tuple, rx_shoulder_tuple), - f"Mean-square error: {mse}", - f"Running with digital gain {digital_gain}, TX gain {tx_gain} and RX gain {rx_gain}"] + f"TX MER {tx_mer:.2}, RX MER {rx_mer:.2}", + f"Mean-square error: {mse:.3}"] + if tx_shoulder_tuple is not None: + summary.append("Shoulders: TX {!r}, RX {!r}".format(tx_shoulder_tuple, rx_shoulder_tuple)) + summary.append(f"Running with digital gain {digital_gain}, TX gain {tx_gain} and RX gain {rx_gain}") with lock: results['state'] = 'Update Predistorter' @@ -361,7 +362,7 @@ def engine_worker(): results['stateprogress'] = 100 results['summary'] = [f"Restored DPD defaults", f"Running with digital gain {digital_gain}, TX gain {tx_gain} and RX gain {rx_gain}"] - results['modeldata'] = repr(dpddata) + results['modeldata'] = dpddata_to_str(dpddata) else: dump_file = os.path.join(plot_path, f"adapt_{dump_id}.pkl") try: @@ -373,7 +374,7 @@ def engine_worker(): results['stateprogress'] = 100 results['summary'] = [f"Restored DPD settings from dumpfile {dump_id}", f"Running with digital gain {d['digital_gain']}, TX gain {d['txgain']} and RX gain {d['rxgain']}"] - results['modeldata'] = repr(d["dpddata"]) + results['modeldata'] = dpddata_to_str(d["dpddata"]) except: e = traceback.format_exc() with lock: -- cgit v1.2.3