BUG Ensure NotImplemented is passed on in MaskedArray ufunc's#3900
BUG Ensure NotImplemented is passed on in MaskedArray ufunc's#3900charris merged 3 commits intonumpy:masterfrom
Conversation
|
Needs tests. |
|
Needs tests.
|
not having contributed to numpy before, I'm not familiar with its Prof. M. H. van Kerkwijk |
|
All you need to do is install nose. After that the easiest way to proceed is |
|
@charris - thanks, that probably saved me hours! Now added test cases. |
numpy/ma/tests/test_core.py
Outdated
There was a problem hiding this comment.
For nose related reasons, don't use docstrings in tests, just do # ...
|
Looking good, just a few issues. |
|
This will need a backport to both 1.8.x and 1.7.x. |
|
@charris - OK on all except the |
|
@charris - on the backport, do I need to do anything for that? |
|
It's probably easier for me to do the backports unless you want the experience. The docstring thing isn't a major point and the masked arrays haven't seen much maintenance in years. If you fixup the rest of the functions in another PR, that would be great and I'll go ahead and put this in when Travis passes. |
|
In it goes, thanks. If you fix the docstrings it might be worth doing a PEP8 cleanup at the same time. I don't know how conformant the file is at the moment. |
BUG Ensure NotImplemented is passed on in MaskedArray ufunc's
Currently, masked array
ufuncreplacements do not check whether theufunccall on the data proper actually works (see below). This PR ensures that they pass onNotImplementedif needed, so that classes more interesting than thestringbelow will have a chance to try to do the reverse operation.Note that this is a long-standing bug; I'm not sure how far it can be backported, but hope it can make 1.8.0.
p.s. The reason I stumbled upon this is that I am trying to implement a
MaskedQuantityclass forastropy[1]. For this package, we already haveUnitandQuantityclasses, and set it up such thatarray * unitreturns aQuantity; I'd hope to do havemasked_array * unitsimilarly to return aMaskedQuantity.[1] http://docs.astropy.org/en/latest/units/quantity.html