From 596e0dcb2d0f73692ab34f4c29b147d33c223810 Mon Sep 17 00:00:00 2001 From: Arturs Bekasovs <arturs.bekasovs@stfc.ac.uk> Date: Tue, 14 Jan 2014 13:42:29 +0000 Subject: [PATCH] Refs #8700. Adding logs to *_Workspace when doing a single fit. --- .../MantidQtMantidWidgets/FitPropertyBrowser.h | 5 +++-- .../MuonFitPropertyBrowser.h | 4 ++-- .../MantidWidgets/src/MuonFitPropertyBrowser.cpp | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FitPropertyBrowser.h b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FitPropertyBrowser.h index ab21560ff6d..f7808c93005 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FitPropertyBrowser.h +++ b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FitPropertyBrowser.h @@ -209,6 +209,9 @@ public: void postDeleteHandle(const std::string& wsName); void addHandle(const std::string& wsName,const boost::shared_ptr<Mantid::API::Workspace> ws); + /// Called when the Fit is finished + virtual void finishHandle(const Mantid::API::IAlgorithm* alg); + /// Returns the list of workspaces that are currently been worked on by the fit property browser. QStringList getWorkspaceNames(); /// Create a MatrixWorkspace from a TableWorkspace @@ -426,8 +429,6 @@ private: void createCompositeFunction(const QString& str = ""); /// Check if the workspace can be used in the fit virtual bool isWorkspaceValid(Mantid::API::Workspace_sptr)const; - /// Called when the fit is finished - void finishHandle(const Mantid::API::IAlgorithm* alg); /// Find QtBrowserItem for a property prop among the chidren of QtBrowserItem* findItem(QtBrowserItem* parent,QtProperty* prop)const; /// Set the parameters to the fit outcome diff --git a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/MuonFitPropertyBrowser.h b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/MuonFitPropertyBrowser.h index 1d05b1422cd..8efd86a299c 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/MuonFitPropertyBrowser.h +++ b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/MuonFitPropertyBrowser.h @@ -42,7 +42,8 @@ public: virtual void init(); /// Set the input workspace name virtual void setWorkspaceName(const QString& wsName); - + /// Called when the fit is finished + virtual void finishHandle(const Mantid::API::IAlgorithm* alg); public slots: /// Perform the fit algorithm @@ -61,7 +62,6 @@ protected: private slots: virtual void doubleChanged(QtProperty* prop); - private: /// Get the registered function names virtual void populateFunctionNames(); diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/MuonFitPropertyBrowser.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/MuonFitPropertyBrowser.cpp index 6e19abb887d..766e7f5bea8 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/src/MuonFitPropertyBrowser.cpp +++ b/Code/Mantid/MantidQt/MantidWidgets/src/MuonFitPropertyBrowser.cpp @@ -346,5 +346,20 @@ bool MuonFitPropertyBrowser::isWorkspaceValid(Workspace_sptr ws)const return false; } +void MuonFitPropertyBrowser::finishHandle(const IAlgorithm* alg) +{ + // Input workspace should be a MatrixWorkspace according to isWorkspaceValid + auto inWs = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>( + static_cast<std::string>( alg->getProperty("InputWorkspace") ) ); + + auto outWs = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>( + outputName() + "_Workspace"); + + if (inWs && outWs) + outWs->copyExperimentInfoFrom(inWs.get()); + + FitPropertyBrowser::finishHandle(alg); +} + } // MantidQt } // API -- GitLab