[fix] overcome numerical instabilities

due to the usage of large absolute values (timestamp) on time axis the estimation of the expectation value gets instable
This commit is contained in:
Sebastian Wehling-Benatelli 2016-05-09 12:06:47 +02:00
parent 4480854ee5
commit 3705eb567b

View File

@ -256,9 +256,10 @@ class ProbabilityDensityFunction(object):
''' '''
rval = 0 rval = 0
for n, x in enumerate(self.axis): axis = self.axis - self.x0
for n, x in enumerate(axis):
rval += x * self.data[n] 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.expectation() mu = self.expectation()