Add a couple of additional properties to the algorithm that can output the results from the fitting algorithm that is run internally.
Fixes #37447
Further detail of work
Adds two new optional properties OutputFitCurves and OutputFitParameters that output the resulting fit workspace and the parameters table workspace respectively. One, either, or both can be given for flexibility. Also did some refactoring to simplify the algorithm.
To test:
Build the docs
Use the script from the docs to run the algorithm.
print('Efficiency at ' + str(mtd['eff'].dataX(0)[0]) + ' Å = ' + str(mtd['eff'].dataY(0)[0]))
print('Error in efficiency at ' + str(mtd['eff'].dataX(0)[0]) + ' Å = ' + str(mtd['eff'].dataE(0)[0]))
3. Check it runs as normal and produces an output workspace.
4. Now run it with the new properties.
```python
wsPara = CreateSampleWorkspace('Histogram', Function='User Defined', UserDefinedFunction='name=UserFunction,Formula=0.5*exp(-0.0733*12*x*(1-0.9))',XUnit='Wavelength', xMin='1',XMax='8', BinWidth='1')
wsPara1 = CloneWorkspace(wsPara)
wsAnti = CreateSampleWorkspace('Histogram', Function='User Defined', UserDefinedFunction='name=UserFunction,Formula=0.5*exp(-0.0733*12*x*(1+0.9))',XUnit='Wavelength', xMin='1',XMax='8', BinWidth='1')
wsAnti1 = CloneWorkspace(wsAnti)
grp = GroupWorkspaces([wsPara,wsAnti,wsPara1,wsAnti1])
eff = HeliumAnalyserEfficiency(grp, SpinStates='11,01,00,10', OutputFitParameters="fit_params", OutputFitCurves="curves")
print('Efficiency at ' + str(mtd['eff'].dataX(0)[0]) + ' Å = ' + str(mtd['eff'].dataY(0)[0]))
print('Error in efficiency at ' + str(mtd['eff'].dataX(0)[0]) + ' Å = ' + str(mtd['eff'].dataE(0)[0]))
This does not require release notes because it changes functionality that was new to mantid 6.10.
Reviewer
Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.
Do changes function as described? Add comments below that describe the tests performed?
Do the changes handle unexpected situations, e.g. bad input?
Has the relevant (user and developer) documentation been added/updated?
Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.
Gatekeeper
If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.
Description of work
Summary of work
Add a couple of additional properties to the algorithm that can output the results from the fitting algorithm that is run internally.
Fixes #37447
Further detail of work
Adds two new optional properties
OutputFitCurves
andOutputFitParameters
that output the resulting fit workspace and the parameters table workspace respectively. One, either, or both can be given for flexibility. Also did some refactoring to simplify the algorithm.To test:
grp = GroupWorkspaces([wsPara,wsAnti,wsPara1,wsAnti1]) eff = HeliumAnalyserEfficiency(grp, SpinStates='11,01,00,10')
print('Efficiency at ' + str(mtd['eff'].dataX(0)[0]) + ' Å = ' + str(mtd['eff'].dataY(0)[0])) print('Error in efficiency at ' + str(mtd['eff'].dataX(0)[0]) + ' Å = ' + str(mtd['eff'].dataE(0)[0]))
This does not require release notes because it changes functionality that was new to mantid 6.10.
Reviewer
Please comment on the points listed below (full description). Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.
Code Review
Functional Tests
Does everything look good? Mark the review as Approve. A member of
@mantidproject/gatekeepers
will take care of it.Gatekeeper
If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.