Skip to content

Commit

Permalink
Replace separate checks for NaN and inf with all and isfinite
Browse files Browse the repository at this point in the history
  • Loading branch information
haticekaratay committed Jul 24, 2024
1 parent b9a273a commit 5ed5c70
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,7 @@ def _uncertainty(result):
if getattr(result, 'uncertainty', None) is not None:
# we'll keep the uncertainty and result in the same unit (so
# we only have to show the unit at the end)
if (np.any(np.isnan(result.uncertainty.value)) or
np.any(np.isinf(result.uncertainty.value))):
if not np.all(np.isfinite(result.uncertainty.value)):
return ''
return str(result.uncertainty.to_value(result.unit))
else:
Expand Down

0 comments on commit 5ed5c70

Please sign in to comment.