From 9c13e85dc2c76641723085452a5a92c85a1cc14c Mon Sep 17 00:00:00 2001 From: Ethan Peterson Date: Sat, 1 Oct 2022 09:22:57 -0400 Subject: [PATCH] fix wwinp reader --- openmc/weight_windows.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/openmc/weight_windows.py b/openmc/weight_windows.py index 9183bb08b7..eb30e838a6 100644 --- a/openmc/weight_windows.py +++ b/openmc/weight_windows.py @@ -560,10 +560,13 @@ def wwinp_to_wws(path): end_idx = start_idx + (nfx * nfy * nfz) * nt_i * ne_i # read values and reshape according to ordering - # slowest to fastest: z, y, x, e - ww_values = ww_data[start_idx:end_idx].reshape(nfz, nfy, nfx, ne_i) - # swap z and x axes for correct shape and (ijk, e) mesh indexing - ww_values = np.swapaxes(ww_values, 2, 0) + # slowest to fastest: t, e, z, y, x + # reorder with transpose since our ordering is x, y, z, e, t + ww_shape = (nt_i, ne_i, nfz, nfy, nfx) + ww_values = ww_data[start_idx:end_idx].reshape(ww_shape).T + # Only use first time bin since we don't support time dependent weight + # windows yet. + ww_values = ww_values[:, :, :, :, 0] start_idx = end_idx # create a weight window object