예제 #1
0
def test_blockfile_matches_get_blocks():
    """Test if BlockFile(5, 10) is the same as blocks 5-10 from orig"""
    from electrolib.blocks.blockfile import BlockFile
    from electrolib.sources.sinfile import SinFile
    sfile = SinFile(secsblock=5, duration=60)
    bfile = BlockFile(sfile, 5, 10)
    sblock = sfile.get_blocks(5, 10)
    bblock = bfile.get_blocks(0, bfile.nblocks)
    for name in sblock:
        assert numpy.allclose(sblock[name], bblock[name])
예제 #2
0
def test_blockfile_bounds():
    """Test if BlockFile(-1, nblocks + 1) reproduces original file"""
    from electrolib.blocks.blockfile import BlockFile
    from electrolib.sources.sinfile import SinFile
    sfile = SinFile(secsblock=5, duration=60)
    bfile = BlockFile(sfile, -1, sfile.nblocks + 1)
    sblock = sfile.get_blocks(0, sfile.nblocks)
    bblock = bfile.get_blocks(0, bfile.nblocks)
    for name in sblock:
        assert numpy.allclose(sblock[name], bblock[name])