History

python/tests/test_phasevoc.py: simplify, add wrong sized input tests

Paul Brossier committed 10 years ago

Commit dfada331 parent ad5eae81 file · +28 −47Browse files

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

Unified · Split

python/tests/test_phasevoc.py+28−47
@@ -2,8 +2,6 @@ · 1 unmodified line
22
33 from numpy.testing import TestCase, assert_equal, assert_array_less
44 from aubio import fvec, cvec, pvoc, float_type
5−from numpy import array, shape
6−from numpy.random import random
75 from nose2.tools import params
86 import numpy as np
97
@@ -50,51 +48,6 @@ class aubio_pvoc_test_case(TestCase): · 40 unmodified lines
5048 assert_equal ( s.phas, 0.)
5149 assert_equal ( r, 0.)
5250
53− def test_resynth_8_steps_sine(self):
54− """ check the resynthesis of is correct with 87.5% overlap """
55− hop_s = 1024
56− ratio = 8
57− freq = 445; samplerate = 22050
58− sigin = create_sine(hop_s, freq, samplerate)
59− self.reconstruction( sigin, hop_s, ratio)
60−
61− def test_resynth_8_steps(self):
62− """ check the resynthesis of is correct with 87.5% overlap """
63− hop_s = 1024
64− ratio = 8
65− sigin = create_noise(hop_s)
66− self.reconstruction(sigin, hop_s, ratio)
67−
68− def test_resynth_4_steps_sine(self):
69− """ check the resynthesis of is correct with 87.5% overlap """
70− hop_s = 1024
71− ratio = 4
72− freq = 445; samplerate = 22050
73− sigin = create_sine(hop_s, freq, samplerate)
74− self.reconstruction(sigin, hop_s, ratio)
75−
76− def test_resynth_4_steps(self):
77− """ check the resynthesis of is correct with 75% overlap """
78− hop_s = 1024
79− ratio = 4
80− sigin = create_noise(hop_s)
81− self.reconstruction(sigin, hop_s, ratio)
82−
83− def test_resynth_2_steps_sine(self):
84− """ check the resynthesis of is correct with 50% overlap """
85− hop_s = 1024
86− ratio = 2
87− freq = 445; samplerate = 22050
88− sigin = create_sine(hop_s, freq, samplerate)
89− self.reconstruction(sigin, hop_s, ratio)
90−
91− def test_resynth_2_steps(self):
92− """ check the resynthesis of is correct with 50% overlap """
93− hop_s = 1024
94− ratio = 2
95− sigin = create_noise(hop_s)
96− self.reconstruction(sigin, hop_s, ratio)
97−
9851 @params(
9952 ( 256, 8),
10053 ( 256, 4),
@@ -153,6 +106,34 @@ class aubio_pvoc_test_case(TestCase): · 52 unmodified lines
153106 # make sure all square errors are less than desired precision
154107 assert_array_less(sq_error, max_sq_error)
155108
109+ def test_large_input_timegrain(self):
110+ win_s = 1024
111+ f = pvoc(win_s)
112+ t = fvec(win_s + 1)
113+ with self.assertRaises(ValueError):
114+ f(t)
115+
116+ def test_small_input_timegrain(self):
117+ win_s = 1024
118+ f = pvoc(win_s)
119+ t = fvec(1)
120+ with self.assertRaises(ValueError):
121+ f(t)
122+
123+ def test_large_input_fftgrain(self):
124+ win_s = 1024
125+ f = pvoc(win_s)
126+ s = cvec(win_s + 5)
127+ with self.assertRaises(ValueError):
128+ f.rdo(s)
129+
130+ def test_small_input_fftgrain(self):
131+ win_s = 1024
132+ f = pvoc(win_s)
133+ s = cvec(16)
134+ with self.assertRaises(ValueError):
135+ f.rdo(s)
136+
156137 if __name__ == '__main__':
157138 from nose2 import main
158139 main()

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