[bugfix] due to changes in the usage of ProbabiltyDensityFunction.data expectation and standard deviation were wrongly calculated
This commit is contained in:
parent
39184ef150
commit
8cef8ff2db
@ -187,7 +187,7 @@ class ProbabilityDensityFunction(object):
|
|||||||
|
|
||||||
func, params = fit_curve(axis, pdf)
|
func, params = fit_curve(axis, pdf)
|
||||||
|
|
||||||
return ProbabilityDensityFunction(x0, incr, npts, branches['gauss'], mu,
|
return ProbabilityDensityFunction(x0, incr, npts, func, mu,
|
||||||
params, eta)
|
params, eta)
|
||||||
|
|
||||||
def __nonzero__(self):
|
def __nonzero__(self):
|
||||||
@ -303,16 +303,15 @@ class ProbabilityDensityFunction(object):
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
rval = 0
|
rval = 0
|
||||||
axis = self.axis - self.x0
|
for x in self.axis:
|
||||||
for n, x in enumerate(axis):
|
rval += x * self.data(x)
|
||||||
rval += x * self.data(n)
|
return rval * self.incr
|
||||||
return rval * self.incr + self.x0
|
|
||||||
|
|
||||||
def standard_deviation(self):
|
def standard_deviation(self):
|
||||||
mu = self.mu
|
mu = self.mu
|
||||||
rval = 0
|
rval = 0
|
||||||
for n, x in enumerate(self.axis):
|
for x in self.axis:
|
||||||
rval += (x - mu) ** 2 * self.data(n)
|
rval += (x - mu) ** 2 * self.data(x)
|
||||||
return rval * self.incr
|
return rval * self.incr
|
||||||
|
|
||||||
def prob_lt_val(self, value):
|
def prob_lt_val(self, value):
|
||||||
|
Loading…
Reference in New Issue
Block a user