Пример #1
0
def test_frames_from_2d_buffer():
    buf = np.array([np.arange(6),np.arange(6,12)])
    ff = to_lists(fr.frames_from_array(buf, 2, 2))
    assert(ff == [[[0,1],[6,7]],[[2,3],[8,9]],[[4,5],[10,11]]])
    ff = to_lists(fr.frames_from_array(buf, 1, 2))
    assert(ff == [[[0,1],[6,7]],[[1,2],[7,8]],[[2,3],[8,9]],
                  [[3,4],[9,10]],[[4,5],[10,11]],[[5,0],[11,0]]])
Пример #2
0
def test_frames_from_2d_buffer():
    buf = np.array([np.arange(6), np.arange(6, 12)])
    ff = to_lists(fr.frames_from_array(buf, 2, 2))
    assert (ff == [[[0, 1], [6, 7]], [[2, 3], [8, 9]], [[4, 5], [10, 11]]])
    ff = to_lists(fr.frames_from_array(buf, 1, 2))
    assert (ff == [[[0, 1], [6, 7]], [[1, 2], [7, 8]], [[2, 3], [8, 9]],
                   [[3, 4], [9, 10]], [[4, 5], [10, 11]], [[5, 0], [11, 0]]])
Пример #3
0
def test_process_frames_summary():
    buf = input_data(blocksize * 10)
    ff = fr.frames_from_array(buf, blocksize, blocksize)
    results = list(vamp.process_frames(ff, rate, blocksize, plugin_key, "input-summary", {}))
    assert len(results) == 10
    for i in range(len(results)):
        #
        # each feature has a single value, equal to the number of non-zero elts
        # in the input block (which is all of them, i.e. the blocksize) plus
        # the first elt (which is i * blockSize + 1)
        #
        expected = blocksize + i * blocksize + 1
        actual = results[i]["values"][0]
        assert actual == expected
Пример #4
0
def test_process_frames_summary():
    buf = input_data(blocksize * 10)
    ff = fr.frames_from_array(buf, blocksize, blocksize)
    results = list(
        vamp.process_frames(ff, rate, blocksize, plugin_key, "input-summary",
                            {}))
    assert len(results) == 10
    for i in range(len(results)):
        #
        # each feature has a single value, equal to the number of non-zero elts
        # in the input block (which is all of them, i.e. the blocksize) plus
        # the first elt (which is i * blockSize + 1)
        #
        expected = blocksize + i * blocksize + 1
        actual = results[i]["values"][0]
        assert actual == expected
Пример #5
0
def test_frames_from_1d_buffer():
    buf = np.arange(6)
    ff = to_lists(fr.frames_from_array(buf, 2, 2))
    assert(ff == [[[0,1]],[[2,3]],[[4,5]]])
    ff = to_lists(fr.frames_from_array(buf, 1, 2))
    assert(ff == [[[0,1]],[[1,2]],[[2,3]],[[3,4]],[[4,5]],[[5,0]]])
Пример #6
0
def test_frames_from_1d_buffer():
    buf = np.arange(6)
    ff = to_lists(fr.frames_from_array(buf, 2, 2))
    assert (ff == [[[0, 1]], [[2, 3]], [[4, 5]]])
    ff = to_lists(fr.frames_from_array(buf, 1, 2))
    assert (ff == [[[0, 1]], [[1, 2]], [[2, 3]], [[3, 4]], [[4, 5]], [[5, 0]]])