Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new features to the ndcube.__add__ method #794

Open
wants to merge 66 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
9c38077
Added new features to the ndcube._add_ method
PCJY Dec 11, 2024
1d5d2ab
Merge branch 'main' of https://github.com/sunpy/ndcube into nddataAri…
PCJY Dec 16, 2024
aaa9ef0
Update ndcube/ndcube.py
PCJY Dec 16, 2024
ed4f61e
Update ndcube/ndcube.py
PCJY Dec 16, 2024
ea43a1d
Modified the _add_ method further.
PCJY Dec 18, 2024
a891ff9
Merge branch 'nddataArithmetic' of https://github.com/PCJY/ndcube int…
PCJY Dec 18, 2024
f575e2c
Further modifies the _add_ method.
PCJY Dec 23, 2024
8951635
Added a changelog file for this new feature.
PCJY Dec 23, 2024
58e4363
Merge branch 'main' of https://github.com/sunpy/ndcube into nddataAri…
PCJY Dec 23, 2024
bcf4fb9
Added a new method test_cube_add_uncertainty_and_mask to test_ndcube.py.
PCJY Dec 23, 2024
c4d639a
Modified the test_cube_add_uncertainty_and_mask method in test_ndcube.py
PCJY Dec 23, 2024
bd317e3
Modified the test_cube_add_uncertainty_and_mask further.
PCJY Dec 23, 2024
e0375ec
Fixed how the masks are combined.
PCJY Jan 14, 2025
0158737
Set masked uncertainty entries to 0.
PCJY Jan 18, 2025
9074f45
Moved uncertainty combination out of the mask-combining If Statements.
PCJY Jan 21, 2025
9e267d3
Merge branch 'main' of https://github.com/sunpy/ndcube into nddataAri…
PCJY Jan 21, 2025
d8c2db9
Merge branch 'main' into nddataArithmetic
PCJY Jan 21, 2025
5f422f5
Removed mask-dealing in the add method.
PCJY Jan 22, 2025
3369223
Merge branch 'nddataArithmetic' of https://github.com/PCJY/ndcube int…
PCJY Jan 22, 2025
f17da78
Removed mask-dealing in the Add method.
PCJY Jan 22, 2025
344b6f7
use a conditional statement to still check whether there is a mask.
PCJY Jan 22, 2025
7ff78aa
Changed mask to False and removed mask-checking in test_cube_add_unce…
PCJY Jan 22, 2025
5852daa
Added placeholders for using the new parameters and modified the no-m…
PCJY Jan 22, 2025
5dcb8ff
Set default of operation_ignores_mask to be True.
PCJY Jan 22, 2025
b385643
Make NDCube.__add__ call the NDCube.add method.
PCJY Jan 28, 2025
9941993
tidied up the __add__ method, copied the original test_cube_arithmeti…
PCJY Jan 29, 2025
4568ae2
Only check whether value has unit if it is not an NDData
PCJY Feb 3, 2025
b1cf478
Merge branch 'main' of https://github.com/sunpy/ndcube into nddataAri…
PCJY Feb 3, 2025
bb2c541
Update ndcube/ndcube.py
PCJY Feb 4, 2025
3f6ebed
Update ndcube/ndcube.py
PCJY Feb 4, 2025
3b76d54
Update ndcube/tests/test_ndcube.py
PCJY Feb 4, 2025
e7701b2
Merge branch 'nddataArithmetic' of https://github.com/PCJY/ndcube int…
PCJY Feb 4, 2025
64cc02e
Fix uncertainty propagation and ensure expected_uncertainty is numpy …
PCJY Feb 4, 2025
48b313e
Apply suggestions from code review
PCJY Feb 11, 2025
50d64c1
Merge branch 'main' of https://github.com/sunpy/ndcube into nddataAri…
PCJY Feb 11, 2025
23fef8a
check value and unit of addition
PCJY Feb 11, 2025
ed9d5f1
Update ndcube/ndcube.py
PCJY Feb 11, 2025
02f86b3
Merge branch 'main' of https://github.com/sunpy/ndcube into nddataAri…
PCJY Feb 17, 2025
7ea75f3
change values for uncertainty in a fixture to fixed values.
PCJY Feb 17, 2025
f31768d
Merge branch 'nddataArithmetic' of https://github.com/PCJY/ndcube int…
PCJY Feb 17, 2025
efafb89
Merge branch 'main' into nddataArithmetic
PCJY Feb 17, 2025
a32e474
Merge branch 'nddataArithmetic' of https://github.com/PCJY/ndcube int…
PCJY Feb 17, 2025
83d99cf
added unit in ndcube for kwargs['data'], changed values for uncertainty.
PCJY Feb 18, 2025
3b5a0ce
new test method for units of both objects being None.
PCJY Feb 18, 2025
9fbb9e3
Merge branch 'main' of https://github.com/sunpy/ndcube into nddataAri…
PCJY Feb 20, 2025
1f0ffc6
within a new ndcube-dev env, removed any unit involved for now.
PCJY Feb 20, 2025
fd78f6f
Added new test case for only one of them having a unit.
PCJY Feb 20, 2025
b284e1f
Test case for both objects having the same unit, and causes TypeError.
PCJY Feb 21, 2025
379faac
Fix test for adding nddata and ndcube uncertainties.
DanRyanIrish Feb 24, 2025
c6070c0
Added more test functions for full coverage.
PCJY Feb 24, 2025
d88838d
Fix pytest indirect issue: Added cube(request) fixture to correctly r…
PCJY Feb 26, 2025
f097110
Fix indirect fixture reference.
DanRyanIrish Feb 26, 2025
c920a10
Merge branch 'DanRyanIrish-nddataArithmetic' into nddataArithmetic
PCJY Feb 26, 2025
5565408
Written all tests and fixed an error in ndcube with test results.
PCJY Feb 27, 2025
51d26c1
Fixed a small error in a test function.
PCJY Feb 27, 2025
46cef9d
changed assert_cubes_equal, fixed self-referring of tests.
PCJY Feb 28, 2025
1eb0357
Update ndcube/tests/helpers.py
PCJY Mar 3, 2025
553b1d7
Changed the naming of test functions.
PCJY Mar 3, 2025
8f9baa4
Merge branch 'nddataArithmetic' of https://github.com/PCJY/ndcube int…
PCJY Mar 3, 2025
fdecacd
Changed the way to check whether both objects' uncertainty are None.
PCJY Mar 3, 2025
3ab2ead
Three conditional scenarios.
PCJY Mar 3, 2025
fdee146
Rewrote the uncertainty results checking.
PCJY Mar 4, 2025
d755849
Rewrote the uncertainty checking again.
PCJY Mar 4, 2025
5b9626f
Implementing mask.
PCJY Mar 11, 2025
3f1b8ef
Implementing mask.
PCJY Mar 11, 2025
22a673b
Added Fill() Method's skeleton.
PCJY Mar 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions ndcube/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,14 +679,14 @@ def ndcube_2d_ln_lt_units(wcs_2d_lt_ln):


@pytest.fixture
def ndcube_2d_ln_lt_no_unit_uncert(wcs_2d_lt_ln):
def ndcube_2d_ln_lt_no_unit_no_unc(wcs_2d_lt_ln):
shape = (10, 12)
data_cube = data_nd(shape).astype(float)
return NDCube(data_cube, wcs=wcs_2d_lt_ln)


@pytest.fixture
def ndcube_2d_with_unit_uncertainty(wcs_2d_lt_ln):
def ndcube_2d_unit_unc(wcs_2d_lt_ln):
shape = (10, 12)
data_cube = data_nd(shape).astype(float)
uncertainty = StdDevUncertainty(np.ones(shape)*0.2, unit=u.ct)
Expand All @@ -695,7 +695,7 @@ def ndcube_2d_with_unit_uncertainty(wcs_2d_lt_ln):


@pytest.fixture
def ndcube_2d_unit_None(wcs_2d_lt_ln):
def ndcube_2d_uncertainty_no_unit(wcs_2d_lt_ln):
shape = (10, 12)
data_cube = data_nd(shape).astype(float)
uncertainty = StdDevUncertainty(np.ones(shape)*0.2)
Expand Down Expand Up @@ -752,7 +752,9 @@ def ndcube_1d_l(wcs_1d_l):
"ndcube_2d_ln_lt_units",
"ndcube_2d_dask",
"ndcube_1d_l",
"ndcube_2d_unit_None",
"ndcube_2d_ln_lt_no_unit_no_unc",
"ndcube_2d_uncertainty_no_unit",
"ndcube_2d_unit_unc",
])
def all_ndcubes(request):
"""
Expand Down
1 change: 1 addition & 0 deletions ndcube/ndcube.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@
kwargs["uncertainty"] = new_uncertainty
elif value.uncertainty is not None:
new_uncertainty = value.uncertainty
kwargs["uncertainty"] = new_uncertainty
else:
new_uncertainty = None
else:
Expand All @@ -1027,7 +1028,7 @@
elif self.unit not in (None, u.Unit("")):
raise TypeError("Cannot add a unitless object to an NDCube with a unit.")
else:
kwargs["data"] = self.data + value

Check warning on line 1031 in ndcube/ndcube.py

View check run for this annotation

Codecov / codecov/patch

ndcube/ndcube.py#L1031

Added line #L1031 was not covered by tests

# return the new NDCube instance
return self._new_instance(**kwargs)
Expand Down
220 changes: 145 additions & 75 deletions ndcube/tests/test_ndcube.py
Original file line number Diff line number Diff line change
Expand Up @@ -1138,38 +1138,11 @@ def test_cube_arithmetic_add(ndcube_2d_ln_lt_units, value): # this test methods
check_arithmetic_value_and_units(new_cube, cube_quantity + value)


# value is an NDData, The case when neither NDData nor NDCube has a unit.
@pytest.mark.parametrize('value', [
NDData(np.ones((10, 12)), # pass in the values to be tested as a set of ones.
wcs=None,
uncertainty=StdDevUncertainty(np.ones((10, 12))*0.1)),
])
def test_cube_add_unit_none(ndcube_2d_unit_None, value):
new_cube = ndcube_2d_unit_None + value # perform the addition
expected_uncertainty = ndcube_2d_unit_None.uncertainty.propagate(
operation=np.add,
other_nddata=value,
result_data=new_cube.data,
correlation=0,
)
assert np.allclose(new_cube.data, ndcube_2d_unit_None.data + value.data) # check value of addition result
assert type(new_cube.uncertainty) is type(expected_uncertainty) # check type of uncertainty
assert np.allclose(new_cube.uncertainty.array, expected_uncertainty.array), \
f"Expected uncertainty: {expected_uncertainty}, but got: {new_cube.uncertainty.array}" # check value of uncertainty


@pytest.fixture
def cube(request):
"""Explicitly get fixture values."""
return request.getfixturevalue(request.param)

# The case when only one of them has a unit. other attributes such as result value or uncertainty do not matter.
# Only one of them has a unit.
# An expected typeError should be raised.
# TODO: both have a unit, neither has a unit, one has a unit.
# For now, try figuring out how to make the test be able to
@pytest.mark.parametrize(("cube", "value"),
@pytest.mark.parametrize(("ndc", "value"),
[
("ndcube_2d_unit_None", NDData(np.ones((10, 12)),
("ndcube_2d_uncertainty_no_unit", NDData(np.ones((10, 12)),
wcs=None,
unit=u.m,
uncertainty=StdDevUncertainty(np.ones((10, 12)) * 0.1))
Expand All @@ -1179,73 +1152,170 @@ def cube(request):
uncertainty=StdDevUncertainty(np.ones((10, 12)) * 0.1))
),
],
indirect=["cube"])
def test_cube_add_one_unit(cube, value):
#print(f"cube: {cube}")
assert isinstance(cube, NDCube)
indirect=("ndc",))
def test_cube_add_one_unit(ndc, value):
assert isinstance(ndc, NDCube)
with pytest.raises(TypeError, match="Adding objects requires both have a unit or neither has a unit."):
cube + value
ndc + value


# The case when both NDData and NDCube have uncertainty. No mask is involved.
# Both NDData NDCube have a unit.
# Both NDData and NDCube have unit and uncertainty. No mask is involved.
# Test different scenarios when units are equivalent and when they are not. TODO (bc somewhere is checking the units are the same)
# 1, user input, expected output
# 2, check the codebase itself
@pytest.mark.parametrize('value', [
NDData(np.ones((10, 12)), # pass in the values to be tested as a set of ones.
wcs=None,
unit=u.ct,
uncertainty=StdDevUncertainty(np.ones((10, 12))*0.1, unit=u.ct)),
])
def test_cube_add_both_unit(ndcube_2d_with_unit_uncertainty, value):
new_cube = ndcube_2d_with_unit_uncertainty + value # perform the addition
# what is an equivalent unit in astropy for count (ct)?
@pytest.mark.parametrize(("ndc", "value"),
[
("ndcube_2d_unit_unc", NDData(np.ones((10, 12)), # pass in the values to be tested as a set of ones.
wcs=None,
unit=u.ct,
uncertainty=StdDevUncertainty(np.ones((10, 12))*0.1, unit=u.ct))
),
],
indirect=("ndc",))
def test_cube_add_cube_unit_unc_nddata_unit_unc(ndc, value):
new_cube = ndc + value # perform the addition
# Check uncertainty propagation
expected_uncertainty = ndcube_2d_with_unit_uncertainty.uncertainty.propagate(
expected_uncertainty = ndc.uncertainty.propagate(
operation=np.add,
other_nddata=value,
result_data=new_cube.data*new_cube.unit,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is a bit circular. You shouldn't use outputs of the test to form expected values. Otherwise the test may pass when it shouldn't.

Suggested change
expected_uncertainty = ndc.uncertainty.propagate(
operation=np.add,
other_nddata=value,
result_data=new_cube.data*new_cube.unit,
expected_unit = u.ct
expected_data = (ndc.data * ndc.unit).to_value(expected_unit) + (value.data * value.unit).to_value(expected_unit)
expected_uncertainty = ndc.uncertainty.propagate(
operation=np.add,
other_nddata=value,
result_data=expected_data*expected_unit,

Copy link
Contributor Author

@PCJY PCJY Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @DanRyanIrish , thank you for the suggestions. I checked the code for the assert_cubes_equal method. I am unsure whether it checks the values, type and units of the uncertainty attributes as well.
It looks like it only checks whether the shapes of uncertainties are the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanRyanIrish Or maybe I can
either: use the assert_cube_equal method together with a few more lines that checks the values, type and units of the uncertainty attributes,
or: adding a few more lines into the assert_cube_equal method?

Copy link
Member

@DanRyanIrish DanRyanIrish Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @PCJY. Well spotted. You're right. You should include a check_uncertainty_values=False kwarg to assert_cube_equal and make it check those aspects of the uncertainty if set to True. So the code here would be replaced by something like:

if check_uncertainty_values:
    # Check output and expected uncertainty are of same type. Remember they could be None.
    # If the uncertainties are not None,...
    # Check units, shape, and values of the uncertainty.
elif test_input.uncertainty:
        assert test_input.uncertainty.array.shape == expected_cube.uncertainty.array.shape

Then you can set check_uncertainty_values to True when you call assert_cubes_equal in your tests, and that should do what you need it to do.

Copy link
Contributor Author

@PCJY PCJY Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanRyanIrish I see what you mean, thank you for this suggestion! I will implement this.

correlation=0,
)
assert np.allclose(new_cube.data, ndcube_2d_with_unit_uncertainty.data + value.data)
assert new_cube.unit == u.ct # sometimes explicit, in case the other part is also wrong.
assert np.allclose(new_cube.data, ndc.data + value.data)
assert new_cube.unit == u.ct
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using above suggested changes:

Suggested change
assert np.allclose(new_cube.data, ndc.data + value.data)
assert new_cube.unit == u.ct
assert np.allclose(new_cube.data, expected_data)
assert new_cube.unit == expected_unit

assert type(new_cube.uncertainty) is type(expected_uncertainty) # check type of uncertainty
assert np.allclose(new_cube.uncertainty.array, expected_uncertainty.array), \
f"Expected uncertainty: {expected_uncertainty}, but got: {new_cube.uncertainty.array}" # check value of uncertainty


# NDCube has no uncertainty.
@pytest.mark.parametrize('value', [
NDData(np.ones((10, 12)), # pass in the values to be tested as a set of ones.
wcs=None,
unit=u.ct,
uncertainty=StdDevUncertainty(np.ones((10, 12))*0.1, unit=u.ct)),
])
def test_cube_add_ndcube_uncertainty_none(ndcube_2d_ln_lt_units, value):
new_cube = ndcube_2d_ln_lt_units + value # perform the addition
# Both have unit, NDCube has no uncertainty and NDData has uncertainty.
@pytest.mark.parametrize(("ndc", "value"),
[
("ndcube_2d_ln_lt_units", NDData(np.ones((10, 12)), # pass in the values to be tested as a set of ones.
wcs=None,
unit=u.ct,
uncertainty=StdDevUncertainty(np.ones((10, 12))*0.1, unit=u.ct))
),
],
indirect=("ndc",))
def test_cube_add_cube_unit_nddata_unit_unc(ndc, value):
new_cube = ndc + value # perform the addition

assert new_cube.unit == u.ct
assert np.allclose(new_cube.data, ndcube_2d_ln_lt_units.data + value.data) # check value of addition result
assert type(new_cube.uncertainty) is type(value.uncertainty) # check type of uncertainty
assert np.allclose(new_cube.uncertainty.array, value.uncertainty.array), \
f"Expected uncertainty: {value.uncertainty.array}, but got: {new_cube.uncertainty.array}" # check value of uncertainty

assert np.allclose(new_cube.data, ndc.data + value.data) # check value of addition result

# NDData has no uncertainty. Both have units.
@pytest.mark.parametrize('value', [
NDData(np.ones((10, 12)), unit=u.ct),
])
def test_cube_add_no_uncertainty(ndcube_2d_ln_lt_units, value):
new_cube = ndcube_2d_ln_lt_units + value # perform the addition

# Both have units, NDData has no uncertainty and NDCube has uncertainty.
@pytest.mark.parametrize(("ndc", "value"),
[
("ndcube_2d_unit_unc", NDData(np.ones((10, 12)), # pass in the values to be tested as a set of ones.
wcs=None,
unit=u.ct)
),
],
indirect=("ndc",))
def test_cube_add_cube_unit_unc_nddata_unit(ndc, value):
new_cube = ndc + value # perform the addition

assert new_cube.unit == u.ct
assert np.allclose(new_cube.data, ndcube_2d_ln_lt_units.data + value.data) # check value of addition result
assert type(new_cube.uncertainty) is type(ndc.uncertainty) # check type of uncertainty
assert np.allclose(new_cube.uncertainty.array, ndc.uncertainty.array), \
f"Expected uncertainty: {ndc.uncertainty}, but got: {new_cube.uncertainty.array}" # check value of uncertainty

assert np.allclose(new_cube.data, ndc.data + value.data) # check value of addition result

# Neither NDData nor NDCube has uncertainty or unit.
@pytest.mark.parametrize('value', [
NDData(np.ones((10, 12))), # NDData without unit, without uncertainty
])
def test_cube_add_nddata_uncertainty_none(ndcube_2d_ln_lt_no_unit_uncert, value):
new_cube = ndcube_2d_ln_lt_no_unit_uncert + value # perform the addition

assert np.allclose(new_cube.data, ndcube_2d_ln_lt_no_unit_uncert.data + value.data) # check value of addition result
# Both have units, neither has uncertainty.
@pytest.mark.parametrize(("ndc", "value"),
[
("ndcube_2d_ln_lt_units", NDData(np.ones((10, 12)), # pass in the values to be tested as a set of ones.
wcs=None,
unit=u.ct)
),
],
indirect=("ndc",))
def test_cube_add_cube_unit_nddata_unit(ndc, value):
new_cube = ndc + value # perform the addition

assert np.allclose(new_cube.data, ndc.data + value.data) # check value of addition result


# Neither has a unit, both have uncertainty.
@pytest.mark.parametrize(("ndc", "value"),
[
("ndcube_2d_uncertainty_no_unit", NDData(np.ones((10, 12)), # pass in the values to be tested as a set of ones.
wcs=None,
uncertainty=StdDevUncertainty(np.ones((10, 12))*0.1))
),
],
indirect=("ndc",))
def test_cube_add_cube_unc_nddata_unc(ndc, value):
new_cube = ndc + value # perform the addition

# Check uncertainty propagation
expected_uncertainty = ndc.uncertainty.propagate(
operation=np.add,
other_nddata=value,
result_data=new_cube.data,
correlation=0,
)
assert np.allclose(new_cube.data, ndc.data + value.data)
assert type(new_cube.uncertainty) is type(expected_uncertainty) # check type of uncertainty
assert np.allclose(new_cube.uncertainty.array, expected_uncertainty.array), \
f"Expected uncertainty: {expected_uncertainty}, but got: {new_cube.uncertainty.array}" # check value of uncertainty


# Neither has a unit, NDData has uncertainty and NDCube has no uncertainty.
@pytest.mark.parametrize(("ndc", "value"),
[
("ndcube_2d_ln_lt_no_unit_no_unc", NDData(np.ones((10, 12)), # pass in the values to be tested as a set of ones.
wcs=None,
uncertainty=StdDevUncertainty(np.ones((10, 12))*0.1))
),
],
indirect=("ndc",))
def test_cube_add_cube_nddata_unc(ndc, value):
new_cube = ndc + value # perform the addition
assert type(new_cube.uncertainty) is type(value.uncertainty) # check type of uncertainty
assert np.allclose(new_cube.uncertainty.array, value.uncertainty.array), \
f"Expected uncertainty: {value.uncertainty}, but got: {new_cube.uncertainty.array}" # check value of uncertainty

assert np.allclose(new_cube.data, ndc.data + value.data) # check value of addition result


# Neither has a unit, NDData has no uncertainty and NDCube has uncertainty.
@pytest.mark.parametrize(("ndc", "value"),
[
("ndcube_2d_uncertainty_no_unit", NDData(np.ones((10, 12)), # pass in the values to be tested as a set of ones.
wcs=None)
),
],
indirect=("ndc",))
def test_cube_add_cube_unc_nddata(ndc, value):
new_cube = ndc + value # perform the addition

assert type(new_cube.uncertainty) is type(ndc.uncertainty) # check type of uncertainty
assert np.allclose(new_cube.uncertainty.array, ndc.uncertainty.array), \
f"Expected uncertainty: {ndc.uncertainty}, but got: {new_cube.uncertainty.array}" # check value of uncertainty

assert np.allclose(new_cube.data, ndc.data + value.data) # check value of addition result


# Neither has unit or uncertainty.
@pytest.mark.parametrize(("ndc", "value"),
[
("ndcube_2d_ln_lt_no_unit_no_unc", NDData(np.ones((10, 12)), # pass in the values to be tested as a set of ones.
wcs=None)
),
],
indirect=("ndc",))
def test_cube_add_cube_nddata(ndc, value):
new_cube = ndc + value # perform the addition

assert np.allclose(new_cube.data, ndc.data + value.data) # check value of addition result


# The case when both NDData and NDCube have uncertainty, unit. Also:
Expand All @@ -1261,7 +1331,7 @@ def test_cube_add_nddata_uncertainty_none(ndcube_2d_ln_lt_no_unit_uncert, value)
uncertainty=StdDevUncertainty(np.ones((10, 12)) * 0.05),
mask=np.ones((10, 12), dtype=bool))
])
def test_cube_add_masked_value(ndcube_2d_ln_lt_mask, value):
def test_cube_add_cube_unit_mask_nddata_unc_unit_mask(ndcube_2d_ln_lt_mask, value):
with pytest.raises(TypeError, match='Please use the add method.'):
ndcube_2d_ln_lt_mask + value

Expand Down