Ignore:
Timestamp:
Sep 16, 2017, 5:41:35 PM (7 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
Children:
a729232
Parents:
5e56bbd (diff), c3e98d7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into coveralls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_filterbank_mel.py

    r5e56bbd r38a965e  
    11#! /usr/bin/env python
    22
    3 from unittest import main
    4 from numpy.testing import TestCase
    5 from numpy.testing import assert_equal, assert_almost_equal
    6 from numpy import array, shape
     3import numpy as np
     4from numpy.testing import TestCase, assert_equal, assert_almost_equal
     5
    76from aubio import cvec, filterbank, float_type
     7
     8import warnings
     9warnings.filterwarnings('ignore', category=UserWarning, append=True)
    810
    911class aubio_filterbank_mel_test_case(TestCase):
     
    1315        f.set_mel_coeffs_slaney(16000)
    1416        a = f.get_coeffs()
    15         assert_equal(shape (a), (40, 512/2 + 1) )
     17        assert_equal(np.shape (a), (40, 512/2 + 1) )
    1618
    1719    def test_other_slaney(self):
    1820        f = filterbank(40, 512*2)
    1921        f.set_mel_coeffs_slaney(44100)
    20         _ = f.get_coeffs()
     22        self.assertIsInstance(f.get_coeffs(), np.ndarray)
    2123        #print "sum is", sum(sum(a))
    2224        for win_s in [256, 512, 1024, 2048, 4096]:
    2325            f = filterbank(40, win_s)
    2426            f.set_mel_coeffs_slaney(32000)
    25             _ = f.get_coeffs()
    2627            #print "sum is", sum(sum(a))
     28            self.assertIsInstance(f.get_coeffs(), np.ndarray)
    2729
    2830    def test_triangle_freqs_zeros(self):
    2931        f = filterbank(9, 1024)
    3032        freq_list = [40, 80, 200, 400, 800, 1600, 3200, 6400, 12800, 15000, 24000]
    31         freqs = array(freq_list, dtype = float_type)
     33        freqs = np.array(freq_list, dtype = float_type)
    3234        f.set_triangle_bands(freqs, 48000)
    33         _ = f.get_coeffs().T
    3435        assert_equal ( f(cvec(1024)), 0)
     36        self.assertIsInstance(f.get_coeffs(), np.ndarray)
    3537
    3638    def test_triangle_freqs_ones(self):
    3739        f = filterbank(9, 1024)
    3840        freq_list = [40, 80, 200, 400, 800, 1600, 3200, 6400, 12800, 15000, 24000]
    39         freqs = array(freq_list, dtype = float_type)
     41        freqs = np.array(freq_list, dtype = float_type)
    4042        f.set_triangle_bands(freqs, 48000)
    41         _ = f.get_coeffs().T
     43        self.assertIsInstance(f.get_coeffs(), np.ndarray)
    4244        spec = cvec(1024)
    4345        spec.norm[:] = 1
     
    4749
    4850if __name__ == '__main__':
    49     main()
     51    import nose2
     52    nose2.main()
Note: See TracChangeset for help on using the changeset viewer.