def test_detect(): params = K2ISDataSet.detect_params(K2IS_TESTDATA_PATH, InlineJobExecutor())["parameters"] assert params == { "path": K2IS_TESTDATA_PATH, "nav_shape": (34, 35), "sig_shape": (1860, 2048), "sync_offset": 250 }
def test_k2is_dist(dist_ctx): ds = K2ISDataSet(path=K2IS_TESTDATA_PATH) import glob print(dist_ctx.executor.run_function(lambda: os.listdir("/data/Capture52/"))) print(dist_ctx.executor.run_function(lambda: list(sorted(glob.glob("/data/Capture52/*"))))) ds = ds.initialize(dist_ctx.executor) roi = np.zeros(ds.shape.nav, dtype=bool) roi[0, 5] = 1 roi[0, 17] = 1 analysis = dist_ctx.create_sum_analysis(dataset=ds) results = dist_ctx.run(analysis, roi=roi) assert results[0].raw_data.shape == (1860, 2048)
def main(input_filename, output_filename, dtype): ds = K2ISDataSet(path=input_filename) ds.initialize() out_ds = np.memmap(output_filename, dtype=dtype, mode="w+", shape=tuple(ds.raw_shape)) num_parts = len(list(ds.get_partitions())) for p_idx, p in enumerate(ds.get_partitions()): for tile in p.get_tiles(): out_ds[tile.tile_slice.get()] = tile.data.astype(dtype) print("partition %d/%d done" % (p_idx + 1, num_parts)) print("done")
def test_detect(): params = K2ISDataSet.detect_params(K2IS_TESTDATA_PATH) assert params == { "path": K2IS_TESTDATA_PATH, }
def default_k2is(): ds = K2ISDataSet(path=K2IS_TESTDATA_PATH) ds.initialize() return ds
def test_detect(): params = K2ISDataSet.detect_params(K2IS_TESTDATA_PATH, InlineJobExecutor())["parameters"] assert params == { "path": K2IS_TESTDATA_PATH, }
def default_k2is(): ds = K2ISDataSet(path=K2IS_TESTDATA_PATH) ds.initialize(InlineJobExecutor()) return ds