From 084b3d8f8c3b452dab30bdcbff96acb13d25d925 Mon Sep 17 00:00:00 2001 From: Michael Wedel Date: Wed, 6 May 2015 13:45:27 +0200 Subject: [PATCH] Refs #11674. Added raw fit parameter output option to PoldiFitPeaks2D. --- .../WorkflowAlgorithms/PoldiDataAnalysis.py | 16 +++++++++++++++- .../Framework/SINQ/src/PoldiFitPeaks2D.cpp | 13 +++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PoldiDataAnalysis.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PoldiDataAnalysis.py index 7b434dc8d360..d6d4686f5bb5 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PoldiDataAnalysis.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PoldiDataAnalysis.py @@ -59,6 +59,10 @@ def PyInit(self): doc=('If this is activated, plot the sum of residuals and calculated spectrum together ' 'with the theoretical spectrum and the residuals.')) + self.declareProperty('OutputRawFitParameters', False, direction=Direction.Input, + doc=('Activating this option produces an output workspace which contains the raw ' + 'fit parameters.')) + self.declareProperty(WorkspaceProperty(name="OutputWorkspace", defaultValue="", direction=Direction.Output), doc='WorkspaceGroup with result data from all processing steps.') @@ -182,6 +186,12 @@ def runPeakFit2D(self, peaks): refinedPeaksName = self.baseName + "_peaks_refined_2d" refinedCellName = self.baseName + "_cell_refined" + rawFitParametersWorkspaceName = '' + outputRawFitParameters = self.getProperty('OutputRawFitParameters').value + if outputRawFitParameters: + rawFitParametersWorkspaceName = self.baseName + "_raw_fit_parameters" + + pawleyFit = self.getProperty('PawleyFit').value PoldiFitPeaks2D(InputWorkspace=self.inputWorkspace, @@ -192,7 +202,8 @@ def runPeakFit2D(self, peaks): OutputWorkspace=spectrum2DName, Calculated1DSpectrum=spectrum1DName, RefinedPoldiPeakWorkspace=refinedPeaksName, - RefinedCellParameters=refinedCellName) + RefinedCellParameters=refinedCellName, + RawFitParameters=rawFitParametersWorkspaceName) workspaces = [AnalysisDataService.retrieve(spectrum2DName), AnalysisDataService.retrieve(spectrum1DName), @@ -200,6 +211,9 @@ def runPeakFit2D(self, peaks): if AnalysisDataService.doesExist(refinedCellName): workspaces.append(AnalysisDataService.retrieve(refinedCellName)) + if AnalysisDataService.doesExist(rawFitParametersWorkspaceName): + workspaces.append(AnalysisDataService.retrieve(rawFitParametersWorkspaceName)) + return workspaces def runResidualAnalysis(self, calculated2DSpectrum): diff --git a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp index 1634d42f0571..9e41fb92edf1 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -1143,6 +1143,11 @@ void PoldiFitPeaks2D::init() { declareProperty(new WorkspaceProperty( "RefinedCellParameters", "", Direction::Output, PropertyMode::Optional)); + + declareProperty(new WorkspaceProperty("RawFitParameters", "", + Direction::Output, + PropertyMode::Optional), + "Table workspace that contains all raw fit parameters."); } /// Executes the algorithm @@ -1245,6 +1250,14 @@ void PoldiFitPeaks2D::exec() { g_log.warning() << "Warning: Cell parameter table is empty."; } } + + // Optionally output the raw fitting parameters. + Property *rawFitParameters = getPointerToProperty("RawFitParameters"); + if (!rawFitParameters->isDefault()) { + ITableWorkspace_sptr parameters = + fitAlgorithm->getProperty("OutputParameters"); + setProperty("RawFitParameters", parameters); + } } } // namespace Poldi