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: replace np.isinf(x) & (x>0) -> np.isposinf(x) to avoid RuntimeWarning #3381

Merged
merged 1 commit into from
Feb 24, 2014

Conversation

argriffing
Copy link
Contributor

This fixes warnings of the type

scipy/special/_testutils.py", line 244, in check
    pinf_x = np.isinf(x) & (x > 0)
RuntimeWarning: invalid value encountered in greater

and is less complicated.

>>> import numpy as np
>>> a = np.nan
>>> b = np.inf
>>> c = -np.inf
>>> d = 4
>>> e = np.array([a, b, c, d])
>>> for x in (a, b, c, d, e): print np.isposinf(x)
... 
False
True
False
False
[False  True False False]
>>> for x in (a, b, c, d, e): print np.isinf(x) & (x > 0)
... 
False
True
False
False
__main__:1: RuntimeWarning: invalid value encountered in greater
[False  True False False]

This fix is pillaged from #3370.

@pv pv added the PR label Feb 24, 2014
pv added a commit that referenced this pull request Feb 24, 2014
MAINT: replace np.isinf(x) & (x>0) -> np.isposinf(x) to avoid RuntimeWarning
@pv pv merged commit 6dc9dce into scipy:master Feb 24, 2014
@pv
Copy link
Member

pv commented Feb 24, 2014

Thanks, LGTM

@rgommers rgommers added this to the 0.14.0 milestone Feb 24, 2014
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.

None yet

4 participants