Skip to content

Commit

Permalink
Refs #4858 Hook sequential fit option up to python script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Jackson committed Feb 10, 2014
1 parent f324504 commit e47d442
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
Expand Up @@ -24,6 +24,7 @@ namespace IDA
virtual QString helpURL() {return "MSDFit";}

private slots:
void sequential();
void plotInput();
void minChanged(double val);
void maxChanged(double val);
Expand Down
38 changes: 37 additions & 1 deletion Code/Mantid/MantidQt/CustomInterfaces/src/MSDFit.cpp
Expand Up @@ -51,6 +51,7 @@ namespace IDA

connect(uiForm().msd_pbPlotInput, SIGNAL(clicked()), this, SLOT(plotInput()));
connect(uiForm().msd_inputFile, SIGNAL(filesFound()), this, SLOT(plotInput()));
connect(uiForm().msd_pbSequential, SIGNAL(clicked()), this, SLOT(sequential()));

uiForm().msd_leSpectraMin->setValidator(m_intVal);
uiForm().msd_leSpectraMax->setValidator(m_intVal);
Expand All @@ -63,7 +64,7 @@ namespace IDA
"startX = " + QString::number(m_msdDblMng->value(m_msdProp["Start"])) +"\n"
"endX = " + QString::number(m_msdDblMng->value(m_msdProp["End"])) +"\n"
"specMin = " + uiForm().msd_leSpectraMin->text() + "\n"
"specMax = " + uiForm().msd_leSpectraMax->text() + "\n"
"specMax = " + uiForm().msd_leSpectraMin->text() + "\n"
"inputs = [r'" + uiForm().msd_inputFile->getFilenames().join("', r'") + "']\n";

if ( uiForm().msd_ckVerbose->isChecked() ) pyInput += "verbose = True\n";
Expand All @@ -81,6 +82,41 @@ namespace IDA
QString pyOutput = runPythonCode(pyInput).trimmed();
}

void MSDFit::sequential()
{
QString errors = validate();

if (errors.isEmpty())
{
QString pyInput =
"from IndirectDataAnalysis import msdfit\n"
"startX = " + QString::number(m_msdDblMng->value(m_msdProp["Start"])) +"\n"
"endX = " + QString::number(m_msdDblMng->value(m_msdProp["End"])) +"\n"
"specMin = " + uiForm().msd_leSpectraMin->text() + "\n"
"specMax = " + uiForm().msd_leSpectraMax->text() + "\n"
"inputs = [r'" + uiForm().msd_inputFile->getFilenames().join("', r'") + "']\n";

if ( uiForm().msd_ckVerbose->isChecked() ) pyInput += "verbose = True\n";
else pyInput += "verbose = False\n";

if ( uiForm().msd_ckPlot->isChecked() ) pyInput += "plot = True\n";
else pyInput += "plot = False\n";

if ( uiForm().msd_ckSave->isChecked() ) pyInput += "save = True\n";
else pyInput += "save = False\n";

pyInput +=
"msdfit(inputs, startX, endX, spec_min=specMin, spec_max=specMax, Save=save, Verbose=verbose, Plot=plot)\n";

QString pyOutput = runPythonCode(pyInput).trimmed();
}
else
{
showInformationBox(errors);
}

}

QString MSDFit::validate()
{
UserInputValidator uiv;
Expand Down

0 comments on commit e47d442

Please sign in to comment.