diff --git a/punchbowl/data/io.py b/punchbowl/data/io.py index 303f0753..130fd8e9 100644 --- a/punchbowl/data/io.py +++ b/punchbowl/data/io.py @@ -114,7 +114,10 @@ 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.""" - return (1/uncertainty_array) * data_array + # 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) + return uncertainty_array def _update_statistics(cube: NDCube) -> None: diff --git a/punchbowl/level3/tests/test_celestial_intermediary.py b/punchbowl/level3/tests/test_celestial_intermediary.py index a22a9682..de5fada1 100644 --- a/punchbowl/level3/tests/test_celestial_intermediary.py +++ b/punchbowl/level3/tests/test_celestial_intermediary.py @@ -174,8 +174,6 @@ def test_shift_image_onto_fill_value(tmp_path): for hdu in hdul[1:]: hdu.header['CRVAL1A'] += 10 hdu.header['CRVAL2A'] += 10 - # Cut down to one Stokes component to speed up the test - hdu.data = hdul[1].data[0] hdul.writeto(file2) cube1 = io.load_ndcube_from_fits(file1, key='A')