- Timestamp:
- Nov 2, 2018, 8:34:17 PM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
- Children:
- 8607a74
- Parents:
- 5af36fa
- Location:
- python/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/tests/test_filterbank_mel.py
r5af36fa r67024ff 3 3 import numpy as np 4 4 from numpy.testing import TestCase, assert_equal, assert_almost_equal 5 from _tools import assert_warns 5 6 6 7 from aubio import cvec, filterbank, float_type … … 29 30 freq_list = [40, 80, 200, 400, 800, 1600, 3200, 6400, 12800, 15000, 24000] 30 31 freqs = np.array(freq_list, dtype = float_type) 31 f.set_triangle_bands(freqs, 48000) 32 with assert_warns(UserWarning): 33 f.set_triangle_bands(freqs, 48000) 32 34 assert_equal ( f(cvec(1024)), 0) 33 35 self.assertIsInstance(f.get_coeffs(), np.ndarray) … … 37 39 freq_list = [40, 80, 200, 400, 800, 1600, 3200, 6400, 12800, 15000, 24000] 38 40 freqs = np.array(freq_list, dtype = float_type) 39 f.set_triangle_bands(freqs, 48000) 41 with assert_warns(UserWarning): 42 f.set_triangle_bands(freqs, 48000) 40 43 self.assertIsInstance(f.get_coeffs(), np.ndarray) 41 44 spec = cvec(1024) … … 45 48 0.02133301, 0.02133301, 0.02133311, 0.02133334, 0.02133345]) 46 49 50 def test_triangle_freqs_normal(self): 51 """ create a filter with set_triangle_bands, normal mode """ 52 f = filterbank(3, 1024) 53 freq_list = [100, 1000, 10000, 15000, 20000] 54 freqs = np.array(freq_list, dtype = float_type) 55 f.set_triangle_bands(freqs, 44100) 56 57 def test_triangle_freqs_too_long(self): 58 """ create a filter with freq_list too long """ 59 f = filterbank(2, 1024) 60 freq_list = [100, 1000, 10000, 15000, 20000] 61 freqs = np.array(freq_list, dtype = float_type) 62 with assert_warns(UserWarning): 63 f.set_triangle_bands(freqs, 44100) 64 65 def test_triangle_freqs_too_short(self): 66 """ create a filter with freq_list too short """ 67 f = filterbank(4, 1024) 68 freq_list = [100, 1000, 10000, 15000, 20000] 69 freqs = np.array(freq_list, dtype = float_type) 70 with assert_warns(UserWarning): 71 f.set_triangle_bands(freqs, 44100) 72 73 def test_above_nyquist(self): 74 """ create a filter with freq_list too short """ 75 f = filterbank(3, 1024) 76 freq_list = [100, 1000, 10000, 15000, 23000] 77 freqs = np.array(freq_list, dtype = float_type) 78 with assert_warns(UserWarning): 79 f.set_triangle_bands(freqs, 44100) 80 47 81 if __name__ == '__main__': 48 82 from unittest import main -
python/tests/test_source.py
r5af36fa r67024ff 70 70 if 'f_' in soundfile and samplerate == 0: 71 71 import re 72 f = re.compile( '.*_\([0:9]*f\)_.*')72 f = re.compile(r'.*_\([0:9]*f\)_.*') 73 73 match_f = re.findall('([0-9]*)f_', soundfile) 74 74 if len(match_f) == 1:
Note: See TracChangeset
for help on using the changeset viewer.