Changeset ac9eea7 for python/tests


Ignore:
Timestamp:
Mar 3, 2013, 9:14:32 PM (12 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:
0bd161d
Parents:
9dd10cc
Message:

tests/python/src/spectral/filterbank.py: replaced by python/tests/test_filterbank.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_filterbank.py

    r9dd10cc rac9eea7  
    44from numpy.testing import assert_equal, assert_almost_equal
    55from numpy import random
     6from math import pi
    67from aubio import cvec, filterbank
    78
     
    1819    assert_equal (r, f.get_coeffs())
    1920
     21  def test_phase(self):
     22    f = filterbank(40, 512)
     23    c = cvec(512)
     24    c.phas[:] = pi
     25    assert_equal( f(c), 0);
     26
     27  def test_norm(self):
     28    f = filterbank(40, 512)
     29    c = cvec(512)
     30    c.norm[:] = 1
     31    assert_equal( f(c), 0);
     32
     33  def test_random_norm(self):
     34    f = filterbank(40, 512)
     35    c = cvec(512)
     36    c.norm[:] = random.random((512 / 2 + 1,)).astype('float32')
     37    assert_equal( f(c), 0)
     38
     39  def test_random_coeffs(self):
     40    f = filterbank(40, 512)
     41    c = cvec(512)
     42    r = random.random([40, 512 / 2 + 1]).astype('float32')
     43    r /= r.sum()
     44    f.set_coeffs(r)
     45    c.norm[:] = random.random((512 / 2 + 1,)).astype('float32')
     46    assert_equal ( f(c) < 1., True )
     47    assert_equal ( f(c) > 0., True )
     48
     49  def test_mfcc_coeffs(self):
     50    f = filterbank(40, 512)
     51    c = cvec(512)
     52    f.set_mel_coeffs_slaney(44100)
     53    c.norm[:] = random.random((512 / 2 + 1,)).astype('float32')
     54    assert_equal ( f(c) < 1., True )
     55    assert_equal ( f(c) > 0., True )
     56
    2057if __name__ == '__main__':
    2158  from unittest import main
Note: See TracChangeset for help on using the changeset viewer.