From dbd36e0f1f18beb02d4ae85bd96e65d5f876e240 Mon Sep 17 00:00:00 2001 From: wirawan Date: Wed, 1 Dec 2010 17:11:46 +0000 Subject: [PATCH] * Added division of errorbar by a scalar. --- math/stats/errorbar.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/math/stats/errorbar.py b/math/stats/errorbar.py index f8adbc1..953c52f 100644 --- a/math/stats/errorbar.py +++ b/math/stats/errorbar.py @@ -1,4 +1,4 @@ -# $Id: errorbar.py,v 1.1 2010-10-19 20:19:25 wirawan Exp $ +# $Id: errorbar.py,v 1.2 2010-12-01 17:11:46 wirawan Exp $ # # Module wpylib.math.stats.errorbar # Errorbar text handling for Python @@ -184,7 +184,7 @@ class errorbar(object): return self.__class__(self.val, self.err, self.eb, self.ebproc) # Some algebraic operations with scalars are defined here: def __mul__(self, y): - """Scales y by a scalar value.""" + """Scales by a scalar value.""" return self.__class__(self.val*y, self.err*y, ebproc=self.ebproc) __rmul__ = __mul__ def __imul__(self, y): @@ -192,6 +192,14 @@ class errorbar(object): self.val *= y self.err *= y self.ebupdate() + def __div__(self, y): + """Divides by a scalar value.""" + return self.__class__(self.val/y, self.err/y, ebproc=self.ebproc) + def __idiv__(self, y): + """Scales itself by a scalar value (division).""" + self.val /= y + self.err /= y + self.ebupdate() def __add__(self, y): """Adds by a scalar value or another errorbar value.