mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 14:50:25 +01:00
fix: Fixed bug in details which appears when tau has vanishing error.
This commit is contained in:
parent
7d0b3d4d6b
commit
cae02bfa53
1 changed files with 2 additions and 2 deletions
|
@ -699,8 +699,6 @@ class Obs:
|
|||
return 'Obs[' + str(self) + ']'
|
||||
|
||||
def __str__(self):
|
||||
if self._dvalue == 0.0:
|
||||
return str(self.value)
|
||||
return _format_uncertainty(self.value, self._dvalue)
|
||||
|
||||
def __hash__(self):
|
||||
|
@ -979,6 +977,8 @@ class CObs:
|
|||
|
||||
def _format_uncertainty(value, dvalue):
|
||||
"""Creates a string of a value and its error in paranthesis notation, e.g., 13.02(45)"""
|
||||
if dvalue == 0.0:
|
||||
return str(value)
|
||||
fexp = np.floor(np.log10(dvalue))
|
||||
if fexp < 0.0:
|
||||
return '{:{form}}({:2.0f})'.format(value, dvalue * 10 ** (-fexp + 1), form='.' + str(-int(fexp) + 1) + 'f')
|
||||
|
|
Loading…
Add table
Reference in a new issue