8000 ENH: Adding __array_ufunc__ capability to MaskedArrays (again) by greglucas · Pull Request #22914 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Adding __array_ufunc__ capability to MaskedArrays (again) #22914

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

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ab732d0
ENH: Adding __array_ufunc__ capability to MaskedArrays.
greglucas Apr 15, 2020
63df460
DOC: Adding improvement note for MaskedArray ufunc
greglucas Apr 14, 2021
a63e97a
nomask in nomask out
rcomer Jul 13, 2022
eca1e3c
BUG: fix ma.minimum.reduce with axis keyword
rcomer Jul 16, 2022
997d27d
TST: add a test for ma.minimum.reduce with axis keyword
rcomer Jul 16, 2022
bd091a6
MNT: Remove __add__ and other unnecessary overrides
greglucas Jul 23, 2022
b5b9ad3
ENH: Add sign ufunc to masked arrays
greglucas Jul 23, 2022
d0ac064
ENH: Remove masked ufunc power restriction
greglucas Jul 23, 2022
dd74620
ENH: Add masked invert ufunc
greglucas Jul 23, 2022
c638cdc
MNT: Remove some restrictions on masked array ufunc implementations
greglucas Jul 23, 2022
b35c309
FIX: Rearrange handling of ndarray-like ufuncs
greglucas Jul 24, 2022
de22beb
FIX: Pass kwargs through ufunc reduce
greglucas Jul 24, 2022
9564f27
MNT: Add power ufunc to masked arrays
greglucas Jul 24, 2022
a7ba76f
FIX: add back getmaskarray to __array_wrap__ of masked arrays
greglucas Jul 24, 2022
fa6c56f
FIX: view should return the type(self) rather than MaskedArray
greglucas Jul 24, 2022
cbfd86f
FIX: Revert sum and trace overrides from masked arrays
greglucas Jul 24, 2022
4a58583
ENH: Add rint and update round method
greglucas Jul 24, 2022
2acf530
FIX: Change back partition/argpartition
greglucas Jul 24, 2022
e6e80e6
FIX: Remove compress updates
greglucas Jul 24, 2022
366dfc3
MAINT: Remove unused delegate_binop code
greglucas Jan 2, 2023
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
Prev Previous commit
Next Next commit
MNT: Add power ufunc to masked arrays
  • Loading branch information
greglucas committed Jan 3, 2023
commit 9564f27fd03bcade82cfdd6aa350f394b701b961
19 changes: 2 additions & 17 deletions numpy/ma/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
'product', 'ptp', 'put', 'putmask', 'ravel', 'remainder',
'repeat', 'reshape', 'resize', 'right_shift', 'round', 'round_',
'set_fill_value', 'shape', 'sin', 'sign', 'sinh', 'size', 'soften_mask',
'sometrue', 'sort', 'sqrt', 'squeeze', 'std', 'subtract', 'sum',
'sometrue', 'sort', 'sqrt', 'square', 'squeeze', 'std', 'subtract', 'sum',
'swapaxes', 'take', 'tan', 'tanh', 'trace', 'transpose', 'true_divide',
'var', 'where', 'zeros', 'zeros_like',
]
Expand Down Expand Up @@ -1230,6 +1230,7 @@ def __call__(self, a, b, *args, **kwargs):
isfinite = _MaskedUnaryOperation(umath.isfinite)
invert = _MaskedUnaryOperation(np.invert)
sign = _MaskedUnaryOperation(umath.sign)
square = _MaskedUnaryOperation(umath.square)

# Domained unary ufuncs
sqrt = _MaskedUnaryOperation(umath.sqrt, 0.0,
Expand Down Expand Up @@ -4305,22 +4306,6 @@ def __ge__(self, other):
def __gt__(self, other):
return self._comparison(other, operator.gt)

def __pow__(self, other):
"""
Raise self to the power other, masking the potential NaNs/Infs

"""
if self._delegate_binop(other):
return NotImplemented
return power(self, other)

def __rpow__(self, other):
"""
Raise other to the power self, masking the potential NaNs/Infs

"""
return power(other, self)

def __iadd__(self, other):
"""
Add other to self in-place.
Expand Down
0