Changeset b74513d


Ignore:
Timestamp:
Jan 29, 2015, 3:53:08 PM (9 years ago)
Author:
Paul Brossier <piem@piem.org>
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:
16f8dcc
Parents:
048dd6c
Message:

tests/test_pitch.py: add more tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_pitch.py

    r048dd6c rb74513d  
    6868        errors = errors[2:]
    6969        # check that the mean of all relative errors is less than 10%
    70         assert abs (mean(errors) ) < 0.1, pitches
    71         assert abs (mean(errors) ) < 0.1, "error is bigger than 0.1 (%f)" % mean(errors)
     70        #assert abs (mean(errors) ) < 0.1, pitches
     71        assert abs (median(errors) ) < 0.06, "median of relative errors is bigger than 0.06 (%f)\n found %s\n errors %s" % (mean(errors), pitches, errors)
    7272        #print 'len(pitches), cut:', len(pitches), cut
    73         #print 'mean errors: ', mean(errors), 'mean pitches: ', mean(pitches)
     73        #print 'median errors: ', median(errors), 'median pitches: ', median(pitches)
    7474
    7575pitch_algorithms = [ "default", "yinfft", "yin", "schmitt", "mcomb", "fcomb" , "specacf" ]
     76pitch_algorithms = [ "default", "yinfft", "yin", "schmitt", "mcomb", "fcomb" ]
    7677
     78#freqs = [ 27.5, 55., 110., 220., 440., 880., 1760., 3520. ]
     79freqs = [             110., 220., 440., 880., 1760., 3520. ]
     80signal_modes = []
     81for freq in freqs:
     82    signal_modes += [
     83        ( 4096,  2048, 44100, freq ),
     84        ( 2048,  512, 44100, freq ),
     85        ( 2048, 1024, 44100, freq ),
     86        ( 2048, 1024, 32000, freq ),
     87        ]
     88
     89freqs = [ ] #55., 110., 220., 440., 880., 1760., 3520. ]
     90for freq in freqs:
     91    signal_modes += [
     92        ( 2048, 1024, 22050, freq ),
     93        ( 1024,  256, 16000, freq ),
     94        ( 1024,  256, 8000,  freq ),
     95        ( 1024, 512+256, 8000, freq ),
     96        ]
     97
     98"""
    7799signal_modes = [
    78100        ( 4096,  512, 44100, 2.*882. ),
     
    88110        ( 1024, 512+256, 8000, 440. ),
    89111        ]
     112"""
    90113
    91114def create_test (algo, mode):
     
    97120    for mode in signal_modes:
    98121        test_method = create_test (algo, mode)
    99         test_method.__name__ = 'test_pitch_%s_%d_%d_%dHz_sin_%.2f' % ( algo,
     122        test_method.__name__ = 'test_pitch_%s_%d_%d_%dHz_sin_%.0f' % ( algo,
    100123                mode[0], mode[1], mode[2], mode[3] )
    101124        setattr (aubio_pitch_Sinusoid, test_method.__name__, test_method)
Note: See TracChangeset for help on using the changeset viewer.