Skip to content

Flaky test_scattering_angles_with_gravity_invariant_under_rotation ? #686

@nvaytet

Description

@nvaytet

See run here: https://github.com/scipp/scippneutron/actions/runs/22857790890/job/66302875350?pr=685

=================================== FAILURES ===================================
_________ test_scattering_angles_with_gravity_invariant_under_rotation _________

    @given(rotation=rotations())
>   @settings(max_examples=10)
                   ^^^

tests/conversion/beamline_conversions_test.py:695: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/conversion/beamline_conversions_test.py:721: in test_scattering_angles_with_gravity_invariant_under_rotation
    sc.testing.assert_allclose(original['two_theta'], rotated['two_theta'])
.tox/py311/lib/python3.11/site-packages/scipp/testing/assertions.py:70: in assert_allclose
    return _assert_similar(_assert_allclose_impl, a, b, rtol=rtol, atol=atol, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/py311/lib/python3.11/site-packages/scipp/testing/assertions.py:104: in _assert_similar
    impl(*args, **kwargs)
.tox/py311/lib/python3.11/site-packages/scipp/testing/assertions.py:136: in _assert_allclose_impl
    _assert_allclose_data(a, b, **kwargs)
.tox/py311/lib/python3.11/site-packages/scipp/testing/assertions.py:244: in _assert_allclose_data
    _assert_allclose_variable_data(a, b, **kwargs)
.tox/py311/lib/python3.11/site-packages/scipp/testing/assertions.py:255: in _assert_allclose_variable_data
    _assert_allclose_dense_variable_data(a, b, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = <scipp.Variable> (wavelength: 3, det: 2)    float64            [rad]  [0.685674, 0.552127, ..., 0.685672, 0.552129]
b = <scipp.Variable> (wavelength: 3, det: 2)    float64            [rad]  [0.685671, 0.552128, ..., 0.685673, 0.552126]
rtol = None, atol = None, kwargs = {}

    def _assert_allclose_dense_variable_data(
        a: Variable,
        b: Variable,
        rtol: Variable | None = None,
        atol: Variable | None = None,
        **kwargs: Any,
    ) -> None:
        if rtol is not None:
            kwargs['rtol'] = rtol.to(unit='dimensionless').value
        if atol is not None:
            if hasattr(a, 'unit'):
                atol = atol.to(unit=a.unit)
            else:
                atol = atol.to(unit='dimensionless')
            kwargs['atol'] = atol.value
    
        with _add_note('values'):
>           np.testing.assert_allclose(
                a.values, b.values, err_msg='when comparing values', **kwargs
            )
E           AssertionError: 
E           Not equal to tolerance rtol=1e-07, atol=0
E           when comparing values
E           Mismatched elements: 6 / 6 (100%)
E           Max absolute difference among violations: 2.36802898e-06
E           Max relative difference among violations: 4.19456698e-06
E            ACTUAL: array([[0.685674, 0.552127],
E                  [0.685672, 0.552128],
E                  [0.685672, 0.552129]])
E            DESIRED: array([[0.685671, 0.552128],
E                  [0.685673, 0.552127],
E                  [0.685673, 0.552126]])
E           in values
E           Falsifying example: test_scattering_angles_with_gravity_invariant_under_rotation(
E               rotation=(lambda q: sc.spatial.rotation(value=q / np.linalg.norm(q)))(
E                   array([4.95652019e-160, 4.95652019e-160, 4.95652019e-160, 4.95652019e-160]),
E               ),
E           )
E           Explanation:
E               These lines were always and only run by failing examples:
E                   /home/runner/work/scippneutron/scippneutron/.tox/py311/lib/python3.11/site-packages/numpy/_core/arrayprint.py:1016
E                   /home/runner/work/scippneutron/scippneutron/.tox/py311/lib/python3.11/site-packages/numpy/_core/arrayprint.py:1021
E                   /home/runner/work/scippneutron/scippneutron/.tox/py311/lib/python3.11/site-packages/numpy/_core/fromnumeric.py:102
E                   /home/runner/work/scippneutron/scippneutron/.tox/py311/lib/python3.11/site-packages/numpy/testing/_private/utils.py:872
E                   /home/runner/work/scippneutron/scippneutron/.tox/py311/lib/python3.11/site-packages/numpy/testing/_private/utils.py:880
E                   (and 19 more with settings.verbosity >= verbose)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions