-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Broadcasting with masked array doesn't work with divide (after tile instruction) (Trac #2035) #2627
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
Comments
Attachment added by trac user elephantterrible on 2012-02-02: ma_tiling_issue.py |
@bsouthey wrote on 2012-02-02 The error appears to be in call to 'numpy.core.numeric.array' at line 827 numpy/lib/shape_base.py:
Also, setting 'copy=True' in the call does not change anything.
|
@rgommers wrote on 2012-02-20 |
Milestone changed to |
Still open 1.9-devel. |
A similar issue with np.tile modifying the mask of MaskedArrays was reported in #3140 |
Hello, I have run the snippet of code and it is not failing anymore: possibly fixed at the same time as #3140? >>> import numpy as np
>>> np.__version__
'1.24.0.dev0+934.gdb7414b7f'
>>> import numpy.core.numeric as _nx
>>> b=np.ma.array([[1,2,3],[4,5,6]], mask=[[1,0,0],[1,0,0]])
>>> d=4
>>> c = _nx.array(b,copy=True,subok=True,ndmin=d)
>>> b/4
masked_array(
data=[[--, 0.5, 0.75],
[--, 1.25, 1.5]],
mask=[[ True, False, False],
[ True, False, False]],
fill_value=1e+20)
>>> c = _nx.array(b,copy=False,subok=True,ndmin=d)
>>> b/4
masked_array(
data=[[--, 0.5, 0.75],
[--, 1.25, 1.5]],
mask=[[ True, False, False],
[ True, False, False]],
fill_value=1e+20) Thanks for listening. |
OK, closing. Thanks for checking. |
Original ticket http://projects.scipy.org/numpy/ticket/2035 on 2012-02-02 by trac user elephantterrible, assigned to unknown.
Broadcasting in a division does not work after a tile instruction.
See attached script to reproduce.
If the tile instruction is commented out, the division works.
Division also works if numpy.divide() is used, or if there's no masked value.
Python gives the following error:
The error occurs in all numpy versions (1.5.1, 1.6.1, 2.0.0.dev) with python 2.7.1
The original bug discussion is on numpy-discuss:
http://www.mail-archive.com/numpy-discussion@scipy.org/msg35146.html
The text was updated successfully, but these errors were encountered: