aboutsummaryrefslogtreecommitdiffstats
path: root/dpd/src/Adapt.py
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-12-29 08:32:58 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-12-29 08:32:58 +0100
commitbc25ed90fb34398f9fd3066b7237d1306628b16f (patch)
treede9c96d45728e96b6157e1554503e5d90f229495 /dpd/src/Adapt.py
parent740d4815fda8737cc7f021999d30aeacd851b032 (diff)
downloaddabmod-bc25ed90fb34398f9fd3066b7237d1306628b16f.tar.gz
dabmod-bc25ed90fb34398f9fd3066b7237d1306628b16f.tar.bz2
dabmod-bc25ed90fb34398f9fd3066b7237d1306628b16f.zip
Transform Const into a global config structure, avoid depending on logging for plot location
Diffstat (limited to 'dpd/src/Adapt.py')
-rw-r--r--dpd/src/Adapt.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/dpd/src/Adapt.py b/dpd/src/Adapt.py
index 939e50e..153442b 100644
--- a/dpd/src/Adapt.py
+++ b/dpd/src/Adapt.py
@@ -16,11 +16,6 @@ import os
import datetime
import pickle
-try:
- logging_path = os.path.dirname(logging.getLoggerClass().root.handlers[0].baseFilename)
-except AttributeError:
- logging_path = None
-
LUT_LEN = 32
FORMAT_POLY = 1
FORMAT_LUT = 2
@@ -58,8 +53,9 @@ class Adapt:
ZMQ remote control.
"""
- def __init__(self, port, coef_path):
+ def __init__(self, config, port, coef_path):
logging.debug("Instantiate Adapt object")
+ self.c = config
self.port = port
self.coef_path = coef_path
self.host = "localhost"
@@ -229,10 +225,10 @@ class Adapt:
"""Backup current settings to a file"""
dt = datetime.datetime.now().isoformat()
if path is None:
- if logging_path is not None:
- path = logging_path + "/" + dt + "_adapt.pkl"
+ if self.c.plot_location is not None:
+ path = self.c.plot_location + "/" + dt + "_adapt.pkl"
else:
- raise Exception("Cannot dump Adapt without either logging_path or path set")
+ raise Exception("Cannot dump Adapt without either plot_location or path set")
d = {
"txgain": self.get_txgain(),
"rxgain": self.get_rxgain(),