From 8655fe2cd134dcd4675cc990aa4fadc1a407ac1f Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Tue, 26 Oct 2021 10:00:18 +0100 Subject: [PATCH] Obs.is_zero() now correctly detects when an Obs is zero within machine precision --- pyerrors/pyerrors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyerrors/pyerrors.py b/pyerrors/pyerrors.py index 9e8388e9..25f1280e 100644 --- a/pyerrors/pyerrors.py +++ b/pyerrors/pyerrors.py @@ -355,11 +355,11 @@ class Obs: print(e_name, ':', self.e_content[e_name]) def is_zero_within_error(self, sigma=1): - """ Checks whether the observable is zero within 'sigma' standard errors. + """Checks whether the observable is zero within 'sigma' standard errors. Works only properly when the gamma method was run. """ - return np.abs(self.value) <= sigma * self.dvalue + return self.is_zero() or np.abs(self.value) <= sigma * self.dvalue def is_zero(self): return np.isclose(0.0, self.value) and all(np.allclose(0.0, delta) for delta in self.deltas.values())