summaryrefslogtreecommitdiffstats
path: root/python/dpd
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-12-05 12:12:45 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-12-05 12:12:45 +0100
commite749bd08958a462f57b8492721a04128468656d0 (patch)
tree1c3c7801ccc8985f7f4393daf8d275c5eed4a717 /python/dpd
parent31b65e41043900c0cadd80961f4b22cdfc171e7d (diff)
downloaddabmod-e749bd08958a462f57b8492721a04128468656d0.tar.gz
dabmod-e749bd08958a462f57b8492721a04128468656d0.tar.bz2
dabmod-e749bd08958a462f57b8492721a04128468656d0.zip
Get calibration to work with GUI
Diffstat (limited to 'python/dpd')
-rw-r--r--python/dpd/Measure.py7
-rw-r--r--python/dpd/RX_Agc.py5
2 files changed, 6 insertions, 6 deletions
diff --git a/python/dpd/Measure.py b/python/dpd/Measure.py
index 36b1888..489c4c0 100644
--- a/python/dpd/Measure.py
+++ b/python/dpd/Measure.py
@@ -94,14 +94,15 @@ class Measure:
def get_samples(self):
"""Connect to ODR-DabMod, retrieve TX and RX samples, load
into numpy arrays, and return a tuple
- (txframe_aligned, tx_ts, rxframe_aligned, rx_ts, rx_median)
+ (txframe_aligned, tx_ts, rxframe_aligned, rx_ts, rx_median, tx_median)
"""
txframe, tx_ts, rxframe, rx_ts = self.receive_tcp()
# Normalize received signal with sent signal
rx_median = np.median(np.abs(rxframe))
- rxframe = rxframe / rx_median * np.median(np.abs(txframe))
+ tx_median = np.median(np.abs(txframe))
+ rxframe = rxframe / rx_median * tx_median
du = DU.Dab_Util(self.c, self.samplerate)
txframe_aligned, rxframe_aligned = du.subsample_align(txframe, rxframe)
@@ -111,7 +112,7 @@ class Measure:
% (len(txframe), txframe.dtype, len(rxframe), rxframe.dtype,
len(txframe_aligned), txframe_aligned.dtype, len(rxframe_aligned), rxframe_aligned.dtype) )
- return txframe_aligned, tx_ts, rxframe_aligned, rx_ts, rx_median
+ return txframe_aligned, tx_ts, rxframe_aligned, rx_ts, rx_median, tx_median
# The MIT License (MIT)
#
diff --git a/python/dpd/RX_Agc.py b/python/dpd/RX_Agc.py
index 2a2f548..48ef7f3 100644
--- a/python/dpd/RX_Agc.py
+++ b/python/dpd/RX_Agc.py
@@ -48,7 +48,7 @@ class Agc:
self.adapt.set_rxgain(self.rxgain)
# Measure
- txframe_aligned, tx_ts, rxframe_aligned, rx_ts, rx_median=self.measure.get_samples()
+ txframe_aligned, tx_ts, rxframe_aligned, rx_ts, rx_median, tx_median = self.measure.get_samples()
# Estimate Maximum
rx_peak = self.peak_to_median * rx_median
@@ -89,8 +89,7 @@ class Agc:
axs = axs.ravel()
for j in range(5):
- txframe_aligned, tx_ts, rxframe_aligned, rx_ts, rx_median =\
- self.measure.get_samples()
+ txframe_aligned, tx_ts, rxframe_aligned, rx_ts, rx_median, tx_median = self.measure.get_samples()
rxframe_aligned_abs = np.abs(rxframe_aligned)