ref: 574708177d5fabaec1d91d5b2f9bfeaad77d57cc
parent: 0bd161d0603e3972a838d0592dbfb05da262ed48
author: Paul Brossier <piem@piem.org>
date: Sun Mar 3 10:19:35 EST 2013
tests/python/src/temporal/c_weighting.py: replaced by python/tests/test_filter.py
--- /dev/null
+++ b/python/tests/c_weighting_test_simple_8000.expected
@@ -1,0 +1,2 @@
+ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 5.00000000e-01 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
+ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 3.39108697e-01 2.23441868e-01 -1.31029191e-01 3.33061907e-02 -2.89386407e-02 -1.68524660e-02 -5.02737225e-03 -2.47225074e-02 -3.06670933e-03 -2.20570849e-02 -5.57507292e-03 -1.81342032e-02 -7.89289483e-03 -1.50756531e-02 -9.23565472e-03 -1.29964131e-02 -9.78591684e-03 -1.16053213e-02 -9.84372912e-03 -1.06315198e-02
--- a/python/tests/test_filter.py
+++ b/python/tests/test_filter.py
@@ -40,6 +40,15 @@
u = f(v)
assert_almost_equal (expected[1], u)
+ def test_c_weighting_8000(self):
+ expected = array_from_text_file('c_weighting_test_simple_8000.expected')
+ f = digital_filter(5)
+ f.set_c_weighting(8000)
+ v = fvec(32)
+ v[12] = .5
+ u = f(v)
+ assert_almost_equal (expected[1], u)
+
def test_a_weighting(self):
expected = array_from_text_file('a_weighting_test_simple.expected')
f = digital_filter(7)
--- a/tests/python/src/temporal/c_weighting.py
+++ /dev/null
@@ -1,59 +1,0 @@
-from localaubio import *
-
-class c_weighting_unit(aubio_unit_template):
-
- def test_simple(self):
- expected = array_from_text_file('src/temporal/c_weighting_test_simple.expected')
- samplerate = 44100
- channels = 1
- buf_size = 32
-
- # prepare input
- input = new_fvec (buf_size, 1)
- output = new_fvec (buf_size, 1)
- fvec_write_sample (input, 0.5, 0, 12)
-
- # check input
- for i in range(buf_size):
- for c in range(channels):
- self.assertEqual(expected[0][i], fvec_read_sample(input, c, i))
-
- # filter
- f = new_aubio_filter_c_weighting (samplerate, channels)
- aubio_filter_do_outplace (f, input, output)
- del_aubio_filter (f)
-
- # check output
- for i in range(buf_size):
- for c in range(channels):
- self.assertAlmostEqual(expected[1][i], fvec_read_sample(output, c, i))
-
- def test_simple_8000(self):
- expected = array_from_text_file('src/temporal/c_weighting_test_simple_8000.expected')
- samplerate = 8000
- channels = 1
- buf_size = 32
-
- # prepare input
- input = new_fvec (buf_size, 1)
- output = new_fvec (buf_size, 1)
- fvec_write_sample (input, 0.5, 0, 12)
-
- # check input
- for i in range(buf_size):
- for c in range(channels):
- self.assertEqual(expected[0][i], fvec_read_sample(input, c, i))
-
- # filter
- f = new_aubio_filter_c_weighting (samplerate, channels)
- aubio_filter_do_outplace (f, input, output)
- del_aubio_filter (f)
-
- # check output
- for i in range(buf_size):
- for c in range(channels):
- self.assertAlmostEqual(expected[1][i], fvec_read_sample(output, c, i))
-
-if __name__ == '__main__':
- import unittest
- unittest.main()
--- a/tests/python/src/temporal/c_weighting_test_simple_8000.expected
+++ /dev/null
@@ -1,2 +1,0 @@
- 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 5.00000000e-01 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
- 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 3.39108697e-01 2.23441868e-01 -1.31029191e-01 3.33061907e-02 -2.89386407e-02 -1.68524660e-02 -5.02737225e-03 -2.47225074e-02 -3.06670933e-03 -2.20570849e-02 -5.57507292e-03 -1.81342032e-02 -7.89289483e-03 -1.50756531e-02 -9.23565472e-03 -1.29964131e-02 -9.78591684e-03 -1.16053213e-02 -9.84372912e-03 -1.06315198e-02