Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork11.5k
Description
Describe the issue:
We discovered on issue in scipy CI for the macos-15-intel image (so macOS15 on x86_64), seescipy/scipy#23728.
We are doing some numpy calculations with two arrays that are equal. The output from the calculations are not equal, which is causing a test to fail.
I've tried to produce a MWE here, using the numerical values from the test. We can add commits to a scipy repo if it would help fix the issue.
Reproduce the code example:
qd1=np.array([0.08657014997765064,0.13163636378278895,0.2875018918897967,0.6033886973966058,0.9999999999999998,1.1995075247991498,1.1744216441141135,1.1035795154847736,1.,1.073651252165022,1.1035795154847738,1.1744216441141135,1.1995075247991498,1.,0.6033886973966055,0.2875018918897964 ,0.1316363637827889 ])qd2=np.array([0.08657014997765064,0.13163636378278895,0.2875018918897967,0.6033886973966058,0.9999999999999998,1.1995075247991498,1.1744216441141135,1.1035795154847736,1.,1.073651252165022,1.1035795154847738,1.1744216441141135,1.1995075247991498,1.,0.6033886973966055,0.2875018918897964,0.1316363637827889 ])np.testing.assert_equal(qd1,qd2)denominator1=qd1.T.real @qd1.real+qd1.T.imag @qd1.imag# always >= 0denominator2=qd2.T.real @qd2.real+qd2.T.imag @qd2.imag# always >= 0np.testing.assert_equal(denominator2,denominator1)# fails on macos15-intel
Error message:
______________________ test_issue2370[hamming-17-9-False] ______________________win_name ='hamming', m = 17, hop = 9, sym_win = False, scaled = True @pytest.mark.parametrize('sym_win', (False, True)) @pytest.mark.parametrize('hop', (8, 9)) @pytest.mark.parametrize('m', (16, 17)) @pytest.mark.parametrize('win_name', ('hann','hamming')) def test_issue2370(win_name, m, hop, sym_win, scaled=True):"""Analyze macos15-intel problems (issue 23710)""" win = get_window(win_name, m, not sym_win) d_win = np.ones_like(win) d1, s1, qd1, wd1 = _closest_STFT_dual_window2(win, hop, d_win, scaled=scaled) d2, s2, qd2, wd2 = _closest_STFT_dual_window2(win, hop, d_win, scaled=scaled)# Identical function calls should produce identical results: xp_assert_equal(wd2, wd1) xp_assert_equal(qd2, qd1) assert qd1 is not qd2# ensure mutating qd1 is not the problemprint(np.show_config()) with np.printoptions(floatmode='unique'): print(qd1) print(qd2)# Taken from closest_STFT_dual_window (qd1 == qd2): denominator1 = qd1.T.real @ qd1.real + qd1.T.imag @ qd1.imag# always >= 0 denominator2 = qd2.T.real @ qd2.real + qd2.T.imag @ qd2.imag# always >= 0> xp_assert_equal(denominator2, denominator1)# fails on macos15-intel ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^E AssertionError: E Arrays are not equalE E Mismatched elements: 1 / 1 (100%)E Max absolute difference among violations: 1.77635684e-15E Max relative difference among violations: 1.34978521e-16E ACTUAL: array(13.160293)E DESIRED: array(13.160293)d1 = array([0.97938895, 0.98061979, 0.98358784, 0.99307115, 1.00491089, 1.00221594, 0.98288757, 0.95702906, 1.0078942 , 0.92892457, 0.95702906, 0.98288757, 1.00221594, 1.00491089, 0.99307115, 0.98358784, 0.98061979])d2 = array([0.97938895, 0.98061979, 0.98358784, 0.99307115, 1.00491089, 1.00221594, 0.98288757, 0.95702906, 1.0078942 , 0.92892457, 0.95702906, 0.98288757, 1.00221594, 1.00491089, 0.99307115, 0.98358784, 0.98061979])d_win = array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.])denominator1 = np.float64(13.160292677077127)denominator2 = np.float64(13.160292677077129)hop = 9m = 17qd1 = array([0.08657015, 0.13163636, 0.28750189, 0.6033887 , 1. , 1.19950752, 1.17442164, 1.10357952, 1. , 1.07365125, 1.10357952, 1.17442164, 1.19950752, 1. , 0.6033887 , 0.28750189, 0.13163636])qd2 = array([0.08657015, 0.13163636, 0.28750189, 0.6033887 , 1. , 1.19950752, 1.17442164, 1.10357952, 1. , 1.07365125, 1.10357952, 1.17442164, 1.19950752, 1. , 0.6033887 , 0.28750189, 0.13163636])s1 = np.float64(0.9838148350779551)s2 = np.float64(0.9838148350779548)scaled = Truesym_win = Falsewd1 = array([0.08074311, 0.12631077, 0.28262163, 0.60287906, 1.00491089, 1.1984944 , 1.15448617, 1.05893212, 1.0078942 , 1.00138376, 1.05893212, 1.15448617, 1.1984944 , 1.00491089, 0.60287906, 0.28262163, 0.12631077])wd2 = array([0.08074311, 0.12631077, 0.28262163, 0.60287906, 1.00491089, 1.1984944 , 1.15448617, 1.05893212, 1.0078942 , 1.00138376, 1.05893212, 1.15448617, 1.1984944 , 1.00491089, 0.60287906, 0.28262163, 0.12631077])win = array([0.08 , 0.11106277, 0.2000559 , 0.33496036, 0.49755655, 0.66588498, 0.81721193, 0.93109988, 0.99216763, 0.99216763, 0.93109988, 0.81721193, 0.66588498, 0.49755655, 0.33496036, 0.2000559 , 0.11106277])win_name ='hamming'scipy/signal/tests/test_short_time_fft.py:109: AssertionError
Python and NumPy Versions:
Build Dependencies:
blas:
detection method: system
found: true
include directory: unknown
lib directory: unknown
name: accelerate
openblas configuration: unknown
pc file directory: unknown
version: unknown
lapack:
detection method: system
found: true
include directory: unknown
lib directory: unknown
name: accelerate
openblas configuration: unknown
pc file directory: unknown
version: unknown
Compilers:
c:
commands: cc
linker: ld64
name: clang
version: 15.0.0
c++:
commands: c++
linker: ld64
name: clang
version: 15.0.0
cython:
commands: cython
linker: cython
name: cython
version: 3.1.3
Machine Information:
build:
cpu: x86_64
endian: little
family: x86_64
system: darwin
host:
cpu: x86_64
endian: little
family: x86_64
system: darwin
Python Information:
path: /private/var/folders/vk/nx37ffx50hv5djclhltc26vw0000gn/T/build-env-ihgssrah/bin/python
version: '3.13'
SIMD Extensions:
baseline:
- SSE
- SSE2
- SSE3
found: - SSSE3
- SSE41
- POPCNT
- SSE42
- AVX
- F16C
- FMA3
- AVX2
not found: - AVX512F
- AVX512CD
- AVX512_KNL
- AVX512_SKX
- AVX512_CLX
- AVX512_CNL
- AVX512_ICL
Runtime Environment:
No response
Context for the issue:
No response