aboutsummaryrefslogtreecommitdiffstats
path: root/python/dpd/Adapt.py
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-01-09 12:21:21 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-01-09 12:21:21 +0100
commit75ba4f064a65ebad77d130f160b9469418e49c9f (patch)
tree85ab6398ae59159eab0acb1501d206f322aa9449 /python/dpd/Adapt.py
parent8dd12110d63f89eab62097b391fb909478db3d94 (diff)
downloaddabmod-75ba4f064a65ebad77d130f160b9469418e49c9f.tar.gz
dabmod-75ba4f064a65ebad77d130f160b9469418e49c9f.tar.bz2
dabmod-75ba4f064a65ebad77d130f160b9469418e49c9f.zip
GUI: Add ability to restore previous DPD settings
Diffstat (limited to 'python/dpd/Adapt.py')
-rw-r--r--python/dpd/Adapt.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/python/dpd/Adapt.py b/python/dpd/Adapt.py
index 9c2c2b6..8023a53 100644
--- a/python/dpd/Adapt.py
+++ b/python/dpd/Adapt.py
@@ -152,7 +152,7 @@ class Adapt:
_write_lut_file(scalefactor, lut, self._coef_path)
else:
raise ValueError("Unknown predistorter '{}'".format(dpddata[0]))
- self._mod_rc.set_param_value("memlesspoly", "coefffile", self._coef_path)
+ self._mod_rc.set_param_value("memlesspoly", "coeffile", self._coef_path)
def dump(self, path: str) -> None:
"""Backup current settings to a file"""
@@ -161,26 +161,31 @@ class Adapt:
"txgain": self.get_txgain(),
"rxgain": self.get_rxgain(),
"digital_gain": self.get_digital_gain(),
- "predistorter": self.get_predistorter()
+ "dpddata": self.get_predistorter()
}
with open(path, "wb") as f:
pickle.dump(d, f)
- def load(self, path: str) -> None:
+ def restore(self, path: str):
"""Restore settings from a file"""
with open(path, "rb") as f:
d = pickle.load(f)
self.set_txgain(0)
+
+ # If any of the following fail, we will be running
+ # with the safe value of txgain=0
self.set_digital_gain(d["digital_gain"])
self.set_rxgain(d["rxgain"])
- self.set_predistorter(d["predistorter"])
+ self.set_predistorter(d["dpddata"])
self.set_txgain(d["txgain"])
+ return d
+
# The MIT License (MIT)
#
-# Copyright (c) 2018 Matthias P. Braendli
+# Copyright (c) 2019 Matthias P. Braendli
# Copyright (c) 2017 Andreas Steger
#
# Permission is hereby granted, free of charge, to any person obtaining a copy