Skip to content
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

MAINT: Hide nan warnings for masked internal MA computations #7349

Merged
merged 1 commit into from
Feb 27, 2016

Conversation

ahaldane
Copy link
Member

This prevents RuntimeWarnings when there is a np.nan value in a masked position in a masked array, eg

>>> a = np.ma.array([0.5, np.nan], mask=[0,1])
>>> a > 0
/usr/bin/ipython2:1: RuntimeWarning: invalid value encountered in greater
#!/usr/bin/python2
masked_array(data = [True --],
             mask = [False  True],
       fill_value = True)

(This PR was split off from #5706)

On my computer I'm still having trouble getting the unit tests actually detect the warnings, even though I see them in a python shell. I'm adding a temporary commit that should cause unit tests to fail, to see if appveyor catches it.

@charris
Copy link
Member

charris commented Feb 26, 2016

"this should fail" is pretty uninformative, needs improvement.

@ahaldane
Copy link
Member Author

The last commit is temporary, I'll remove it in a minute. It reverts some of the changes of the previous commit to make sure the unit tests fail.

@@ -1123,7 +1129,7 @@ def __call__(self, a, b, *args, **kwargs):
# Apply the domain
domain = ufunc_domain.get(self.f, None)
if domain is not None:
m |= filled(domain(da, db), True)
m |= domain(da, db)
Copy link
Member

Choose a reason for hiding this comment

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

This change seems radical. What is the intent?

Copy link
Member Author

Choose a reason for hiding this comment

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

The call to filled has no effect since da and db have no masked values (they are just the data arrays of a and b).

@charris
Copy link
Member

charris commented Feb 26, 2016

Some comments would help keep/make the code more understandable.

@mhvk
Copy link
Contributor

mhvk commented Feb 27, 2016

Looks good!

charris added a commit that referenced this pull request Feb 27, 2016
MAINT: Hide nan warnings for masked internal MA computations
@charris charris merged commit 140552d into numpy:master Feb 27, 2016
@charris
Copy link
Member

charris commented Feb 27, 2016

Thanks Allan.

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

Successfully merging this pull request may close these issues.

None yet

3 participants