diff options
Diffstat (limited to 'python/dpd/apply_adapt_dumps.py')
-rwxr-xr-x | python/dpd/apply_adapt_dumps.py | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/python/dpd/apply_adapt_dumps.py b/python/dpd/apply_adapt_dumps.py new file mode 100755 index 0000000..20bc013 --- /dev/null +++ b/python/dpd/apply_adapt_dumps.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# DPD Computation Engine, apply stored configuration. +# +# http://www.opendigitalradio.org +# Licence: The MIT License, see notice at the end of this file + +import datetime +import os +import glob +import logging + +dt = datetime.datetime.now().isoformat() +logging.basicConfig(format='%(asctime)s - %(module)s - %(levelname)s - %(message)s', + datefmt='%Y-%m-%d %H:%M:%S', + level=logging.DEBUG) + +import src.Adapt as Adapt +import argparse + +parser = argparse.ArgumentParser( + description="Load pkl dumps DPD settings into ODR-DabMod") +parser.add_argument('--port', default=50055, type=int, + help='port of DPD server to connect to (default: 50055)', + required=False) +parser.add_argument('--rc-port', default=9400, type=int, + help='port of ODR-DabMod ZMQ Remote Control to connect to (default: 9400)', + required=False) +parser.add_argument('--coefs', default='poly.coef', + help='File with DPD coefficients, which will be read by ODR-DabMod', + required=False) +parser.add_argument('file', help='File to read the DPD settings from') + +cli_args = parser.parse_args() + +port = cli_args.port +port_rc = cli_args.rc_port +coef_path = cli_args.coefs +filename = cli_args.file + +# No need to initialise a GlobalConfig since adapt only needs this one field +class DummyConfig: + def __init__(self): + self.plot_location = None + +c = DummyConfig() + +adapt = Adapt.Adapt(c, port_rc, coef_path) + +print("Loading and applying DPD settings from {}".format(filename)) +adapt.load(filename) + +# The MIT License (MIT) +# +# Copyright (c) 2017 Andreas Steger +# Copyright (c) 2017 Matthias P. Braendli +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. |