tests/python/src/onset/peakpick.py: update to interpolated peak position
authorPaul Brossier <piem@piem.org>
Thu, 8 Oct 2009 00:35:50 +0000 (02:35 +0200)
committerPaul Brossier <piem@piem.org>
Thu, 8 Oct 2009 00:35:50 +0000 (02:35 +0200)
tests/python/src/onset/peakpick.py

index fdf1d4176780b80ff9dfd9db42ef0bcd20195de7..037f28edb417afb40a8149c2a9203bdc9c715d87 100644 (file)
@@ -20,7 +20,7 @@ class peakpick_unit(aubio_unit_template):
 
   def test_peakpick_zeroes(self):
     """ check peakpick run on a vector full of zero returns no peak. """
-    self.assertEqual(0., aubio_peakpick_pimrt_getval(self.o))
+    self.assertEqual(0., aubio_peakpicker_get_thresholded_input(self.o))
 
   def test_peakpick_impulse(self):
     """ check peakpick detects a single impulse as a peak. """
@@ -30,7 +30,7 @@ class peakpick_unit(aubio_unit_template):
       input = new_fvec(buf_size, channels)
       fvec_write_sample(input, 1000., 0, index)
       fvec_write_sample(input, 1000./2, 0, index+1)
-      #print "%2s" % index, aubio_peakpick_pimrt(input, self.o), "|",
+      #print "%2s" % index, aubio_peakpicker_do(self.o, input), "|",
       #for i in range(buf_size): print fvec_read_sample(input, 0, i),
       #print
       del_fvec(input)
@@ -44,20 +44,20 @@ class peakpick_unit(aubio_unit_template):
       fvec_write_sample(input, 1000., 0, index+1)
       fvec_write_sample(input, 1000., 0, index+3)
       fvec_write_sample(input, 1000./2, 0, index+4)
-      peak_pick_result = aubio_peakpick_pimrt(input, self.o)
-      if index == 2: self.assertEqual(1., peak_pick_result)
+      peak_pick_result = aubio_peakpicker_do(self.o, input)
+      if index == 2:
+        # we are at the peak. check the result is after current sample,
+        # and not after next one
+        self.failIf( 1. >= peak_pick_result )
+        self.failIf( 2. < peak_pick_result )
       else: self.assertEqual(0., peak_pick_result)
-      #print "%2s" % index, peak_pick_result, "|",
-      #for i in range(buf_size): print fvec_read_sample(input, 0, i),
-      #print
       del_fvec(input)
     for index in range(buf_size-4,buf_size-1):
       input = new_fvec(buf_size, channels)
       fvec_write_sample(input, 1000./2, 0, index)
       fvec_write_sample(input, 1000., 0, index+1)
-      #print "%2s" % index, aubio_peakpick_pimrt(input, self.o), "|",
-      #for i in range(buf_size): print fvec_read_sample(input, 0, i),
-      #print
+      peak_pick_result = aubio_peakpicker_do(self.o, input)
+      self.assertEqual(0., peak_pick_result)
       del_fvec(input)
 
   def test_peakpick_set_threshold(self):