mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
feat: tolerance of Obs.is_zero can now be specified
This commit is contained in:
parent
c31034565a
commit
ebbfaf8e80
1 changed files with 11 additions and 3 deletions
|
@ -418,9 +418,17 @@ class Obs:
|
||||||
"""
|
"""
|
||||||
return self.is_zero() or 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, rtol=1.e-5, atol=1.e-8):
|
||||||
"""Checks whether the observable is zero within machine precision."""
|
"""Checks whether the observable is zero within a given tolerance.
|
||||||
return np.isclose(0.0, self.value) and all(np.allclose(0.0, delta) for delta in self.deltas.values())
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
rtol : float
|
||||||
|
Relative tolerance (for details see numpy documentation).
|
||||||
|
atol : float
|
||||||
|
Absolute tolerance (for details see numpy documentation).
|
||||||
|
"""
|
||||||
|
return np.isclose(0.0, self.value, rtol, atol) and all(np.allclose(0.0, delta, rtol, atol) for delta in self.deltas.values())
|
||||||
|
|
||||||
def plot_tauint(self, save=None):
|
def plot_tauint(self, save=None):
|
||||||
"""Plot integrated autocorrelation time for each ensemble.
|
"""Plot integrated autocorrelation time for each ensemble.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue