Skip to content

Commit

Permalink
Merge pull request #37937 from mantidproject/37594_sliceviewer_sample…
Browse files Browse the repository at this point in the history
…_data_order

37594 sliceviewer sample data order
  • Loading branch information
SilkeSchomann committed Sep 12, 2024
2 parents c36a1c9 + d7991b3 commit 251c8f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- A warning will now be displayed if a workspace with unordered spectrum numbers is opened in the :ref:sliceviewer. These workspaces can fail to display correctly and may result in errors.
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,13 @@ def _do_slice_viewer(self, names):
parent, flags = get_window_config()
for ws in self._ads.retrieveWorkspaces(names, unrollGroups=True):
try:
y = ws.getYDimension()
if y.getName() == "sample":
spec_xvals = [ws.getYDimension().getX(ispec) for ispec in range(ws.getNumberHistograms())]
# Check if the q values are sorted, if not display error
if sorted(spec_xvals) != spec_xvals:
logger.warning("Warning: Invalid Data Format. Consider sorting by sample number and try again")

presenter = SliceViewer(ws=ws, conf=CONF, parent=parent, window_flags=flags)
presenter.view.show()
except Exception as exception:
Expand Down

0 comments on commit 251c8f6

Please sign in to comment.