Ticket #7864 (closed: fixed)
Catch Error for invalid bin range in setBinRange()
Reported by: | Mike Thomas | Owned by: | Andrei Savici |
---|---|---|---|
Priority: | major | Milestone: | Release 3.1 |
Component: | Framework | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Arturs Bekasovs |
Description
Entering bin range values outside the range of the data yields an error from MantidPlot about the scrollbar. It would be more useful to identify that the bin range is wrong. The current error message reads:
Sorry, MantidPlot has caught an unexpected exception: XIntegrationScrollBar : minimum and maximum must be between 0 and 1 Would you like to terminate MantidPlot or try to continue working? If you choose to continue it is advisable to save your data and restart the application. Terminate Continue
The error was caused in the python command line with the lines
instrument_view = getInstrumentView("Small_Angle") instrument_view.setBinRange(10000,15000)
where Small_Angle is a workspace of data in units of wavelength with a min of 2.2 and max of 10. Hence the range 10000,15000 is unsuitable
Change History
comment:1 Changed 7 years ago by Andrei Savici
- Owner changed from Anyone to Andrei Savici
- Status changed from new to inprogress
comment:2 Changed 7 years ago by Andrei Savici
Check if set maximum less than allowed minimum. Refs #7864
Changeset: 806b1f1e22401c01a5018864c66520d1cd9a3f65
comment:3 Changed 7 years ago by Andrei Savici
- Status changed from inprogress to verify
- Resolution set to fixed
comment:5 Changed 7 years ago by Arturs Bekasovs
- Status changed from verify to verifying
- Tester set to Arturs Bekasovs
comment:6 Changed 7 years ago by Arturs Bekasovs
- Status changed from verifying to reopened
- Resolution fixed deleted
An exception thrown was definitely an over-reaction. It isn't happening any more.
However, as it works now, it might not be entirely obvious what the function is doing when you specify unreasonable values. I think a log-warning saying something like "Specified range start is too small, set to min value" would make it much better.
Another option might be not to change values if arguments are unreasonable, returning an appropriate error (not an exception of course). This way usually helps to avoid lots of user mistakes. (http://en.wikipedia.org/wiki/Fail-fast).
comment:7 Changed 7 years ago by Andrei Savici
- Status changed from reopened to verify
- Resolution set to fixed
There are other things users are not warned about (such as swapping minimum and maximum if they are in the wrong order). If someone wants some big notices, a new ticket should be opened.
comment:8 Changed 7 years ago by Arturs Bekasovs
- Status changed from verify to closed
Merge remote-tracking branch 'origin/feature/7864_XIntegrationRange'
Full changeset: 020cf106d0867f18e9eda26a18cdfb5ff6cf1ac3
comment:9 Changed 7 years ago by Arturs Bekasovs
As discussed, that's not the only occasion when it does something silently, so if that's really important - new ticket would be more appropriate.
comment:10 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 8709