Skip to content

Commit 6f6327a

Browse files
committed
Remove superfluous NDCube.__add__ tests.
1 parent bab5524 commit 6f6327a

1 file changed

Lines changed: 43 additions & 42 deletions

File tree

ndcube/tests/test_ndcube_arithmetic.py

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,48 @@ def test_arithmetic_add_one_unit(ndc, value):
4949
ndc + value
5050

5151

52+
@pytest.mark.parametrize(("ndc", "value", "expected_kwargs"),
53+
[(
54+
"ndcube_2d_ln_lt_no_unit_no_unc_no_mask_2",
55+
NDData(np.ones((2, 3)), wcs=None),
56+
{"data": np.array([[1, 2, 3], [4, 5, 6]])}
57+
),
58+
(
59+
"ndcube_2d_ln_lt_no_unit_no_unc_no_mask_2",
60+
NDData(np.ones((2, 3)),
61+
wcs=None,
62+
uncertainty=StdDevUncertainty(np.ones((2, 3))*0.1),
63+
mask=np.array([[True, False, False], [False, True, False]])),
64+
{"data": np.array([[1, 2, 3], [4, 5, 6]]),
65+
"uncertainty": astropy.nddata.StdDevUncertainty(np.ones((2, 3))*0.1),
66+
"mask": np.array([[True, False, False], [False, True, False]])}
67+
), # ndc has no mask no uncertainty no unit, but nddata has all.
68+
(
69+
"ndcube_2d_ln_lt_unit_unc_mask",
70+
NDData(np.ones((2, 3)),
71+
wcs=None,
72+
uncertainty=StdDevUncertainty(np.ones((2, 3))*0.1),
73+
mask=np.array([[True, False, False], [False, True, False]]),
74+
unit=u.ct),
75+
{"unit": u.ct,
76+
"data": np.array([[1, 2, 3], [4, 5, 6]]),
77+
"uncertainty": astropy.nddata.StdDevUncertainty(np.array([[0.1 , 0.1118034 , 0.14142136],
78+
[0.18027756, 0.2236068 , 0.26925824]])),
79+
"mask": np.array([[True, True, True], [False, True, True]])}
80+
) # both of them have uncertainty and mask and unit.
81+
],
82+
indirect=("ndc",))
83+
def test_cube_arithmetic_add_nddata(ndc, value, expected_kwargs, wcs_2d_lt_ln):
84+
output_cube = ndc + value # perform the multiplication
85+
86+
expected_kwargs["wcs"] = wcs_2d_lt_ln
87+
expected_cube = NDCube(**expected_kwargs)
88+
89+
# Assert output cube is same as expected cube
90+
assert_cubes_equal(output_cube, expected_cube, check_uncertainty_values=True)
91+
92+
93+
"""
5294
# Both NDData and NDCube have unit and uncertainty. No mask is involved.
5395
# Test different scenarios when units are equivalent and when they are not. TODO (bc somewhere is checking the units are the same)
5496
# what is an equivalent unit in astropy for count (ct)?
@@ -288,7 +330,7 @@ def test_arithmetic_add_nddata_mask(ndcube_2d_ln_lt_nomask, value):
288330
289331
# Assert output cube is same as expected cube
290332
assert_cubes_equal(output_cube, expected_cube)
291-
333+
"""
292334

293335
@pytest.mark.parametrize('value', [
294336
10 * u.ct,
@@ -385,47 +427,6 @@ def test_cube_arithmetic_multiply_nddata(ndc, value, expected_kwargs, wcs_2d_lt_
385427
assert_cubes_equal(output_cube, expected_cube, check_uncertainty_values=True)
386428

387429

388-
@pytest.mark.parametrize(("ndc", "value", "expected_kwargs"),
389-
[(
390-
"ndcube_2d_ln_lt_no_unit_no_unc_no_mask_2",
391-
NDData(np.ones((2, 3)), wcs=None),
392-
{"data": np.array([[1, 2, 3], [4, 5, 6]])}
393-
),
394-
(
395-
"ndcube_2d_ln_lt_no_unit_no_unc_no_mask_2",
396-
NDData(np.ones((2, 3)),
397-
wcs=None,
398-
uncertainty=StdDevUncertainty(np.ones((2, 3))*0.1),
399-
mask=np.array([[True, False, False], [False, True, False]])),
400-
{"data": np.array([[1, 2, 3], [4, 5, 6]]),
401-
"uncertainty": astropy.nddata.StdDevUncertainty(np.ones((2, 3))*0.1),
402-
"mask": np.array([[True, False, False], [False, True, False]])}
403-
), # ndc has no mask no uncertainty no unit, but nddata has all.
404-
(
405-
"ndcube_2d_ln_lt_unit_unc_mask",
406-
NDData(np.ones((2, 3)),
407-
wcs=None,
408-
uncertainty=StdDevUncertainty(np.ones((2, 3))*0.1),
409-
mask=np.array([[True, False, False], [False, True, False]]),
410-
unit=u.ct),
411-
{"unit": u.ct,
412-
"data": np.array([[1, 2, 3], [4, 5, 6]]),
413-
"uncertainty": astropy.nddata.StdDevUncertainty(np.array([[0.1 , 0.1118034 , 0.14142136],
414-
[0.18027756, 0.2236068 , 0.26925824]])),
415-
"mask": np.array([[True, True, True], [False, True, True]])}
416-
) # both of them have uncertainty and mask and unit.
417-
],
418-
indirect=("ndc",))
419-
def test_cube_arithmetic_add_nddata(ndc, value, expected_kwargs, wcs_2d_lt_ln):
420-
output_cube = ndc + value # perform the multiplication
421-
422-
expected_kwargs["wcs"] = wcs_2d_lt_ln
423-
expected_cube = NDCube(**expected_kwargs)
424-
425-
# Assert output cube is same as expected cube
426-
assert_cubes_equal(output_cube, expected_cube, check_uncertainty_values=True)
427-
428-
429430
@pytest.mark.parametrize('value', [
430431
10 * u.ct,
431432
u.Quantity([10], u.ct),

0 commit comments

Comments
 (0)