Skip to content

Commit

Permalink
Refs #7840 added new scale factor option to resolution file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Jackson committed Oct 11, 2013
1 parent 0f5c962 commit 866efd8
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 10 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,10 +1910,22 @@ Later steps in the process (saving, renaming) will not be done.</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cal_pbPlotEnergy">
<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>Plot Energy</string>
<string>1.0</string>
</property>
<property name="placeholderText">
<string/>
</property>
</widget>
</item>
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 @@ -98,6 +98,8 @@ void Indirect::initLayout()
connect(m_uiForm.cal_pbPlot, SIGNAL(clicked()), this, SLOT(calPlotRaw()));
connect(m_uiForm.cal_pbPlotEnergy, SIGNAL(clicked()), this, SLOT(calPlotEnergy()));
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 @@ -137,6 +139,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 @@ -565,10 +568,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 @@ -778,6 +784,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 @@ -1449,7 +1466,6 @@ void Indirect::calibValidateIntensity(const QString & text)
}
}


void Indirect::useCalib(bool state)
{
m_uiForm.ind_calibFile->isOptional(!state);
Expand Down Expand Up @@ -1486,7 +1502,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 866efd8

Please sign in to comment.