Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnginXFitPeaks: add new optional property to generate table workspace #810

Merged

Conversation

FedeMPouzols
Copy link
Contributor

This fixes #11748

To test:

difc, zero = EnginXFitPeaks(ws, 0, [0.65, 1.9], OutputParametersTableName=out_tbl_name)

There's a small ugliness in that there's a bit of code duplication with PR #806, as these two are in different tickets. This is commented in the code and can be sorted out, putting common utility methods in EnginXUtils, in follow-up tickets/issues when these two are merged. This can be done for example in #10910 which is in part about refactoring common stuff and moving it into EnginXUtils.

@FedeMPouzols FedeMPouzols added Python Diffraction Issues and pull requests related to diffraction labels May 29, 2015
@FedeMPouzols FedeMPouzols added this to the Release 3.5 milestone May 29, 2015
@Anders-Markvardsen
Copy link
Member

Note running algorithm with ENGIN00213855, Workspaceindex=0 and ExpectedPeaks=0.65,1.9 generates the output:

EnginXFitPeaks started
i_min = 2354 i_max = 9503
Error in execution of algorithm ConvertTableToMatrixWorkspace:
The input table is empty
Error in execution of algorithm EnginXFitPeaks:
The input table is empty
at line 67 in 'C:/Backup/Backup_folder1/work/code/Mantid/git/mantid/Code/Mantid/Framework/PythonInterface/plugins/algorithms\EnginXFitPeaks.py'
caused by line 194 in 'C:/Backup/Backup_folder1/work/code/Mantid/git/mantid/Code/Mantid/Framework/PythonInterface/plugins/algorithms\EnginXFitPeaks.py'
caused by line 205 in 'C:/Backup/Backup_folder1/work/code/Mantid/git/mantid/Code/Mantid/Framework/PythonInterface/plugins/algorithms\EnginXFitPeaks.py'

@FedeMPouzols
Copy link
Contributor Author

Ah, this is actually an error condition that wasn't being checked. I've added a verbose exception for this.

If you do this (or any similar very wrong guess of the expected peaks):

Load("ENGINX00213855", OutputWorkspace='foo')
EnginXFitPeaks(InputWorkspace='foo', WorkspaceIndex=0, ExpectedPeaks=[0.65, 1.9, 33, 99])

You sould now get an error like this:

Error in execution of algorithm EnginXFitPeaks:
Could not fit any peak. Please check the list of expected peaks, as it does not seem to be appropriate for the workspace given. More details: Could find 4 peaks using the algorithm FindPeaks but then it was not possible to fit any peak starting from these peaks found and using 'BackToBackExponential' as peak function.
  at line 69 in '/home/fedemp/mantid-repos/mantid-urgent/mantid/Code/Mantid/Framework/PythonInterface/plugins/algorithms/EnginXFitPeaks.py'
  caused by line 204 in '/home/fedemp/mantid-repos/mantid-urgent/mantid/Code/Mantid/Framework/PythonInterface/plugins/algorithms/EnginXFitPeaks.py'

I added this as an exception, rather than simply an error message, as the algorithm cannot finish succesfully and cannot produce sensible output values when this happens.

@Anders-Markvardsen
Copy link
Member

Now when running ENGIN00213855, Workspaceindex=0 and ExpectedPeaks=0.65,1.9 get the informative output:

Error in execution of algorithm EnginXFitPeaks:
Could not fit any peak. Please check the list of expected peaks, as it does not seem to be appropriate for the workspace given. More details: Could find 2 peaks using the algorithm FindPeaks but then it was not possible to fit any peak starting from these peaks found and using 'BackToBackExponential' as peak function.
at line 69 in 'C:/Backup/Backup_folder1/work/code/Mantid/git/mantid/Code/Mantid/Framework/PythonInterface/plugins/algorithms\EnginXFitPeaks.py'
caused by line 204 in 'C:/Backup/Backup_folder1/work/code/Mantid/git/mantid/Code/Mantid/Framework/PythonInterface/plugins/algorithms\EnginXFitPeaks.py'

Minor change to for the description of the new algorithm property
Anders-Markvardsen added a commit that referenced this pull request Jun 17, 2015
…t_table_with_difc_zero

EnginXFitPeaks: add new optional property to generate table workspace
@Anders-Markvardsen Anders-Markvardsen merged commit 9d4da13 into master Jun 17, 2015
@Anders-Markvardsen Anders-Markvardsen deleted the 10909_EnginXFitPeaks_output_table_with_difc_zero branch June 17, 2015 09:00
@Anders-Markvardsen
Copy link
Member

Code review good and test added for new algorithm property

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Diffraction Issues and pull requests related to diffraction
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EnginX FitPeaks Output
2 participants