From e8cbc2f37754450857ef7fca2464c0a011f88e32 Mon Sep 17 00:00:00 2001 From: Sebastianw Wehling-Benatelli Date: Thu, 30 Jun 2016 13:14:38 +0200 Subject: [PATCH] [change] implementation of quantile calculation corrected --- pylot/core/util/pdf.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pylot/core/util/pdf.py b/pylot/core/util/pdf.py index ed6ea70c..71ccfaa6 100644 --- a/pylot/core/util/pdf.py +++ b/pylot/core/util/pdf.py @@ -297,20 +297,18 @@ class ProbabilityDensityFunction(object): def quantile(self, prob_value, eps=0.01): l = self.axis[0] r = self.axis[-1] - m = (r - l) / 2 + m = (r + l) / 2 diff = prob_value - self.prob_lt_val(m) while abs(diff) > eps: if diff > 0: l = m else: r = m - m = (r - l) / 2 + m = (r + l) / 2 diff = prob_value - self.prob_lt_val(m) + print(m, prob_value, self.prob_lt_val(m)) return m - - pass - def quantile_distance(self, prob_value): ql = self.quantile(prob_value) qu = self.quantile(1 - prob_value)