From 6181d5588d0f90126718cdc328ecd22d49f939e1 Mon Sep 17 00:00:00 2001 From: wirawan Date: Thu, 10 Mar 2011 20:17:55 +0000 Subject: [PATCH] * The sign of the scalar prefactor should not enter the uncertainty (err) field! --- math/stats/errorbar.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/math/stats/errorbar.py b/math/stats/errorbar.py index 953c52f..55aeafd 100644 --- a/math/stats/errorbar.py +++ b/math/stats/errorbar.py @@ -1,4 +1,4 @@ -# $Id: errorbar.py,v 1.2 2010-12-01 17:11:46 wirawan Exp $ +# $Id: errorbar.py,v 1.3 2011-03-10 20:17:55 wirawan Exp $ # # Module wpylib.math.stats.errorbar # Errorbar text handling for Python @@ -185,20 +185,20 @@ class errorbar(object): # Some algebraic operations with scalars are defined here: def __mul__(self, y): """Scales by a scalar value.""" - return self.__class__(self.val*y, self.err*y, ebproc=self.ebproc) + return self.__class__(self.val*y, self.err*abs(y), ebproc=self.ebproc) __rmul__ = __mul__ def __imul__(self, y): """Scales itself by a scalar value.""" self.val *= y - self.err *= y + self.err *= abs(y) self.ebupdate() def __div__(self, y): """Divides by a scalar value.""" - return self.__class__(self.val/y, self.err/y, ebproc=self.ebproc) + return self.__class__(self.val/y, self.err/abs(y), ebproc=self.ebproc) def __idiv__(self, y): """Scales itself by a scalar value (division).""" self.val /= y - self.err /= y + self.err /= abs(y) self.ebupdate() def __add__(self, y):