Skip to content
Snippets Groups Projects
Commit a889a2ef authored by Dan Nixon's avatar Dan Nixon
Browse files

Fix JumpFit usage example test

Refs #11083
parent ddbe3037
No related branches found
No related tags found
No related merge requests found
...@@ -108,7 +108,13 @@ class JumpFit(PythonAlgorithm): ...@@ -108,7 +108,13 @@ class JumpFit(PythonAlgorithm):
# Run fit function # Run fit function
if self._out_name is "": if self._out_name is "":
# Find the last underscore
ws_suffix_index = self._in_ws.rfind('_') ws_suffix_index = self._in_ws.rfind('_')
if ws_suffix_index == -1:
# Use the entire string if underscore not found
ws_suffix_index = len(self._in_ws)
self._out_name = self._in_ws[:ws_suffix_index] + '_' + self._jump_function + '_fit' self._out_name = self._in_ws[:ws_suffix_index] + '_' + self._jump_function + '_fit'
Fit(Function=function, InputWorkspace=spectrum_ws, CreateOutput=True, Output=self._out_name, Fit(Function=function, InputWorkspace=spectrum_ws, CreateOutput=True, Output=self._out_name,
......
...@@ -20,25 +20,26 @@ of 4 models (the fit function used is given in brackets): ...@@ -20,25 +20,26 @@ of 4 models (the fit function used is given in brackets):
Usage Usage
----- -----
**Example - Chudley-Elliott fit** **Example - Chudley-Elliot fit**
.. testcode:: exChudleyElliottFit .. testcode:: exChudleyElliotFit
data = Load(Filename='irs26176_graphite002_conv_2LFixF_s0_to_9_Result.nxs') data = Load(Filename='irs26176_graphite002_conv_2LFixF_s0_to_9_Result.nxs')
JumpFit(InputWorkspace=data, JumpFit(InputWorkspace=data,
FUnction='ChudleyElliot',
QMin=0.6, QMin=0.6,
QMax=1.8) QMax=1.8)
fit = mtd['irs26176_graphite002_conv_2LFixF_s0_to_9_ChudleyElliot_fit_Workspace'] fit = mtd['data_ChudleyElliot_fit_Workspace']
params = mtd['irs26176_graphite002_conv_2LFixF_s0_to_9_ChudleyElliot_fit_Parameters'] params = mtd['data_ChudleyElliot_fit_Parameters']
print 'Fit parameters: %s' % params.column(0) print 'Fit parameters: %s' % ', '.join(params.column(0))
**Output:** **Output:**
.. testoutput:: exChudleyElliottFit .. testoutput:: exChudleyElliotFit
Tau, L, Cost function value Fit parameters: Tau, L, Cost function value
.. categories:: .. categories::
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment