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, TST: test failures against NumPy main #20062

Closed
tylerjereddy opened this issue Feb 9, 2024 · 4 comments · Fixed by #20067
Closed

MAINT, TST: test failures against NumPy main #20062

tylerjereddy opened this issue Feb 9, 2024 · 4 comments · Fixed by #20067
Labels
maintenance Items related to regular maintenance tasks scipy.fft
Milestone

Comments

@tylerjereddy
Copy link
Contributor

Details of test failures
============================================================================================ FAILURES =============================================================================================
___________________________________________________________________________________ TestSingleIFFT.test_djbfft ____________________________________________________________________________________
[gw4] linux -- Python 3.11.2 /home/treddy/python_venvs/py_311_scipy_dev/bin/python
scipy/fft/_pocketfft/tests/test_basic.py:226: in test_djbfft
    assert_allclose(y,y2, rtol=self.rtol, atol=self.atol)
        i          = 2
        n          = 4
        self       = <scipy.fft._pocketfft.tests.test_basic.TestSingleIFFT object at 0x7fef57d8d510>
        x          = array([0, 1, 2, 3])
        y          = array([ 1.5+0.j , -0.5-0.5j, -0.5+0.j , -0.5+0.5j], dtype=complex64)
        y2         = array([ 0.+0.j, -0.-0.j, -0.+0.j, -0.+0.j])
../../../../../spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/python-3.11.2-4qncg2nqev5evxfmamde3e6rnb34b4ls/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
E   AssertionError: 
E   Not equal to tolerance rtol=1e-05, atol=0.0001
E   
E   Mismatched elements: 4 / 4 (100%)
E   Max absolute difference among violations: 1.5
E   Max relative difference among violations: inf
E    ACTUAL: array([ 1.5+0.j , -0.5-0.5j, -0.5+0.j , -0.5+0.5j], dtype=complex64)
E    DESIRED: array([ 0.+0.j, -0.-0.j, -0.+0.j, -0.+0.j])
        args       = (<function assert_allclose.<locals>.compare at 0x7fef5ab8cb80>, array([ 1.5+0.j , -0.5-0.5j, -0.5+0.j , -0.5+0.5j], dtype=complex64), array([ 0.+0.j, -0.-0.j, -0.+0.j, -0.+0.j]))
        func       = <function assert_array_compare at 0x7fef5aa5f2e0>
        kwds       = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-05, atol=0.0001', 'strict': False, ...}
        self       = <contextlib._GeneratorContextManager object at 0x7fef5aa6b850>
_______________________________________________________________________________ test_backend_call[ifft-ifft-mock3] ________________________________________________________________________________
[gw7] linux -- Python 3.11.2 /home/treddy/python_venvs/py_311_scipy_dev/bin/python
scipy/fft/tests/test_backend.py:60: in test_backend_call
    assert_allclose(func(x), answer, atol=1e-10)
        answer     = array([[ 0.+0.j, -0.+0.j],
       [ 0.+0.j, -0.+0.j],
       [ 0.+0.j, -0.+0.j],
       [ 0.+0.j, -0.+0.j],
       [ 0... -0.+0.j],
       [ 0.+0.j, -0.+0.j],
       [ 0.+0.j, -0.+0.j],
       [ 0.+0.j, -0.+0.j],
       [ 0.+0.j, -0.+0.j]])
        func       = <uarray multimethod 'ifft'>
        mock       = <scipy.fft.tests.mock_backend._MockFunction object at 0x7f02aca57d10>
        np_func    = <function ifft at 0x7f02af6587b0>
        x          = array([[ 0,  1],
       [ 2,  3],
       [ 4,  5],
       [ 6,  7],
       [ 8,  9],
       [10, 11],
       [12, 13],
       [14, 15],
       [16, 17],
       [18, 19]])
../../../../../spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/python-3.11.2-4qncg2nqev5evxfmamde3e6rnb34b4ls/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
E   AssertionError: 
E   Not equal to tolerance rtol=1e-07, atol=1e-10
E   
E   Mismatched elements: 20 / 20 (100%)
E   Max absolute difference among violations: 18.5
E   Max relative difference among violations: inf
E    ACTUAL: array([[ 0.5-0.j, -0.5-0.j],
E          [ 2.5-0.j, -0.5-0.j],
E          [ 4.5-0.j, -0.5-0.j],...
E    DESIRED: array([[ 0.+0.j, -0.+0.j],
E          [ 0.+0.j, -0.+0.j],
E          [ 0.+0.j, -0.+0.j],...
        args       = (<function assert_allclose.<locals>.compare at 0x7f0294cb58a0>, array([[ 0.5-0.j, -0.5-0.j],
       [ 2.5-0.j, -0.5-0....-0.+0.j],
       [ 0.+0.j, -0.+0.j],
       [ 0.+0.j, -0.+0.j],
       [ 0.+0.j, -0.+0.j],
       [ 0.+0.j, -0.+0.j]]))
        func       = <function assert_array_compare at 0x7f02aff6f2e0>
        kwds       = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=1e-10', 'strict': False, ...}
        self       = <contextlib._GeneratorContextManager object at 0x7f02aff7b310>
______________________________________________________________________________ test_backend_call[ifft2-ifft2-mock4] _______________________________________________________________________________
[gw7] linux -- Python 3.11.2 /home/treddy/python_venvs/py_311_scipy_dev/bin/python
scipy/fft/tests/test_backend.py:60: in test_backend_call
    assert_allclose(func(x), answer, atol=1e-10)
        answer     = array([[ 0.+0.j, -0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0...  0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j]])
        func       = <uarray multimethod 'ifft2'>
        mock       = <scipy.fft.tests.mock_backend._MockFunction object at 0x7f02aca57d90>
        np_func    = <function ifft2 at 0x7f02af659770>
        x          = array([[ 0,  1],
       [ 2,  3],
       [ 4,  5],
       [ 6,  7],
       [ 8,  9],
       [10, 11],
       [12, 13],
       [14, 15],
       [16, 17],
       [18, 19]])
../../../../../spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/python-3.11.2-4qncg2nqev5evxfmamde3e6rnb34b4ls/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
E   AssertionError: 
E   Not equal to tolerance rtol=1e-07, atol=1e-10
E   
E   Mismatched elements: 11 / 20 (55%)
E   Max absolute difference among violations: 9.5
E   Max relative difference among violations: inf
E    ACTUAL: array([[ 9.500000e+00-0.000000e+00j, -5.000000e-01-0.000000e+00j],
E          [-1.000000e+00-3.077684e+00j,  0.000000e+00+0.000000e+00j],
E          [-1.000000e+00-1.376382e+00j,  0.000000e+00+0.000000e+00j],...
E    DESIRED: array([[ 0.+0.j, -0.+0.j],
E          [ 0.+0.j,  0.+0.j],
E          [ 0.+0.j,  0.+0.j],...
        args       = (<function assert_allclose.<locals>.compare at 0x7f0294cb5080>, array([[ 9.50000000e+00-0.00000000e+00j, -5.00000000e-... 0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j]]))
        func       = <function assert_array_compare at 0x7f02aff6f2e0>
        kwds       = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=1e-10', 'strict': False, ...}
        self       = <contextlib._GeneratorContextManager object at 0x7f02aff7b310>
______________________________________________________________________________ test_backend_call[ifftn-ifftn-mock5] _______________________________________________________________________________
[gw7] linux -- Python 3.11.2 /home/treddy/python_venvs/py_311_scipy_dev/bin/python
scipy/fft/tests/test_backend.py:60: in test_backend_call
    assert_allclose(func(x), answer, atol=1e-10)
        answer     = array([[ 0.+0.j, -0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0...  0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j]])
        func       = <uarray multimethod 'ifftn'>
        mock       = <scipy.fft.tests.mock_backend._MockFunction object at 0x7f02aca57e50>
        np_func    = <function ifftn at 0x7f02af659370>
        x          = array([[ 0,  1],
       [ 2,  3],
       [ 4,  5],
       [ 6,  7],
       [ 8,  9],
       [10, 11],
       [12, 13],
       [14, 15],
       [16, 17],
       [18, 19]])
../../../../../spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/python-3.11.2-4qncg2nqev5evxfmamde3e6rnb34b4ls/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
E   AssertionError: 
E   Not equal to tolerance rtol=1e-07, atol=1e-10
E   
E   Mismatched elements: 11 / 20 (55%)
E   Max absolute difference among violations: 9.5
E   Max relative difference among violations: inf
E    ACTUAL: array([[ 9.500000e+00-0.000000e+00j, -5.000000e-01-0.000000e+00j],
E          [-1.000000e+00-3.077684e+00j,  0.000000e+00+0.000000e+00j],
E          [-1.000000e+00-1.376382e+00j,  0.000000e+00+0.000000e+00j],...
E    DESIRED: array([[ 0.+0.j, -0.+0.j],
E          [ 0.+0.j,  0.+0.j],
E          [ 0.+0.j,  0.+0.j],...
        args       = (<function assert_allclose.<locals>.compare at 0x7f0294cb5440>, array([[ 9.50000000e+00-0.00000000e+00j, -5.00000000e-... 0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j]]))
        func       = <function assert_array_compare at 0x7f02aff6f2e0>
        kwds       = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=1e-10', 'strict': False, ...}
        self       = <contextlib._GeneratorContextManager object at 0x7f02aff7b310>
______________________________________________________________________________ test_backend_call[irfft-irfft-mock9] _______________________________________________________________________________
[gw7] linux -- Python 3.11.2 /home/treddy/python_venvs/py_311_scipy_dev/bin/python
scipy/fft/tests/test_backend.py:60: in test_backend_call
    assert_allclose(func(x), answer, atol=1e-10)
        answer     = array([[ 0., -0.],
       [ 0., -0.],
       [ 0., -0.],
       [ 0., -0.],
       [ 0., -0.],
       [ 0., -0.],
       [ 0., -0.],
       [ 0., -0.],
       [ 0., -0.],
       [ 0., -0.]])
        func       = <uarray multimethod 'irfft'>
        mock       = <scipy.fft.tests.mock_backend._MockFunction object at 0x7f02aca5c190>
        np_func    = <function irfft at 0x7f02af658bb0>
        x          = array([[ 0,  1],
       [ 2,  3],
       [ 4,  5],
       [ 6,  7],
       [ 8,  9],
       [10, 11],
       [12, 13],
       [14, 15],
       [16, 17],
       [18, 19]])
../../../../../spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/python-3.11.2-4qncg2nqev5evxfmamde3e6rnb34b4ls/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
E   AssertionError: 
E   Not equal to tolerance rtol=1e-07, atol=1e-10
E   
E   Mismatched elements: 20 / 20 (100%)
E   Max absolute difference among violations: 18.5
E   Max relative difference among violations: inf
E    ACTUAL: array([[ 0.5, -0.5],
E          [ 2.5, -0.5],
E          [ 4.5, -0.5],...
E    DESIRED: array([[ 0., -0.],
E          [ 0., -0.],
E          [ 0., -0.],...
        args       = (<function assert_allclose.<locals>.compare at 0x7f0294cc0e00>, array([[ 0.5, -0.5],
       [ 2.5, -0.5],
       [ 4.5....],
       [ 0., -0.],
       [ 0., -0.],
       [ 0., -0.],
       [ 0., -0.],
       [ 0., -0.],
       [ 0., -0.]]))
        func       = <function assert_array_compare at 0x7f02aff6f2e0>
        kwds       = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=1e-10', 'strict': False, ...}
        self       = <contextlib._GeneratorContextManager object at 0x7f02aff7b310>
_____________________________________________________________________________ test_backend_call[irfft2-irfft2-mock10] _____________________________________________________________________________
[gw7] linux -- Python 3.11.2 /home/treddy/python_venvs/py_311_scipy_dev/bin/python
scipy/fft/tests/test_backend.py:60: in test_backend_call
    assert_allclose(func(x), answer, atol=1e-10)
        answer     = array([[ 0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.]])
        func       = <uarray multimethod 'irfft2'>
        mock       = <scipy.fft.tests.mock_backend._MockFunction object at 0x7f02aca5c250>
        np_func    = <function irfft2 at 0x7f02af659f70>
        x          = array([[ 0,  1],
       [ 2,  3],
       [ 4,  5],
       [ 6,  7],
       [ 8,  9],
       [10, 11],
       [12, 13],
       [14, 15],
       [16, 17],
       [18, 19]])
../../../../../spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/python-3.11.2-4qncg2nqev5evxfmamde3e6rnb34b4ls/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
E   AssertionError: 
E   Not equal to tolerance rtol=1e-07, atol=1e-10
E   
E   Mismatched elements: 11 / 20 (55%)
E   Max absolute difference among violations: 9.5
E   Max relative difference among violations: inf
E    ACTUAL: array([[ 9.500000e+00, -5.000000e-01],
E          [-1.000000e+00,  0.000000e+00],
E          [-1.000000e+00,  1.776357e-16],...
E    DESIRED: array([[ 0.,  0.],
E          [-0.,  0.],
E          [-0.,  0.],...
        args       = (<function assert_allclose.<locals>.compare at 0x7f0294cc0b80>, array([[ 9.50000000e+00, -5.00000000e-01],
       [-1.....],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.]]))
        func       = <function assert_array_compare at 0x7f02aff6f2e0>
        kwds       = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=1e-10', 'strict': False, ...}
        self       = <contextlib._GeneratorContextManager object at 0x7f02aff7b310>
_____________________________________________________________________________ test_backend_call[irfftn-irfftn-mock11] _____________________________________________________________________________
[gw7] linux -- Python 3.11.2 /home/treddy/python_venvs/py_311_scipy_dev/bin/python
scipy/fft/tests/test_backend.py:60: in test_backend_call
    assert_allclose(func(x), answer, atol=1e-10)
        answer     = array([[ 0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.]])
        func       = <uarray multimethod 'irfftn'>
        mock       = <scipy.fft.tests.mock_backend._MockFunction object at 0x7f02aca5c310>
        np_func    = <function irfftn at 0x7f02af659d70>
        x          = array([[ 0,  1],
       [ 2,  3],
       [ 4,  5],
       [ 6,  7],
       [ 8,  9],
       [10, 11],
       [12, 13],
       [14, 15],
       [16, 17],
       [18, 19]])
../../../../../spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/python-3.11.2-4qncg2nqev5evxfmamde3e6rnb34b4ls/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
E   AssertionError: 
E   Not equal to tolerance rtol=1e-07, atol=1e-10
E   
E   Mismatched elements: 11 / 20 (55%)
E   Max absolute difference among violations: 9.5
E   Max relative difference among violations: inf
E    ACTUAL: array([[ 9.500000e+00, -5.000000e-01],
E          [-1.000000e+00,  0.000000e+00],
E          [-1.000000e+00,  1.776357e-16],...
E    DESIRED: array([[ 0.,  0.],
E          [-0.,  0.],
E          [-0.,  0.],...
        args       = (<function assert_allclose.<locals>.compare at 0x7f0294cc1440>, array([[ 9.50000000e+00, -5.00000000e-01],
       [-1.....],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.],
       [-0.,  0.]]))
        func       = <function assert_array_compare at 0x7f02aff6f2e0>
        kwds       = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=1e-10', 'strict': False, ...}
        self       = <contextlib._GeneratorContextManager object at 0x7f02aff7b310>
______________________________________________________________________________ test_backend_call[ihfft-ihfft-mock15] ______________________________________________________________________________
[gw7] linux -- Python 3.11.2 /home/treddy/python_venvs/py_311_scipy_dev/bin/python
scipy/fft/tests/test_backend.py:60: in test_backend_call
    assert_allclose(func(x), answer, atol=1e-10)
        answer     = array([[ 0.-0.j, -0.-0.j],
       [ 0.-0.j, -0.-0.j],
       [ 0.-0.j, -0.-0.j],
       [ 0.-0.j, -0.-0.j],
       [ 0... -0.-0.j],
       [ 0.-0.j, -0.-0.j],
       [ 0.-0.j, -0.-0.j],
       [ 0.-0.j, -0.-0.j],
       [ 0.-0.j, -0.-0.j]])
        func       = <uarray multimethod 'ihfft'>
        mock       = <scipy.fft.tests.mock_backend._MockFunction object at 0x7f02aca5c610>
        np_func    = <function ihfft at 0x7f02af658fb0>
        x          = array([[ 0,  1],
       [ 2,  3],
       [ 4,  5],
       [ 6,  7],
       [ 8,  9],
       [10, 11],
       [12, 13],
       [14, 15],
       [16, 17],
       [18, 19]])
../../../../../spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/python-3.11.2-4qncg2nqev5evxfmamde3e6rnb34b4ls/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
E   AssertionError: 
E   Not equal to tolerance rtol=1e-07, atol=1e-10
E   
E   Mismatched elements: 20 / 20 (100%)
E   Max absolute difference among violations: 18.5
E   Max relative difference among violations: inf
E    ACTUAL: array([[ 0.5+0.j, -0.5+0.j],
E          [ 2.5+0.j, -0.5+0.j],
E          [ 4.5+0.j, -0.5+0.j],...
E    DESIRED: array([[ 0.-0.j, -0.-0.j],
E          [ 0.-0.j, -0.-0.j],
E          [ 0.-0.j, -0.-0.j],...
        args       = (<function assert_allclose.<locals>.compare at 0x7f0294cc2480>, array([[ 0.5+0.j, -0.5+0.j],
       [ 2.5+0.j, -0.5+0....-0.-0.j],
       [ 0.-0.j, -0.-0.j],
       [ 0.-0.j, -0.-0.j],
       [ 0.-0.j, -0.-0.j],
       [ 0.-0.j, -0.-0.j]]))
        func       = <function assert_array_compare at 0x7f02aff6f2e0>
        kwds       = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=1e-10', 'strict': False, ...}
        self       = <contextlib._GeneratorContextManager object at 0x7f02aff7b310>
_________________________________________________________________________________ TestLongDoubleIFFT.test_djbfft __________________________________________________________________________________
[gw2] linux -- Python 3.11.2 /home/treddy/python_venvs/py_311_scipy_dev/bin/python
scipy/fft/_pocketfft/tests/test_basic.py:226: in test_djbfft
    assert_allclose(y,y2, rtol=self.rtol, atol=self.atol)
        i          = 2
        n          = 4
        self       = <scipy.fft._pocketfft.tests.test_basic.TestLongDoubleIFFT object at 0x7f87e10215d0>
        x          = array([0, 1, 2, 3])
        y          = array([ 1.5+0.j , -0.5-0.5j, -0.5+0.j , -0.5+0.5j], dtype=complex256)
        y2         = array([ 0.+0.j, -0.-0.j, -0.+0.j, -0.+0.j])
../../../../../spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/python-3.11.2-4qncg2nqev5evxfmamde3e6rnb34b4ls/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
E   AssertionError: 
E   Not equal to tolerance rtol=1e-10, atol=1e-10
E   
E   Mismatched elements: 4 / 4 (100%)
E   Max absolute difference among violations: 1.5
E   Max relative difference among violations: inf
E    ACTUAL: array([ 1.5+0.j , -0.5-0.5j, -0.5+0.j , -0.5+0.5j], dtype=complex256)
E    DESIRED: array([ 0.+0.j, -0.-0.j, -0.+0.j, -0.+0.j])
        args       = (<function assert_allclose.<locals>.compare at 0x7f87c4dc4540>, array([ 1.5+0.j , -0.5-0.5j, -0.5+0.j , -0.5+0.5j], dtype=complex256), array([ 0.+0.j, -0.-0.j, -0.+0.j, -0.+0.j]))
        func       = <function assert_array_compare at 0x7f87e80832e0>
        kwds       = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-10, atol=1e-10', 'strict': False, ...}
        self       = <contextlib._GeneratorContextManager object at 0x7f87e808fa50>
___________________________________________________________________________________ TestDoubleIFFT.test_djbfft ____________________________________________________________________________________
[gw2] linux -- Python 3.11.2 /home/treddy/python_venvs/py_311_scipy_dev/bin/python
scipy/fft/_pocketfft/tests/test_basic.py:226: in test_djbfft
    assert_allclose(y,y2, rtol=self.rtol, atol=self.atol)
        i          = 2
        n          = 4
        self       = <scipy.fft._pocketfft.tests.test_basic.TestDoubleIFFT object at 0x7f87e0ff9a90>
        x          = array([0, 1, 2, 3])
        y          = array([ 1.5+0.j , -0.5-0.5j, -0.5+0.j , -0.5+0.5j])
        y2         = array([ 0.+0.j, -0.-0.j, -0.+0.j, -0.+0.j])
../../../../../spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/python-3.11.2-4qncg2nqev5evxfmamde3e6rnb34b4ls/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
E   AssertionError: 
E   Not equal to tolerance rtol=1e-10, atol=1e-10
E   
E   Mismatched elements: 4 / 4 (100%)
E   Max absolute difference among violations: 1.5
E   Max relative difference among violations: inf
E    ACTUAL: array([ 1.5+0.j , -0.5-0.5j, -0.5+0.j , -0.5+0.5j])
E    DESIRED: array([ 0.+0.j, -0.-0.j, -0.+0.j, -0.+0.j])
        args       = (<function assert_allclose.<locals>.compare at 0x7f87c4cd4040>, array([ 1.5+0.j , -0.5-0.5j, -0.5+0.j , -0.5+0.5j]), array([ 0.+0.j, -0.-0.j, -0.+0.j, -0.+0.j]))
        func       = <function assert_array_compare at 0x7f87e80832e0>
        kwds       = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-10, atol=1e-10', 'strict': False, ...}
        self       = <contextlib._GeneratorContextManager object at 0x7f87e808fa50>
_______________________________________________________________ TestNdimageFourier.test_fourier_shift_complex01[complex64-6-shape0] _______________________________________________________________
[gw1] linux -- Python 3.11.2 /home/treddy/python_venvs/py_311_scipy_dev/bin/python
scipy/ndimage/tests/test_fourier.py:92: in test_fourier_shift_complex01
    assert_array_almost_equal(a.real[1:, 1:], expected[:-1, :-1],
        a          = array([[5.1100000e+02-1.0409498e-15j, 4.9600000e+02-9.1848515e-16j,
        4.9700000e+02-1.0409498e-15j, 4.9800000e+0...200000e+02-7.6293945e-06j,
        4.9300000e+02-7.6293945e-06j, 4.9400000e+02-7.6293945e-06j]],
      dtype=complex64)
        dec        = 6
        dtype      = <class 'numpy.complex64'>
        expected   = array([[  0.+0.j,   1.+0.j,   2.+0.j,   3.+0.j,   4.+0.j,   5.+0.j,
          6.+0.j,   7.+0.j,   8.+0.j,   9.+0.j,  1...j, 503.+0.j, 504.+0.j, 505.+0.j, 506.+0.j, 507.+0.j,
        508.+0.j, 509.+0.j, 510.+0.j, 511.+0.j]], dtype=complex64)
        self       = <scipy.ndimage.tests.test_fourier.TestNdimageFourier object at 0x7f82f393cf50>
        shape      = (32, 16)
../../../../../spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/python-3.11.2-4qncg2nqev5evxfmamde3e6rnb34b4ls/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
        args       = (array([[1.5258789e-05, 1.0000153e+00, 2.0000153e+00, 3.0000153e+00,
        4.0000153e+00, 5.0000153e+00, 6.0000153e+...  486.+0.j, 487.+0.j, 488.+0.j, 489.+0.j, 490.+0.j, 491.+0.j,
        492.+0.j, 493.+0.j, 494.+0.j]], dtype=complex64))
        func       = <function assert_array_almost_equal at 0x7f82faf5f6a0>
        kwds       = {'decimal': 6}
        self       = <contextlib._GeneratorContextManager object at 0x7f82faf6f090>
/home/treddy/python_venvs/py_311_scipy_dev/lib/python3.11/site-packages/numpy/_utils/__init__.py:85: in wrapper
    return fun(*args, **kwargs)
        args       = (array([[1.5258789e-05, 1.0000153e+00, 2.0000153e+00, 3.0000153e+00,
        4.0000153e+00, 5.0000153e+00, 6.0000153e+...  486.+0.j, 487.+0.j, 488.+0.j, 489.+0.j, 490.+0.j, 491.+0.j,
        492.+0.j, 493.+0.j, 494.+0.j]], dtype=complex64))
        dep_version = '2.0.0'
        fun        = <function assert_array_almost_equal at 0x7f82faf5f600>
        kwargs     = {'decimal': 6}
        new_name   = 'desired'
        new_names  = ['actual', 'desired']
        old_name   = 'y'
        old_names  = ['x', 'y']
../../../../../spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/python-3.11.2-4qncg2nqev5evxfmamde3e6rnb34b4ls/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
E   AssertionError: 
E   Arrays are not almost equal to 6 decimals
E   
E   Mismatched elements: 46 / 465 (9.89%)
E   Max absolute difference among violations: 1.5258789e-05
E   Max relative difference among violations: 1.5258789e-05
E    ACTUAL: array([[1.525879e-05, 1.000015e+00, 2.000015e+00, 3.000015e+00,
E           4.000015e+00, 5.000015e+00, 6.000015e+00, 7.000015e+00,
E           8.000015e+00, 9.000015e+00, 1.000002e+01, 1.100002e+01,...
E    DESIRED: array([[  0.+0.j,   1.+0.j,   2.+0.j,   3.+0.j,   4.+0.j,   5.+0.j,
E             6.+0.j,   7.+0.j,   8.+0.j,   9.+0.j,  10.+0.j,  11.+0.j,
E            12.+0.j,  13.+0.j,  14.+0.j],...
        args       = (<function assert_array_almost_equal.<locals>.compare at 0x7f82e029d760>, array([[1.5258789e-05, 1.0000153e+00, 2.0000...  486.+0.j, 487.+0.j, 488.+0.j, 489.+0.j, 490.+0.j, 491.+0.j,
        492.+0.j, 493.+0.j, 494.+0.j]], dtype=complex64))
        func       = <function assert_array_compare at 0x7f82faf5f2e0>
        kwds       = {'err_msg': '', 'header': 'Arrays are not almost equal to 6 decimals', 'precision': 6, 'verbose': True}
        self       = <contextlib._GeneratorContextManager object at 0x7f82faf6ed90>
_______________________________________________________________ TestNdimageFourier.test_fourier_shift_complex01[complex64-6-shape1] _______________________________________________________________
[gw1] linux -- Python 3.11.2 /home/treddy/python_venvs/py_311_scipy_dev/bin/python
scipy/ndimage/tests/test_fourier.py:92: in test_fourier_shift_complex01
    assert_array_almost_equal(a.real[1:, 1:], expected[:-1, :-1],
        a          = array([[464.00003  +6.5629202e-08j, 450.       -2.6251681e-07j,
        451.       +1.6407300e-07j, 452.       -5.3095...
        446.       -5.3095139e-08j, 447.       -2.0595633e-07j,
        448.       -3.1280658e-07j]], dtype=complex64)
        dec        = 6
        dtype      = <class 'numpy.complex64'>
        expected   = array([[  0.+0.j,   1.+0.j,   2.+0.j,   3.+0.j,   4.+0.j,   5.+0.j,
          6.+0.j,   7.+0.j,   8.+0.j,   9.+0.j,  1...   456.+0.j, 457.+0.j, 458.+0.j, 459.+0.j, 460.+0.j, 461.+0.j,
        462.+0.j, 463.+0.j, 464.+0.j]], dtype=complex64)
        self       = <scipy.ndimage.tests.test_fourier.TestNdimageFourier object at 0x7f82f393d150>
        shape      = (31, 15)
../../../../../spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/python-3.11.2-4qncg2nqev5evxfmamde3e6rnb34b4ls/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
        args       = (array([[  0.       ,   1.       ,   2.       ,   3.       ,   4.       ,
          4.9999843,   5.9999843,   6.999984....j,
        441.+0.j, 442.+0.j, 443.+0.j, 444.+0.j, 445.+0.j, 446.+0.j,
        447.+0.j, 448.+0.j]], dtype=complex64))
        func       = <function assert_array_almost_equal at 0x7f82faf5f6a0>
        kwds       = {'decimal': 6}
        self       = <contextlib._GeneratorContextManager object at 0x7f82faf6f090>
/home/treddy/python_venvs/py_311_scipy_dev/lib/python3.11/site-packages/numpy/_utils/__init__.py:85: in wrapper
    return fun(*args, **kwargs)
        args       = (array([[  0.       ,   1.       ,   2.       ,   3.       ,   4.       ,
          4.9999843,   5.9999843,   6.999984....j,
        441.+0.j, 442.+0.j, 443.+0.j, 444.+0.j, 445.+0.j, 446.+0.j,
        447.+0.j, 448.+0.j]], dtype=complex64))
        dep_version = '2.0.0'
        fun        = <function assert_array_almost_equal at 0x7f82faf5f600>
        kwargs     = {'decimal': 6}
        new_name   = 'desired'
        new_names  = ['actual', 'desired']
        old_name   = 'y'
        old_names  = ['x', 'y']
../../../../../spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/python-3.11.2-4qncg2nqev5evxfmamde3e6rnb34b4ls/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
E   AssertionError: 
E   Arrays are not almost equal to 6 decimals
E   
E   Mismatched elements: 238 / 420 (56.7%)
E   Max absolute difference among violations: 6.1035156e-05
E   Max relative difference among violations: 3.1471252e-06
E    ACTUAL: array([[  0.      ,   1.      ,   2.      ,   3.      ,   4.      ,
E             4.999984,   5.999984,   6.999984,   7.999984,   8.999984,
E             9.999984,  10.999984,  11.999984,  12.999984],...
E    DESIRED: array([[  0.+0.j,   1.+0.j,   2.+0.j,   3.+0.j,   4.+0.j,   5.+0.j,
E             6.+0.j,   7.+0.j,   8.+0.j,   9.+0.j,  10.+0.j,  11.+0.j,
E            12.+0.j,  13.+0.j],...
        args       = (<function assert_array_almost_equal.<locals>.compare at 0x7f82e10fbf60>, array([[  0.       ,   1.       ,   2.      ....j,
        441.+0.j, 442.+0.j, 443.+0.j, 444.+0.j, 445.+0.j, 446.+0.j,
        447.+0.j, 448.+0.j]], dtype=complex64))
        func       = <function assert_array_compare at 0x7f82faf5f2e0>
        kwds       = {'err_msg': '', 'header': 'Arrays are not almost equal to 6 decimals', 'precision': 6, 'verbose': True}
        self       = <contextlib._GeneratorContextManager object at 0x7f82faf6ed90>
===================================================================================== short test summary info =====================================================================================
FAILED scipy/fft/_pocketfft/tests/test_basic.py::TestSingleIFFT::test_djbfft - AssertionError: 
FAILED scipy/fft/tests/test_backend.py::test_backend_call[ifft-ifft-mock3] - AssertionError: 
FAILED scipy/fft/tests/test_backend.py::test_backend_call[ifft2-ifft2-mock4] - AssertionError: 
FAILED scipy/fft/tests/test_backend.py::test_backend_call[ifftn-ifftn-mock5] - AssertionError: 
FAILED scipy/fft/tests/test_backend.py::test_backend_call[irfft-irfft-mock9] - AssertionError: 
FAILED scipy/fft/tests/test_backend.py::test_backend_call[irfft2-irfft2-mock10] - AssertionError: 
FAILED scipy/fft/tests/test_backend.py::test_backend_call[irfftn-irfftn-mock11] - AssertionError: 
FAILED scipy/fft/tests/test_backend.py::test_backend_call[ihfft-ihfft-mock15] - AssertionError: 
FAILED scipy/fft/_pocketfft/tests/test_basic.py::TestLongDoubleIFFT::test_djbfft - AssertionError: 
FAILED scipy/fft/_pocketfft/tests/test_basic.py::TestDoubleIFFT::test_djbfft - AssertionError: 
FAILED scipy/ndimage/tests/test_fourier.py::TestNdimageFourier::test_fourier_shift_complex01[complex64-6-shape0] - AssertionError: 
FAILED scipy/ndimage/tests/test_fourier.py::TestNdimageFourier::test_fourier_shift_complex01[complex64-6-shape1] - AssertionError: 
============================================================ 12 failed, 45918 passed, 2491 skipped, 151 xfailed, 10 xpassed in 46.65s =============================================================

It is all related to FFT stuff. Bisected on x86_64 Linux to:

22c56b5707a8980d216a95b50db9f880a18b1caa is the first bad commit
commit 22c56b5707a8980d216a95b50db9f880a18b1caa
Author: Marten Henric van Kerkwijk <mhvk@astro.utoronto.ca>
Date:   Sun Jan 28 09:20:37 2024 -0500

    ENH: Use templating to add support float and longdouble.
    
    Also adjust python side to allow multiple double types.

 doc/release/upcoming_changes/25536.new_feature.rst |  15 +-
 numpy/fft/_pocketfft.py                            |  80 ++++------
 numpy/fft/_pocketfft_umath.cpp                     | 165 +++++++++++++--------
 numpy/fft/tests/test_pocketfft.py                  |  45 +++---
 4 files changed, 165 insertions(+), 140 deletions(-)

cc @mhvk @seberg just in case the shims aren't exclusively needed on our end (that I'm not sure of just yet)

@tylerjereddy tylerjereddy added maintenance Items related to regular maintenance tasks scipy.fft labels Feb 9, 2024
@tylerjereddy tylerjereddy added this to the 1.13.0 milestone Feb 9, 2024
@mhvk
Copy link

mhvk commented Feb 9, 2024

@tylerjereddy - I suspect this is because numpy now doesn't automatically upcast to double any more. From the failures, it looks like integer input is given to the FFT routines (seeing things like x = array([0, 1, 2, 3]). On a 32-bit system, could that be cast to float32? The easiest solution might be to ensure that input always is float (i.e., add some .0 to the input x arrays...).

At least, I hope it is as simple as that! I obviously don't want to cause undue problems!

@tylerjereddy
Copy link
Contributor Author

thanks!

@seberg
Copy link
Contributor

seberg commented Feb 9, 2024

On a 32-bit system, could that be cast to float32?

I would hope it is precision change, but the default lookup should only allow float64 loops for default integers (32bit ints are not "safely" cast to float32, only float64).

Or did we add a non-default loop selection?

@mhvk
Copy link

mhvk commented Feb 9, 2024

Yes, that is worrying. Yet, the integer input seems to correspond to complex64 output...

Looking at the tests in scipy/fft/_pocketfft/tests/test_basic.py

    def test_djbfft(self):
        for i in range(2,14):
            n = 2**i
            x = np.arange(n)
            y = ifft(x.astype(self.cdt))
            y2 = numpy.fft.ifft(x)
            assert_allclose(y,y2, rtol=self.rtol, atol=self.atol)
            y = ifft(x)
            assert_allclose(y,y2, rtol=self.rtol, atol=self.atol)

it seems more obvious: the numpy fft is just doing the calculation at a different precision that the internal call; I think that should be numpy.fft.ifft(x.astype(self.cdt)) to make it symmetric. Or maybe better x = np.arange(n).astype(self.cdt) and then use that everywhere.

EDIT: or maybe np.arange(n, dtype=self.rdt) - that maybe keeps the essence of the test better.

@tylerjereddy tylerjereddy changed the title MAINT, TST: fest failures against NumPy main MAINT, TST: test failures against NumPy main Feb 9, 2024
tylerjereddy added a commit to tylerjereddy/scipy that referenced this issue Feb 10, 2024
* Fixes scipy#20062

* for 2/3 of the problem tests I was able to adopt
the philosophy of "let's keep the expected value the same;
we don't really care what NumPy is doing as long as the
expected value in the test is the same as before"; so, we
compensate for the casting changes in NumPy by generating
the expected value with a more explicit cast

* for `test_fourier_shift_complex01` that would be more
surgery though--this one is a real mess--it calls NumPy FFT
functionality twice before the SciPy function under test, then
feeds that input to the SciPy function under test, then calls
NumPy FFT functionality twice on the output of the SciPy function
under test; here, I dropped the lower-precision pass-through
test precision expectations, because we can't lean on NumPy to
automatically preserve as much precision here anymore; a stricter
view on preserving the essence of this test might be to either
hardcode the expected value in the lower-precision dtype case, or
carefully craft it with NumPy wider dtype while not feeding
the wider dtype to the SciPy function under test

[skip cirrus] [skip circle]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Items related to regular maintenance tasks scipy.fft
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants