Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bugfix/8245_sans_trans_option'
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Nov 1, 2013
2 parents b2880c5 + 34b5813 commit 7b92714
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ private slots:
/// Adds a warning message to the tab title
void setLoggerTabTitleToWarn();
/// Handle selection of the transmission
void transSelectorChanged(int );

void transSelectorChanged(int );
void loadTransmissionSettings();

private:
/// used to specify the range of validation to do
Expand Down
24 changes: 15 additions & 9 deletions Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,8 @@ bool SANSRunWindow::loadUserFile()
"print i.ReductionSingleton().DQXY"), m_uiForm.qy_dqy,
m_uiForm.qy_dqy_opt);

// The tramission line of the Limits section (read settings for sample and can)
transSelectorChanged(1); transSelectorChanged(0);

// The tramission line of the Limits section (read settings for sample and can)
loadTransmissionSettings();

// The front rescale/shift section
m_uiForm.frontDetRescale->setText(runReduceScriptFunction(
Expand Down Expand Up @@ -3497,6 +3496,10 @@ void SANSRunWindow::transSelectorChanged(int currindex){
m_uiForm.trans_max_can, m_uiForm.trans_opt_can};
for (size_t i = 0; i< 6; i++) wid[i]->setVisible(visible);

}

void SANSRunWindow::loadTransmissionSettings(){

QString transMin = runReduceScriptFunction(
"print i.ReductionSingleton().transmission_calculator.lambdaMin('SAMPLE')").trimmed();
if (transMin == "None")
Expand All @@ -3510,20 +3513,20 @@ void SANSRunWindow::transSelectorChanged(int currindex){
m_uiForm.trans_max->setText(runReduceScriptFunction(
"print i.ReductionSingleton().transmission_calculator.lambdaMax('SAMPLE')").trimmed());
}

QString text = runReduceScriptFunction(
"print i.ReductionSingleton().transmission_calculator.fitMethod('SAMPLE')").trimmed();
int index = m_uiForm.trans_opt->findText(text, Qt::MatchFixedString);
if( index >= 0 )
{
m_uiForm.trans_opt->setCurrentIndex(index);
}
if ( text == "Off" || text == "None" )
if ( text == "OFF" || text == "None" )
m_uiForm.transFitOnOff->setChecked(false);
else
m_uiForm.transFitOnOff->setChecked(true);

if (visible){
transMin = runReduceScriptFunction(
transMin = runReduceScriptFunction(
"print i.ReductionSingleton().transmission_calculator.lambdaMin('CAN')").trimmed();
if (transMin == "None")
{
Expand All @@ -3538,16 +3541,19 @@ void SANSRunWindow::transSelectorChanged(int currindex){
}
text = runReduceScriptFunction(
"print i.ReductionSingleton().transmission_calculator.fitMethod('CAN')").trimmed();
index = m_uiForm.trans_opt_can->findText(text, Qt::MatchCaseSensitive);
index = m_uiForm.trans_opt_can->findText(text, Qt::MatchFixedString);
if( index >= 0 )
{
m_uiForm.trans_opt_can->setCurrentIndex(index);
}
if ( text == "Off" || text == "None" )
if ( text == "OFF" || text == "None" )
m_uiForm.transFitOnOff_can->setChecked(false);
else
m_uiForm.transFitOnOff_can->setChecked(true);
}

bool separated = runReduceScriptFunction("print i.ReductionSingleton().transmission_calculator.isSeparate()").trimmed()=="True";

m_uiForm.trans_selector_opt->setCurrentIndex(separated?1:0);


}
Expand Down
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 7b92714

Please sign in to comment.