From 5a93302d1307e92c952871de693ca9dc98595b1a Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 8 Oct 2009 02:35:50 +0200 Subject: [PATCH] tests/python/src/onset/peakpick.py: update to interpolated peak position --- tests/python/src/onset/peakpick.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/python/src/onset/peakpick.py b/tests/python/src/onset/peakpick.py index fdf1d417..037f28ed 100644 --- a/tests/python/src/onset/peakpick.py +++ b/tests/python/src/onset/peakpick.py @@ -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): -- 2.26.2