From 0b54d5b5a003e86b13d3cfc4200b14a66d8be81a Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Sat, 15 Jul 2023 09:25:53 -0700 Subject: [PATCH] Remove product --- ndcube/conftest.py | 4 ++-- ndcube/extra_coords/tests/test_extra_coords.py | 2 +- ndcube/extra_coords/tests/test_lookup_table_coord.py | 2 +- ndcube/tests/test_ndcube.py | 4 ++-- ndcube/utils/cube.py | 2 +- ndcube/utils/tests/test_utils_cube.py | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ndcube/conftest.py b/ndcube/conftest.py index 64bcebb67..76f33a1b4 100644 --- a/ndcube/conftest.py +++ b/ndcube/conftest.py @@ -36,14 +36,14 @@ def skycoord_2d_lut(shape): - total_len = np.product(shape) + total_len = np.prod(shape) data = (np.arange(total_len).reshape(shape), np.arange(total_len, total_len * 2).reshape(shape)) return SkyCoord(*data, unit=u.deg) def data_nd(shape): - nelem = np.product(shape) + nelem = np.prod(shape) return np.arange(nelem).reshape(shape) diff --git a/ndcube/extra_coords/tests/test_extra_coords.py b/ndcube/extra_coords/tests/test_extra_coords.py index 1f5bf352d..ea410fac0 100644 --- a/ndcube/extra_coords/tests/test_extra_coords.py +++ b/ndcube/extra_coords/tests/test_extra_coords.py @@ -42,7 +42,7 @@ def skycoord_2d_lut(): @pytest.fixture def quantity_2d_lut(): ec_shape = (3, 3) - return np.arange(np.product(ec_shape)).reshape(ec_shape) * u.m / u.s + return np.arange(np.prod(ec_shape)).reshape(ec_shape) * u.m / u.s # ExtraCoords from WCS diff --git a/ndcube/extra_coords/tests/test_lookup_table_coord.py b/ndcube/extra_coords/tests/test_lookup_table_coord.py index 5092d75cc..c20fb6f80 100644 --- a/ndcube/extra_coords/tests/test_lookup_table_coord.py +++ b/ndcube/extra_coords/tests/test_lookup_table_coord.py @@ -265,7 +265,7 @@ def test_join_3d(lut_2d_skycoord_mesh, lut_1d_wave): @pytest.mark.xfail(reason=">1D Tables not supported") def test_2d_quantity(): shape = (3, 3) - data = np.arange(np.product(shape)).reshape(shape) * u.m / u.s + data = np.arange(np.prod(shape)).reshape(shape) * u.m / u.s ltc = QuantityTableCoordinate(data) assert u.allclose(ltc.wcs.pixel_to_world(0, 0), 0 * u.m / u.s) diff --git a/ndcube/tests/test_ndcube.py b/ndcube/tests/test_ndcube.py index a9f94f11b..b8f1e1ada 100644 --- a/ndcube/tests/test_ndcube.py +++ b/ndcube/tests/test_ndcube.py @@ -21,7 +21,7 @@ def generate_data(shape): - data = np.arange(np.product(shape)) + data = np.arange(np.prod(shape)) return data.reshape(shape) @@ -211,7 +211,7 @@ def test_axis_world_coords_empty_ec(ndcube_3d_l_ln_lt_ectime): def test_axis_world_coords_complex_ec(ndcube_4d_ln_lt_l_t): cube = ndcube_4d_ln_lt_l_t ec_shape = cube.data.shape[1:3] - data = np.arange(np.product(ec_shape)).reshape(ec_shape) * u.m / u.s + data = np.arange(np.prod(ec_shape)).reshape(ec_shape) * u.m / u.s # The lookup table has to be in world order so transpose it. cube.extra_coords.add('velocity', (2, 1), data.T) diff --git a/ndcube/utils/cube.py b/ndcube/utils/cube.py index f8994a7b8..74de42877 100644 --- a/ndcube/utils/cube.py +++ b/ndcube/utils/cube.py @@ -252,7 +252,7 @@ def propagate_rebin_uncertainties(uncertainty, data, mask, operation, operation_ if not propagation_operation: if operation in {np.sum, np.nansum, np.mean, np.nanmean}: propagation_operation = np.add - elif operation in {np.product, np.prod, np.nanprod}: + elif operation in {np.prod, np.nanprod}: propagation_operation = np.multiply else: raise ValueError("propagation_operation not recognized.") diff --git a/ndcube/utils/tests/test_utils_cube.py b/ndcube/utils/tests/test_utils_cube.py index 8c4c7f9a1..db839e794 100644 --- a/ndcube/utils/tests/test_utils_cube.py +++ b/ndcube/utils/tests/test_utils_cube.py @@ -66,7 +66,7 @@ def test_propagate_rebin_uncertainties_prod(stacked_pixel_data): # Run function output = propagate_rebin_uncertainties(uncertainty, data, mask, - np.product, operation_ignores_mask=False) + np.prod, operation_ignores_mask=False) assert type(output) is type(expected) assert np.allclose(output.array, expected.array)