python/tests/test_fft.py: skip test fft(zeros).phas == 0 if needed, expected powerpc
authorPaul Brossier <piem@piem.org>
Mon, 28 Nov 2016 17:14:01 +0000 (18:14 +0100)
committerPaul Brossier <piem@piem.org>
Mon, 28 Nov 2016 17:14:01 +0000 (18:14 +0100)
python/tests/test_fft.py
python/tests/test_phasevoc.py

index fa349e5..a8f82b9 100755 (executable)
@@ -33,7 +33,14 @@ class aubio_fft_test_case(TestCase):
         f = fft (win_s)
         fftgrain = f (timegrain)
         assert_equal ( fftgrain.norm, 0 )
-        assert_equal ( fftgrain.phas, 0 )
+        try:
+            assert_equal ( fftgrain.phas, 0 )
+        except AssertionError:
+            assert_equal (fftgrain.phas[fftgrain.phas > 0], +pi)
+            assert_equal (fftgrain.phas[fftgrain.phas < 0], -pi)
+            assert_equal (np.abs(fftgrain.phas[np.abs(fftgrain.phas) != pi]), 0)
+            self.skipTest('fft(fvec(%d)).phas != +0, ' % win_s \
+                    + 'This is expected when using fftw3 on powerpc.')
 
     def test_impulse(self):
         """ check the transform of one impulse at a random place """
index 23cbad5..957d3b1 100755 (executable)
@@ -46,7 +46,14 @@ class aubio_pvoc_test_case(TestCase):
             r = f.rdo(s)
             assert_equal ( t, 0.)
             assert_equal ( s.norm, 0.)
-            assert_equal ( s.phas, 0.)
+            try:
+                assert_equal ( s.phas, 0 )
+            except AssertionError:
+                assert_equal (s.phas[s.phas > 0], +np.pi)
+                assert_equal (s.phas[s.phas < 0], -np.pi)
+                assert_equal (np.abs(s.phas[np.abs(s.phas) != np.pi]), 0)
+                self.skipTest('pvoc(fvec(%d)).phas != +0, ' % win_s \
+                        + 'This is expected when using fftw3 on powerpc.')
             assert_equal ( r, 0.)
 
     @params(