Showing the changes to python/tests (1 of 1 file). Show all
Unified · Split
| @@ -2,8 +2,6 @@ · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | from numpy.testing import TestCase, assert_equal, assert_array_less |
| 4 | 4 | from aubio import fvec, cvec, pvoc, float_type |
| 5 | −from numpy import array, shape | |
| 6 | −from numpy.random import random | |
| 7 | 5 | from nose2.tools import params |
| 8 | 6 | import numpy as np |
| 9 | 7 | |
| @@ -50,51 +48,6 @@ class aubio_pvoc_test_case(TestCase): · 40 unmodified lines | ||
| 50 | 48 | assert_equal ( s.phas, 0.) |
| 51 | 49 | assert_equal ( r, 0.) |
| 52 | 50 | |
| 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 | − | |
| 98 | 51 | @params( |
| 99 | 52 | ( 256, 8), |
| 100 | 53 | ( 256, 4), |
| @@ -153,6 +106,34 @@ class aubio_pvoc_test_case(TestCase): · 52 unmodified lines | ||
| 153 | 106 | # make sure all square errors are less than desired precision |
| 154 | 107 | assert_array_less(sq_error, max_sq_error) |
| 155 | 108 | |
| 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 | + | |
| 156 | 137 | if __name__ == '__main__': |
| 157 | 138 | from nose2 import main |
| 158 | 139 | main() |