Ticket #8279 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Can no longer plot the Spectra of a Group Workspace

Reported by: Peter Parker Owned by: Peter Parker
Priority: critical Milestone: Release 3.0
Component: GUI Keywords:
Cc: Blocked By:
Blocking: Tester: Karl Palmen

Description (last modified by Peter Parker) (diff)

To reproduce, load MUSR00015193 from the AutoTestData directory. Right-click on the resulting GroupWorkspace, and select "Plot Spectrum...". You will be unable to plot any of the spectra since for some reason it doesn't detect any "common" spectra between them.

Note that selecting the child workspaces individually works fine.

EDIT

Even worse, I've just discovered that if you select a GroupWorkspace and one of its child workspaces, then try to plot spectra, then Mantid crashes.

Attachments

Test Plot Spectra.py (1.2 KB) - added by Peter Parker 7 years ago.

Change History

comment:1 Changed 7 years ago by Peter Parker

  • Description modified (diff)

comment:2 Changed 7 years ago by Peter Parker

  • Milestone changed from Backlog to Release 3.0

Not sure why I set to backlog.

comment:3 Changed 7 years ago by Peter Parker

  • Status changed from new to inprogress

Refs #8279 - Fix crash and undesired behaviour.

Ultimately, the problems were caused as a result of code I wrote nearly two years ago. It was some of the first C++ and Mantid code I ever did, and it really does show. Overengineered in places and underengineered in others, redundant code, useless abstractions, and poor use of common idioms. Just awful.

I'd love a chance to go back and redo it, and probably make it a third of the size in the process.

In the meantime, I've made the following changes:

  • Correctly filtered the workspaces that have been selected by the user to exclude non-MatrixWorkspaces. This means including the children of WorkspaceGroups and excluding WorkspaceGroups themselves.
  • Correctly find the common spectra IDs between selected workspaces.
  • Only offer the user the chance to select spectra IDs to plot if there are indeed common IDs between all selected workspaces. Otherwise just allow selection of common workspace indices.
  • If workspaces only share a single common workspace index (and don't share any common spectra IDs), or if all workspaces only have a single spectrum, then just go ahead and plot them. No need to ask the user at this point.

Changeset: b12631b7fe6f78d45d9ad85fa8982da895a7bba3

Last edited 7 years ago by Peter Parker (previous) (diff)

Changed 7 years ago by Peter Parker

comment:4 Changed 7 years ago by Peter Parker

  • Status changed from inprogress to verify
  • Resolution set to fixed

To Test:

Run the attached script to generate some workspaces with various spectra IDs. Try to plot various combinations of workspaces and see if you get reasonable choices presented to you by the dialog, or whether the plot is done automatically.

See the comment for the commit above for how the dialog is supposed to behave.

To help, here are some expected results that should hold true for various combinations of the generated workspaces:

Plot Combination Available Spectra ID's Available WS Indice(s)
even 0, 2, 4, 6 0-3
odd 1, 3, 5, 7 0-3
consecutive 2, 3, 4, 5 0-3
singleEven The only available spectrum is automatically plotted
singleOdd The only available spectrum is automatically plotted
singleOdd & odd 5 0
odd & even None available 0-3
even & consecutive 2, 4 0-3

Also, load some WorkspaceGroup files (i.e. some MUSR000XXXXX.nxs files from AutoTestData) and see if selecting the WorkspaceGroup itself causes any problems. Try various combinations that include the group children and the above workspaces.

comment:5 Changed 7 years ago by Karl Palmen

  • Status changed from verify to verifying
  • Tester set to Karl Palmen

comment:6 Changed 7 years ago by Karl Palmen

I find that the spectra plotted are the union of the sets of spectra of the workspaces. The ticket does not make it clear whether this is the desired behaviour, but it seems OK. There is also no crash when parent and child are selected.

One other issue, is that the title is the title of the first workspace rather than a composite of all the workspaces. I've created ticket #8302 for this.

Test passed.

comment:7 Changed 7 years ago by Karl Palmen

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/bugfix/8279_fix_plot_spectra_for_groups_and_multiple_workspace'

Full changeset: 322f6b1fb22e326a251bf2cd8fdf0d37f19224ee

comment:8 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9124

Note: See TracTickets for help on using tickets.