From 3705eb567bc624ec700a4e72d56cbe096bf91649 Mon Sep 17 00:00:00 2001 From: Sebastianw Wehling-Benatelli Date: Mon, 9 May 2016 12:06:47 +0200 Subject: [PATCH] [fix] overcome numerical instabilities due to the usage of large absolute values (timestamp) on time axis the estimation of the expectation value gets instable --- pylot/core/util/pdf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pylot/core/util/pdf.py b/pylot/core/util/pdf.py index 776192aa..1a233aed 100644 --- a/pylot/core/util/pdf.py +++ b/pylot/core/util/pdf.py @@ -256,9 +256,10 @@ class ProbabilityDensityFunction(object): ''' 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] - return rval * self.incr + return rval * self.incr + self.x0 def standard_deviation(self): mu = self.expectation()