Skip to content

Revert line from #4585 to get mask, data shapes to match in .flat #4615

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

Merged
merged 1 commit into from
Apr 12, 2014

Conversation

mhvk
Copy link
Contributor

@mhvk mhvk commented Apr 12, 2014

@charris -- this reverts the shape assignment and adds a test for the problematic matrix masked array example that you gave in #4585. Now, as expected:

n [1]: import numpy as np; from numpy.ma import MaskedArray

In [2]: a = MaskedArray(np.matrix(np.eye(3)), mask=0)

In [3]: a
Out[3]: 
masked_matrix(data =
 [[1.0 0.0 0.0]
 [0.0 1.0 0.0]
 [0.0 0.0 1.0]],
              mask =
 [[False False False]
 [False False False]
 [False False False]],
        fill_value = 1e+20)


In [4]: a.flat[:2]
Out[4]: 
masked_matrix(data =
 [[1.0 0.0]],
              mask =
 [[False False]],
        fill_value = 1e+20)

@@ -1305,6 +1305,7 @@ def test_shrink_mask(self):
assert_equal(a.mask, nomask)

def test_flat(self):
"""Test that flat can return all types of items [#4585, #4615]"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not use docstrings in tests, use comments #... instead. It makes the nose output more readable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we haven't yet fixed all tests for this, especially the corroded antiquities. Software years are so very short...

@mhvk
Copy link
Contributor Author

mhvk commented Apr 12, 2014

@charris -- ok, changed docstring to comment (these are astropy habits coming through -- there, the request is the opposite).

I do still hope to get to changing MaskedArray to use the new __numpy_ufunc__, but best to work in small steps.

@charris
Copy link
Member

charris commented Apr 12, 2014

Fast. LGTM pending travis.

charris added a commit that referenced this pull request Apr 12, 2014
Revert line from #4585 to get mask, data shapes to match in .flat
@charris charris merged commit 61c699e into numpy:master Apr 12, 2014
@charris
Copy link
Member

charris commented Apr 12, 2014

Merged, thanks Marten.

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

Successfully merging this pull request may close these issues.

2 participants