Beispiel #1
0
def test_chunk():
    data = np.random.randn(200, 4)
    chunks = chunk_bounds(data.shape[0], 100, overlap=20)
    
    # Chunk 1.
    ch = Chunk(data=data, bounds=next(chunks))
    
    assert ch.window_full == (0, 100)
    assert ch.window_keep == (0, 90)
    
    assert np.array_equal(ch.data_chunk_full, data[0:100])
    assert np.array_equal(ch.data_chunk_keep, data[0:90])
    
    # Chunk 2.
    ch = Chunk(data=data, bounds=next(chunks))
    
    assert ch.window_full == (80, 180)
    assert ch.window_keep == (90, 170)
    
    assert np.array_equal(ch.data_chunk_full, data[80:180])
    assert np.array_equal(ch.data_chunk_keep, data[90:170])
Beispiel #2
0
def test_chunk_bounds():
    chunks = chunk_bounds(200, 100, overlap=20)
    
    assert next(chunks) == (0, 100, 0, 90)
    assert next(chunks) == (80, 180, 90, 170)
    assert next(chunks) == (160, 200, 170, 200)