From 8cef8ff2db94c9d3336c1bf5648483e591852847 Mon Sep 17 00:00:00 2001 From: Sebastian Wehling-Benatelli Date: Tue, 12 Jul 2016 16:19:27 +0200 Subject: [PATCH] [bugfix] due to changes in the usage of ProbabiltyDensityFunction.data expectation and standard deviation were wrongly calculated --- pylot/core/util/pdf.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pylot/core/util/pdf.py b/pylot/core/util/pdf.py index dfc11ac6..e0e3f078 100644 --- a/pylot/core/util/pdf.py +++ b/pylot/core/util/pdf.py @@ -187,7 +187,7 @@ class ProbabilityDensityFunction(object): func, params = fit_curve(axis, pdf) - return ProbabilityDensityFunction(x0, incr, npts, branches['gauss'], mu, + return ProbabilityDensityFunction(x0, incr, npts, func, mu, params, eta) def __nonzero__(self): @@ -303,16 +303,15 @@ class ProbabilityDensityFunction(object): ''' rval = 0 - axis = self.axis - self.x0 - for n, x in enumerate(axis): - rval += x * self.data(n) - return rval * self.incr + self.x0 + for x in self.axis: + rval += x * self.data(x) + return rval * self.incr def standard_deviation(self): mu = self.mu rval = 0 - for n, x in enumerate(self.axis): - rval += (x - mu) ** 2 * self.data(n) + for x in self.axis: + rval += (x - mu) ** 2 * self.data(x) return rval * self.incr def prob_lt_val(self, value):