Skip to content

Commit

Permalink
Added Normalization flag (fixed issue). About to add low range pixel …
Browse files Browse the repository at this point in the history
…flag. This refs #4303
  • Loading branch information
JeanBilheux committed Feb 10, 2012
1 parent 19dea74 commit 69202c3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
24 changes: 13 additions & 11 deletions Code/Mantid/Framework/PythonAPI/PythonAlgorithms/RefLReduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def PyInit(self):
self.declareListProperty("SignalPeakPixelRange", [126, 134], Validator=ArrayBoundedValidator(Lower=0))
self.declareProperty("SubtractSignalBackground", True)
self.declareListProperty("SignalBackgroundPixelRange", [123, 137], Validator=ArrayBoundedValidator(Lower=0))
self.declareProperty("NormFlag", True)
self.declareListProperty("NormPeakPixelRange", [127, 133], Validator=ArrayBoundedValidator(Lower=0))
self.declareProperty("SubtractNormBackground", True)
self.declareListProperty("NormBackgroundPixelRange", [123, 137], Validator=ArrayBoundedValidator(Lower=0))
Expand Down Expand Up @@ -85,8 +86,6 @@ def PyExec(self):
subtract_data_bck = self.getProperty("SubtractSignalBackground")
subtract_norm_bck = self.getProperty("SubtractNormBackground")



########################################################################
# Find full path to event NeXus data file
f = FileFinder.findRuns("REF_L%d" %run_numbers[0])
Expand Down Expand Up @@ -215,6 +214,7 @@ def PyExec(self):
ws_data = "__DataWks"
ws_transposed = '__TransposedID'
if subtract_data_bck:
print 'in subtract_data_bck'
ConvertToHistogram(InputWorkspace=ws_integrated_data,
OutputWorkspace=ws_integrated_data)

Expand Down Expand Up @@ -272,12 +272,9 @@ def PyExec(self):
else:
ConvertToHistogram(InputWorkspace=ws_integrated_data,
OutputWorkspace=ws_data)

# Work on Normalization file #########################################

s_normalization_run = str(normalization_run).strip()
# s_normalization_run = '' #REMOVE_ME
if (s_normalization_run != ''):

# Work on Normalization file #########################################
if (NormFlag):

# Find full path to event NeXus data file
f = FileFinder.findRuns("REF_L%d" %normalization_run)
Expand Down Expand Up @@ -403,6 +400,8 @@ def PyExec(self):
RHSWorkspace=ws_norm_rebinned,
OutputWorkspace=ws_data)

mt =mtd[ws_data]

ReplaceSpecialValues(InputWorkspace=ws_data, NaNValue=0, NaNError=0, InfinityValue=0, InfinityError=0, OutputWorkspace=ws_data)

output_ws = self.getPropertyValue("OutputWorkspace")
Expand All @@ -416,8 +415,11 @@ def PyExec(self):

# Clean up intermediary workspaces
mtd.deleteWorkspace(ws_data)
mtd.deleteWorkspace(ws_norm)
mtd.deleteWorkspace(ws_norm_rebinned)
mtd.deleteWorkspace(ws_norm_histo_data)

if (NormFlag):
mtd.deleteWorkspace(ws_norm)
mtd.deleteWorkspace(ws_norm_rebinned)
mtd.deleteWorkspace(ws_norm_histo_data)


mtd.registerPyAlgorithm(RefLReduction())
3 changes: 2 additions & 1 deletion Code/Mantid/scripts/Interface/reduction_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def setup_layout(self, load_last=False):
self._interface.destroy()

self._interface = instrument_factory(self._instrument, settings=self.general_settings)

if self._interface is not None:
tab_list = self._interface.get_tabs()
for tab in tab_list:
Expand Down Expand Up @@ -388,7 +389,7 @@ def reduce_clicked(self):
self.interface_chk.setEnabled(True)
self.file_menu.setEnabled(True)
self.tools_menu.setEnabled(True)

def open_file(self, file_path=None):
"""
Open an XML file and populate the UI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ def to_script(self, file_name=None):
f.write(script)
f.close()




return script


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ def get_state(self):

state_list.append(data)
state.data_sets = state_list

return state

def get_editing_state(self):
Expand Down Expand Up @@ -508,5 +509,5 @@ def get_editing_state(self):
##
# Add here states that are data file dependent
##

return m

0 comments on commit 69202c3

Please sign in to comment.