Skip to content

Commit 1afaffe

Browse files
committed
Merge branch 'nddataArithmetic' of https://github.com/PCJY/ndcube into nddataArithmetic
2 parents af0a31d + 65c6ebc commit 1afaffe

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

ndcube/ndcube.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -983,25 +983,20 @@ def add(self, value, handle_mask=np.logical_and):
983983
# addition
984984
kwargs["data"] = self.data + value_data # ignoring the mask here
985985
result_data = kwargs["data"]
986+
kwargs["uncertainty"] = self._combine_uncertainty(value, result_data)
986987

987988
if self.mask is None and value.mask is None:
988989
# combine the uncertainty, it can be propagated without any issue.
989-
kwargs["uncertainty"] = self.combine_uncertainty(value, result_data)
990+
pass
990991

991992
elif self.mask is None:
992993
kwargs["mask"] = value.mask # mask needs to be set.
993-
# combine the uncertainty
994-
kwargs["uncertainty"] = self.combine_uncertainty(value, result_data)
995994

996995
elif value.mask is None:
997996
kwargs["mask"] = self.mask
998-
# combine the uncertainty
999-
kwargs["uncertainty"] = self.combine_uncertainty(value, result_data)
1000997

1001998
else:
1002999
kwargs["mask"] = handle_mask(self.mask, value.mask)
1003-
# combine the uncertainty
1004-
kwargs["uncertainty"] = self.combine_uncertainty(value, result_data)
10051000

10061001

10071002
elif hasattr(value, 'unit'):
@@ -1039,7 +1034,7 @@ def __add__(self, value):
10391034

10401035
return self.add(value) # without any mask, the add method can be called here and will work properly without needing arguments to be passed.
10411036

1042-
def combine_uncertainty(self, value, result_data):
1037+
def _combine_uncertainty(self, value, result_data):
10431038
# combine the uncertainty;
10441039
if self.uncertainty is not None and value.uncertainty is not None:
10451040
if self.unit is not None:

0 commit comments

Comments
 (0)