From a01fd14d400f19fbd1c9cdfc55b411010f5ac444 Mon Sep 17 00:00:00 2001 From: Duc Le Date: Fri, 27 Sep 2024 17:39:40 +0100 Subject: [PATCH] Fix 1D dos ascii save 1-line output #1004 --- src/mslice/models/workspacemanager/file_io.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mslice/models/workspacemanager/file_io.py b/src/mslice/models/workspacemanager/file_io.py index 7bc32fd7..b7e69440 100644 --- a/src/mslice/models/workspacemanager/file_io.py +++ b/src/mslice/models/workspacemanager/file_io.py @@ -186,12 +186,14 @@ def load_from_ascii(file_path, ws_name): def _get_md_histo_xye(histo_ws): dim = histo_ws.getDimension(0) + if dim.getNBins() == 1: + dim = histo_ws.getDimension(1) start = dim.getMinimum() end = dim.getMaximum() nbin = dim.getNBins() x = np.linspace(start, end, nbin) - y = histo_ws.getSignalArray() - e = np.sqrt(histo_ws.getErrorSquaredArray()) + y = np.squeeze(histo_ws.getSignalArray()) + e = np.squeeze(np.sqrt(histo_ws.getErrorSquaredArray())) if histo_ws.displayNormalization() == MDNormalization.NumEventsNormalization: num_events = histo_ws.getNumEventsArray() y = y / num_events