From 6fe91efd056c1dce808137e9e9c392edfc3259ac Mon Sep 17 00:00:00 2001 From: Ethan Peterson Date: Sun, 2 Oct 2022 10:45:01 -0400 Subject: [PATCH] fixed wwinp reader tests --- tests/unit_tests/weightwindows/test_wwinp_reader.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/unit_tests/weightwindows/test_wwinp_reader.py b/tests/unit_tests/weightwindows/test_wwinp_reader.py index 434a36753..437e588f6 100644 --- a/tests/unit_tests/weightwindows/test_wwinp_reader.py +++ b/tests/unit_tests/weightwindows/test_wwinp_reader.py @@ -118,7 +118,13 @@ def test_wwinp_reader(wwinp_data, request): # check the expected weight window values mocked in the file -- # a reversed array of the flat index into the numpy array n_wws = np.prod((*mesh.dimension, e_bounds.size - 1)) - exp_ww_lb = np.linspace(1, n_wws, n_wws)[::-1] + nx, ny, nz, ne = mesh.dimension + (e_bounds.size - 1,) + exp_ww_lb = np.linspace(1, n_wws, n_wws)[::-1].reshape(nx, ny, nz, ne) + # this is how the ww lower bounds were actually written to file + exp_ww_lb = np.swapaxes(exp_ww_lb, 0, 2).flatten() + # this is how we expect them to be read back in + exp_ww_lb = exp_ww_lb.reshape(ne, nz, ny, nx).T.flatten() + np.testing.assert_array_equal(exp_ww_lb, ww.lower_ww_bounds.flatten())