Create an instance of Dask client in the 'compute_total_spectrum' function to test if it works
(tmpdir)
| 524 | |
| 525 | |
| 526 | def test_compute_total_spectrum2(tmpdir): |
| 527 | """Create an instance of Dask client in the 'compute_total_spectrum' function to test if it works""" |
| 528 | |
| 529 | # Start with dask array |
| 530 | data_shape = (7, 12, 20) |
| 531 | data_dask = da.random.random(data_shape, chunks=(2, 3, 4)) |
| 532 | |
| 533 | data_numpy = data_dask.compute() |
| 534 | total_spectrum_expected = np.sum(np.sum(data_numpy, axis=0), axis=0) |
| 535 | |
| 536 | data = _create_xrf_data(data_dask, "dask_array", tmpdir=tmpdir) |
| 537 | |
| 538 | # Run computations without the progress bar |
| 539 | total_spectrum = compute_total_spectrum(data, chunk_pixels=12) |
| 540 | |
| 541 | npt.assert_array_almost_equal( |
| 542 | total_spectrum, total_spectrum_expected, err_msg="Total spectrum was computed incorrectly" |
| 543 | ) |
| 544 | |
| 545 | |
| 546 | # fmt: off |
nothing calls this directly
no test coverage detected