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

Test failure with hypothesis 4.42.0 #135

Open
astrofrog opened this issue Nov 21, 2019 · 2 comments
Open

Test failure with hypothesis 4.42.0 #135

astrofrog opened this issue Nov 21, 2019 · 2 comments
Labels

Comments

@astrofrog
Copy link
Member

A new test failure has appeared with hypothesis 4.42.0:

_____________________________________________________________ test_vec2ang _____________________________________________________________

    @given(vectors=arrays(float, (3,), elements=floats(-1, 1)).filter(not_at_origin),
>          lonlat=booleans(), ndim=integers(0, 4))
    @settings(max_examples=500, derandomize=True)
    def test_vec2ang(vectors, lonlat, ndim):

astropy_healpix/tests/test_healpy.py:209: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

vectors = array([ -0.00000000e+00,  -0.00000000e+00,   2.22044605e-16]), lonlat = False, ndim = 0

    @given(vectors=arrays(float, (3,), elements=floats(-1, 1)).filter(not_at_origin),
           lonlat=booleans(), ndim=integers(0, 4))
    @settings(max_examples=500, derandomize=True)
    def test_vec2ang(vectors, lonlat, ndim):
        vectors = np.broadcast_to(vectors, (2,) * ndim + (3,))
        theta1, phi1 = hp_compat.vec2ang(vectors, lonlat=lonlat)
        theta2, phi2 = hp.vec2ang(vectors, lonlat=lonlat)
        # Healpy sometimes returns NaNs for phi (somewhat incorrectly)
        phi2 = np.nan_to_num(phi2)
        assert_allclose(theta1, theta1, atol=1e-10)
>       assert_allclose(phi1, phi2, atol=1e-10)
E       AssertionError: 
E       Not equal to tolerance rtol=1e-07, atol=1e-10
E       
E       Mismatch: 100%
E       Max absolute difference: 3.141592653589793
E       Max relative difference: 1.0
E        x: array([ 0.])
E        y: array([ 3.141593])

astropy_healpix/tests/test_healpy.py:218: AssertionError
-------------------------------------------------------------- Hypothesis -----------------------------------------------------

I think this is a real failing test case rather than a hypothesis issue. Maybe we shouldn't be comparing phi values for theta=0 or theta=pi?

@cdeil
Copy link
Member

cdeil commented Nov 21, 2019

Maybe we shouldn't be comparing phi values for theta=0 or theta=pi?

Yes, phi is meaningless at the poles.

@pllim
Copy link
Member

pllim commented Jun 14, 2022

I don't see CI failing, so has this been solved?

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

No branches or pull requests

3 participants