aboutsummaryrefslogtreecommitdiffstats
path: root/dpd/src/Model.py
diff options
context:
space:
mode:
Diffstat (limited to 'dpd/src/Model.py')
-rw-r--r--dpd/src/Model.py26
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"