Skip to content

Commit 30bf887

Browse files
authored
Merge pull request #38284 from peterfpeterson/sliceviewer_normalization_fix_ornlnext
Fix normalization for sliceviewer - ornl-next
2 parents 54ab77b + d086ca0 commit 30bf887

File tree

2 files changed

+9
-9
lines changed
  • docs/source/release/v6.12.0/Workbench/SliceViewer/Bugfixes
  • qt/python/mantidqt/mantidqt/widgets/sliceviewer/models

2 files changed

+9
-9
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fixed a bug where the workspace normalization is not preserved when one has more than two dimensions and one uses the slider to change the slice point.

qt/python/mantidqt/mantidqt/widgets/sliceviewer/models/model.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from mantid.api import MatrixWorkspace, MultipleExperimentInfos
1212
from mantid.kernel import SpecialCoordinateSystem
13-
from mantid.plots.datafunctions import get_indices
13+
from mantid.plots.datafunctions import get_indices, get_normalization, get_md_data2d_bin_bounds
1414
from mantid.simpleapi import BinMD, IntegrateMDHistoWorkspace, TransposeMD
1515

1616
from .base_model import SliceViewerBaseModel
@@ -181,10 +181,9 @@ def get_ws_MDE(
181181

182182
def get_data_MDH(self, slicepoint, transpose=False):
183183
indices, _ = get_indices(self.get_ws(), slicepoint=slicepoint)
184-
if transpose:
185-
return np.ma.masked_invalid(self.get_ws().getSignalArray()[indices]).T
186-
else:
187-
return np.ma.masked_invalid(self.get_ws().getSignalArray()[indices])
184+
mdh_normalization, _ = get_normalization(self.get_ws())
185+
_, _, z = get_md_data2d_bin_bounds(self.get_ws(), mdh_normalization, indices, not (transpose))
186+
return z
188187

189188
def get_data_MDE(self, slicepoint, bin_params, dimension_indices, limits=None, transpose=False):
190189
"""
@@ -196,10 +195,10 @@ def get_data_MDE(self, slicepoint, bin_params, dimension_indices, limits=None, t
196195
should be provided in the order of the workspace not the display
197196
:param transpose: If true then transpose the data before returning
198197
"""
199-
if transpose:
200-
return np.ma.masked_invalid(self.get_ws_MDE(slicepoint, bin_params, limits, dimension_indices).getSignalArray().squeeze()).T
201-
else:
202-
return np.ma.masked_invalid(self.get_ws_MDE(slicepoint, bin_params, limits, dimension_indices).getSignalArray().squeeze())
198+
mdh = self.get_ws_MDE(slicepoint, bin_params, limits, dimension_indices)
199+
mdh_normalization, _ = get_normalization(mdh)
200+
_, _, z = get_md_data2d_bin_bounds(mdh, mdh_normalization, transpose=not (transpose))
201+
return z
203202

204203
def get_properties(self):
205204
"""

0 commit comments

Comments
 (0)