From f190e3a93e03ebf0fd41e946ce5a6bb25534319f Mon Sep 17 00:00:00 2001 From: Elliot Oram <Elliot.Oram@stfc.ac.uk> Date: Wed, 10 Feb 2016 16:09:03 +0000 Subject: [PATCH] Fix ConvertToElasticQ function to add workspace to ADS for fit alg Refs #15250 --- .../ConvolutionFitSequential.h | 2 +- .../src/ConvolutionFitSequential.cpp | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Framework/WorkflowAlgorithms/inc/MantidWorkflowAlgorithms/ConvolutionFitSequential.h b/Framework/WorkflowAlgorithms/inc/MantidWorkflowAlgorithms/ConvolutionFitSequential.h index c05b9e9d4ca..22858f33571 100644 --- a/Framework/WorkflowAlgorithms/inc/MantidWorkflowAlgorithms/ConvolutionFitSequential.h +++ b/Framework/WorkflowAlgorithms/inc/MantidWorkflowAlgorithms/ConvolutionFitSequential.h @@ -53,7 +53,7 @@ private: const std::vector<std::string> &); std::vector<double> squareVector(std::vector<double>); std::vector<double> cloneVector(const std::vector<double> &); - API::MatrixWorkspace_sptr convertInputToElasticQ(API::MatrixWorkspace_sptr &, + void convertInputToElasticQ(API::MatrixWorkspace_sptr &, const std::string &); void calculateEISF(API::ITableWorkspace_sptr &); std::string convertBackToShort(const std::string &); diff --git a/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp b/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp index ca93f043d7c..dc94ab1ede4 100644 --- a/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp +++ b/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp @@ -180,7 +180,7 @@ void ConvolutionFitSequential::exec() { // Convert input workspace to get Q axis const std::string tempFitWsName = "__convfit_fit_ws"; - auto tempFitWs = convertInputToElasticQ(inputWs, tempFitWsName); + convertInputToElasticQ(inputWs, tempFitWsName); Progress plotPeakStringProg(this, 0.0, 0.05, specMax - specMin); // Construct plotpeak string @@ -446,15 +446,13 @@ ConvolutionFitSequential::cloneVector(const std::vector<double> &original) { } /** - * Converts the input workspaces to get the Elastic Q axis + * Converts the input workspaces to spectrum axis to ElasticQ and adds it to the + * ADS to be used by PlotPeakBylogValue * @param inputWs - The MatrixWorkspace to be converted * @param wsName - The desired name of the output workspace - * @return Shared pointer to the converted workspace */ -API::MatrixWorkspace_sptr ConvolutionFitSequential::convertInputToElasticQ( +void ConvolutionFitSequential::convertInputToElasticQ( API::MatrixWorkspace_sptr &inputWs, const std::string &wsName) { - auto tempFitWs = WorkspaceFactory::Instance().create( - "Workspace2D", inputWs->getNumberHistograms(), 2, 1); auto axis = inputWs->getAxis(1); if (axis->isSpectra()) { auto convSpec = createChildAlgorithm("ConvertSpectrumAxis"); @@ -471,16 +469,14 @@ API::MatrixWorkspace_sptr ConvolutionFitSequential::convertInputToElasticQ( throw std::runtime_error("Input must have axis values of Q"); } auto cloneWs = createChildAlgorithm("CloneWorkspace"); + cloneWs->setAlwaysStoreInADS(true); cloneWs->setProperty("InputWorkspace", inputWs); cloneWs->setProperty("OutputWorkspace", wsName); cloneWs->executeAsChildAlg(); - tempFitWs = cloneWs->getProperty("OutputWorkspace"); } else { throw std::runtime_error( "Input workspace must have either spectra or numeric axis."); } - - return tempFitWs; } /** -- GitLab