Skip to content

Commit

Permalink
Merge pull request #329 from punch-mission/ignore-errors
Browse files Browse the repository at this point in the history
Ignore warnings in unpacking uncertainty
  • Loading branch information
jmbhughes authored Nov 26, 2024
2 parents 872f76b + 38cea0b commit 8978ec0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions punchbowl/data/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ def _pack_uncertainty(cube: NDCube) -> np.ndarray:
def _unpack_uncertainty(uncertainty_array: np.ndarray, data_array: np.ndarray) -> np.ndarray:
"""Uncompress the uncertainty when reading from a file."""
# This is (1/uncertainty_array) * data_array, but this way we save time on memory allocation
np.divide(1, uncertainty_array, out=uncertainty_array)
np.multiply(data_array, uncertainty_array, out=uncertainty_array)
with np.errstate(divide="ignore", invalid="ignore"):
np.divide(1, uncertainty_array, out=uncertainty_array)
np.multiply(data_array, uncertainty_array, out=uncertainty_array)
return uncertainty_array


Expand Down

0 comments on commit 8978ec0

Please sign in to comment.