Changeset 42f1cf14 for tests/python/src
- Timestamp:
- May 18, 2008, 3:23:11 AM (17 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- bf9d8a6
- Parents:
- 4ecfee9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/python/src/utils/hist.py
r4ecfee9 r42f1cf14 1 1 import unittest 2 import random 2 3 3 4 from template import aubio_unit_template … … 6 7 buf_size = 2048 7 8 channels = 1 8 flow = 0.9 fhig = 100.9 flow = float(random.randint(0, 100) + random.random()) 10 fhig = float(random.randint(100, 1000) + random.random()) 10 11 11 12 nelems = 1000 … … 14 15 15 16 def setUp(self): 17 print flow, fhig 16 18 self.o = new_aubio_hist(flow, fhig, nelems, channels) 17 19 … … 31 33 del_fvec(input) 32 34 33 def test_hist_impulse(self): 34 """ test hist on impulse """ 35 def test_hist_impulse_top(self): 36 """ test hist on impulse (top - 1.) """ 37 """ this returns 1./nelems because 1 element is in the range """ 35 38 input = new_fvec(buf_size, channels) 36 39 constant = fhig - 1. … … 40 43 del_fvec(input) 41 44 42 def test_hist_impulse2(self): 43 """ test hist on impulse """ 45 def test_hist_impulse_over(self): 46 """ test hist on impulse (top + 1.) """ 47 """ this returns 0 because constant is out of range """ 44 48 input = new_fvec(buf_size, channels) 45 49 constant = fhig + 1. 50 fvec_write_sample(input,constant,0,0) 51 aubio_hist_do_notnull(self.o, input) 52 self.assertCloseEnough(0., aubio_hist_mean(self.o)) 53 del_fvec(input) 54 55 def test_hist_impulse_bottom(self): 56 """ test hist on constant near lower limit """ 57 """ this returns 1./nelems because 1 element is in the range """ 58 input = new_fvec(buf_size, channels) 59 constant = flow + 1. 46 60 fvec_write_sample(input,constant,0,0) 47 61 aubio_hist_do_notnull(self.o, input) … … 49 63 del_fvec(input) 50 64 65 def test_hist_impulse_under(self): 66 """ test hist on constant under lower limit """ 67 """ this returns 0 because constant is out of range """ 68 input = new_fvec(buf_size, channels) 69 constant = flow - 1. 70 fvec_write_sample(input,constant,0,0) 71 aubio_hist_do_notnull(self.o, input) 72 self.assertCloseEnough(0., aubio_hist_mean(self.o)) 73 del_fvec(input) 74 51 75 if __name__ == '__main__': unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.