From 49620ea6940543a875e0499a1554b33ffb85fa85 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 19 Dec 2018 16:29:39 +0100 Subject: GUI: Combine model plots into single plot --- python/dpd/ExtractStatistic.py | 2 +- python/dpd/Model_Poly.py | 26 +++++++++----------------- 2 files changed, 10 insertions(+), 18 deletions(-) (limited to 'python/dpd') diff --git a/python/dpd/ExtractStatistic.py b/python/dpd/ExtractStatistic.py index a23fa1a..25647a6 100644 --- a/python/dpd/ExtractStatistic.py +++ b/python/dpd/ExtractStatistic.py @@ -115,7 +115,7 @@ class ExtractStatistic: i_sub += 1 ax = plt.subplot(sub_rows, sub_cols, i_sub) ax.plot(num) - ax.set_xlabel("TX Amplitude") + ax.set_xlabel("TX Amplitude bin") ax.set_ylabel("Number of Samples") ax.set_ylim(0, self.n_per_bin * 1.2) diff --git a/python/dpd/Model_Poly.py b/python/dpd/Model_Poly.py index 5722531..7ab6aa1 100644 --- a/python/dpd/Model_Poly.py +++ b/python/dpd/Model_Poly.py @@ -42,18 +42,19 @@ class Poly: self.reset_coefs() - def plot(self, am_plot_location, pm_plot_location, title): - if self._am_plot_data is not None: + def plot(self, plot_location, title): + if self._am_plot_data is not None and self._pm_plot_data is not None: tx_dpd, rx_received, coefs_am, coefs_am_new = self._am_plot_data tx_range, rx_est = self._am_calc_line(coefs_am, 0, 0.6) tx_range_new, rx_est_new = self._am_calc_line(coefs_am_new, 0, 0.6) - sub_rows = 1 + sub_rows = 2 sub_cols = 1 fig = plt.figure(figsize=(sub_cols * 6, sub_rows / 2. * 6)) i_sub = 0 + # AM subplot i_sub += 1 ax = plt.subplot(sub_rows, sub_cols, i_sub) ax.plot(tx_range, rx_est, @@ -67,27 +68,18 @@ class Poly: label="Binned Data", color="blue", s=1) - ax.set_title("Model AM {}".format(title)) + ax.set_title("Model AM and PM {}".format(title)) ax.set_xlabel("TX Amplitude") ax.set_ylabel("RX Amplitude") - ax.set_xlim(-0.5, 1.5) + ax.set_xlim(0, 1.0) ax.legend(loc=4) - fig.tight_layout() - fig.savefig(am_plot_location) - plt.close(fig) - - if self._pm_plot_data is not None: + # PM sub plot tx_dpd, phase_diff, coefs_pm, coefs_pm_new = self._pm_plot_data tx_range, phase_diff_est = self._pm_calc_line(coefs_pm, 0, 0.6) tx_range_new, phase_diff_est_new = self._pm_calc_line(coefs_pm_new, 0, 0.6) - sub_rows = 1 - sub_cols = 1 - fig = plt.figure(figsize=(sub_cols * 6, sub_rows / 2. * 6)) - i_sub = 0 - i_sub += 1 ax = plt.subplot(sub_rows, sub_cols, i_sub) ax.plot(tx_range, phase_diff_est, @@ -101,13 +93,13 @@ class Poly: label="Binned Data", color="blue", s=1) - ax.set_title("Model PM {}".format(title)) ax.set_xlabel("TX Amplitude") ax.set_ylabel("Phase DIff") + ax.set_xlim(0, 1.0) ax.legend(loc=4) fig.tight_layout() - fig.savefig(pm_plot_location) + fig.savefig(plot_location) plt.close(fig) def reset_coefs(self): -- cgit v1.2.3