Ticket #5915 (closed: fixed)

Opened 8 years ago

Last modified 5 years ago

Improved warning when no detector in IDF

Reported by: Anders Markvardsen Owned by: Karl Palmen
Priority: major Milestone: Release 2.3
Component: Mantid Keywords:
Cc: owen.arnold@… Blocked By: #5900
Blocking: Tester: Owen Arnold

Description (last modified by Anders Markvardsen) (diff)

This ticket should not be completed before #5900 has been completed.

The attached IDF_minimalistic.xml file contains an instrument which can be loaded successfully with LoadEmptyInstrument.

However if the is="detector" attribute is removed in that IDF, which then means there is no detectors in the file MantidPlot produces the error message:

"All arguments to init must be positive and non-zero Error in execution of algorithm LoadEmptyInstrument: All arguments to init must be positive and non-zero"

Change this so error message from LoadEmptyInstrument is generated:

"No detectors defined in IDF. LoadEmptyInstrument requires at least one detector to be defined in IDF at the moment. Since number of detectors equals number of histograms in the workspace created by LoadEmptyInstrument, and at the moment a workspace must contain at least one histogram."

Attachments

IDF_minimalistic.xml (678 bytes) - added by Anders Markvardsen 8 years ago.

Change History

comment:1 Changed 8 years ago by Anders Markvardsen

  • Description modified (diff)

Changed 8 years ago by Anders Markvardsen

comment:2 Changed 8 years ago by Anders Markvardsen

  • Status changed from new to assigned
  • Owner changed from Anders Markvardsen to Karl Palmen

comment:3 Changed 8 years ago by Karl Palmen

A chat with Martyn has suggested that the fix for this should go into the LoadEmptyInstrument algorithm and not in the InstrumentDefinitionParser. The latter could then still be used to parse an instrument without detectors, which would require a ready made workspace to load.

comment:4 Changed 8 years ago by Karl Palmen

  • Status changed from assigned to accepted

comment:5 Changed 8 years ago by Karl Palmen

I've tried out a fix for this and it works, but when I tried it with the XML file I used to test #5914 I found the same error message that I added for this turns up later on, amongst others.

I find this is because LoadEmptyInstrument does not give up when the LoadInstrument algorithm fails and so gives more error messages. I can't find a neat way of dealing with this.

comment:6 Changed 8 years ago by Karl Palmen

I've found out that LoadInstrument throws a InstrumentDefinitionError, if there are issues with the content of XML instrument file. LoadEmptyInstument should also do so.

Any InstrumentDefinitionError thrown by the LoadInstrument subalgorithm should be rethrown and this exception should be thrown in this case.

comment:7 Changed 8 years ago by Karl Palmen

Get appropriate error message logged re #5915

I find the error messaging for LoadEmptyInstrument.cpp is messy. It should throw the exceptions of the LoadInstrument sub-algorithm rather than try to continue. It should also throw an appropriate exeception in this case.

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: 9d4c13382c573ea69aee01de3b1ad006782fa0e0

comment:8 Changed 8 years ago by Karl Palmen

Tidy up error messaging re #5914 re #5915

In particular, LoadEmptyInstrument does not attempt to continue running, if the LoadInstrument sub-algorithm has failed.

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: 3e27f8d32ad9b180eca51928dcf7c8ec6ed9bf10

comment:9 Changed 8 years ago by Karl Palmen

Fix for event workspaces too re #5915

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: d2c48a3b60b273776d77928d8dc3e012a4952b5a

comment:10 Changed 8 years ago by Karl Palmen

Added unit test for ticket re #5915

This necessitated an amendment of a make file to ensure scoped file is available to the test.

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: a20f87531db3dd30575ec057f562de2d19889247

comment:11 Changed 8 years ago by Karl Palmen

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

comment:12 Changed 8 years ago by Owen Arnold

  • Status changed from verify to verifying
  • Tester set to Owen Arnold

comment:13 Changed 8 years ago by Owen Arnold

  • Status changed from verifying to closed

This functionality is unit tested.

Running LoadEmptyInstrument on the provided XML file produces the expected results before an after the removal of the is="dectector" attribute.

comment:14 Changed 8 years ago by Karl Palmen

Get appropriate error message logged re #5915

I find the error messaging for LoadEmptyInstrument.cpp is messy. It should throw the exceptions of the LoadInstrument sub-algorithm rather than try to continue. It should also throw an appropriate exeception in this case.

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: 9d4c13382c573ea69aee01de3b1ad006782fa0e0

comment:15 Changed 8 years ago by Karl Palmen

Tidy up error messaging re #5914 re #5915

In particular, LoadEmptyInstrument does not attempt to continue running, if the LoadInstrument sub-algorithm has failed.

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: 3e27f8d32ad9b180eca51928dcf7c8ec6ed9bf10

comment:16 Changed 8 years ago by Karl Palmen

Fix for event workspaces too re #5915

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: d2c48a3b60b273776d77928d8dc3e012a4952b5a

comment:17 Changed 8 years ago by Karl Palmen

Added unit test for ticket re #5915

This necessitated an amendment of a make file to ensure scoped file is available to the test.

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: a20f87531db3dd30575ec057f562de2d19889247

comment:18 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 6761

Note: See TracTickets for help on using tickets.