Example #1
0
def test_generate_filterbank_failure():
    with pytest.raises(AssertionError) as excinfo:
        generate_filterbank(min_freq=2, max_freq=22,
            last_low_freq=8, low_width=6, low_overlap=4,
            high_width=10, high_overlap=6, low_bound=0.2)
    assert ("max freq needs to be exactly the center "
            "of a filter band  "
            "Close center: 20") == excinfo.value.message  
    
    with pytest.raises(AssertionError) as excinfo:
        generate_filterbank(min_freq=2, max_freq=20,
            last_low_freq=9, low_width=6, low_overlap=4,
            high_width=10, high_overlap=6, low_bound=0.2)
    assert ("last low freq "
        "needs to be exactly the center of a low_width filter band.  "
        "Close center: 8") == excinfo.value.message 
Example #2
0
def test_generate_filterbank():
    filterbands = generate_filterbank(min_freq=2, max_freq=16,
        last_low_freq=8, low_width=6, low_overlap=4,
        high_width=10, high_overlap=6, low_bound=0.2)
    assert np.array_equal([[0.2,5],[1,7],[3,9],[5,11],[7,17],[11,21]],
        filterbands)