From: Paul Brossier Date: Wed, 7 Nov 2007 15:51:42 +0000 (+0100) Subject: update fft.py tests, merge from banane X-Git-Tag: bzr2git~467^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d57d1de0928922ffec021faa56361e80a556a96b;p=aubio.git update fft.py tests, merge from banane --- d57d1de0928922ffec021faa56361e80a556a96b diff --cc tests/python/fft.py index b856238f,329caa9e..f94f9cfc --- a/tests/python/fft.py +++ b/tests/python/fft.py @@@ -83,15 -82,15 +82,21 @@@ class fft_unit(aubio_unit_template) for index in range(buf_size/2+1): for channel in range(1, channels): self.assertEqual(0., cvec_read_norm(fftgrain, channel, index)) ++ self.assertEqual(0., cvec_read_phas(fftgrain, channel, index)) ++ # check norm and phase == 0 in first first and last bin of first channel - self.assertAlmostEqual((buf_size-1)*some_constant, cvec_read_norm(fftgrain, 0, 0), precision) - self.assertEqual(0., cvec_read_phas(fftgrain, 0, 0)) - self.assertEqual(0., cvec_read_norm(fftgrain, 0, buf_size/2+1)) - self.assertEqual(0., cvec_read_phas(fftgrain, 0, buf_size/2+1)) - # check unwrap2pi(phas) ~= pi everywhere but in first bin - self.assertCloseEnough((buf_size-1)*some_constant, cvec_read_norm(fftgrain, 0, 0)) ++ # check unwrap2pi(phas) ~= pi everywhere but in first and last bin + self.assertCloseEnough(0., cvec_read_phas(fftgrain, 0, 0)) - self.assertCloseEnough(0., cvec_read_norm(fftgrain, 0, buf_size/2+1)) ++ for index in range(1,buf_size/2): ++ self.assertCloseEnough(math.pi, aubio_unwrap2pi(cvec_read_phas(fftgrain, 0, index))) ++ self.assertCloseEnough(0., cvec_read_phas(fftgrain, 0, buf_size/2)) + self.assertCloseEnough(0., cvec_read_phas(fftgrain, 0, buf_size/2+1)) - # check unwrap2pi(phas) ~= pi everywhere but in first bin ++ ++ self.assertCloseEnough((buf_size-1)*some_constant, cvec_read_norm(fftgrain, 0, 0)) for index in range(1,buf_size/2+1): - self.assertAlmostEqual ( math.pi, aubio_unwrap2pi(cvec_read_phas(fftgrain, 0, index)), precision) - self.assertAlmostEqual(some_constant, cvec_read_norm(fftgrain, 0, index), precision) - self.assertCloseEnough(math.pi, aubio_unwrap2pi(cvec_read_phas(fftgrain, 0, index))) - self.assertCloseEnough(some_constant, cvec_read_norm(fftgrain, 0, index)) ++ self.assertCloseEnough(some_constant, abs(cvec_read_norm(fftgrain, 0, index))) ++ self.assertCloseEnough(0., cvec_read_norm(fftgrain, 0, buf_size/2+1)) ++ del fftgrain del input