Skip to content

astropy.units test failures with Numpy 1.18 from conda on Windows #9871

Closed

Description

@astrofrog

Maintainer note: Revert temporary pinning in #9878 when this is resolved unless #9726 gets to it first.

I'm seeing test failures on Windows with Numpy 1.18 - and these are also happening on Travis for the Windows build. To reproduce:

conda create -n test-conda-numpy python=3.7
conda activate test-conda-numpy
conda install numpy
pip install -e .[test]
pytest astropy\units

The error log is:

====================================================== FAILURES =======================================================
__________________________________________________ TestFFT.test_fft ___________________________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C00148>

    def test_fft(self):
>       self.check(np.fft.fft)

astropy\units\tests\test_quantity_non_ufuncs.py:1845:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C00148>
func = <function fft at 0x00000224CE5CB168>, args = (), kwargs = {}
o = array([[ 120. +0.j        ,   -8.+40.21871594j,   -8.+19.3137085j ,
          -8.+11.9728461j ,   -8. +8.j        ,   ...,   -8. -5.3454291j ,
          -8. -8.j        ,   -8.-11.9728461j ,   -8.-19.3137085j ,
          -8.-40.21871594j]])
expected = <Quantity [[ 120. +0.j        ,   -8.+40.21871594j,   -8.+19.3137085j ,
              -8.+11.9728461j ,   -8. +8.j    ....3454291j ,
              -8. -8.j        ,   -8.-11.9728461j ,   -8.-19.3137085j ,
              -8.-40.21871594j]] s>
@py_assert1 = <function all at 0x00000224CE3A0948>, @py_assert5 = None, @py_assert3 = None, @py_assert4 = False
@py_assert8 = False
@py_format6 = 'array([[ 120....0.21871594j]]) == <Quantity [[ ...21871594j]] s>\n~Use -v to get the full diff'

    def check(self, func, *args, **kwargs):
        o = func(self.q, *args, **kwargs)
        expected = func(self.q.value, *args, **kwargs) * self.q.unit
        assert o.shape == expected.shape
>       assert np.all(o == expected)
E       assert False
E        +  where False = <function all at 0x00000224CE3A0948>(array([[ 120....0.21871594j]]) == <Quantity [[ ...21871594j]] s>
E        +    where <function all at 0x00000224CE3A0948> = np.all
E           Use -v to get the full diff)

astropy\units\tests\test_quantity_non_ufuncs.py:68: AssertionError
__________________________________________________ TestFFT.test_ifft __________________________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2BEC888>

    def test_ifft(self):
>       self.check(np.fft.ifft)

astropy\units\tests\test_quantity_non_ufuncs.py:1848:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2BEC888>
func = <function ifft at 0x00000224CE5CB288>, args = (), kwargs = {}
o = array([[  7.5-0.j        ,  -0.5-2.51366975j,  -0.5-1.20710678j,
         -0.5-0.74830288j,  -0.5-0.5j       ,  -0.5-0...0678j,  -0.5+0.33408932j,
         -0.5+0.5j       ,  -0.5+0.74830288j,  -0.5+1.20710678j,
         -0.5+2.51366975j]])
expected = <Quantity [[  7.5-0.j        ,  -0.5-2.51366975j,  -0.5-1.20710678j,
             -0.5-0.74830288j,  -0.5-0.5j       ,....5+0.33408932j,
             -0.5+0.5j       ,  -0.5+0.74830288j,  -0.5+1.20710678j,
             -0.5+2.51366975j]] s>
@py_assert1 = <function all at 0x00000224CE3A0948>, @py_assert5 = None, @py_assert3 = None, @py_assert4 = False
@py_assert8 = False
@py_format6 = 'array([[  7.5...2.51366975j]]) == <Quantity [[ ...51366975j]] s>\n~Use -v to get the full diff'

    def check(self, func, *args, **kwargs):
        o = func(self.q, *args, **kwargs)
        expected = func(self.q.value, *args, **kwargs) * self.q.unit
        assert o.shape == expected.shape
>       assert np.all(o == expected)
E       assert False
E        +  where False = <function all at 0x00000224CE3A0948>(array([[  7.5...2.51366975j]]) == <Quantity [[ ...51366975j]] s>
E        +    where <function all at 0x00000224CE3A0948> = np.all
E           Use -v to get the full diff)

astropy\units\tests\test_quantity_non_ufuncs.py:68: AssertionError
__________________________________________________ TestFFT.test_rfft __________________________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C0AE48>

    def test_rfft(self):
>       self.check(np.fft.rfft)

astropy\units\tests\test_quantity_non_ufuncs.py:1851:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C0AE48>
func = <function rfft at 0x00000224CE5CB318>, args = (), kwargs = {}
o = array([[ 120. +0.j        ,   -8.+40.21871594j,   -8.+19.3137085j ,
          -8.+11.9728461j ,   -8. +8.j        ,   ...728461j ,   -8. +8.j        ,   -8. +5.3454291j ,
          -8. +3.3137085j ,   -8. +1.59129894j,   -8. +0.j        ]])
expected = <Quantity [[ 120. +0.j        ,   -8.+40.21871594j,   -8.+19.3137085j ,
              -8.+11.9728461j ,   -8. +8.j    ...j ,   -8. +8.j        ,   -8. +5.3454291j ,
              -8. +3.3137085j ,   -8. +1.59129894j,   -8. +0.j        ]] s>
@py_assert1 = <function all at 0x00000224CE3A0948>, @py_assert5 = None, @py_assert3 = None, @py_assert4 = False
@py_assert8 = False
@py_format6 = 'array([[ 120....0.j        ]]) == <Quantity [[ ...j        ]] s>\n~Use -v to get the full diff'

    def check(self, func, *args, **kwargs):
        o = func(self.q, *args, **kwargs)
        expected = func(self.q.value, *args, **kwargs) * self.q.unit
        assert o.shape == expected.shape
>       assert np.all(o == expected)
E       assert False
E        +  where False = <function all at 0x00000224CE3A0948>(array([[ 120....0.j        ]]) == <Quantity [[ ...j        ]] s>
E        +    where <function all at 0x00000224CE3A0948> = np.all
E           Use -v to get the full diff)

astropy\units\tests\test_quantity_non_ufuncs.py:68: AssertionError
_________________________________________________ TestFFT.test_irfft __________________________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C3BDC8>

    def test_irfft(self):
>       self.check(np.fft.irfft)

astropy\units\tests\test_quantity_non_ufuncs.py:1854:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C3BDC8>
func = <function irfft at 0x00000224CE5CB3A8>, args = (), kwargs = {}
o = array([[ 7.50000000e+00, -3.05077103e+00,  8.88178420e-17,
        -3.49071198e-01,  7.77156117e-17, -1.33333333e-01,
...         5.26245714e-15, -1.33333333e-01,  4.66293670e-16,
        -3.49071198e-01, -4.73695157e-16, -3.05077103e+00]])
expected = <Quantity [[ 7.50000000e+00, -3.05077103e+00,  8.88178420e-17,
            -3.49071198e-01,  7.77156117e-17, -1.333333...   5.26245714e-15, -1.33333333e-01,  4.66293670e-16,
            -3.49071198e-01, -4.73695157e-16, -3.05077103e+00]] s>
@py_assert1 = <function all at 0x00000224CE3A0948>, @py_assert5 = None, @py_assert3 = None, @py_assert4 = False
@py_assert8 = False
@py_format6 = 'array([[ 7.50...5077103e+00]]) == <Quantity [[ ...77103e+00]] s>\n~Use -v to get the full diff'

    def check(self, func, *args, **kwargs):
        o = func(self.q, *args, **kwargs)
        expected = func(self.q.value, *args, **kwargs) * self.q.unit
        assert o.shape == expected.shape
>       assert np.all(o == expected)
E       assert False
E        +  where False = <function all at 0x00000224CE3A0948>(array([[ 7.50...5077103e+00]]) == <Quantity [[ ...77103e+00]] s>
E        +    where <function all at 0x00000224CE3A0948> = np.all
E           Use -v to get the full diff)

astropy\units\tests\test_quantity_non_ufuncs.py:68: AssertionError
__________________________________________________ TestFFT.test_fft2 __________________________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C70588>

    def test_fft2(self):
>       self.check(np.fft.fft2)

astropy\units\tests\test_quantity_non_ufuncs.py:1857:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C70588>
func = <function fft2 at 0x00000224CE5CB798>, args = (), kwargs = {}
o = array([[ 8128.   +0.j        ,   -64. +321.7497275j ,
          -64. +154.50966799j,   -64.  +95.78276881j,
          ...        ,
            0.   -0.j        ,     0.   -0.j        ,
            0.   -0.j        ,     0.   -0.j        ]])
expected = <Quantity [[ 8128.   +0.j        ,   -64. +321.7497275j ,
              -64. +154.50966799j,   -64.  +95.78276881j,
  ...                0.   -0.j        ,     0.   -0.j        ,
                0.   -0.j        ,     0.   -0.j        ]] s>
@py_assert1 = <function all at 0x00000224CE3A0948>, @py_assert5 = None, @py_assert3 = None, @py_assert4 = False
@py_assert8 = False
@py_format6 = 'array([[ 8128...0.j        ]]) == <Quantity [[ ...j        ]] s>\n~Use -v to get the full diff'

    def check(self, func, *args, **kwargs):
        o = func(self.q, *args, **kwargs)
        expected = func(self.q.value, *args, **kwargs) * self.q.unit
        assert o.shape == expected.shape
>       assert np.all(o == expected)
E       assert False
E        +  where False = <function all at 0x00000224CE3A0948>(array([[ 8128...0.j        ]]) == <Quantity [[ ...j        ]] s>
E        +    where <function all at 0x00000224CE3A0948> = np.all
E           Use -v to get the full diff)

astropy\units\tests\test_quantity_non_ufuncs.py:68: AssertionError
_________________________________________________ TestFFT.test_ifft2 __________________________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2B8ED88>

    def test_ifft2(self):
>       self.check(np.fft.ifft2)

astropy\units\tests\test_quantity_non_ufuncs.py:1860:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2B8ED88>
func = <function ifft2 at 0x00000224CE5CB828>, args = (), kwargs = {}
o = array([[63.5 -0.j        , -0.5 -2.51366975j, -0.5 -1.20710678j,
        -0.5 -0.74830288j, -0.5 -0.5j       , -0.5 -0...     ,  0.  +0.j        ,
         0.  +0.j        ,  0.  +0.j        ,  0.  +0.j        ,
         0.  +0.j        ]])
expected = <Quantity [[63.5 -0.j        , -0.5 -2.51366975j, -0.5 -1.20710678j,
            -0.5 -0.74830288j, -0.5 -0.5j       ,...  +0.j        ,
             0.  +0.j        ,  0.  +0.j        ,  0.  +0.j        ,
             0.  +0.j        ]] s>
@py_assert1 = <function all at 0x00000224CE3A0948>, @py_assert5 = None, @py_assert3 = None, @py_assert4 = False
@py_assert8 = False
@py_format6 = 'array([[63.5 ...0.j        ]]) == <Quantity [[6...j        ]] s>\n~Use -v to get the full diff'

    def check(self, func, *args, **kwargs):
        o = func(self.q, *args, **kwargs)
        expected = func(self.q.value, *args, **kwargs) * self.q.unit
        assert o.shape == expected.shape
>       assert np.all(o == expected)
E       assert False
E        +  where False = <function all at 0x00000224CE3A0948>(array([[63.5 ...0.j        ]]) == <Quantity [[6...j        ]] s>
E        +    where <function all at 0x00000224CE3A0948> = np.all
E           Use -v to get the full diff)

astropy\units\tests\test_quantity_non_ufuncs.py:68: AssertionError
_________________________________________________ TestFFT.test_rfft2 __________________________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C74708>

    def test_rfft2(self):
>       self.check(np.fft.rfft2)

astropy\units\tests\test_quantity_non_ufuncs.py:1863:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C74708>
func = <function rfft2 at 0x00000224CE5CB948>, args = (), kwargs = {}
o = array([[ 8128.   +0.j        ,   -64. +321.7497275j ,
          -64. +154.50966799j,   -64.  +95.78276881j,
          ...        ,     0.   +0.j        ,
            0.   +0.j        ,     0.   +0.j        ,
            0.   +0.j        ]])
expected = <Quantity [[ 8128.   +0.j        ,   -64. +321.7497275j ,
              -64. +154.50966799j,   -64.  +95.78276881j,
  ...    0.   +0.j        ,
                0.   +0.j        ,     0.   +0.j        ,
                0.   +0.j        ]] s>
@py_assert1 = <function all at 0x00000224CE3A0948>, @py_assert5 = None, @py_assert3 = None, @py_assert4 = False
@py_assert8 = False
@py_format6 = 'array([[ 8128...0.j        ]]) == <Quantity [[ ...j        ]] s>\n~Use -v to get the full diff'

    def check(self, func, *args, **kwargs):
        o = func(self.q, *args, **kwargs)
        expected = func(self.q.value, *args, **kwargs) * self.q.unit
        assert o.shape == expected.shape
>       assert np.all(o == expected)
E       assert False
E        +  where False = <function all at 0x00000224CE3A0948>(array([[ 8128...0.j        ]]) == <Quantity [[ ...j        ]] s>
E        +    where <function all at 0x00000224CE3A0948> = np.all
E           Use -v to get the full diff)

astropy\units\tests\test_quantity_non_ufuncs.py:68: AssertionError
_________________________________________________ TestFFT.test_irfft2 _________________________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C4BA88>

    def test_irfft2(self):
>       self.check(np.fft.irfft2)

astropy\units\tests\test_quantity_non_ufuncs.py:1866:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C4BA88>
func = <function irfft2 at 0x00000224CE5CBA68>, args = (), kwargs = {}
o = array([[ 6.35000000e+01, -3.05077103e+00,  8.30105637e-17,
        -3.49071198e-01,  1.22730749e-15, -1.33333333e-01,
...        -5.92118946e-16,  2.23015496e+00,  1.18423789e-16,
         3.96276551e+00, -1.18423789e-16,  1.22505108e+01]])
expected = <Quantity [[ 6.35000000e+01, -3.05077103e+00,  8.30105637e-17,
            -3.49071198e-01,  1.22730749e-15, -1.333333...  -5.92118946e-16,  2.23015496e+00,  1.18423789e-16,
             3.96276551e+00, -1.18423789e-16,  1.22505108e+01]] s>
@py_assert1 = <function all at 0x00000224CE3A0948>, @py_assert5 = None, @py_assert3 = None, @py_assert4 = False
@py_assert8 = False
@py_format6 = 'array([[ 6.35...2505108e+01]]) == <Quantity [[ ...05108e+01]] s>\n~Use -v to get the full diff'

    def check(self, func, *args, **kwargs):
        o = func(self.q, *args, **kwargs)
        expected = func(self.q.value, *args, **kwargs) * self.q.unit
        assert o.shape == expected.shape
>       assert np.all(o == expected)
E       assert False
E        +  where False = <function all at 0x00000224CE3A0948>(array([[ 6.35...2505108e+01]]) == <Quantity [[ ...05108e+01]] s>
E        +    where <function all at 0x00000224CE3A0948> = np.all
E           Use -v to get the full diff)

astropy\units\tests\test_quantity_non_ufuncs.py:68: AssertionError
__________________________________________________ TestFFT.test_fftn __________________________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C75388>

    def test_fftn(self):
>       self.check(np.fft.fftn)

astropy\units\tests\test_quantity_non_ufuncs.py:1869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C75388>
func = <function fftn at 0x00000224CE5CB678>, args = (), kwargs = {}
o = array([[ 8128.   +0.j        ,   -64. +321.7497275j ,
          -64. +154.50966799j,   -64.  +95.78276881j,
          ...        ,
            0.   -0.j        ,     0.   -0.j        ,
            0.   -0.j        ,     0.   -0.j        ]])
expected = <Quantity [[ 8128.   +0.j        ,   -64. +321.7497275j ,
              -64. +154.50966799j,   -64.  +95.78276881j,
  ...                0.   -0.j        ,     0.   -0.j        ,
                0.   -0.j        ,     0.   -0.j        ]] s>
@py_assert1 = <function all at 0x00000224CE3A0948>, @py_assert5 = None, @py_assert3 = None, @py_assert4 = False
@py_assert8 = False
@py_format6 = 'array([[ 8128...0.j        ]]) == <Quantity [[ ...j        ]] s>\n~Use -v to get the full diff'

    def check(self, func, *args, **kwargs):
        o = func(self.q, *args, **kwargs)
        expected = func(self.q.value, *args, **kwargs) * self.q.unit
        assert o.shape == expected.shape
>       assert np.all(o == expected)
E       assert False
E        +  where False = <function all at 0x00000224CE3A0948>(array([[ 8128...0.j        ]]) == <Quantity [[ ...j        ]] s>
E        +    where <function all at 0x00000224CE3A0948> = np.all
E           Use -v to get the full diff)

astropy\units\tests\test_quantity_non_ufuncs.py:68: AssertionError
_________________________________________________ TestFFT.test_ifftn __________________________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2CF5DC8>

    def test_ifftn(self):
>       self.check(np.fft.ifftn)

astropy\units\tests\test_quantity_non_ufuncs.py:1872:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2CF5DC8>
func = <function ifftn at 0x00000224CE5CB708>, args = (), kwargs = {}
o = array([[63.5 -0.j        , -0.5 -2.51366975j, -0.5 -1.20710678j,
        -0.5 -0.74830288j, -0.5 -0.5j       , -0.5 -0...     ,  0.  +0.j        ,
         0.  +0.j        ,  0.  +0.j        ,  0.  +0.j        ,
         0.  +0.j        ]])
expected = <Quantity [[63.5 -0.j        , -0.5 -2.51366975j, -0.5 -1.20710678j,
            -0.5 -0.74830288j, -0.5 -0.5j       ,...  +0.j        ,
             0.  +0.j        ,  0.  +0.j        ,  0.  +0.j        ,
             0.  +0.j        ]] s>
@py_assert1 = <function all at 0x00000224CE3A0948>, @py_assert5 = None, @py_assert3 = None, @py_assert4 = False
@py_assert8 = False
@py_format6 = 'array([[63.5 ...0.j        ]]) == <Quantity [[6...j        ]] s>\n~Use -v to get the full diff'

    def check(self, func, *args, **kwargs):
        o = func(self.q, *args, **kwargs)
        expected = func(self.q.value, *args, **kwargs) * self.q.unit
        assert o.shape == expected.shape
>       assert np.all(o == expected)
E       assert False
E        +  where False = <function all at 0x00000224CE3A0948>(array([[63.5 ...0.j        ]]) == <Quantity [[6...j        ]] s>
E        +    where <function all at 0x00000224CE3A0948> = np.all
E           Use -v to get the full diff)

astropy\units\tests\test_quantity_non_ufuncs.py:68: AssertionError
_________________________________________________ TestFFT.test_rfftn __________________________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C4B488>

    def test_rfftn(self):
>       self.check(np.fft.rfftn)

astropy\units\tests\test_quantity_non_ufuncs.py:1875:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C4B488>
func = <function rfftn at 0x00000224CE5CB8B8>, args = (), kwargs = {}
o = array([[ 8128.   +0.j        ,   -64. +321.7497275j ,
          -64. +154.50966799j,   -64.  +95.78276881j,
          ...        ,     0.   +0.j        ,
            0.   +0.j        ,     0.   +0.j        ,
            0.   +0.j        ]])
expected = <Quantity [[ 8128.   +0.j        ,   -64. +321.7497275j ,
              -64. +154.50966799j,   -64.  +95.78276881j,
  ...    0.   +0.j        ,
                0.   +0.j        ,     0.   +0.j        ,
                0.   +0.j        ]] s>
@py_assert1 = <function all at 0x00000224CE3A0948>, @py_assert5 = None, @py_assert3 = None, @py_assert4 = False
@py_assert8 = False
@py_format6 = 'array([[ 8128...0.j        ]]) == <Quantity [[ ...j        ]] s>\n~Use -v to get the full diff'

    def check(self, func, *args, **kwargs):
        o = func(self.q, *args, **kwargs)
        expected = func(self.q.value, *args, **kwargs) * self.q.unit
        assert o.shape == expected.shape
>       assert np.all(o == expected)
E       assert False
E        +  where False = <function all at 0x00000224CE3A0948>(array([[ 8128...0.j        ]]) == <Quantity [[ ...j        ]] s>
E        +    where <function all at 0x00000224CE3A0948> = np.all
E           Use -v to get the full diff)

astropy\units\tests\test_quantity_non_ufuncs.py:68: AssertionError
_________________________________________________ TestFFT.test_irfftn _________________________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C1E648>

    def test_irfftn(self):
>       self.check(np.fft.irfftn)

astropy\units\tests\test_quantity_non_ufuncs.py:1878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C1E648>
func = <function irfftn at 0x00000224CE5CB9D8>, args = (), kwargs = {}
o = array([[ 6.35000000e+01, -3.05077103e+00,  8.30105637e-17,
        -3.49071198e-01,  1.22730749e-15, -1.33333333e-01,
...        -5.92118946e-16,  2.23015496e+00,  1.18423789e-16,
         3.96276551e+00, -1.18423789e-16,  1.22505108e+01]])
expected = <Quantity [[ 6.35000000e+01, -3.05077103e+00,  8.30105637e-17,
            -3.49071198e-01,  1.22730749e-15, -1.333333...  -5.92118946e-16,  2.23015496e+00,  1.18423789e-16,
             3.96276551e+00, -1.18423789e-16,  1.22505108e+01]] s>
@py_assert1 = <function all at 0x00000224CE3A0948>, @py_assert5 = None, @py_assert3 = None, @py_assert4 = False
@py_assert8 = False
@py_format6 = 'array([[ 6.35...2505108e+01]]) == <Quantity [[ ...05108e+01]] s>\n~Use -v to get the full diff'

    def check(self, func, *args, **kwargs):
        o = func(self.q, *args, **kwargs)
        expected = func(self.q.value, *args, **kwargs) * self.q.unit
        assert o.shape == expected.shape
>       assert np.all(o == expected)
E       assert False
E        +  where False = <function all at 0x00000224CE3A0948>(array([[ 6.35...2505108e+01]]) == <Quantity [[ ...05108e+01]] s>
E        +    where <function all at 0x00000224CE3A0948> = np.all
E           Use -v to get the full diff)

astropy\units\tests\test_quantity_non_ufuncs.py:68: AssertionError
__________________________________________________ TestFFT.test_hfft __________________________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2B2B608>

    def test_hfft(self):
>       self.check(np.fft.hfft)

astropy\units\tests\test_quantity_non_ufuncs.py:1881:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2B2B608>
func = <function hfft at 0x00000224CE5CB438>, args = (), kwargs = {}
o = array([[ 2.25000000e+02, -9.15231310e+01,  2.66453526e-15,
        -1.04721360e+01,  2.33146835e-15, -4.00000000e+00,
...         1.57873714e-13, -4.00000000e+00,  1.39888101e-14,
        -1.04721360e+01, -1.42108547e-14, -9.15231310e+01]])
expected = <Quantity [[ 2.25000000e+02, -9.15231310e+01,  2.66453526e-15,
            -1.04721360e+01,  2.33146835e-15, -4.000000...   1.57873714e-13, -4.00000000e+00,  1.39888101e-14,
            -1.04721360e+01, -1.42108547e-14, -9.15231310e+01]] s>
@py_assert1 = <function all at 0x00000224CE3A0948>, @py_assert5 = None, @py_assert3 = None, @py_assert4 = False
@py_assert8 = False
@py_format6 = 'array([[ 2.25...5231310e+01]]) == <Quantity [[ ...31310e+01]] s>\n~Use -v to get the full diff'

    def check(self, func, *args, **kwargs):
        o = func(self.q, *args, **kwargs)
        expected = func(self.q.value, *args, **kwargs) * self.q.unit
        assert o.shape == expected.shape
>       assert np.all(o == expected)
E       assert False
E        +  where False = <function all at 0x00000224CE3A0948>(array([[ 2.25...5231310e+01]]) == <Quantity [[ ...31310e+01]] s>
E        +    where <function all at 0x00000224CE3A0948> = np.all
E           Use -v to get the full diff)

astropy\units\tests\test_quantity_non_ufuncs.py:68: AssertionError
_________________________________________________ TestFFT.test_ihfft __________________________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C1E788>

    def test_ihfft(self):
>       self.check(np.fft.ihfft)

astropy\units\tests\test_quantity_non_ufuncs.py:1884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFFT object at 0x00000224D2C1E788>
func = <function ihfft at 0x00000224CE5CB4C8>, args = (), kwargs = {}
o = array([[  7.5+0.j        ,  -0.5-2.51366975j,  -0.5-1.20710678j,
         -0.5-0.74830288j,  -0.5-0.5j       ,  -0.5-0...5-0.74830288j,  -0.5-0.5j       ,  -0.5-0.33408932j,
         -0.5-0.20710678j,  -0.5-0.09945618j,  -0.5-0.j        ]])
expected = <Quantity [[  7.5+0.j        ,  -0.5-2.51366975j,  -0.5-1.20710678j,
             -0.5-0.74830288j,  -0.5-0.5j       ,...830288j,  -0.5-0.5j       ,  -0.5-0.33408932j,
             -0.5-0.20710678j,  -0.5-0.09945618j,  -0.5-0.j        ]] s>
@py_assert1 = <function all at 0x00000224CE3A0948>, @py_assert5 = None, @py_assert3 = None, @py_assert4 = False
@py_assert8 = False
@py_format6 = 'array([[  7.5...0.j        ]]) == <Quantity [[ ...j        ]] s>\n~Use -v to get the full diff'

    def check(self, func, *args, **kwargs):
        o = func(self.q, *args, **kwargs)
        expected = func(self.q.value, *args, **kwargs) * self.q.unit
        assert o.shape == expected.shape
>       assert np.all(o == expected)
E       assert False
E        +  where False = <function all at 0x00000224CE3A0948>(array([[  7.5...0.j        ]]) == <Quantity [[ ...j        ]] s>
E        +    where <function all at 0x00000224CE3A0948> = np.all
E           Use -v to get the full diff)

astropy\units\tests\test_quantity_non_ufuncs.py:68: AssertionError
__________________________________ TestFunctionHelpersCompleteness.test_all_included __________________________________

self = <astropy.units.tests.test_quantity_non_ufuncs.TestFunctionHelpersCompleteness object at 0x00000224D2D440C8>

    @pytest.mark.xfail(NO_ARRAY_FUNCTION,
                       reason="no __array_function__ wrapping in numpy<1.17")
    def test_all_included(self):
        included_in_helpers = (SUBCLASS_SAFE_FUNCTIONS |
                               UNSUPPORTED_FUNCTIONS |
                               set(FUNCTION_HELPERS.keys()) |
                               set(DISPATCHED_FUNCTIONS.keys()))
>       assert all_wrapped == included_in_helpers
E       AssertionError: assert {<function ze...E396048>, ...} == {<function mo...E39A048>, ...}
E         Extra items in the right set:
E         <function ifft2 at 0x00000224CE5CB828>
E         <function hfft at 0x00000224CE5CB438>
E         <function irfft2 at 0x00000224CE5CBA68>
E         <function fftn at 0x00000224CE5CB678>
E         <function ifft at 0x00000224CE5CB288>
E         <function rfftn at 0x00000224CE5CB8B8>...
E
E         ...Full output truncated (10 lines hidden), use '-vv' to show

astropy\units\tests\test_quantity_non_ufuncs.py:2184: AssertionError
=============================== 15 failed, 2417 passed, 3 skipped, 1 xfailed in 15.01s ================================

Interestingly if I remove the conda package for Numpy and install with pip:

conda remove numpy
pip install numpy six

then the failures go away! (six is for one of the pytest plugins)

cc @mhvk

Activity

  1. mhvk commented on Jan 21, 2020

    @mhvk
    Contributor

    Almost certainly the conda version has some intel substitutions for the regular numpy fft routines which do not respect the __array_function__ overrides. There is a special label Intel/Anaconda for that at numpy...

    To test: my guess is that with conda this below will give a TypeError:

    import numpy as np
    class A:
       def __array_function__(self, *args, **kwargs):
            return 'Ha!'
    
    np.fft.fft(A())
    # 'Ha!'
    
  2. pllim commented on Jan 21, 2020

    @pllim
    Member

    Close, it is ValueError:

    In [4]: aa = A()
    
    In [5]: np.fft.fft(aa)
    ---------------------------------------------------------------------------
    ValueError                                Traceback (most recent call last)
    <ipython-input-5-bc590274363c> in <module>
    ----> 1 np.fft.fft(aa)
    
    ~\Miniconda3\envs\test-conda-numpy\lib\site-packages\mkl_fft\_numpy_fft.py in ff
    t(a, n, axis, norm)
        158     """
        159     x = _float_utils.__downcast_float128_array(a)
    --> 160     output = mkl_fft.fft(x, n, axis)
        161     if _unitary(norm):
        162         output *= 1 / sqrt(output.shape[axis])
    
    mkl_fft\_pydfti.pyx in mkl_fft._pydfti.fft()
    
    mkl_fft\_pydfti.pyx in mkl_fft._pydfti._fft1d_impl()
    
    mkl_fft\_pydfti.pyx in mkl_fft._pydfti.__process_arguments()
    
    ValueError: Invalid axis (-1) specified.
    

    I can also reproduce the failures @astrofrog listed above. conda gave me numpy and numpy-base 1.18.1. Hope this helps.

  3. astrofrog commented on Jan 21, 2020

    @astrofrog
    MemberAuthor

    @mhvk - would you be able to report this in the appropriate upstream channel?

  4. pllim commented on Jan 21, 2020

    @pllim
    Member

    For completeness, pip install numpy works (I got the "Ha!" output) and installing numpy from conda-forge also works, since that one gives me 1.17 and not 1.18.

  5. pllim commented on Jan 21, 2020

    @pllim
    Member

    I proposed a stop-gap solution at #9878 in case this will take a while. If that PR is merged, it should be reverted when this issue is addressed properly upstream.

  6. changed the title [-]astropy.units test failures with Numpy 1.18 on Windows[/-] [+]astropy.units test failures with Numpy 1.18 from conda on Windows[/+] on Jan 21, 2020
  7. pllim commented on Jan 21, 2020

    @pllim
    Member

    FWIW, I reported this at numpy/numpy#15378

  8. pllim commented on Jan 21, 2020

    @pllim
    Member

    Update: From what I can understand over at the Numpy issue, this is pretty much a "won't fix" situation until FFT backend can be refactored in Numpy, which sounds like a long-term plan. Which means, we now relies on #9726 to solve this indirectly. I will update the latter.

  9. mhvk commented on Jan 21, 2020

    @mhvk
    Contributor

    Thanks all for investigating, and @pllim for raising the issue upstream. Right now, perhaps a TODO would be to add some documentation to "known issues"? Fortunately, this is not that likely to be encountered in practice (at least, as long as fftfreq and fftshift do work, which is the case now).

    My longer term sense would be to have something in the tests that checks whether a group of functions obeys __array_function__ and skip all the tests if that is not the case. We already have NO_ARRAY_FUNCTION in test_quantity_non_ufuncs - that might just need to become a little more complicated...

  10. pllim commented on Jan 21, 2020

    @pllim
    Member
  11. pllim commented on Jan 22, 2020

    @pllim
    Member

    Update: Anaconda has agreed to fix conda packaging for Numpy 1.18 upstream.

  12. pllim commented on Jan 22, 2020

    @pllim
    Member

    ContinuumIO/anaconda-issues#11568 (comment) and the code above works for me now.

  13. pllim commented on Jan 22, 2020

    @pllim
    Member

    p.s. Let's wait for #9726 instead of unpinning #9878 as yet a separate PR, so Tom R won't have to resolve conflicts again. 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions