aboutsummaryrefslogtreecommitdiffstats
path: root/python/dpdce.py
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-12-12 08:37:20 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-12-12 08:37:20 +0100
commit8ddc109a649899ab6a0b673908186a39c75c8f71 (patch)
tree72f77cb95387513f6d3d982c9dc2ef77829bebae /python/dpdce.py
parent5d825e7586814d47f29d3b4324effb36c6acd9ed (diff)
downloaddabmod-8ddc109a649899ab6a0b673908186a39c75c8f71.tar.gz
dabmod-8ddc109a649899ab6a0b673908186a39c75c8f71.tar.bz2
dabmod-8ddc109a649899ab6a0b673908186a39c75c8f71.zip
GUI: add progress bar
Diffstat (limited to 'python/dpdce.py')
-rwxr-xr-xpython/dpdce.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/python/dpdce.py b/python/dpdce.py
index 838d265..03bc907 100755
--- a/python/dpdce.py
+++ b/python/dpdce.py
@@ -138,6 +138,7 @@ results = {
'tx_median': 0,
'rx_median': 0,
'state': 'Idle',
+ 'stateprogress': 0, # in percent
'summary': ['DPD has not been calibrated yet'],
}
lock = Lock()
@@ -155,13 +156,20 @@ def engine_worker():
break
elif cmd == "calibrate":
with lock:
- results['state'] = 'rx gain calibration'
+ results['state'] = 'RX Gain Calibration'
+ results['stateprogress'] = 0
- agc_success, agc_summary = agc.run()
- summary = ["First calibration run:"] + agc_summary.split("\n")
- if agc_success:
+ summary = []
+ N_ITER = 5
+ for i in range(N_ITER):
agc_success, agc_summary = agc.run()
- summary += ["Second calibration run: "] + agc_summary.split("\n")
+ summary = ["calibration run {}:".format(i)] + agc_summary.split("\n")
+
+ with lock:
+ results['stateprogress'] = int((i + 1) * 100/N_ITER)
+
+ if not agc_success:
+ break
txframe_aligned, tx_ts, rxframe_aligned, rx_ts, rx_median, tx_median = meas.get_samples()
@@ -171,11 +179,13 @@ def engine_worker():
results['tx_median'] = float(tx_median)
results['rx_median'] = float(rx_median)
results['state'] = 'Idle'
+ results['stateprogress'] = 0
results['summary'] = ["Calibration was done:"] + summary
finally:
with lock:
- results['state'] = 'terminated'
+ results['state'] = 'Terminated'
+ results['stateprogress'] = 0
engine = Thread(target=engine_worker)