Skip to content
Snippets Groups Projects
Commit fc816f92 authored by Alex Buts's avatar Alex Buts
Browse files

Re #11445 Fixed issues with reduction failing if all workspaces

are cleaned up from Mantid
parent 1434c294
No related branches found
No related tags found
No related merge requests found
......@@ -87,6 +87,7 @@ class MARIReductionFromFile(ISISDirectInelasticReduction):
self.scale_to_fix_abf = 0.997979227566217
def runTest(self):
#self.red.run_reduction()
outWS = self.red.reduce()
outWS*=self.scale_to_fix_abf
......
......@@ -328,6 +328,19 @@ if __name__ == "__main__":
# search path checking after time specified below.
rd.wait_for_file = 0 # waiting time interval
### Define a run number to validate reduction against future changes #############
# Take a run number with good reduced results and build validation run
# for this result. Then place the validation run together with the reduction script.
# Next time, the script will run reduction and compare the reduction results against
# the results obtained earlier.
#rd.validate_run_number = 21968 # Enabling this property disables normal reduction
# and forces reduction to reduce run specified here and compares results against
# validation file, processed earlier or calculate this file if run for the first time.
#This would ensure that reduction script have not changed,
#allow to identify reason of changes if it was and would allow to recover the script,
#used to produce initial reduction if changes are unacceptable.
####get reduction parameters from properties above, override what you want locally ###
# and run reduction. Overriding would have form:
# rd.reducer.property_name (from the dictionary above) = new value e.g.
......@@ -345,10 +358,3 @@ if __name__ == "__main__":
# usual way to go is to reduce workspace and save it internally
rd.run_reduction()
#### Validate reduction result against known result, obtained earlier ###
#rez,mess=rd.validate_result()
#if not rez:
# raise RuntimeError("validation failed with error: {0}".format(mess))
#else:
# print "ALL Fine"
......@@ -485,20 +485,22 @@ class RunDescriptor(PropDescriptor):
noutputs=0
if self._mask_ws_name:
mask_ws = mtd[self._mask_ws_name]
#TODO: need normal exposure of getNumberMasked() method of masks workspace
if noutputs>1:
__tmp_masks,spectra = ExtractMask(self._mask_ws_name)
num_masked = len(spectra)
DeleteWorkspace(__tmp_masks)
return (mask_ws,num_masked)
if self._mask_ws_name in mtd:
mask_ws = mtd[self._mask_ws_name]
#TODO: need normal exposure of getNumberMasked() method of masks workspace
if noutputs>1:
__tmp_masks,spectra = ExtractMask(self._mask_ws_name)
num_masked = len(spectra)
DeleteWorkspace(__tmp_masks)
return (mask_ws,num_masked)
else:
return mask_ws
else:
return mask_ws
self._mask_ws_name = None
if noutputs>1:
return (None,0)
else:
if noutputs>1:
return (None,0)
else:
return None
return None
#--------------------------------------------------------------------------------------------------------------------
def add_masked_ws(self,masked_ws):
"""Extract masking from the workspace provided and store masks
......
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