From 1e32ae4f336d1fcb174b0e5b8157bb9a9c9dcec7 Mon Sep 17 00:00:00 2001 From: andreas128 Date: Thu, 28 Sep 2017 12:27:34 +0200 Subject: Fix warning for mean of empty slice --- dpd/src/ExtractStatistic.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dpd/src/ExtractStatistic.py b/dpd/src/ExtractStatistic.py index bf9eba5..9df85bc 100644 --- a/dpd/src/ExtractStatistic.py +++ b/dpd/src/ExtractStatistic.py @@ -126,7 +126,8 @@ class ExtractStatistic: def _rx_value_per_bin(self): rx_values = [] for values in self.rx_values_lists: - rx_values.append(np.mean(np.abs(values))) + mean = np.mean(np.abs(values)) if len(values) > 0 else np.nan + rx_values.append(mean) return rx_values def _tx_value_per_bin(self): @@ -147,7 +148,8 @@ class ExtractStatistic: def _phase_diff_value_per_bin(self, phase_diffs_values_lists): phase_list = [] for values in phase_diffs_values_lists: - phase_list.append(np.mean(values)) + mean = np.mean(values) if len(values) > 0 else np.nan + phase_list.append(mean) return phase_list def extract(self, tx_dpd, rx): -- cgit v1.2.3