History

tests/test_pitch.py: add more tests

Paul Brossier committed 11 years ago

Commit b74513d1 parent 048dd6c1 file · +27 −4Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/tests/test_pitch.py+27−4
@@ -67,13 +67,35 @@ class aubio_pitch_Sinusoid(TestCase): · 66 unmodified lines
6767 pitches = pitches[2:]
6868 errors = errors[2:]
6969 # check that the mean of all relative errors is less than 10%
70− assert abs (mean(errors) ) < 0.1, pitches
71− assert abs (mean(errors) ) < 0.1, "error is bigger than 0.1 (%f)" % mean(errors)
70+ #assert abs (mean(errors) ) < 0.1, pitches
71+ assert abs (median(errors) ) < 0.06, "median of relative errors is bigger than 0.06 (%f)\n found %s\n errors %s" % (mean(errors), pitches, errors)
7272 #print 'len(pitches), cut:', len(pitches), cut
73− #print 'mean errors: ', mean(errors), 'mean pitches: ', mean(pitches)
73+ #print 'median errors: ', median(errors), 'median pitches: ', median(pitches)
7474
7575 pitch_algorithms = [ "default", "yinfft", "yin", "schmitt", "mcomb", "fcomb" , "specacf" ]
76+pitch_algorithms = [ "default", "yinfft", "yin", "schmitt", "mcomb", "fcomb" ]
77+
78+#freqs = [ 27.5, 55., 110., 220., 440., 880., 1760., 3520. ]
79+freqs = [ 110., 220., 440., 880., 1760., 3520. ]
80+signal_modes = []
81+for freq in freqs:
82+ signal_modes += [
83+ ( 4096, 2048, 44100, freq ),
84+ ( 2048, 512, 44100, freq ),
85+ ( 2048, 1024, 44100, freq ),
86+ ( 2048, 1024, 32000, freq ),
87+ ]
88+
89+freqs = [ ] #55., 110., 220., 440., 880., 1760., 3520. ]
90+for freq in freqs:
91+ signal_modes += [
92+ ( 2048, 1024, 22050, freq ),
93+ ( 1024, 256, 16000, freq ),
94+ ( 1024, 256, 8000, freq ),
95+ ( 1024, 512+256, 8000, freq ),
96+ ]
7697
98+"""
7799 signal_modes = [
78100 ( 4096, 512, 44100, 2.*882. ),
79101 ( 4096, 512, 44100, 882. ),
@@ -87,6 +109,7 @@ signal_modes = [ · 7 unmodified lines
87109 ( 1024, 256, 8000, 440. ),
88110 ( 1024, 512+256, 8000, 440. ),
89111 ]
112+"""
90113
91114 def create_test (algo, mode):
92115 def do_test_pitch(self):
@@ -96,7 +119,7 @@ def create_test (algo, mode): · 3 unmodified lines
96119 for algo in pitch_algorithms:
97120 for mode in signal_modes:
98121 test_method = create_test (algo, mode)
99− test_method.__name__ = 'test_pitch_%s_%d_%d_%dHz_sin_%.2f' % ( algo,
122+ test_method.__name__ = 'test_pitch_%s_%d_%d_%dHz_sin_%.0f' % ( algo,
100123 mode[0], mode[1], mode[2], mode[3] )
101124 setattr (aubio_pitch_Sinusoid, test_method.__name__, test_method)
102125

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t