1 from numpy.testing import TestCase, run_module_suite
2 from numpy.testing import assert_equal, assert_almost_equal
4 from numpy import array, shape
6 class aubio_pvoc_test_case(TestCase):
8 def test_members(self):
10 assert_equal ([f.win_s, f.hop_s], [1024, 512])
12 assert_equal ([f.win_s, f.hop_s], [2048, 128])
15 win_s, hop_s = 1024, 256
16 f = pvoc (win_s, hop_s)
18 for time in range( 4 * win_s / hop_s ):
21 assert_equal ( array(t), 0)
22 assert_equal ( s.norm, 0)
23 assert_equal ( s.phas, 0)
26 def test_steps_two_channels(self):
27 """ check the resynthesis of steps is correct """
28 f = pvoc(1024, 512, 2)
31 # positive step in first channel
33 # positive step in second channel
39 #self.plot_this ( s1.norm.T )
40 assert_almost_equal ( t1, r2, decimal = 6 )
42 def test_steps_three_random_channels(self):
43 from random import random
49 t1[i][j] = random() * 2. - 1.
54 assert_almost_equal( t1, t2, decimal = 6 )
56 def plot_this( self, this ):
57 from pylab import semilogy, show
61 if __name__ == '__main__':
62 from unittest import main