コード例 #1
0
ファイル: test_mib.py プロジェクト: woozey/LiberTEM
def test_missing_frames(lt_ctx):
    """
    there can be some frames missing at the end
    """
    # one full row of additional frames in the data set than in the file
    scan_size = (33, 32)
    ds = MIBDataSet(path=MIB_TESTDATA_PATH,
                    tileshape=(1, 3, 256, 256),
                    scan_size=scan_size)
    ds = ds.initialize()
    ds.check_valid()

    for p in ds.get_partitions():
        for t in p.get_tiles():
            pass
コード例 #2
0
ファイル: test_mib.py プロジェクト: woozey/LiberTEM
def test_too_many_frames():
    """
    mib files can contain more frames than the intended scanning dimensions
    """
    # one full row of additional frames in the file
    scan_size = (31, 32)
    ds = MIBDataSet(path=MIB_TESTDATA_PATH,
                    tileshape=(1, 3, 256, 256),
                    scan_size=scan_size)
    ds = ds.initialize()
    ds.check_valid()

    for p in ds.get_partitions():
        for t in p.get_tiles():
            pass
コード例 #3
0
ファイル: test_mib.py プロジェクト: bryanfleming99/TEMproject
def test_too_many_frames(lt_ctx):
    """
    mib files can contain more frames than the intended scanning dimensions
    """
    # one full row of additional frames in the file
    scan_size = (31, 32)
    ds = MIBDataSet(path=MIB_TESTDATA_PATH, scan_size=scan_size)
    ds = ds.initialize(lt_ctx.executor)
    ds.check_valid()

    tileshape = Shape((16, ) + tuple(ds.shape.sig), sig_dims=ds.shape.sig.dims)
    tiling_scheme = TilingScheme.make_for_shape(
        tileshape=tileshape,
        dataset_shape=ds.shape,
    )

    for p in ds.get_partitions():
        for t in p.get_tiles(tiling_scheme=tiling_scheme):
            pass
コード例 #4
0
ファイル: test_mib.py プロジェクト: bryanfleming99/TEMproject
def test_missing_frames(lt_ctx):
    """
    there can be some frames missing at the end
    """
    # one full row of additional frames in the data set than in the file
    scan_size = (33, 32)
    ds = MIBDataSet(path=MIB_TESTDATA_PATH, scan_size=scan_size)
    ds = ds.initialize(lt_ctx.executor)
    ds.check_valid()

    tileshape = Shape((16, ) + tuple(ds.shape.sig), sig_dims=ds.shape.sig.dims)
    tiling_scheme = TilingScheme.make_for_shape(
        tileshape=tileshape,
        dataset_shape=ds.shape,
    )

    for p in ds.get_partitions():
        for t in p.get_tiles(tiling_scheme=tiling_scheme):
            pass
コード例 #5
0
def test_positive_sync_offset(default_mib, lt_ctx):
    udf = SumSigUDF()
    sync_offset = 2

    ds_with_offset = MIBDataSet(
        path=MIB_TESTDATA_PATH, nav_shape=(32, 32), sync_offset=sync_offset
    )
    ds_with_offset.set_num_cores(4)
    ds_with_offset = ds_with_offset.initialize(lt_ctx.executor)
    ds_with_offset.check_valid()

    p0 = next(ds_with_offset.get_partitions())
    assert p0._start_frame == 2
    assert p0.slice.origin == (0, 0, 0)

    tileshape = Shape(
        (16,) + tuple(ds_with_offset.shape.sig),
        sig_dims=ds_with_offset.shape.sig.dims
    )
    tiling_scheme = TilingScheme.make_for_shape(
        tileshape=tileshape,
        dataset_shape=ds_with_offset.shape,
    )

    t0 = next(p0.get_tiles(tiling_scheme))
    assert tuple(t0.tile_slice.origin) == (0, 0, 0)

    for p in ds_with_offset.get_partitions():
        for t in p.get_tiles(tiling_scheme=tiling_scheme):
            pass

    assert p.slice.origin == (768, 0, 0)
    assert p.slice.shape[0] == 256

    result = lt_ctx.run_udf(dataset=default_mib, udf=udf)
    result = result['intensity'].raw_data[sync_offset:]

    result_with_offset = lt_ctx.run_udf(dataset=ds_with_offset, udf=udf)
    result_with_offset = result_with_offset['intensity'].raw_data[
        :ds_with_offset._meta.image_count - sync_offset
    ]

    assert np.allclose(result, result_with_offset)