aboutsummaryrefslogtreecommitdiffstats
path: root/dpd
diff options
context:
space:
mode:
authorandreas128 <Andreas>2017-09-27 12:49:04 +0200
committerandreas128 <Andreas>2017-09-27 12:49:04 +0200
commit02a0b7419fc5b7aaf18fb9be4ed0888defa77e2d (patch)
treec49c05edc82af242de4b07ad97a9d3307457f072 /dpd
parent38e4b3a35d4265844641d4527d8952080c0d0d79 (diff)
downloaddabmod-02a0b7419fc5b7aaf18fb9be4ed0888defa77e2d.tar.gz
dabmod-02a0b7419fc5b7aaf18fb9be4ed0888defa77e2d.tar.bz2
dabmod-02a0b7419fc5b7aaf18fb9be4ed0888defa77e2d.zip
Move consts to Const.py; Cleanup
Diffstat (limited to 'dpd')
-rwxr-xr-xdpd/apply_adapt_dumps.py12
-rw-r--r--dpd/src/ExtractStatistic.py6
-rw-r--r--dpd/src/MER.py2
-rw-r--r--dpd/src/Measure_Shoulders.py4
-rw-r--r--dpd/src/Model_Poly.py5
-rw-r--r--dpd/src/Symbol_align.py2
-rw-r--r--dpd/src/Test_data.py4
7 files changed, 16 insertions, 19 deletions
diff --git a/dpd/apply_adapt_dumps.py b/dpd/apply_adapt_dumps.py
index 7b661c9..790a64a 100755
--- a/dpd/apply_adapt_dumps.py
+++ b/dpd/apply_adapt_dumps.py
@@ -46,7 +46,7 @@ import src.Agc as Agc
import src.TX_Agc as TX_Agc
import argparse
-import src.const
+import src.Const
import src.Symbol_align
import src.Measure_Shoulders
import src.MER
@@ -105,20 +105,20 @@ samplerate = cli_args.samplerate
searchpath = cli_args.searchpath
target_median = cli_args.target_median
-c = src.const.const(samplerate, target_median)
+c = src.Const.Const(samplerate, target_median, -1, -1, -1)
SA = src.Symbol_align.Symbol_align(c)
MER = src.MER.MER(c)
-MS = src.Measure_Shoulders.Measure_Shoulder(c, plot=False)
+MS = src.Measure_Shoulders.Measure_Shoulders(c)
meas = Measure.Measure(samplerate, port, num_req)
-extStat = ExtractStatistic.ExtractStatistic(c, plot=True)
+extStat = ExtractStatistic.ExtractStatistic(c)
adapt = Adapt.Adapt(port_rc, coef_path)
dpddata = adapt.get_predistorter()
if cli_args.lut:
- model = Model.Lut(c, plot=True)
+ model = Model.Lut(c)
else:
- model = Model.Poly(c, plot=True)
+ model = Model.Poly(c)
adapt.set_predistorter(model.get_dpd_data())
adapt.set_digital_gain(digital_gain)
adapt.set_txgain(txgain)
diff --git a/dpd/src/ExtractStatistic.py b/dpd/src/ExtractStatistic.py
index 306c401..bf9eba5 100644
--- a/dpd/src/ExtractStatistic.py
+++ b/dpd/src/ExtractStatistic.py
@@ -34,9 +34,7 @@ class ExtractStatistic:
"""Calculate a low variance RX value for equally spaced tx values
of a predefined range"""
- def __init__(self,
- c,
- plot=False):
+ def __init__(self, c):
self.c = c
self.n_meas = 0
@@ -58,7 +56,7 @@ class ExtractStatistic:
for i in range(c.ES_n_bins):
self.rx_values.append(None)
- self.plot = plot
+ self.plot = c.ES_plot
def _plot_and_log(self):
if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot:
diff --git a/dpd/src/MER.py b/dpd/src/MER.py
index 393e55c..69c94f9 100644
--- a/dpd/src/MER.py
+++ b/dpd/src/MER.py
@@ -13,7 +13,7 @@ try:
except:
logging_path = "/tmp/"
-import src.const
+import src.Const
import numpy as np
import matplotlib
matplotlib.use('agg')
diff --git a/dpd/src/Measure_Shoulders.py b/dpd/src/Measure_Shoulders.py
index acb05b4..710e800 100644
--- a/dpd/src/Measure_Shoulders.py
+++ b/dpd/src/Measure_Shoulders.py
@@ -61,7 +61,7 @@ def shoulder_from_sig_offset(arg):
return peak-shoulder, peak, shoulder
-class Measure_Shoulder:
+class Measure_Shoulders:
"""Calculate difference between the DAB signal and the shoulder hight in the
power spectrum"""
@@ -75,7 +75,7 @@ class Measure_Shoulder:
dt = datetime.datetime.now().isoformat()
fig_path = logging_path + "/" + dt + "_sync_subsample_aligned.svg"
- fft = calc_fft_db(signal, 100)
+ fft = calc_fft_db(signal, 100, 10)
peak, idxs_peak = self._calc_peak(fft)
shoulder, idxs_sh = self._calc_shoulder_hight(fft, self.c)
diff --git a/dpd/src/Model_Poly.py b/dpd/src/Model_Poly.py
index e799f1e..6a74bea 100644
--- a/dpd/src/Model_Poly.py
+++ b/dpd/src/Model_Poly.py
@@ -5,15 +5,12 @@
# http://www.opendigitalradio.org
# Licence: The MIT License, see notice at the end of this file
-import datetime
import os
import logging
logging_path = os.path.dirname(logging.getLoggerClass().root.handlers[0].baseFilename)
import numpy as np
-import matplotlib.pyplot as plt
-from sklearn import linear_model
import src.Model_AM as Model_AM
import src.Model_PM as Model_PM
@@ -24,6 +21,7 @@ def assert_np_float32(x):
assert x.dtype == np.float32
assert x.flags.contiguous
+
def _check_input_get_next_coefs(tx_abs, rx_abs, phase_diff):
assert_np_float32(tx_abs)
assert_np_float32(rx_abs)
@@ -64,6 +62,7 @@ class Poly:
return self.coefs_am, self.coefs_pm
def train(self, tx_abs, rx_abs, phase_diff):
+ # type: (np.ndarray, np.ndarray, np.ndarray) -> (str, np.ndarray, np.ndarray)
_check_input_get_next_coefs(tx_abs, rx_abs, phase_diff)
coefs_am_new = self.model_am.get_next_coefs(tx_abs, rx_abs, self.coefs_am)
diff --git a/dpd/src/Symbol_align.py b/dpd/src/Symbol_align.py
index c9ae239..e21e793 100644
--- a/dpd/src/Symbol_align.py
+++ b/dpd/src/Symbol_align.py
@@ -15,7 +15,7 @@ except:
logging_path = "/tmp/"
import numpy as np
-import src.const
+import src.Const
import scipy
import matplotlib
matplotlib.use('agg')
diff --git a/dpd/src/Test_data.py b/dpd/src/Test_data.py
index 9dd0913..67f4dff 100644
--- a/dpd/src/Test_data.py
+++ b/dpd/src/Test_data.py
@@ -14,7 +14,7 @@ try:
except:
logging_path = "/tmp/"
-import src.const
+import src.Const
import src.Dab_Util
import numpy as np
import matplotlib
@@ -40,7 +40,7 @@ class Test_data:
plt.plot(np.angle(np.fft.fftshift(np.fft.fft(tx_orig))), 'p')
"""
- self.c = src.const.const(sample_rate)
+ self.c = src.Const.Const(sample_rate)
self.du = src.Dab_Util.Dab_Util(sample_rate)
self.file_paths = {