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

Function test_snip_method_numba

pyxrf/core/tests/test_map_processing.py:1280–1311  ·  view source on GitHub ↗

Compare the output of `snip_method_numba` with the output produced by `snip_method` to make sure the functions are equivalent.

()

Source from the content-addressed store, hash-verified

1278
1279
1280def test_snip_method_numba():
1281 """
1282 Compare the output of `snip_method_numba` with the output produced
1283 by `snip_method` to make sure the functions are equivalent.
1284 """
1285
1286 dataset_params = {"n_data_dimensions": (20, 20)}
1287 add_pts_before, add_pts_after = 0, 0
1288 use_snip = True
1289
1290 ft = _FitXRFMapTesting(
1291 dataset_params=dataset_params,
1292 use_snip=use_snip,
1293 add_pts_before=add_pts_before,
1294 add_pts_after=add_pts_after,
1295 )
1296
1297 # Just run the test with input data represented as numpy array
1298 data = ft.data_input
1299
1300 width = 0.5
1301
1302 for ny in range(data.shape[0]):
1303 for nx in range(data.shape[1]):
1304 spec_sel = data[ny, nx, :]
1305
1306 bg = snip_method_numba(spec_sel, 0, 0.01, 0, width=width)
1307 bg_expected = snip_method(spec_sel, 0, 0.01, 0, width=width)
1308
1309 npt.assert_array_almost_equal(
1310 bg, bg_expected, err_msg=f"Background estimates don't match for the pixel ({ny}, {nx})"
1311 )

Callers

nothing calls this directly

Calls 2

snip_method_numbaFunction · 0.90
_FitXRFMapTestingClass · 0.85

Tested by

no test coverage detected