Skip to content

Commit

Permalink
Merge branch 'feature/7840_c2e_add_scale_to_res' into develop
Browse files Browse the repository at this point in the history
Refs #7840

Conflicts:
	Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ConvertToEnergy.ui
  • Loading branch information
Samuel Jackson committed Oct 11, 2013
2 parents 7039a44 + 866efd8 commit d141b83
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1784,6 +1784,9 @@ Later steps in the process (saving, renaming) will not be done.</string>
<property name="text">
<string>1.0</string>
</property>
<property name="placeholderText">
<string/>
</property>
</widget>
</item>
<item>
Expand Down Expand Up @@ -1879,8 +1882,25 @@ Later steps in the process (saving, renaming) will not be done.</string>
<item>
<layout class="QVBoxLayout" name="cal_treeRes">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_21">
<item>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="1">
<widget class="QPushButton" name="cal_pbPlotEnergy">
<property name="text">
<string>Plot Energy</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="cal_ckResScale">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Scale RES:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="cal_ckRES">
<property name="toolTip">
<string>Create RES file</string>
Expand All @@ -1890,6 +1910,25 @@ Later steps in the process (saving, renaming) will not be done.</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="cal_leResScale">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>1.0</string>
</property>
<property name="placeholderText">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
Expand Down
31 changes: 26 additions & 5 deletions Code/Mantid/MantidQt/CustomInterfaces/src/Indirect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ void Indirect::initLayout()
connect(m_uiForm.cal_leRunNo, SIGNAL(filesFound()), this, SLOT(calPlotRaw()));
connect(m_uiForm.cal_pbPlot, SIGNAL(clicked()), this, SLOT(calPlotRaw()));
connect(m_uiForm.cal_ckRES, SIGNAL(toggled(bool)), this, SLOT(resCheck(bool)));
connect(m_uiForm.cal_ckRES, SIGNAL(toggled(bool)), m_uiForm.cal_ckResScale, SLOT(setEnabled(bool)));
connect(m_uiForm.cal_ckResScale, SIGNAL(toggled(bool)), m_uiForm.cal_leResScale, SLOT(setEnabled(bool)));
connect(m_uiForm.cal_ckIntensityScaleMultiplier, SIGNAL(toggled(bool)), this, SLOT(intensityScaleMultiplierCheck(bool)));
connect(m_uiForm.cal_leIntensityScaleMultiplier, SIGNAL(textChanged(const QString &)), this, SLOT(calibValidateIntensity(const QString &)));

Expand Down Expand Up @@ -136,6 +138,7 @@ void Indirect::initLayout()

m_uiForm.leScaleMultiplier->setValidator(m_valPosDbl);
m_uiForm.cal_leIntensityScaleMultiplier->setValidator(m_valDbl);
m_uiForm.cal_leResScale->setValidator(m_valDbl);

m_uiForm.sqw_leELow->setValidator(m_valDbl);
m_uiForm.sqw_leEWidth->setValidator(m_valDbl);
Expand Down Expand Up @@ -582,10 +585,13 @@ QString Indirect::savePyCode()
*/
void Indirect::createRESfile(const QString& file)
{
QString scaleFactor("None");
if(m_uiForm.cal_ckIntensityScaleMultiplier->isChecked())
QString scaleFactor("1.0");
if(m_uiForm.cal_ckResScale->isChecked())
{
scaleFactor = m_uiForm.cal_leIntensityScaleMultiplier->text();
if(!m_uiForm.cal_leResScale->text().isEmpty())
{
scaleFactor = m_uiForm.cal_leResScale->text();
}
}

QString pyInput =
Expand Down Expand Up @@ -811,6 +817,17 @@ QString Indirect::validateCalib()
uiv.checkBins(eLow, eWidth, eHigh);
}

if( m_uiForm.cal_ckIntensityScaleMultiplier->isChecked()
&& m_uiForm.cal_leIntensityScaleMultiplier->text().isEmpty() )
{
uiv.addErrorMessage("You must enter a scale for the calibration file");
}

if( m_uiForm.cal_ckResScale->isChecked() && m_uiForm.cal_leResScale->text().isEmpty() )
{
uiv.addErrorMessage("You must enter a scale for the resolution file");
}

return uiv.generateErrorMessage();
}

Expand Down Expand Up @@ -1482,7 +1499,6 @@ void Indirect::calibValidateIntensity(const QString & text)
}
}


void Indirect::useCalib(bool state)
{
m_uiForm.ind_calibFile->isOptional(!state);
Expand Down Expand Up @@ -1519,7 +1535,12 @@ void Indirect::calibCreate()
//scale values by arbitrary scalar if requested
if(m_uiForm.cal_ckIntensityScaleMultiplier->isChecked())
{
reducer += "calib.set_intensity_scale("+m_uiForm.cal_leIntensityScaleMultiplier->text()+")\n";
QString scale = m_uiForm.cal_leIntensityScaleMultiplier->text();
if(scale.isEmpty())
{
scale = "1.0";
}
reducer += "calib.set_intensity_scale("+scale+")\n";
}

reducer += "calib.execute(None, None)\n"
Expand Down

0 comments on commit d141b83

Please sign in to comment.