From a8348834c4bed605e0b0cadaa7dd184b058983cb Mon Sep 17 00:00:00 2001 From: Slobodan Ilic Date: Tue, 26 Jun 2018 21:30:30 +0200 Subject: [PATCH] [#158630519]: Explicitly set pruning mask for pvals --- src/cr/cube/crunch_cube.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cr/cube/crunch_cube.py b/src/cr/cube/crunch_cube.py index dee38d221..94defe494 100644 --- a/src/cr/cube/crunch_cube.py +++ b/src/cr/cube/crunch_cube.py @@ -1159,7 +1159,14 @@ def pvals(self, weighted=True, prune=False, hs_dims=None): crunch cube. ''' stats = self.zscore(weighted=weighted, prune=prune, hs_dims=hs_dims) - return 2 * (1 - norm.cdf(np.abs(stats))) + res = 2 * (1 - norm.cdf(np.abs(stats))) + + if isinstance(stats, np.ma.core.MaskedArray): + # Explicit setting of the mask is necessary, because the norm.cdf + # creates a non-masked version + res = np.ma.masked_array(res, stats.mask) + + return res def scale_means(self): '''Get cube means.'''