diff options
author | andreas128 <Andreas> | 2017-09-02 19:18:01 +0200 |
---|---|---|
committer | andreas128 <Andreas> | 2017-09-02 19:18:01 +0200 |
commit | 719238f0adc19fb3de3b4fd2695b6bb30d4c9dd5 (patch) | |
tree | 05fb049f22a526dd3b2c46b99f7546a84f4938a3 /dpd/src/Model.py | |
parent | 6907d576b69ae065f25584fd4c6635c0c26beab2 (diff) | |
download | dabmod-719238f0adc19fb3de3b4fd2695b6bb30d4c9dd5.tar.gz dabmod-719238f0adc19fb3de3b4fd2695b6bb30d4c9dd5.tar.bz2 dabmod-719238f0adc19fb3de3b4fd2695b6bb30d4c9dd5.zip |
Cleanup logging and plots
Diffstat (limited to 'dpd/src/Model.py')
-rw-r--r-- | dpd/src/Model.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/dpd/src/Model.py b/dpd/src/Model.py index 2aa9feb..dc526c5 100644 --- a/dpd/src/Model.py +++ b/dpd/src/Model.py @@ -20,7 +20,7 @@ class Model: """Calculates new coefficients using the measurement and the old coefficients""" - def __init__(self, coefs_am, coefs_pm): + def __init__(self, coefs_am, coefs_pm, plot=False): self.coefs_am = coefs_am self.coefs_history = [coefs_am, ] self.mses = [0, ] @@ -30,6 +30,8 @@ class Model: self.coefs_pm_history = [coefs_pm, ] self.errs_phase = [0, ] + self.plot=plot + def sample_uniformly(self, txframe_aligned, rxframe_aligned, n_bins=4): """This function returns tx and rx samples in a way that the tx amplitudes have an approximate uniform @@ -144,19 +146,19 @@ class Model: rx_range = rx_range[(rx_range_dpd > 0) & (rx_range_dpd < 2)] rx_range_dpd = rx_range_dpd[(rx_range_dpd > 0) & (rx_range_dpd < 2)] - if logging.getLogger().getEffectiveLevel() == logging.DEBUG: - logging.debug("txframe: min %f, max %f, median %f" % - (np.min(np.abs(txframe_aligned)), - np.max(np.abs(txframe_aligned)), - np.median(np.abs(txframe_aligned)) - )) + logging.debug("txframe: min %f, max %f, median %f" % + (np.min(np.abs(txframe_aligned)), + np.max(np.abs(txframe_aligned)), + np.median(np.abs(txframe_aligned)) + )) - logging.debug("rxframe: min %f, max %f, median %f" % - (np.min(np.abs(rx_choice)), - np.max(np.abs(rx_choice)), - np.median(np.abs(rx_choice)) - )) + logging.debug("rxframe: min %f, max %f, median %f" % + (np.min(np.abs(rx_choice)), + np.max(np.abs(rx_choice)), + np.median(np.abs(rx_choice)) + )) + if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot: dt = datetime.datetime.now().isoformat() fig_path = logging_path + "/" + dt + "_Model.pdf" |