Changeset 0b6d23d for python/tests/test_pitch.py
- Timestamp:
- May 16, 2016, 5:08:18 AM (8 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:
- a6f9ebf
- Parents:
- 58a5fb9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/tests/test_pitch.py
r58a5fb9 r0b6d23d 1 1 #! /usr/bin/env python 2 2 3 from unittest import TestCase 4 from numpy.testing import assert_equal, assert_almost_equal 5 from numpy import random, sin, arange, mean, median, isnan 6 from math import pi 3 from unittest import TestCase, main 4 from numpy.testing import assert_equal 5 from numpy import sin, arange, mean, median, isnan, pi 7 6 from aubio import fvec, pitch, freqtomidi, float_type 8 7 … … 25 24 p = pitch('default', 2048, 512, 32000) 26 25 f = fvec (512) 27 for iin range(10): assert_equal (p(f), 0.)26 for _ in range(10): assert_equal (p(f), 0.) 28 27 29 28 def test_run_on_ones(self): … … 32 31 f = fvec (512) 33 32 f[:] = 1 34 for iin range(10): assert_equal (p(f), 0.)33 for _ in range(10): assert_equal (p(f), 0.) 35 34 36 35 class aubio_pitch_Sinusoid(TestCase): … … 54 53 55 54 def run_pitch(self, p, input_vec, freq): 56 count = 057 55 pitches, errors = [], [] 58 56 input_blocks = input_vec.reshape((-1, p.hop_size)) … … 64 62 assert_equal ( isnan(pitches), False ) 65 63 # cut the first candidates 66 cut = ( p.buf_size - p.hop_size ) / p.hop_size64 #cut = ( p.buf_size - p.hop_size ) / p.hop_size 67 65 pitches = pitches[2:] 68 66 errors = errors[2:] … … 125 123 126 124 if __name__ == '__main__': 127 from unittest import main128 125 main()
Note: See TracChangeset
for help on using the changeset viewer.