MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / test_chunk_numpy_array

Function test_chunk_numpy_array

pyxrf/core/tests/test_map_processing.py:234–250  ·  view source on GitHub ↗

Basic functionailty tests for '_chunk_xrf_map_numpy

(chunk_target, data_shape)

Source from the content-addressed store, hash-verified

232])
233# fmt: on
234def test_chunk_numpy_array(chunk_target, data_shape):
235 """Basic functionailty tests for '_chunk_xrf_map_numpy"""
236
237 data = np.random.random(data_shape)
238 data_dask = _chunk_numpy_array(data, chunk_target)
239
240 chunksize_expected = tuple(
241 [min(chunk_target[0], data_shape[0]), min(chunk_target[1], data_shape[1]), *data_shape[2:]]
242 )
243
244 assert data_dask.shape == data.shape, "The shape of the original and chunked array don't match"
245 assert (
246 data_dask.chunksize == chunksize_expected
247 ), "The chunk size of the Dask array doesn't match the desired chunk size"
248 npt.assert_array_equal(
249 data_dask.compute(), data, err_msg="The chunked array is different from the original array"
250 )
251
252
253# fmt: off

Callers

nothing calls this directly

Calls 1

_chunk_numpy_arrayFunction · 0.90

Tested by

no test coverage detected