Thanks to visit codestin.com
Credit goes to github.com

Skip to content

empty_like does not copy mask (Trac #1979) #2572

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

Closed
numpy-gitbot opened this issue Oct 19, 2012 · 2 comments
Closed

empty_like does not copy mask (Trac #1979) #2572

numpy-gitbot opened this issue Oct 19, 2012 · 2 comments

Comments

@numpy-gitbot
Copy link

Original ticket http://projects.scipy.org/numpy/ticket/1979 on 2011-11-14 by trac user mauro, assigned to unknown.

If empty_like (and also zeros_like, ones_like) is called with a masked array, then the returned array's mask is identical to the originals (i.e. shares same reference).

I think what should happen is that a new mask is returned set to False.

@numpy-gitbot
Copy link
Author

Attachment added by trac user mauro on 2011-11-14: empty_like_ma_bug.py

tomyun added a commit to tomyun/numpy that referenced this issue Jun 5, 2013
As underlying `empty_like()` knows nothing about mask, it would be
`_convert2ma`'s job to properly set up the output mask. `copy` argument
is added to figure out which functions need this behavior.

`ones_like()` and `zeros_like()` which were mere aliases of regular
numpy functions now go through `_convert2ma` as well.

Hopefully this fixes numpy#3145, numpy#2572.
@jjhelmus
Copy link
Contributor

PR #5203 addresses this issue and I believe this can be closed.

The current behavior of empty_like, zeros_like, etc is that the retuned array's mask is identical to the original but does not share a reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants