diff options
author | andreas128 <Andreas> | 2017-08-07 18:46:53 +0100 |
---|---|---|
committer | andreas128 <Andreas> | 2017-08-07 18:46:53 +0100 |
commit | 7c1c9c5b75803bb2d697db1a71150d6779ba699f (patch) | |
tree | 66694c98e9fb3f2e4f8e4c5e4c28d49c11e61cf4 /dpd | |
parent | 17713280a2deba4077c210cf091d401e8f7d60e3 (diff) | |
download | dabmod-7c1c9c5b75803bb2d697db1a71150d6779ba699f.tar.gz dabmod-7c1c9c5b75803bb2d697db1a71150d6779ba699f.tar.bz2 dabmod-7c1c9c5b75803bb2d697db1a71150d6779ba699f.zip |
Add logging to Measure
Diffstat (limited to 'dpd')
-rw-r--r-- | dpd/src/Dab_Util.py | 1 | ||||
-rw-r--r-- | dpd/src/Measure.py | 37 |
2 files changed, 37 insertions, 1 deletions
diff --git a/dpd/src/Dab_Util.py b/dpd/src/Dab_Util.py index ba008b6..1c0fe92 100644 --- a/dpd/src/Dab_Util.py +++ b/dpd/src/Dab_Util.py @@ -94,6 +94,7 @@ class Dab_Util: else: return np.memmap(filename, dtype=np.complex64, mode='r', offset=64/8*offset, shape=length) + # The MIT License (MIT) # # Copyright (c) 2017 Andreas Steger diff --git a/dpd/src/Measure.py b/dpd/src/Measure.py index d3d9320..76f17b2 100644 --- a/dpd/src/Measure.py +++ b/dpd/src/Measure.py @@ -11,6 +11,7 @@ import os import time import logging import Dab_Util as DU +import datetime class Measure: """Collect Measurement from DabMod""" @@ -75,12 +76,46 @@ class Measure: else: rxframe = np.array([], dtype=np.complex64) + if logging.getLogger().getEffectiveLevel() == logging.DEBUG: + import matplotlib.pyplot as plt + + txframe_path = ('/tmp/txframe_fft_' + + datetime.datetime.now().isoformat() + + '.pdf') + plt.plot(np.abs(np.fft.fftshift(np.fft.fft(txframe[2048:])))) + plt.savefig(txframe_path) + plt.clf() + + rxframe_path = ('/tmp/rxframe_fft_' + + datetime.datetime.now().isoformat() + + '.pdf') + plt.plot(np.abs(np.fft.fftshift(np.fft.fft(rxframe[2048:])))) + plt.savefig(rxframe_path) + plt.clf() + + logging.debug("txframe: min %f, max %f, median %f, spectrum %s" % + (np.min(np.abs(txframe)), + np.max(np.abs(txframe)), + np.median(np.abs(txframe)), + txframe_path)) + + logging.debug("rxframe: min %f, max %f, median %f, spectrum %s" % + (np.min(np.abs(rxframe)), + np.max(np.abs(rxframe)), + np.median(np.abs(rxframe)), + rxframe_path)) + logging.debug("Disconnecting") s.close() - logging.info("Measurement done, txframe %d %s, rxframe %d %s" % (len(txframe), txframe.dtype, len(rxframe), rxframe.dtype) ) du = DU.Dab_Util(8192000) txframe_aligned, rxframe_aligned = du.subsample_align(txframe, rxframe) + + logging.info( + "Measurement done, tx %d %s, rx %d %s, tx aligned %d %s, rx aligned %d %s" + % (len(txframe), txframe.dtype, len(rxframe), rxframe.dtype, + len(txframe_aligned), txframe_aligned.dtype, len(rxframe_aligned), rxframe_aligned.dtype) ) + return txframe_aligned, rxframe_aligned # The MIT License (MIT) |