diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-08-06 09:10:42 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-08-06 09:10:42 +0200 |
commit | 7e91c6a59858325593093c046c213c6bd4e7e4f3 (patch) | |
tree | 0a5765a048fd3910caf2fc396d113ef2ef5ea753 /gui/dpd/__init__.py | |
parent | 08705c0399240f984cf54294a369cb3a896e089a (diff) | |
download | dabmod-7e91c6a59858325593093c046c213c6bd4e7e4f3.tar.gz dabmod-7e91c6a59858325593093c046c213c6bd4e7e4f3.tar.bz2 dabmod-7e91c6a59858325593093c046c213c6bd4e7e4f3.zip |
Some GUI changes
Diffstat (limited to 'gui/dpd/__init__.py')
-rw-r--r-- | gui/dpd/__init__.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/gui/dpd/__init__.py b/gui/dpd/__init__.py index c0c76cc..d006c1c 100644 --- a/gui/dpd/__init__.py +++ b/gui/dpd/__init__.py @@ -35,19 +35,31 @@ class DPD: self.T_U = oversample * 2048 # Inverse of carrier spacing self.T_C = oversample * 504 # Duration of cyclic prefix + self.last_capture_info = {} + port = 50055 samples_to_capture = 81920 self.capture = Capture.Capture(self.samplerate, port, samples_to_capture) + def status(self): + r = {} + r['histogram'] = self.capture.bin_histogram() + r['capture'] = self.last_capture_info + return r + def capture_samples(self): """Captures samples and store them in the accumulated samples, returns a string with some info""" - txframe_aligned, tx_ts, tx_median, rxframe_aligned, rx_ts, rx_median = self.capture.get_samples() - - num_acc = self.capture.num_accumulated() - - return "Captured {} with median {}/{}, accumulated {} samples".format( - len(txframe_aligned), tx_median, rx_median, num_acc) + try: + txframe_aligned, tx_ts, tx_median, rxframe_aligned, rx_ts, rx_median = self.capture.get_samples() + self.last_capture_info['length'] = len(txframe_aligned) + self.last_capture_info['tx_median'] = tx_median + self.last_capture_info['rx_median'] = rx_median + self.last_capture_info['tx_ts'] = tx_ts + self.last_capture_info['rx_ts'] = rx_ts + return "Captured {} samples, tx median {}, rx median {}".format(len(txframe_aligned, tx_median, rx_median)) + except ValueError as e: + return "Error: {}".format(e) # tx, rx, phase_diff, n_per_bin = extStat.extract(txframe_aligned, rxframe_aligned) # off = SA.calc_offset(txframe_aligned) |