mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
Obs.is_zero() now correctly detects when an Obs is zero within machine
precision
This commit is contained in:
parent
eedad7deda
commit
8655fe2cd1
1 changed files with 2 additions and 2 deletions
|
@ -355,11 +355,11 @@ class Obs:
|
||||||
print(e_name, ':', self.e_content[e_name])
|
print(e_name, ':', self.e_content[e_name])
|
||||||
|
|
||||||
def is_zero_within_error(self, sigma=1):
|
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.
|
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):
|
def is_zero(self):
|
||||||
return np.isclose(0.0, self.value) and all(np.allclose(0.0, delta) for delta in self.deltas.values())
|
return np.isclose(0.0, self.value) and all(np.allclose(0.0, delta) for delta in self.deltas.values())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue