Skip to content

Commit

Permalink
Remove product
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Jul 15, 2023
1 parent a043622 commit 0b54d5b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ndcube/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion ndcube/extra_coords/tests/test_extra_coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ndcube/extra_coords/tests/test_lookup_table_coord.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions ndcube/tests/test_ndcube.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


def generate_data(shape):
data = np.arange(np.product(shape))
data = np.arange(np.prod(shape))
return data.reshape(shape)


Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ndcube/utils/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion ndcube/utils/tests/test_utils_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0b54d5b

Please sign in to comment.