aboutsummaryrefslogtreecommitdiffstats
path: root/dpd/src/Model_PM.py
diff options
context:
space:
mode:
authorandreas128 <Andreas>2017-09-29 18:50:41 +0200
committerandreas128 <Andreas>2017-09-29 18:50:41 +0200
commit5e3ca125bfc56d31b9c9ef819eab9171b73b7333 (patch)
tree297d400f754742faf6bfc4fc7eff9858163c845c /dpd/src/Model_PM.py
parent64e0193824262e93e7cd67bb8c3af68d278f990c (diff)
downloaddabmod-5e3ca125bfc56d31b9c9ef819eab9171b73b7333.tar.gz
dabmod-5e3ca125bfc56d31b9c9ef819eab9171b73b7333.tar.bz2
dabmod-5e3ca125bfc56d31b9c9ef819eab9171b73b7333.zip
Cleanup
Diffstat (limited to 'dpd/src/Model_PM.py')
-rw-r--r--dpd/src/Model_PM.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/dpd/src/Model_PM.py b/dpd/src/Model_PM.py
index e0fcb55..b0c7ae2 100644
--- a/dpd/src/Model_PM.py
+++ b/dpd/src/Model_PM.py
@@ -15,17 +15,16 @@ import numpy as np
import matplotlib.pyplot as plt
+def is_npfloat32(array):
+ assert isinstance(array, np.ndarray), type(array)
+ assert array.dtype == np.float32, array.dtype
+ assert array.flags.contiguous
+ assert not any(np.isnan(array))
+
+
def check_input_get_next_coefs(tx_dpd, phase_diff):
- is_float32 = lambda x: (isinstance(x, np.ndarray) and
- x.dtype == np.float32 and
- x.flags.contiguous)
- assert is_float32(tx_dpd), \
- "tx_dpd is not float32 but {}".format(tx_dpd[0].dtype)
- assert is_float32(phase_diff), \
- "phase_diff is not float32 but {}".format(tx_dpd[0].dtype)
- assert tx_dpd.shape == phase_diff.shape, \
- "tx_dpd.shape {}, phase_diff.shape {}".format(
- tx_dpd.shape, phase_diff.shape)
+ is_npfloat32(tx_dpd)
+ is_npfloat32(phase_diff)
class Model_PM:
@@ -93,6 +92,8 @@ class Model_PM:
return tx_range, phase_diff
def get_next_coefs(self, tx_dpd, phase_diff, coefs_pm):
+ """Calculate the next AM/PM coefficients using the extracted
+ statistic of TX amplitude and phase difference"""
tx_dpd, phase_diff = self._discard_small_values(tx_dpd, phase_diff)
check_input_get_next_coefs(tx_dpd, phase_diff)