mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 14:50:25 +01:00
Obs.print can now properly deal with value == 0.0
This commit is contained in:
parent
74d1021665
commit
2a303bb610
1 changed files with 5 additions and 1 deletions
|
@ -318,7 +318,11 @@ class Obs:
|
|||
if level == 0:
|
||||
print(self)
|
||||
else:
|
||||
print('Result\t %3.8e +/- %3.8e +/- %3.8e (%3.3f%%)' % (self.value, self.dvalue, self.ddvalue, np.abs(self.dvalue / self.value) * 100))
|
||||
if self.value == 0.0:
|
||||
percentage = np.nan
|
||||
else:
|
||||
percentage = np.abs(self.dvalue / self.value) * 100
|
||||
print('Result\t %3.8e +/- %3.8e +/- %3.8e (%3.3f%%)' % (self.value, self.dvalue, self.ddvalue, percentage))
|
||||
if len(self.e_names) > 1:
|
||||
print(' Ensemble errors:')
|
||||
for e_name in self.e_names:
|
||||
|
|
Loading…
Add table
Reference in a new issue