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

Ammend QLRun algorithm to have multiple outputs

Refs #13826
parent 92beeeaf
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ if is_supported_f2py_platform():
else:
logger.error('F2Py functionality not currently available on your platform.')
from mantid.api import PythonAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, PropertyMode
from mantid.api import PythonAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, PropertyMode, WorkspaceGroupProperty
from mantid.kernel import StringListValidator, Direction
from mantid.simpleapi import *
from mantid import config, logger
......@@ -94,6 +94,16 @@ class QLRun(PythonAlgorithm):
self.declareProperty(name='Save', defaultValue=False, doc='Switch Save result to nxs file Off/On')
self.declareProperty(WorkspaceGroupProperty('OutputWorkspaceFit', '', direction=Direction.Output),
doc='The name of the fit output workspaces')
self.declareProperty(MatrixWorkspaceProperty('OutputWorkspaceProb', '', optional=PropertyMode.Optional,
direction=Direction.Output),
doc='The name of the probability output workspaces')
self.declareProperty(MatrixWorkspaceProperty('OutputWorkspaceResult', '', direction=Direction.Output),
doc='The name of the result output workspaces')
def validateInputs(self):
self._get_properties()
......@@ -313,7 +323,7 @@ class QLRun(PythonAlgorithm):
yProb = yPr0
yProb = np.append(yProb,yPr1)
yProb = np.append(yProb,yPr2)
CreateWorkspace(OutputWorkspace=probWS, DataX=xProb, DataY=yProb, DataE=eProb,\
probWs = CreateWorkspace(OutputWorkspace=probWS, DataX=xProb, DataY=yProb, DataE=eProb,\
Nspec=3, UnitX='MomentumTransfer')
outWS = C2Fw(self._samWS[:-4],fname)
if self._Plot != 'None':
......@@ -339,6 +349,11 @@ class QLRun(PythonAlgorithm):
logger.information('Output fit file created : ' + fit_path)
logger.information('Output paramter file created : ' + out_path)
self.setProperty('OutputworkspaceFit', fitWS)
self.setProperty('OutputWorkspaceResult', outWS)
if self._program == 'QL':
self.setProperty('OutputWorkspaceProb', probWS)
if is_supported_f2py_platform():
# Register algorithm with Mantid
......
......@@ -44,6 +44,8 @@ private:
int m_previewSpec;
/// The ui form
Ui::Quasi m_uiForm;
/// alg
Mantid::API::IAlgorithm_sptr m_QuasiAlg;
};
} // namespace CustomInterfaces
} // namespace MantidQt
......
......@@ -186,6 +186,9 @@ void Quasi::run() {
runAlg->setProperty("SampleWorkspace", sampleName);
runAlg->setProperty("ResolutionWorkspace", resName);
runAlg->setProperty("ResNormWorkspace", resNormFile);
runAlg->setProperty("OutputWorkspaceFit", "fit");
runAlg->setProperty("OutputWorkspaceProb", "prob");
runAlg->setProperty("OutputWorkspaceResult", "result");
runAlg->setProperty("MinRange", eMin);
runAlg->setProperty("MaxRange", eMax);
runAlg->setProperty("SampleBins", sampleBins);
......@@ -199,6 +202,7 @@ void Quasi::run() {
runAlg->setProperty("Save", save);
runAlg->setProperty("Plot", plot);
m_QuasiAlg = runAlg;
m_batchAlgoRunner->addAlgorithm(runAlg);
connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this,
SLOT(algorithmComplete(bool)));
......
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