From a0cba45b4f8ac7c865e80d62f87efd56dbff2c65 Mon Sep 17 00:00:00 2001 From: wcarthur Date: Wed, 28 Oct 2015 09:28:42 +1100 Subject: [PATCH] Remove masked array compress for percentiles When calculating precentiles of values (e.g. track density), the 2-d grid was passed through ma.compress(), which resulted in a scalar value as output for the percentile. This threw the PlotInterface.map methods when trying to create a map of the percentile values. --- Evaluate/genesisDensity.py | 9 +++------ Evaluate/pressureDistribution.py | 10 ++++------ Evaluate/trackDensity.py | 6 ++---- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Evaluate/genesisDensity.py b/Evaluate/genesisDensity.py index e3fb2657..6fd87893 100755 --- a/Evaluate/genesisDensity.py +++ b/Evaluate/genesisDensity.py @@ -255,8 +255,7 @@ def _calculate(self, tracks): values = np.vstack([xx[ii], yy[ii]]) kernel = gaussian_kde(values, bw_method=.1) - import pdb - #pdb.set_trace() + Z = np.reshape(kernel(positions), self.X.shape) return Z.T @@ -266,10 +265,8 @@ def calculateMeans(self): self.synHistMean = ma.mean(self.synHist, axis=0) self.medSynHist = ma.median(self.synHist, axis=0) - self.synHistUpper = percentile(ma.compressed(self.synHist), - per=95, axis=0) - self.synHistLower = percentile(ma.compressed(self.synHist), - per=5, axis=0) + self.synHistUpper = percentile(self.synHist, per=95, axis=0) + self.synHistLower = percentile(self.synHist, per=5, axis=0) @disableOnWorkers def historic(self): diff --git a/Evaluate/pressureDistribution.py b/Evaluate/pressureDistribution.py index fd7be9f3..861f4d79 100644 --- a/Evaluate/pressureDistribution.py +++ b/Evaluate/pressureDistribution.py @@ -14,8 +14,6 @@ import sys import logging -import pdb - import numpy as np import numpy.ma as ma @@ -252,10 +250,10 @@ def calculateMeans(self, synMean, synMin, synMed, synMax, synMinCP): self.synMin = ma.mean(synMin, axis=0) self.synMax = ma.mean(synMax, axis=0) - self.synMeanUpper = percentile(ma.compressed(synMean), per=95, axis=0) - self.synMeanLower = percentile(ma.compressed(synMean), per=5, axis=0) - self.synMinUpper = percentile(ma.compressed(synMin), per=95, axis=0) - self.synMinLower = percentile(ma.compressed(synMin), per=5, axis=0) + self.synMeanUpper = percentile(synMean, per=95, axis=0) + self.synMeanLower = percentile(synMean, per=5, axis=0) + self.synMinUpper = percentile(synMin, per=95, axis=0) + self.synMinLower = percentile(synMin, per=5, axis=0) self.synMinCPDist = np.mean(synMinCP, axis=0) self.synMinCPLower = percentile(synMinCP, per=5, axis=0) diff --git a/Evaluate/trackDensity.py b/Evaluate/trackDensity.py index 4575ca0d..76ad6ce6 100644 --- a/Evaluate/trackDensity.py +++ b/Evaluate/trackDensity.py @@ -199,10 +199,8 @@ def calculateMeans(self): self.synHistMean = ma.mean(self.synHist, axis=0) self.medSynHist = ma.median(self.synHist, axis=0) - self.synHistUpper = percentile(ma.compressed(self.synHist), - per=95, axis=0) - self.synHistLower = percentile(ma.compressed(self.synHist), - per=5, axis=0) + self.synHistUpper = percentile(self.synHist, per=95, axis=0) + self.synHistLower = percentile(self.synHist, per=5, axis=0) @disableOnWorkers def historic(self):