Skip to content

Commit

Permalink
Re #10803 Fixing error which has been already fixed
Browse files Browse the repository at this point in the history
(and changes to wrapper decorators, allowing nice error reporting)
  • Loading branch information
abuts committed Jan 8, 2015
1 parent 14bd88b commit 06d39c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Expand Up @@ -234,7 +234,7 @@ def diagnose(self, white,diag_sample=None,**kwargs):
RangeLower=bkgd_range[0],RangeUpper=bkgd_range[1],
IncludePartialBins=True)
total_counts = Integration(result_ws, IncludePartialBins=True)
background_int = ConvertUnits(background_int, "Energy", AlignBins=0)
background_int = ConvertUnits(background_int, Target="Energy",EMode='Elastic', AlignBins=0)
prop_man.log("Diagnose: finished convertUnits ",'information')

background_int *= prop_man.scale_factor;
Expand Down
14 changes: 8 additions & 6 deletions Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py
Expand Up @@ -2,6 +2,8 @@
from mantid import config

from PropertyManager import PropertyManager;
# this import is used by children
from Direct.DirectEnergyConversion import DirectEnergyConversion
#import inspect
import os
from abc import abstractmethod
Expand Down Expand Up @@ -81,10 +83,10 @@ def main(self,input_file=None,output_directory=None):
raise NotImplementedError('main routine has to be implemented')


def MainProperties(F):
def MainProperties(main_prop_definition):
""" Decorator stores properties dedicated as main and sets these properties as input to reduction parameters."""
def main_prop_wrapper(*args):
properties = F(*args)
properties = main_prop_definition(*args)
#print "in decorator: ",properties
host = args[0];
host._main_properties=properties;
Expand All @@ -93,10 +95,10 @@ def main_prop_wrapper(*args):

return main_prop_wrapper
#
def AdvancedProperties(F):
def AdvancedProperties(adv_prop_definition):
""" Decorator stores properties decided to be advanced and sets these properties as input for reduction parameters """
def advanced_prop_wrapper(*args):
properties = F(*args)
properties = adv_prop_definition(*args)
#print "in decorator: ",properties
host = args[0];
host._advanced_properties=properties;
Expand All @@ -113,7 +115,7 @@ def using_web_data(self):



def iliad(F):
def iliad(main):
""" This decorator wraps around main procedure, tries to identify if the procedure is run from web services or
from Mantid directly and sets up web-modified variables as input for reduction if it runs from web services.
Expand Down Expand Up @@ -145,7 +147,7 @@ def iliad_wrapper(*args):
host.iliad_prop.set_input_parameters(**web_vars);
host.iliad_prop.sample_run = input_file;

rez = F(*args)
rez = main(*args)
# prohibit returning workspace to web services.
if use_web_variables and not isinstance(rez,str):
rez="";
Expand Down

0 comments on commit 06d39c0

Please sign in to comment.