Skip to content

Commit

Permalink
re #8245: sans trans fit option
Browse files Browse the repository at this point in the history
Correct the isis_reduction_steps to process properly the FIT trans option.
Bugs found:

1 - Setting an option for 'both' (can and sample) did not override previous
settings for them alone.
2 - Returning from fitMethod return many variants (LIN, LINEAR, ...). It
is better to return just one variant of the same method (LINEAR, LOGARITHMIC, and PolynomialX)
3 - Add a method to check if the trans was set using the specific selectors (sample and can).
  • Loading branch information
gesnerpassos committed Oct 28, 2013
1 parent 1651ef7 commit d68a5b1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Code/Mantid/scripts/SANS/isis_reduction_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,18 @@ def set_trans_fit(self, fit_method, min_=None, max_=None, override=True, selecto
# apply the propertis to self.fit_settings
for prop in self.fit_props:
self.fit_settings[select+prop] = sel_settings[prop]

# When both is given, it is necessary to clean the specific settings for the individual selectors
if select == 'both::':
for selector_ in ['sample::','can::']:
for prop_ in self.fit_props:
prop_name = selector_+prop_
if self.fit_settings.has_key(prop_name):
del self.fit_settings[prop_name]

def isSeparate(self):
""" Returns true if the can or sample was given and false if just both was used"""
return self.fit_settings.has_key('sample::fit_method') or self.fit_settings.has_key('can::fit_method')

def setup_wksp(self, inputWS, inst, wavbining, pre_monitor, post_monitor):
"""
Expand Down Expand Up @@ -1433,9 +1444,14 @@ def lambdaMin(self, selector):
def lambdaMax(self, selector):
return self._get_fit_property(selector.lower(), 'lambda_max')
def fitMethod(self, selector):
"""It will return LINEAR, LOGARITHM, POLYNOMIALx for x in 2,3,4,5"""
resp = self._get_fit_property(selector.lower(), 'fit_method')
if 'POLYNOMIAL' == resp:
resp += str(self._get_fit_property(selector.lower(), 'order'))
if resp in ['LIN','STRAIGHT'] :
resp = 'LINEAR'
if resp in ['YLOG','LOG']:
resp = 'LOGARITHMIC'
return resp

class AbsoluteUnitsISIS(ReductionStep):
Expand Down Expand Up @@ -1853,7 +1869,7 @@ def read_line(self, line, reducer):
else:
raise 1
reducer.transmission_calculator.set_trans_fit(min_=lambdamin, max_=lambdamax,
fit_method=fit_type, override=False,
fit_method=fit_type, override=True,
selector=selector)
except:
_issueWarning('Incorrectly formatted FIT/TRANS line, %s, line ignored' % upper_line)
Expand Down

0 comments on commit d68a5b1

Please sign in to comment.