diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-08-09 14:43:19 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-08-09 14:44:24 +0200 |
commit | e48f6b7078e9edc30b1a6a357e3f81c21265930a (patch) | |
tree | bba5b26dd0b907337a77ebbdbb1b9cc114f8280a /dpd/main.py | |
parent | 0b491301e11c8e4fd1a3cff9f038f4fa8f5c6aab (diff) | |
download | dabmod-e48f6b7078e9edc30b1a6a357e3f81c21265930a.tar.gz dabmod-e48f6b7078e9edc30b1a6a357e3f81c21265930a.tar.bz2 dabmod-e48f6b7078e9edc30b1a6a357e3f81c21265930a.zip |
DPD CE: Add argument parser
Diffstat (limited to 'dpd/main.py')
-rwxr-xr-x | dpd/main.py | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/dpd/main.py b/dpd/main.py index c871879..98eeb84 100755 --- a/dpd/main.py +++ b/dpd/main.py @@ -1,8 +1,14 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -"""This Python script calculates and updates the parameter of the digital -predistortion module of the ODR-DabMod. More precisely the complex -coefficients of the polynom which is used for predistortion.""" +# +# DPD Calculation Engine main file. +# +# http://www.opendigitalradio.org +# Licence: The MIT License, see notice at the end of this file + +"""This Python script is the main file for ODR-DabMod's DPD Computation Engine. +This engine calculates and updates the parameter of the digital +predistortion module of ODR-DabMod.""" import logging logging.basicConfig(format='%(asctime)s - %(module)s - %(levelname)s - %(message)s', @@ -15,12 +21,32 @@ import src.Measure as Measure import src.Model as Model import src.Adapt as Adapt -port = 50055 -port_rc = 9400 -coef_path = "/home/andreas/dab/ODR-DabMod/polyCoefsCustom" -num_req = 10240 +parser = argparse.ArgumentParser(description="DPD Computation Engine for ODR-DabMod") +parser.add_argument('--port', default='50055', + help='port of DPD server to connect to (default: 50055)', + required=False) +parser.add_argument('--rc-port', default='9400', + help='port of ODR-DabMod ZMQ Remote Control to connect to (default: 9400)', + required=False) +parser.add_argument('--samplerate', default='8192000', + help='Sample rate', + required=False) +parser.add_argument('--coefs', default='dpdpoly.coef', + help='File with DPD coefficients, which will be read by ODR-DabMod', + required=False) +parser.add_argument('--samps', default='10240', + help='Number of samples to request from ODR-DabMod', + required=False) + +cli_args = parser.parse_args() + +port = int(cli_args.port) +port_rc = int(cli_args.rc_port) +coef_path = cli_args.coefs +num_req = int(cli_args.samps) +samplerate = int(cli_args.samplerate) -meas = Measure.Measure(port, num_req) +meas = Measure.Measure(samplerate, port, num_req) adapt = Adapt.Adapt(port_rc, coef_path) coefs = adapt.get_coefs() model = Model.Model(coefs) @@ -31,7 +57,7 @@ adapt.set_coefs(coefs) # The MIT License (MIT) # -# Copyright (c) 2017 Andreas Steger +# Copyright (c) 2017 Andreas Steger, 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 |