aboutsummaryrefslogtreecommitdiffstats
path: root/gui/dpd/__init__.py
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-11-28 11:11:22 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-11-28 11:11:22 +0100
commitcfa9461f269e616d6d54658d583b37d215f35a7b (patch)
treebc56977f6479c297521dff9564ba6ecbffe00a52 /gui/dpd/__init__.py
parentee435c029eac59e0399dc3ae765cc74d66b9442e (diff)
downloaddabmod-cfa9461f269e616d6d54658d583b37d215f35a7b.tar.gz
dabmod-cfa9461f269e616d6d54658d583b37d215f35a7b.tar.bz2
dabmod-cfa9461f269e616d6d54658d583b37d215f35a7b.zip
GUI: Add part of calibration routine
Diffstat (limited to 'gui/dpd/__init__.py')
-rw-r--r--gui/dpd/__init__.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/gui/dpd/__init__.py b/gui/dpd/__init__.py
index 06d180d..716b8c2 100644
--- a/gui/dpd/__init__.py
+++ b/gui/dpd/__init__.py
@@ -23,6 +23,7 @@
# along with ODR-DabMod. If not, see <http://www.gnu.org/licenses/>.
from . import Capture
+import numpy as np
class DPD:
def __init__(self, samplerate=8192000):
@@ -50,6 +51,19 @@ class DPD:
def pointcloud_png(self):
return self.capture.pointcloud_png()
+ def clear_accumulated(self):
+ return self.capture.clear_accumulated()
+
+ def capture_calibration(self):
+ tx_ts, tx_median, rx_ts, rx_median, coarse_offset, correlation_coefficient = self.capture.calibrate()
+ result = {'status': "ok"}
+ result['length'] = len(txframe_aligned)
+ result['tx_median'] = "{:.2}dB".format(20*np.log10(tx_median))
+ result['rx_median'] = "{:.2}dB".format(20*np.log10(rx_median))
+ result['tx_ts'] = tx_ts
+ result['rx_ts'] = rx_ts
+ result['correlation'] = correlation_coefficient
+
def capture_samples(self):
"""Captures samples and store them in the accumulated samples,
returns a dict with some info"""