Skip to content

Commit

Permalink
Now checking for peak and background selection. User reported crashed…
Browse files Browse the repository at this point in the history
… in program that occured because he asked for a background subtraction but provided the same peak and background region... so no background region was extracted and then calculated...crashing the program. Now the program is catching for this problem and even if the user wants a background selection but gives me the same peak and back. region, no back is calculated. This refs #4303.
  • Loading branch information
JeanBilheux committed Jun 15, 2012
1 parent da98859 commit 2222bf2
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Code/Mantid/Framework/PythonAPI/PythonAlgorithms/RefLReduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,18 @@ def PyExec(self):
dMD = dSD + dSM

ws_data = '_' + ws_name + '_DataWks'

#Even if user select Background subtraction
#make sure there is a background selection (peak != back selection)

_LfromPx = data_back[0]
_LtoPx = data_peak[0]
_RfromPx = data_peak[1]
_RtoPx = data_back[1]

if ((_LfromPx == _LtoPx) and (_RfromPx == _RtoPx)):
subtract_data_bck = False

if (subtract_data_bck and (backSubMethod == 1)):

print '-> substract background'
Expand Down Expand Up @@ -455,7 +467,7 @@ def PyExec(self):
else:
if (bLeftBack):
_y_px_range = _Larray
else:
else:
_y_px_range = _Rarray

for i in _tof_range:
Expand Down Expand Up @@ -518,8 +530,8 @@ def PyExec(self):
ConvertToMatrixWorkspace(InputWorkspace=ws_data,
OutputWorkspace=ws_data)

ConvertToMatrixWorkspace(InputWorkspace=ws_data,
OutputWorkspace=ws_data)
# ConvertToMatrixWorkspace(InputWorkspace=ws_data,
# OutputWorkspace=ws_data)

if mtd.workspaceExists(ws_histo_data):
mtd.deleteWorkspace(ws_histo_data)
Expand Down

0 comments on commit 2222bf2

Please sign in to comment.