(tmpdir, data_representation)
| 373 | @pytest.mark.parametrize("data_representation", ["numpy_array", "dask_array", "hdf5_file_dset"]) |
| 374 | # fmt: on |
| 375 | def test_prepare_xrf_data(tmpdir, data_representation): |
| 376 | # Start with dask array |
| 377 | data_shape = (7, 12, 20) |
| 378 | data_dask = da.random.random(data_shape, chunks=(2, 3, 4)) |
| 379 | data_numpy = data_dask.compute() |
| 380 | |
| 381 | data = _create_xrf_data(data_dask, data_representation, tmpdir) |
| 382 | data, file_obj = prepare_xrf_map(data, chunk_pixels=12, n_chunks_min=4) |
| 383 | |
| 384 | assert ( |
| 385 | data.chunksize[0] * data.chunksize[1] == 12 |
| 386 | ), f"Dataset was not properly chunked: data.chunksize={data.chunksize}" |
| 387 | |
| 388 | npt.assert_array_almost_equal( |
| 389 | data.compute(), data_numpy, err_msg="Prepared dataset is different from the original" |
| 390 | ) |
| 391 | |
| 392 | |
| 393 | def test_prepare_xrf_data_hdf5_not_chunked(tmpdir): |
nothing calls this directly
no test coverage detected