aboutsummaryrefslogtreecommitdiffstats
path: root/dpd
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-12-29 07:40:20 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-12-29 07:40:20 +0100
commit740d4815fda8737cc7f021999d30aeacd851b032 (patch)
treec6b1644be30f80b5a972b9d15dd1b55bc05b7aa8 /dpd
parent02c6e85a988149a2ee5d3f54e5120b664c5d6716 (diff)
downloaddabmod-740d4815fda8737cc7f021999d30aeacd851b032.tar.gz
dabmod-740d4815fda8737cc7f021999d30aeacd851b032.tar.bz2
dabmod-740d4815fda8737cc7f021999d30aeacd851b032.zip
DPDCE: fix Adapt init and pickle usage
Diffstat (limited to 'dpd')
-rwxr-xr-xdpd/apply_adapt_dumps.py2
-rw-r--r--dpd/src/Adapt.py12
2 files changed, 7 insertions, 7 deletions
diff --git a/dpd/apply_adapt_dumps.py b/dpd/apply_adapt_dumps.py
index f1f3359..0eb65f3 100755
--- a/dpd/apply_adapt_dumps.py
+++ b/dpd/apply_adapt_dumps.py
@@ -49,7 +49,7 @@ port_rc = cli_args.rc_port
coef_path = cli_args.coefs
filename = cli_args.file
-adapt = Adapt(port_rc, coef_path)
+adapt = Adapt.Adapt(port_rc, coef_path)
print("Loading and applying DPD settings from {}".format(filename))
adapt.load(filename)
diff --git a/dpd/src/Adapt.py b/dpd/src/Adapt.py
index c78c920..939e50e 100644
--- a/dpd/src/Adapt.py
+++ b/dpd/src/Adapt.py
@@ -239,20 +239,20 @@ class Adapt:
"digital_gain": self.get_digital_gain(),
"predistorter": self.get_predistorter()
}
- with open(path, "w") as f:
+ with open(path, "wb") as f:
pickle.dump(d, f)
return path
def load(self, path):
"""Restore settings from a file"""
- with open(path, "r") as f:
+ with open(path, "rb") as f:
d = pickle.load(f)
- self.set_txgain(d["txgain"])
- self.set_digital_gain(d["digital_gain"])
- self.set_rxgain(d["rxgain"])
- self.set_predistorter(d["predistorter"])
+ self.set_txgain(d["txgain"])
+ self.set_digital_gain(d["digital_gain"])
+ self.set_rxgain(d["rxgain"])
+ self.set_predistorter(d["predistorter"])
# The MIT License (MIT)
#