Skip to content
Snippets Groups Projects
Commit e3f72a9f authored by Elliot Oram's avatar Elliot Oram
Browse files

Changed .cpp UI code to run new python alg

Refs #13826
parent b77fb0c1
No related branches found
No related tags found
No related merge requests found
......@@ -11,8 +11,8 @@ class QLRun(PythonAlgorithm):
return "PythonAlgorithms"
def summary(self):
return "This algorithm runs the Fortran QLines programs which fits a Delta function of"
" amplitude 0 and Lorentzians of amplitude A(j) and HWHM W(j) where j=1,2,3. The"
return "This algorithm runs the Fortran QLines programs which fits a Delta function of"+\
" amplitude 0 and Lorentzians of amplitude A(j) and HWHM W(j) where j=1,2,3. The"+\
" whole function is then convoled with the resolution function."
def PyInit(self):
......
......@@ -4,50 +4,48 @@
#include "ui_Quasi.h"
#include "IndirectBayesTab.h"
namespace MantidQt
{
namespace CustomInterfaces
{
class DLLExport Quasi : public IndirectBayesTab
{
Q_OBJECT
public:
Quasi(QWidget * parent = 0);
// Inherited methods from IndirectBayesTab
void setup();
bool validate();
void run();
/// Load default settings into the interface
void loadSettings(const QSettings& settings);
private slots:
/// Slot for when the min range on the range selector changes
void minValueChanged(double min);
/// Slot for when the min range on the range selector changes
void maxValueChanged(double max);
/// Slot to update the guides when the range properties change
void updateProperties(QtProperty* prop, double val);
/// Slot to handle when a new sample file is available
void handleSampleInputReady(const QString& filename);
/// Slot to handle when a new resolution file is available
void handleResolutionInputReady(const QString& wsName);
/// slot to handle when the user changes the program to be used
void handleProgramChange(int index);
/// Slot to handle setting a new preview spectrum
void previewSpecChanged(int value);
/// Handles updating spectra in mini plot
void updateMiniPlot();
private:
/// Current preview spectrum
int m_previewSpec;
/// The ui form
Ui::Quasi m_uiForm;
};
} // namespace CustomInterfaces
namespace MantidQt {
namespace CustomInterfaces {
class DLLExport Quasi : public IndirectBayesTab {
Q_OBJECT
public:
Quasi(QWidget *parent = 0);
// Inherited methods from IndirectBayesTab
void setup();
bool validate();
void run();
/// Load default settings into the interface
void loadSettings(const QSettings &settings);
private slots:
/// Slot for when the min range on the range selector changes
void minValueChanged(double min);
/// Slot for when the min range on the range selector changes
void maxValueChanged(double max);
/// Slot to update the guides when the range properties change
void updateProperties(QtProperty *prop, double val);
/// Slot to handle when a new sample file is available
void handleSampleInputReady(const QString &filename);
/// Slot to handle when a new resolution file is available
void handleResolutionInputReady(const QString &wsName);
/// slot to handle when the user changes the program to be used
void handleProgramChange(int index);
/// Slot to handle setting a new preview spectrum
void previewSpecChanged(int value);
/// Handles updating spectra in mini plot
void updateMiniPlot();
/// Handles what happen after the algorithm is run
void algorithmComplete(bool error);
private:
/// Current preview spectrum
int m_previewSpec;
/// The ui form
Ui::Quasi m_uiForm;
};
} // namespace CustomInterfaces
} // namespace MantidQt
#endif
......@@ -185,7 +185,21 @@ void Quasi::run() {
}
QString plot = m_uiForm.cbPlot->currentText();
pyInput += "QLRun('" + program + "','" + sampleName + "','" + resName +
IAlgorithm_sptr runAlg = AlgorithmManager::Instance().create("QLRun");
runAlg->initialize();
runAlg->setProperty("program", program.toStdString());
runAlg->setProperty("samWs", sampleName.toStdString());
runAlg->setProperty("resWs", resName.toStdString());
runAlg->setProperty("resNormWs", resNormFile.toStdString());
runAlg->setProperty("erange", eRange.toStdString());
runAlg->setProperty("nbins", nBins.toStdString());
runAlg->setProperty("Fit", fitOps.toStdString());
runAlg->setProperty("wfile", fixedWidthFile.toStdString());
runAlg->setProperty("Loop", sequence.toStdString());
runAlg->setProperty("Save", save.toStdString());
runAlg->setProperty("Plot", plot.toStdString());
/*pyInput += "QLRun('" + program + "','" + sampleName + "','" + resName +
"','" + resNormFile + "'," + eRange + ","
" " +
nBins + "," + fitOps + ",'" + fixedWidthFile + "'," + sequence +
......@@ -193,15 +207,25 @@ void Quasi::run() {
" Save=" +
save + ", Plot='" + plot + "')\n";
runPythonScript(pyInput);
updateMiniPlot();
runPythonScript(pyInput);*/
m_batchAlgoRunner->addAlgorithm(runAlg);
connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this,
SLOT(algorithmComplete(bool)));
m_batchAlgoRunner->executeBatchAsync();
}
/**
* Updates the data and fit curves on the mini plot.
*/
void Quasi::updateMiniPlot() {
void Quasi::algorithmComplete(bool error) {
if (error)
return;
else
updateMiniPlot();
}
void Quasi::updateMiniPlot(){
// Update sample plot
if (!m_uiForm.dsSample->isValid())
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment