From bc25ed90fb34398f9fd3066b7237d1306628b16f Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 29 Dec 2017 08:32:58 +0100 Subject: Transform Const into a global config structure, avoid depending on logging for plot location --- dpd/src/Adapt.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'dpd/src/Adapt.py') 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(), -- cgit v1.2.3