def plotStatistics(self, output_file): p = stats.statRemoveNum(np.array(self.param), self.missingValue) a = p - np.mean(p) pmin = p.min() pmax = p.max() amin = a.min() amax = a.max() abins = np.linspace(amin, amax, 50) bins = np.linspace(pmin, pmax, 50) hist = np.empty((len(bins) - 1, self.maxCell)) ahist = np.empty((len(abins) - 1, self.maxCell)) x = np.arange(11) alpha = np.empty((11, self.maxCell)) aalpha = np.empty((11, self.maxCell)) for i in xrange(self.maxCell + 1): p = self.extractParameter(i, 0) a = p - np.mean(p) hist[:, i - 1], b = np.histogram(p, bins, normed=True) ahist[:, i - 1], b = np.histogram(a, abins, normed=True) alpha[:, i - 1] = acf(p, 10) aalpha[:, i - 1] = acf(a, 10) mhist = np.mean(hist, axis=1) uhist = percentile(hist, per=95, axis=1) lhist = percentile(hist, per=5, axis=1) mahist = np.mean(ahist, axis=1) uahist = percentile(ahist, per=95, axis=1) lahist = percentile(ahist, per=5, axis=1) malpha = np.mean(alpha, axis=1) ualpha = percentile(alpha, per=95, axis=1) lalpha = percentile(alpha, per=5, axis=1) maalpha = np.mean(aalpha, axis=1) uaalpha = percentile(aalpha, per=95, axis=1) laalpha = percentile(aalpha, per=5, axis=1) fig = RangeCurve() fig.add(bins[:-1], mhist, uhist, lhist, "Values", "Probability", "") fig.add(abins[:-1], mahist, uahist, lahist, "Anomalies", "Probability", "") fig.add(x, malpha, ualpha, lalpha, "Lag", "Autocorrelation", "ACF of values") fig.add(x, maalpha, uaalpha, laalpha, "Lag", "Autocorrelation", "ACF of anomalies") fig.plot() saveFigure(fig, output_file + '.png')
def plot(self): figure = RangeCompareCurve() figure.set_size_inches(8,3) xlab = "Gate number" ylab = "Landfall probability" x = np.arange(len(self.gates) - 1) figure.add(x, self.historicLandfall, self.synMeanLandfall, self.synUpperLF, self.synLowerLF, xlab, ylab, "Landfall") ylab = "Offshore probability" figure.add(x, self.historicOffshore, self.synMeanOffshore, self.synUpperOF, self.synLowerOF, xlab, ylab, "Offshore") figure.plot() outputFile = pjoin(self.plotPath, 'landfall_rates.png') saveFigure(figure, outputFile)
def plot(self): """ Plot the results and save to file. """ figure = RangeCompareCurve() figure.set_size_inches(8, 3) xlab = "Gate number" ylab = "Landfall probability" x = np.arange(len(self.gates) - 1) figure.add(x, self.historicLandfall, self.synMeanLandfall, self.synUpperLF, self.synLowerLF, xlab, ylab, "Landfall") ylab = "Offshore probability" figure.add(x, self.historicOffshore, self.synMeanOffshore, self.synUpperOF, self.synLowerOF, xlab, ylab, "Offshore") figure.plot() outputFile = pjoin(self.plotPath, 'landfall_rates.png') saveFigure(figure, outputFile)