Ticket #4632 (closed: fixed)
Matho domain error while using MSD Fit tab on IDA interface
Reported by: | Peter Parker | Owned by: | Peter Parker |
---|---|---|---|
Priority: | critical | Milestone: | Release 2.0 |
Component: | Mantid | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Ronald Fowler |
Description
Vicky had been able to get as far as the screenshot (a plot with fit, though with math domain error) on win32 with a build from last week.
I am not able to get as far as that with win 7 on the latest code - I get the following, and no plot:
ValueError on line 9: "invalid literal for int() with base 10: '_eq2'" in file 'IndirectDataAnalysis.py' at line 313
Screenshot and the three needed files are attached.
Attachments
Change History
comment:1 Changed 9 years ago by Peter Parker
Refs #4632 - Guard against ln(0).
Amend MSDFit to workaround the case where we are sometimes trying to thake the natural log of zero.
Changeset: afb65b765558356bf1a8eb58fffc8e4841499367
comment:3 Changed 9 years ago by Peter Parker
- Status changed from accepted to verify
- Resolution set to fixed
To test:
Run the 3 attached files in the MSDFit tab of the IDA interface as in the screenshot. Ensure that there are no math domain errors thrown, and that four plots are drawn when the "Plot Result" checkbox is ticked.
comment:4 Changed 9 years ago by Ronald Fowler
- Status changed from verify to verifying
- Tester set to Ronald Fowler
comment:5 Changed 9 years ago by Ronald Fowler
- Status changed from verifying to closed
With the given data sets the fix to avoid taking ln() of zero values works and the four expected plots are shown. The fix is to map results where the signal and/or the signal plus error are identically zero to the value 1e-12 before taking the log. If the signal happens to be less than zero then a run time exception will still be thrown. Since signals are neutron counts and should never be less than zero this should not be a problem, but changing the test from X==0 to X<=0 might be more robust. The value to assign to zero data points is arbitrary and 1e-12 seems reasonable in this case as it lies well below any data of interest. Rather than being set as two copies of the constant it would be better to define a constant with this value and use that instead.
An alternative approach would be to just exclude zero signal points from the plot. The user is already able to exclude such data from fitting using the EndX property.