diff --git a/Code/Mantid/Build/CMake/DarwinSetup.cmake b/Code/Mantid/Build/CMake/DarwinSetup.cmake index 59a5d0a6be29..9821a44e261d 100644 --- a/Code/Mantid/Build/CMake/DarwinSetup.cmake +++ b/Code/Mantid/Build/CMake/DarwinSetup.cmake @@ -80,7 +80,7 @@ endif () # Force 64-bit compiler as that's all we support ########################################################################### -set ( CLANG_WARNINGS "-Wall -Wextra -Winit-self -Wpointer-arith -Wcast-qual -fno-common -Wno-deprecated-register") +set ( CLANG_WARNINGS "-Wall -Wextra -pedantic -Winit-self -Wpointer-arith -Wcast-qual -fno-common -Wno-deprecated-register") set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 ${CLANG_WARNINGS}" ) set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -std=c++0x" ) diff --git a/Code/Mantid/Build/CMake/FindJsonCPP.cmake b/Code/Mantid/Build/CMake/FindJsonCPP.cmake index c52d1418812b..a28f35fd3334 100644 --- a/Code/Mantid/Build/CMake/FindJsonCPP.cmake +++ b/Code/Mantid/Build/CMake/FindJsonCPP.cmake @@ -9,11 +9,6 @@ # JSONCPP_LIBRARY_DEBUG - library files for linking (debug version) # JSONCPP_LIBRARIES - All required libraries, including the configuration type -# Using unset here is a temporary hack to force FindJson to find the correct -# path in an incremental build. It should be removed a day or two after the -# branch introducing this is merged. -unset ( JSONCPP_INCLUDE_DIR CACHE ) - # Headers find_path ( JSONCPP_INCLUDE_DIR json/reader.h PATH_SUFFIXES jsoncpp ) diff --git a/Code/Mantid/Build/CMake/GNUSetup.cmake b/Code/Mantid/Build/CMake/GNUSetup.cmake index 37d6f9bc32db..67b373b55a4b 100644 --- a/Code/Mantid/Build/CMake/GNUSetup.cmake +++ b/Code/Mantid/Build/CMake/GNUSetup.cmake @@ -24,9 +24,10 @@ set( GNUFLAGS "-Wall -Wextra -Wconversion -Winit-self -Wpointer-arith -Wcast-qua set( GNUFLAGS "${GNUFLAGS} -Wno-deprecated -Wno-write-strings") # Check if we have a new enough version for this flag +# some -pedantic warnings remain with gcc 4.4.7 if ( CMAKE_COMPILER_IS_GNUCXX ) - if (GCC_COMPILER_VERSION VERSION_GREATER "4.3") - set(GNUFLAGS "${GNUFLAGS} -Wno-unused-result") + if (NOT (GCC_COMPILER_VERSION VERSION_LESS "4.5")) + set(GNUFLAGS "${GNUFLAGS} -Wno-unused-result -pedantic") endif () elseif ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) set(GNUFLAGS "${GNUFLAGS} -Wno-sign-conversion") diff --git a/Code/Mantid/Framework/API/CMakeLists.txt b/Code/Mantid/Framework/API/CMakeLists.txt index 543277381857..1380797cf915 100644 --- a/Code/Mantid/Framework/API/CMakeLists.txt +++ b/Code/Mantid/Framework/API/CMakeLists.txt @@ -221,6 +221,7 @@ set ( INC_FILES inc/MantidAPI/IPeakFunction.h inc/MantidAPI/IPeaksWorkspace.h inc/MantidAPI/IPowderDiffPeakFunction.h + inc/MantidAPI/IRemoteJobManager.h inc/MantidAPI/ISpectrum.h inc/MantidAPI/ISplittersWorkspace.h inc/MantidAPI/ITableWorkspace.h diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/DomainCreatorFactory.h b/Code/Mantid/Framework/API/inc/MantidAPI/DomainCreatorFactory.h index 09f4ab0100b4..0b232c59f0d8 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/DomainCreatorFactory.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/DomainCreatorFactory.h @@ -59,7 +59,7 @@ class MANTID_API_DLL DomainCreatorFactoryImpl /// Private Constructor for singleton class DomainCreatorFactoryImpl(); /// No copying - DISABLE_COPY_AND_ASSIGN(DomainCreatorFactoryImpl); + DISABLE_COPY_AND_ASSIGN(DomainCreatorFactoryImpl) /// Private Destructor for singleton virtual ~DomainCreatorFactoryImpl(); diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/FileFinder.h b/Code/Mantid/Framework/API/inc/MantidAPI/FileFinder.h index 410ef30b7541..a970c7300834 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/FileFinder.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/FileFinder.h @@ -50,7 +50,7 @@ Code Documentation is available at: */ class MANTID_API_DLL FileFinderImpl { public: - std::string getFullPath(const std::string &filename) const; + std::string getFullPath(const std::string &filename, const bool ignoreDirs = false) const; std::string getPath(const std::vector &archs, const std::set &filename, const std::vector &extensions) const; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/FunctionParameterDecorator.h b/Code/Mantid/Framework/API/inc/MantidAPI/FunctionParameterDecorator.h index 533c9942cdd2..78fd23781cbf 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/FunctionParameterDecorator.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/FunctionParameterDecorator.h @@ -50,6 +50,11 @@ class MANTID_API_DLL FunctionParameterDecorator : virtual public IFunction { IFunction_sptr clone() const; + virtual void setWorkspace(boost::shared_ptr ws); + virtual void + setMatrixWorkspace(boost::shared_ptr workspace, + size_t wi, double startX, double endX); + /// Set i-th parameter of decorated function. virtual void setParameter(size_t i, const double &value, bool explicitlySet = true); diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/IRemoteJobManager.h b/Code/Mantid/Framework/API/inc/MantidAPI/IRemoteJobManager.h new file mode 100644 index 000000000000..2035e271f89e --- /dev/null +++ b/Code/Mantid/Framework/API/inc/MantidAPI/IRemoteJobManager.h @@ -0,0 +1,280 @@ +#ifndef MANTID_KERNEL_IREMOTEJOBMANAGER_H +#define MANTID_KERNEL_IREMOTEJOBMANAGER_H + +#include "MantidAPI/DllConfig.h" +#include "MantidKernel/DateAndTime.h" + +namespace Mantid { +namespace API { +/** +Common interface to different remote job managers (job schedulers, web +services, etc. such as MOAB, Platform LSF, or SLURM). + +IremoteJobManager objects are (in principle) created via the +RemoteJobManagerFactory. There are several "remote algorithms" in +Mantid: Authenticate, SubmitRemoteJob, QueryRemoteJobStatus, +etc. These algorithms are meant to use this interface to the different +specific implementations. Or, from the opposite angle, the methods of +this interface provide the functionality required by the remote +algorithms in a generic way (with respect to different job schedulers +or underlying mechanisms to handle remote jobs). So-called remote job +manager classes can implement this interface to provide +specialisations for Platform LSF, SLURM, MOAB, the Mantid web service +API, etc. + +A typical sequence of calls when you use this interface would be: + +1) Authenticate/log-in (authenticate()) +2) Do transactions + +Where the sequence of calls within a transaction is: + +2.1) Start transaction (startRemoteTransaction()) +2.2) Do actions +2.3) Stop transaction (stopRemoteTransaction()) + +In 2.2, several types of actions are possible: +- Submit a job to run on the (remote) compute resource (submitRemoteJob()). +- Get status info for one or all jobs (queryRemoteJob() and +queryAllRemoteJobs()). +- Cancel a job (abortRemoteJob()). +- Get list of available files for a transaction on the compute resource +(queryRemoteFile()) +- Upload / download files ( uploadRemoteFile() and downloadRemoteFile()). + + +Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge +National Laboratory & European Spallation Source + +This file is part of Mantid. + +Mantid is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. + +Mantid is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +File change history is stored at: . +Code Documentation is available at: +*/ +class MANTID_API_DLL IRemoteJobManager { +public: + virtual ~IRemoteJobManager(){}; + + /** + * Status and general information about jobs running on (remote) + * compute resources. + */ + struct RemoteJobInfo { + /// Job ID, usually assigned by a job scheduler as an integer + /// number or similar. + std::string id; + /// name of the job, whether given by the user or automatically + /// assigned by the job scheduler + std::string name; + /// Name of the script or executable. Depending on the specific + /// implementation, job scheduler, etc. this can be an + /// 'application' name, a script name or different ways of + /// specifying what is run + std::string runnableName; + /// Last status retrieved (typically: Pending, Running, Exited, + /// etc.). The values are implementation/job scheduler dependent. + std::string status; + /// ID of the transaction where this job is included + std::string transactionID; + /// Date-time of submission. No particular format can be assumed + /// from the specific remote job managers, and some of them may + /// not provide this info + Mantid::Kernel::DateAndTime submitDate; + /// Date-time the job actually started running. No particular + /// format can be assumed + Mantid::Kernel::DateAndTime startDate; + /// Date-time the job finished. No particular format can be + /// assumed + Mantid::Kernel::DateAndTime completionTime; + }; + + /** + * Authenticate or log-in, previous to submitting jobs, up/downloading, etc. + * + * @param username User name or credentials + * + * @param password Password (or other type of authentication token) + * string. + * + * @throws std::invalid_argument If any of the inputs is not set + * properly. + * @throws std::runtime_error If authentication fails + */ + virtual void authenticate(const std::string &username, + const std::string &password) = 0; + + /** + * Submit a job (and implicitly request to start it) within a + * transaction. + * + * @param transactionID ID obtained from a startRemoteTransaction() + * + * @param runnable Name of the script or executable for the + * job. This can be a name or path to a file (implementation + * dependent). + * + * @param param Parameters for the job. This is implementation + * dependent and may be a list of command line options, the name of + * a script or configuration file, the contents of a script to run + * or configuration template, etc. For example, for the Mantid web + * service API, this is the content of a python script. + * + * @param taskName (optional) human readable name for this job. + * + * @param numNodes number of nodes to use (optional and dependent on + * implementation and compute resource) + * + * @parm coresPerNode number of cores to use in each node (optional + * and dependent on implemenation and compute resource) + * + * @return jobID string for the job started (if successful). + * + * @throws std::invalid_argument If any of the inputs is not set + * properly. + * @throws std::runtime_error if job submission fails. + */ + virtual std::string + submitRemoteJob(const std::string &transactionID, const std::string &runnable, + const std::string ¶m, const std::string &taskName = "", + const int numNodes = 1, const int coresPerNode = 1) = 0; + + /** + * Get/download a file from the (remote) compute resource. + * + * @param transactionID ID obtained from a startRemoteTransaction() + * + * @param remoteFileName Name of file on the (remote) compute + * resource. This can be a full or relative path or a simple file + * name, depending on implementation. + * + * @param localFileName Where to place the downloaded file on the + * local machine. + * + * @throws std::invalid_argument If any of the inputs is not set + * properly. + * @throws std::runtime_error If the download operation fails + */ + virtual void downloadRemoteFile(const std::string &transactionID, + const std::string &remoteFileName, + const std::string &localFileName) = 0; + + /** + * Get information (status etc.) for all running jobs on the remote + * compute resource + * + * @return Status and general info for all the jobs found on the + * (remote) compute resource. Each of them should come identified by + * its ID. + * + * @throws std::runtime_error If the query fails + */ + virtual std::vector queryAllRemoteJobs() const = 0; + + /** + * Get the list of files available for a transaction at the (remote) + * compute resource. + * + * @param transactionID ID obtained from startRemoteTransaction() + * + * @return The names of all the available files + * + * @throws std::invalid_argument If there's an issue with the + * transaction ID + * + * @throws std::runtime_error If the query fails + */ + virtual std::vector + queryRemoteFile(const std::string &transactionID) const = 0; + + /** + * Get information (status etc.) for an (in principle) running job + * + * @param jobID ID of a job as obtained from submitRemoteJob() + * + * @return Status and general info for the job requested + * + * @throws std::invalid_argument If there's an issue with the + * job ID + * + * @throws std::runtime_error If the query fails + */ + virtual RemoteJobInfo queryRemoteJob(const std::string &jobID) const = 0; + + /** + * Start a transaction before up/downloading files and submitting + * jobs + * + * @return ID of the transaction as produced by the job scheduler + * and/or remote job manager. + * + * @throws std::runtime_error If the transaction creation fails + */ + virtual std::string startRemoteTransaction() = 0; + + /** + * Finish a transaction. This implicitly can cancel all the + * operations (jobs) associated with this transaction. + * + * @param transactionID An Id of a transaction, as returned by + * startRemoteTransaction() + * + * @throws std::invalid_argument If there's an issue with the + * transaction ID + * + * @throws std::runtime_error If the stop operation fails + */ + virtual void stopRemoteTransaction(const std::string &transactionID) = 0; + + /** + * Cancel a job (expected to be currently running on the remote resource) + * + * @param jobID ID for a job in a transaction, as returned by + * submitRemoteJob() + * + * @throws std::invalid_argument If there's an issue with the + * job ID + * @throws std::runtime_error If the abort/cancel operation fails + */ + virtual void abortRemoteJob(const std::string &jobID) = 0; + + /** + * Upload file for a transaction on the rmeote compute resource + * + * @param transactionID ID, as you get them from + * startRemoteTransaction() + * + * @param remoteFileName Name of file on the (remote) compute + * resource. This can be a full or relative path or a simple file + * name, depending on implementation. + * + * @param localFileName Path to the file to upload + * + * @throws std::invalid_argument If there's an issue with the + * arguments passed + * @throws std::runtime_error If the upload fails + */ + virtual void uploadRemoteFile(const std::string &transactionID, + const std::string &remoteFileName, + const std::string &localFileName) = 0; +}; + +// shared pointer type for the IRemoteJobManager +typedef boost::shared_ptr IRemoteJobManager_sptr; + +} // namespace API +} // namespace Mantid + +#endif // MANTID_API_IREMOTEJOBMANAGER_H diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/ScopedWorkspace.h b/Code/Mantid/Framework/API/inc/MantidAPI/ScopedWorkspace.h index e379a04431fb..50595222e3f2 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/ScopedWorkspace.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/ScopedWorkspace.h @@ -74,7 +74,7 @@ class DLLExport ScopedWorkspace { void set(Workspace_sptr newWS); private: - DISABLE_COPY_AND_ASSIGN(ScopedWorkspace); + DISABLE_COPY_AND_ASSIGN(ScopedWorkspace) /// ADS name of the workspace const std::string m_name; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/ScriptRepository.h b/Code/Mantid/Framework/API/inc/MantidAPI/ScriptRepository.h index b528bdb6e709..97b91a4e7dc1 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/ScriptRepository.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/ScriptRepository.h @@ -48,7 +48,7 @@ enum SCRIPTSTATUS { LOCAL_ONLY = (1u << 1), REMOTE_CHANGED = (1u << 2), LOCAL_CHANGED = (1u << 3), - BOTH_CHANGED = (REMOTE_CHANGED | LOCAL_CHANGED), + BOTH_CHANGED = (REMOTE_CHANGED | LOCAL_CHANGED) }; /** @@ -610,7 +610,7 @@ class MANTID_API_DLL ScriptRepository { /// shared pointer to the function base class typedef boost::shared_ptr ScriptRepository_sptr; -}; -}; +} +} #endif // MANTID_API_SCRIPTREPOSITORY_H_ diff --git a/Code/Mantid/Framework/API/src/FileFinder.cpp b/Code/Mantid/Framework/API/src/FileFinder.cpp index 3c07e3517894..e350531d1107 100644 --- a/Code/Mantid/Framework/API/src/FileFinder.cpp +++ b/Code/Mantid/Framework/API/src/FileFinder.cpp @@ -101,11 +101,12 @@ bool FileFinderImpl::getCaseSensitive() const { /** * Return the full path to the file given its name * @param filename :: A file name (without path) including extension + * @param ignoreDirs :: If true, directories that match are skipped unless the path given is already absolute * @return The full path if the file exists and can be found in one of the * search locations * or an empty string otherwise. */ -std::string FileFinderImpl::getFullPath(const std::string &filename) const { +std::string FileFinderImpl::getFullPath(const std::string &filename, const bool ignoreDirs) const { std::string fName = Kernel::Strings::strip(filename); g_log.debug() << "getFullPath(" << fName << ")\n"; // If this is already a full path, nothing to do @@ -116,7 +117,7 @@ std::string FileFinderImpl::getFullPath(const std::string &filename) const { // circumstances with extensions that have wild cards try { Poco::File fullPath(Poco::Path().resolve(fName)); - if (fullPath.exists()) + if (fullPath.exists() && (!ignoreDirs || !fullPath.isDirectory())) return fullPath.path(); } catch (std::exception &) { } @@ -137,15 +138,20 @@ std::string FileFinderImpl::getFullPath(const std::string &filename) const { std::set files; Kernel::Glob::glob(pathPattern, files, m_globOption); if (!files.empty()) { + Poco::File matchPath(*files.begin()); + if(ignoreDirs && matchPath.isDirectory()) { + continue; + } return *files.begin(); + } #ifdef _WIN32 } else { Poco::Path path(*it, fName); Poco::File file(path); - if (file.exists()) { + if (file.exists() && !(ignoreDirs && file.isDirectory())) { return path.toString(); - } + } } #endif } diff --git a/Code/Mantid/Framework/API/src/FunctionParameterDecorator.cpp b/Code/Mantid/Framework/API/src/FunctionParameterDecorator.cpp index 9c1a1e80045a..0f953040eaee 100644 --- a/Code/Mantid/Framework/API/src/FunctionParameterDecorator.cpp +++ b/Code/Mantid/Framework/API/src/FunctionParameterDecorator.cpp @@ -37,6 +37,21 @@ IFunction_sptr FunctionParameterDecorator::clone() const { return cloned; } +void FunctionParameterDecorator::setWorkspace( + boost::shared_ptr ws) { + throwIfNoFunctionSet(); + + m_wrappedFunction->setWorkspace(ws); +} + +void FunctionParameterDecorator::setMatrixWorkspace( + boost::shared_ptr workspace, size_t wi, + double startX, double endX) { + throwIfNoFunctionSet(); + + m_wrappedFunction->setMatrixWorkspace(workspace, wi, startX, endX); +} + void FunctionParameterDecorator::setParameter(size_t i, const double &value, bool explicitlySet) { throwIfNoFunctionSet(); @@ -91,8 +106,8 @@ double FunctionParameterDecorator::getParameter(const std::string &name) const { } size_t FunctionParameterDecorator::nParams() const { - if(!m_wrappedFunction) { - return 0; + if (!m_wrappedFunction) { + return 0; } return m_wrappedFunction->nParams(); @@ -161,8 +176,8 @@ size_t FunctionParameterDecorator::getParameterIndex( } size_t FunctionParameterDecorator::nAttributes() const { - if(!m_wrappedFunction) { - return 0; + if (!m_wrappedFunction) { + return 0; } return m_wrappedFunction->nAttributes(); diff --git a/Code/Mantid/Framework/API/src/LinearScale.cpp b/Code/Mantid/Framework/API/src/LinearScale.cpp index 14d1ff6820db..4d11c0fb9627 100644 --- a/Code/Mantid/Framework/API/src/LinearScale.cpp +++ b/Code/Mantid/Framework/API/src/LinearScale.cpp @@ -9,7 +9,7 @@ namespace Mantid { namespace API { -DECLARE_TRANSFORMSCALE(LinearScale); +DECLARE_TRANSFORMSCALE(LinearScale) /* Transform the grid to adopt a linear scale * @param gd a grid object diff --git a/Code/Mantid/Framework/API/src/LogManager.cpp b/Code/Mantid/Framework/API/src/LogManager.cpp index 572043d93032..ae405738634e 100644 --- a/Code/Mantid/Framework/API/src/LogManager.cpp +++ b/Code/Mantid/Framework/API/src/LogManager.cpp @@ -434,13 +434,13 @@ void LogManager::clearLogs() { m_manager.clear(); } template MANTID_API_DLL TYPE \ LogManager::getPropertyValueAsType(const std::string &) const; -INSTANTIATE(double); -INSTANTIATE(int); -INSTANTIATE(long); -INSTANTIATE(uint32_t); -INSTANTIATE(uint64_t); -INSTANTIATE(std::string); -INSTANTIATE(bool); +INSTANTIATE(double) +INSTANTIATE(int) +INSTANTIATE(long) +INSTANTIATE(uint32_t) +INSTANTIATE(uint64_t) +INSTANTIATE(std::string) +INSTANTIATE(bool) template MANTID_API_DLL uint16_t LogManager::getPropertyValueAsType(const std::string &) const; diff --git a/Code/Mantid/Framework/API/src/LogarithmScale.cpp b/Code/Mantid/Framework/API/src/LogarithmScale.cpp index 1ecb35a5d533..1e4abfdd83cf 100644 --- a/Code/Mantid/Framework/API/src/LogarithmScale.cpp +++ b/Code/Mantid/Framework/API/src/LogarithmScale.cpp @@ -16,7 +16,7 @@ namespace { Kernel::Logger g_log("LogarithmScale"); } -DECLARE_TRANSFORMSCALE(LogarithmScale); +DECLARE_TRANSFORMSCALE(LogarithmScale) void LogarithmScale::setBase(double &base) { if (base <= 0) { diff --git a/Code/Mantid/Framework/API/test/CostFunctionFactoryTest.h b/Code/Mantid/Framework/API/test/CostFunctionFactoryTest.h index c0c567cc8b22..d54b9807c852 100644 --- a/Code/Mantid/Framework/API/test/CostFunctionFactoryTest.h +++ b/Code/Mantid/Framework/API/test/CostFunctionFactoryTest.h @@ -38,7 +38,7 @@ class CostFunctionFactoryTest_A: public ICostFunction }; -DECLARE_COSTFUNCTION(CostFunctionFactoryTest_A, nedtur); +DECLARE_COSTFUNCTION(CostFunctionFactoryTest_A, nedtur) class CostFunctionFactoryTest : public CxxTest::TestSuite diff --git a/Code/Mantid/Framework/API/test/FileFinderTest.h b/Code/Mantid/Framework/API/test/FileFinderTest.h index 728a394221e0..927b0d4c8efa 100644 --- a/Code/Mantid/Framework/API/test/FileFinderTest.h +++ b/Code/Mantid/Framework/API/test/FileFinderTest.h @@ -105,12 +105,48 @@ class FileFinderTest: public CxxTest::TestSuite m_facFile.remove(); } - void testGetFullPath() + void testGetFullPathWithFilename() { std::string path = FileFinder::Instance().getFullPath("CSP78173.raw"); TS_ASSERT(!path.empty()); } + void testGetFullPathWithDirectoryFindsDirectoryPath() + { + // Use the Schema directory under instrument + std::string path = FileFinder::Instance().getFullPath("Schema"); + TS_ASSERT(!path.empty()); + + // Code has separate path for path relative to working directory so check that too + std::string tempTestName("__FileFinderTestTempTestDir__"); + Poco::File tempTestDir(Poco::Path().resolve(tempTestName)); + tempTestDir.createDirectory(); + + path = FileFinder::Instance().getFullPath(tempTestName); + TS_ASSERT(!path.empty()); + + tempTestDir.remove(); + + } + + void testGetFullPathSkipsDirectoriesOnRequest() + { + // Use the Schema directory under instrument + const bool ignoreDirs(true); + std::string path = FileFinder::Instance().getFullPath("Schema", ignoreDirs); + TSM_ASSERT("Expected an empty path when looking for a directory, instead I found " + path, path.empty()); + + // Code has separate path for path relative to working directory so check that too + std::string tempTestName("__FileFinderTestTempTestDir__"); + Poco::File tempTestDir(Poco::Path().resolve(tempTestName)); + tempTestDir.createDirectory(); + + path = FileFinder::Instance().getFullPath(tempTestName, ignoreDirs); + TSM_ASSERT("Expected an empty path when looking for a directory relative to current, instead I found " + path, path.empty()); + + tempTestDir.remove(); + } + void testMakeFileNameForISIS() { // Set the facility diff --git a/Code/Mantid/Framework/API/test/FuncMinimizerFactoryTest.h b/Code/Mantid/Framework/API/test/FuncMinimizerFactoryTest.h index 640b7345c483..2cef42deca31 100644 --- a/Code/Mantid/Framework/API/test/FuncMinimizerFactoryTest.h +++ b/Code/Mantid/Framework/API/test/FuncMinimizerFactoryTest.h @@ -33,7 +33,7 @@ class FuncMinimizerFactoryTest_A: public IFuncMinimizer } }; -DECLARE_FUNCMINIMIZER(FuncMinimizerFactoryTest_A, nedtur); +DECLARE_FUNCMINIMIZER(FuncMinimizerFactoryTest_A, nedtur) class FuncMinimizerFactoryTest : public CxxTest::TestSuite diff --git a/Code/Mantid/Framework/API/test/FunctionFactoryTest.h b/Code/Mantid/Framework/API/test/FunctionFactoryTest.h index 0654f99aca5c..131988e174f3 100644 --- a/Code/Mantid/Framework/API/test/FunctionFactoryTest.h +++ b/Code/Mantid/Framework/API/test/FunctionFactoryTest.h @@ -134,10 +134,10 @@ class FunctionFactoryTest_CompFunctB: public CompositeFunction }; -DECLARE_FUNCTION(FunctionFactoryTest_FunctA); -DECLARE_FUNCTION(FunctionFactoryTest_FunctB); -DECLARE_FUNCTION(FunctionFactoryTest_CompFunctA); -DECLARE_FUNCTION(FunctionFactoryTest_CompFunctB); +DECLARE_FUNCTION(FunctionFactoryTest_FunctA) +DECLARE_FUNCTION(FunctionFactoryTest_FunctB) +DECLARE_FUNCTION(FunctionFactoryTest_CompFunctA) +DECLARE_FUNCTION(FunctionFactoryTest_CompFunctB) class FunctionFactoryTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/API/test/FunctionParameterDecoratorTest.h b/Code/Mantid/Framework/API/test/FunctionParameterDecoratorTest.h index 4cea527b1a51..a73c6afee7b5 100644 --- a/Code/Mantid/Framework/API/test/FunctionParameterDecoratorTest.h +++ b/Code/Mantid/Framework/API/test/FunctionParameterDecoratorTest.h @@ -6,7 +6,9 @@ #include "MantidAPI/FunctionParameterDecorator.h" #include "MantidAPI/ParamFunction.h" #include "MantidAPI/FunctionFactory.h" +#include "MantidAPI/WorkspaceGroup.h" #include "MantidKernel/Exception.h" + #include #include @@ -44,11 +46,11 @@ class TestableFunctionParameterDecorator : public FunctionParameterDecorator { } }; -DECLARE_FUNCTION(TestableFunctionParameterDecorator); +DECLARE_FUNCTION(TestableFunctionParameterDecorator) class FunctionWithParameters : public ParamFunction { public: - FunctionWithParameters() : ParamFunction() {} + FunctionWithParameters() : ParamFunction(), m_workspace() {} std::string name() const { return "FunctionWithParameters"; } @@ -63,8 +65,15 @@ class FunctionWithParameters : public ParamFunction { UNUSED_ARG(values); // Does nothing, not required for this test. } + + void setWorkspace(boost::shared_ptr ws) { m_workspace = ws; } + + Workspace_const_sptr getWorkspace() const { return m_workspace; } + +private: + Workspace_const_sptr m_workspace; }; -DECLARE_FUNCTION(FunctionWithParameters); +DECLARE_FUNCTION(FunctionWithParameters) class FunctionWithAttributes : public ParamFunction { public: @@ -88,7 +97,7 @@ class FunctionWithAttributes : public ParamFunction { } }; -DECLARE_FUNCTION(FunctionWithAttributes); +DECLARE_FUNCTION(FunctionWithAttributes) class FunctionParameterDecoratorTest : public CxxTest::TestSuite { public: @@ -349,6 +358,25 @@ class FunctionParameterDecoratorTest : public CxxTest::TestSuite { TS_ASSERT_EQUALS(cloned->getParameter("Sigma"), 0.3); } + void testSetWorkspace() { + // using WorkspaceGroup because it is in API + Workspace_const_sptr ws = boost::make_shared(); + + TestableFunctionParameterDecorator invalidFn; + TS_ASSERT_THROWS(invalidFn.setWorkspace(ws), std::runtime_error); + + FunctionParameterDecorator_sptr fn = + getFunctionParameterDecoratorGaussian(); + + TS_ASSERT_THROWS_NOTHING(fn->setWorkspace(ws)); + + boost::shared_ptr decorated = + boost::dynamic_pointer_cast( + fn->getDecoratedFunction()); + + TS_ASSERT_EQUALS(decorated->getWorkspace(), ws); + } + private: FunctionParameterDecorator_sptr getFunctionParameterDecoratorGaussian() { FunctionParameterDecorator_sptr fn = diff --git a/Code/Mantid/Framework/API/test/FunctionPropertyTest.h b/Code/Mantid/Framework/API/test/FunctionPropertyTest.h index ee488c5a7cdb..4618e0e2c89c 100644 --- a/Code/Mantid/Framework/API/test/FunctionPropertyTest.h +++ b/Code/Mantid/Framework/API/test/FunctionPropertyTest.h @@ -23,7 +23,7 @@ class FunctionPropertyTest_Function: public virtual ParamFunction, public virtua virtual void function(const FunctionDomain&,FunctionValues&)const {} }; -DECLARE_FUNCTION(FunctionPropertyTest_Function); +DECLARE_FUNCTION(FunctionPropertyTest_Function) class FunctionPropertyTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/API/test/ImmutableCompositeFunctionTest.h b/Code/Mantid/Framework/API/test/ImmutableCompositeFunctionTest.h index cf4287e72d71..b3299c9b3567 100644 --- a/Code/Mantid/Framework/API/test/ImmutableCompositeFunctionTest.h +++ b/Code/Mantid/Framework/API/test/ImmutableCompositeFunctionTest.h @@ -67,7 +67,7 @@ class ImmutableCompositeFunctionTest_Function: public ImmutableCompositeFunction std::string name()const {return "ImmutableCompositeFunctionTest_Function";} }; -DECLARE_FUNCTION(ImmutableCompositeFunctionTest_Function); +DECLARE_FUNCTION(ImmutableCompositeFunctionTest_Function) //--------------------------------------------------------------------------------- class ImmutableCompositeFunctionTest_FunctionWithTies: public ImmutableCompositeFunction @@ -95,7 +95,7 @@ class ImmutableCompositeFunctionTest_FunctionWithTies: public ImmutableComposite std::string name()const {return "ImmutableCompositeFunctionTest_FunctionWithTies";} }; -DECLARE_FUNCTION(ImmutableCompositeFunctionTest_FunctionWithTies); +DECLARE_FUNCTION(ImmutableCompositeFunctionTest_FunctionWithTies) //--------------------------------------------------------------------------------- class ImmutableCompositeFunctionTest_FunctionThrow: public ImmutableCompositeFunction diff --git a/Code/Mantid/Framework/API/test/MatrixWorkspaceTest.h b/Code/Mantid/Framework/API/test/MatrixWorkspaceTest.h index 38aedd753411..d3dbf1389014 100644 --- a/Code/Mantid/Framework/API/test/MatrixWorkspaceTest.h +++ b/Code/Mantid/Framework/API/test/MatrixWorkspaceTest.h @@ -26,7 +26,7 @@ using namespace testing; // Declare into the factory. -DECLARE_WORKSPACE(WorkspaceTester); +DECLARE_WORKSPACE(WorkspaceTester) /** Create a workspace with numSpectra, with * each spectrum having one detector, at id = workspace index. diff --git a/Code/Mantid/Framework/API/test/MultiDomainFunctionTest.h b/Code/Mantid/Framework/API/test/MultiDomainFunctionTest.h index adf7b610d247..4e7b1870ec6e 100644 --- a/Code/Mantid/Framework/API/test/MultiDomainFunctionTest.h +++ b/Code/Mantid/Framework/API/test/MultiDomainFunctionTest.h @@ -49,7 +49,7 @@ class MultiDomainFunctionTest_Function: public virtual IFunction1D, public virtu } }; -DECLARE_FUNCTION(MultiDomainFunctionTest_Function); +DECLARE_FUNCTION(MultiDomainFunctionTest_Function) namespace { diff --git a/Code/Mantid/Framework/API/test/VectorParameterParserTest.h b/Code/Mantid/Framework/API/test/VectorParameterParserTest.h index ece3e673a302..305353f12e64 100644 --- a/Code/Mantid/Framework/API/test/VectorParameterParserTest.h +++ b/Code/Mantid/Framework/API/test/VectorParameterParserTest.h @@ -94,7 +94,7 @@ class VectorParameterParserTest : public CxxTest::TestSuite TSM_ASSERT_THROWS("No successor, so should throw!", parser.createParameter(pRootElem), std::runtime_error); } - DECLARE_VECTOR_PARAMETER(SucessorVectorParameter, double); + DECLARE_VECTOR_PARAMETER(SucessorVectorParameter, double) void testChainOfResponsibility() { diff --git a/Code/Mantid/Framework/Algorithms/src/AppendSpectra.cpp b/Code/Mantid/Framework/Algorithms/src/AppendSpectra.cpp index 6567ccf080c3..7c37d7c6e2cb 100644 --- a/Code/Mantid/Framework/Algorithms/src/AppendSpectra.cpp +++ b/Code/Mantid/Framework/Algorithms/src/AppendSpectra.cpp @@ -23,10 +23,10 @@ AppendSpectra::AppendSpectra() : WorkspaceJoiners() {} AppendSpectra::~AppendSpectra() {} /// Algorithm's name for identification. @see Algorithm::name -const std::string AppendSpectra::name() const { return "AppendSpectra"; }; +const std::string AppendSpectra::name() const { return "AppendSpectra"; } /// Algorithm's version for identification. @see Algorithm::version -int AppendSpectra::version() const { return 1; }; +int AppendSpectra::version() const { return 1; } /** Initialize the algorithm's properties. */ diff --git a/Code/Mantid/Framework/Algorithms/src/AverageLogData.cpp b/Code/Mantid/Framework/Algorithms/src/AverageLogData.cpp index 40fa96ee2e9f..7430a5f108bc 100644 --- a/Code/Mantid/Framework/Algorithms/src/AverageLogData.cpp +++ b/Code/Mantid/Framework/Algorithms/src/AverageLogData.cpp @@ -20,10 +20,10 @@ AverageLogData::~AverageLogData() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string AverageLogData::name() const { return "AverageLogData"; }; +const std::string AverageLogData::name() const { return "AverageLogData"; } /// Algorithm's version for identification. @see Algorithm::version -int AverageLogData::version() const { return 1; }; +int AverageLogData::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string AverageLogData::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/CalculateDIFC.cpp b/Code/Mantid/Framework/Algorithms/src/CalculateDIFC.cpp index a77fb56a1968..8b7b1fcbf156 100644 --- a/Code/Mantid/Framework/Algorithms/src/CalculateDIFC.cpp +++ b/Code/Mantid/Framework/Algorithms/src/CalculateDIFC.cpp @@ -35,7 +35,7 @@ const std::string CalculateDIFC::name() const { return "CalculateDIFC"; } /// Algorithm's version for identification. @see Algorithm::version int CalculateDIFC::version() const { return 1; -}; +} /// Algorithm's category for identification. @see Algorithm::category const std::string CalculateDIFC::category() const { @@ -45,7 +45,7 @@ const std::string CalculateDIFC::category() const { /// Algorithm's summary for use in the GUI and help. @see Algorithm::summary const std::string CalculateDIFC::summary() const { return "Calculate the DIFC for every pixel"; -}; +} //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. diff --git a/Code/Mantid/Framework/Algorithms/src/CalculateResolution.cpp b/Code/Mantid/Framework/Algorithms/src/CalculateResolution.cpp index 51eac3c536bc..a0a898096641 100644 --- a/Code/Mantid/Framework/Algorithms/src/CalculateResolution.cpp +++ b/Code/Mantid/Framework/Algorithms/src/CalculateResolution.cpp @@ -34,10 +34,10 @@ CalculateResolution::~CalculateResolution() {} /// Algorithm's name for identification. @see Algorithm::name const std::string CalculateResolution::name() const { return "CalculateResolution"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int CalculateResolution::version() const { return 1; }; +int CalculateResolution::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string CalculateResolution::category() const { @@ -48,7 +48,7 @@ const std::string CalculateResolution::category() const { const std::string CalculateResolution::summary() const { return "Calculates the reflectometry resolution (dQ/Q) for a given " "workspace."; -}; +} //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. diff --git a/Code/Mantid/Framework/Algorithms/src/CalculateSlits.cpp b/Code/Mantid/Framework/Algorithms/src/CalculateSlits.cpp index 7808595add88..b3e4872292cd 100644 --- a/Code/Mantid/Framework/Algorithms/src/CalculateSlits.cpp +++ b/Code/Mantid/Framework/Algorithms/src/CalculateSlits.cpp @@ -28,10 +28,10 @@ CalculateSlits::~CalculateSlits() {} /// Algorithm's name for identification. @see Algorithm::name const std::string CalculateSlits::name() const { return "CalculateSlits"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int CalculateSlits::version() const { return 1; }; +int CalculateSlits::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string CalculateSlits::category() const { @@ -41,7 +41,7 @@ const std::string CalculateSlits::category() const { /// Algorithm's summary for use in the GUI and help. @see Algorithm::summary const std::string CalculateSlits::summary() const { return "Calculates appropriate slit widths for reflectometry instruments."; -}; +} //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. diff --git a/Code/Mantid/Framework/Algorithms/src/ChangeLogTime.cpp b/Code/Mantid/Framework/Algorithms/src/ChangeLogTime.cpp index 8663e0a329e6..a42d58d76769 100644 --- a/Code/Mantid/Framework/Algorithms/src/ChangeLogTime.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ChangeLogTime.cpp @@ -7,7 +7,7 @@ namespace Mantid { namespace Algorithms { // Register the algorithm into the AlgorithmFactory -DECLARE_ALGORITHM(ChangeLogTime); +DECLARE_ALGORITHM(ChangeLogTime) using std::string; using std::stringstream; diff --git a/Code/Mantid/Framework/Algorithms/src/ClearInstrumentParameters.cpp b/Code/Mantid/Framework/Algorithms/src/ClearInstrumentParameters.cpp index 74fc77c9e1d3..04c3f06953c4 100644 --- a/Code/Mantid/Framework/Algorithms/src/ClearInstrumentParameters.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ClearInstrumentParameters.cpp @@ -29,7 +29,7 @@ ClearInstrumentParameters::~ClearInstrumentParameters() {} /// Algorithm's name for identification. @see Algorithm::name const std::string ClearInstrumentParameters::name() const { return "ClearInstrumentParameters"; -}; +} /// Summary of the algorithm's purpose. @see Algorithm::summary const std::string ClearInstrumentParameters::summary() const { @@ -37,7 +37,7 @@ const std::string ClearInstrumentParameters::summary() const { } /// Algorithm's version for identification. @see Algorithm::version -int ClearInstrumentParameters::version() const { return 1; }; +int ClearInstrumentParameters::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ClearInstrumentParameters::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/ClearMaskFlag.cpp b/Code/Mantid/Framework/Algorithms/src/ClearMaskFlag.cpp index 71b53a9b1d99..ba16cd12b7f8 100644 --- a/Code/Mantid/Framework/Algorithms/src/ClearMaskFlag.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ClearMaskFlag.cpp @@ -21,10 +21,10 @@ ClearMaskFlag::~ClearMaskFlag() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string ClearMaskFlag::name() const { return "ClearMaskFlag"; }; +const std::string ClearMaskFlag::name() const { return "ClearMaskFlag"; } /// Algorithm's version for identification. @see Algorithm::version -int ClearMaskFlag::version() const { return 1; }; +int ClearMaskFlag::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ClearMaskFlag::category() const { return "Utility"; } diff --git a/Code/Mantid/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp b/Code/Mantid/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp index 6ef693883bb5..0305cd928470 100644 --- a/Code/Mantid/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp @@ -35,7 +35,7 @@ const std::string ConvertAxesToRealSpace::name() const { } /// Algorithm's version for identification. @see Algorithm::version -int ConvertAxesToRealSpace::version() const { return 1; }; +int ConvertAxesToRealSpace::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ConvertAxesToRealSpace::category() const { @@ -46,7 +46,7 @@ const std::string ConvertAxesToRealSpace::category() const { const std::string ConvertAxesToRealSpace::summary() const { return "Converts the spectrum and TOF axes to real space values, integrating " "the data in the process"; -}; +} //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. diff --git a/Code/Mantid/Framework/Algorithms/src/ConvertEmptyToTof.cpp b/Code/Mantid/Framework/Algorithms/src/ConvertEmptyToTof.cpp index 28bbd9076ecb..144171a08a4d 100644 --- a/Code/Mantid/Framework/Algorithms/src/ConvertEmptyToTof.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ConvertEmptyToTof.cpp @@ -39,10 +39,10 @@ ConvertEmptyToTof::~ConvertEmptyToTof() {} /// Algorithm's name for identification. @see Algorithm::name const std::string ConvertEmptyToTof::name() const { return "ConvertEmptyToTof"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int ConvertEmptyToTof::version() const { return 1; }; +int ConvertEmptyToTof::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ConvertEmptyToTof::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/ConvertToHistogram.cpp b/Code/Mantid/Framework/Algorithms/src/ConvertToHistogram.cpp index 3b87dc49dbe5..37acbb1439ea 100644 --- a/Code/Mantid/Framework/Algorithms/src/ConvertToHistogram.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ConvertToHistogram.cpp @@ -7,7 +7,7 @@ namespace Mantid { namespace Algorithms { -DECLARE_ALGORITHM(ConvertToHistogram); +DECLARE_ALGORITHM(ConvertToHistogram) using API::MatrixWorkspace_sptr; using Mantid::MantidVec; diff --git a/Code/Mantid/Framework/Algorithms/src/ConvertToPointData.cpp b/Code/Mantid/Framework/Algorithms/src/ConvertToPointData.cpp index ccc2e8ac79b5..739ca37a9109 100644 --- a/Code/Mantid/Framework/Algorithms/src/ConvertToPointData.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ConvertToPointData.cpp @@ -7,7 +7,7 @@ namespace Mantid { namespace Algorithms { -DECLARE_ALGORITHM(ConvertToPointData); +DECLARE_ALGORITHM(ConvertToPointData) using API::MatrixWorkspace_sptr; using Mantid::MantidVec; diff --git a/Code/Mantid/Framework/Algorithms/src/CopyLogs.cpp b/Code/Mantid/Framework/Algorithms/src/CopyLogs.cpp index f7aadd28a094..c250b7077847 100644 --- a/Code/Mantid/Framework/Algorithms/src/CopyLogs.cpp +++ b/Code/Mantid/Framework/Algorithms/src/CopyLogs.cpp @@ -23,10 +23,10 @@ CopyLogs::~CopyLogs() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string CopyLogs::name() const { return "CopyLogs"; }; +const std::string CopyLogs::name() const { return "CopyLogs"; } /// Algorithm's version for identification. @see Algorithm::version -int CopyLogs::version() const { return 1; }; +int CopyLogs::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string CopyLogs::category() const { return "Utility\\Workspaces"; } diff --git a/Code/Mantid/Framework/Algorithms/src/CreateFlatEventWorkspace.cpp b/Code/Mantid/Framework/Algorithms/src/CreateFlatEventWorkspace.cpp index f2dc26c177f6..525c556bfca6 100644 --- a/Code/Mantid/Framework/Algorithms/src/CreateFlatEventWorkspace.cpp +++ b/Code/Mantid/Framework/Algorithms/src/CreateFlatEventWorkspace.cpp @@ -25,10 +25,10 @@ CreateFlatEventWorkspace::~CreateFlatEventWorkspace() {} /// Algorithm's name for identification. @see Algorithm::name const std::string CreateFlatEventWorkspace::name() const { return "CreateFlatEventWorkspace"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int CreateFlatEventWorkspace::version() const { return 1; }; +int CreateFlatEventWorkspace::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string CreateFlatEventWorkspace::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/CreateSampleWorkspace.cpp b/Code/Mantid/Framework/Algorithms/src/CreateSampleWorkspace.cpp index 0b665c471eb4..0c08dda844cb 100644 --- a/Code/Mantid/Framework/Algorithms/src/CreateSampleWorkspace.cpp +++ b/Code/Mantid/Framework/Algorithms/src/CreateSampleWorkspace.cpp @@ -47,10 +47,10 @@ CreateSampleWorkspace::~CreateSampleWorkspace() { delete m_randGen; } /// Algorithm's name for identification. @see Algorithm::name const std::string CreateSampleWorkspace::name() const { return "CreateSampleWorkspace"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int CreateSampleWorkspace::version() const { return 1; }; +int CreateSampleWorkspace::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string CreateSampleWorkspace::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp b/Code/Mantid/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp index ac913604c97f..2b7b6da12275 100644 --- a/Code/Mantid/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp +++ b/Code/Mantid/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp @@ -32,10 +32,10 @@ CreateTransmissionWorkspace::~CreateTransmissionWorkspace() {} /// Algorithm's name for identification. @see Algorithm::name const std::string CreateTransmissionWorkspace::name() const { return "CreateTransmissionWorkspace"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int CreateTransmissionWorkspace::version() const { return 1; }; +int CreateTransmissionWorkspace::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string CreateTransmissionWorkspace::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/DeleteWorkspace.cpp b/Code/Mantid/Framework/Algorithms/src/DeleteWorkspace.cpp index 329b737da192..7cb53d9b5af4 100644 --- a/Code/Mantid/Framework/Algorithms/src/DeleteWorkspace.cpp +++ b/Code/Mantid/Framework/Algorithms/src/DeleteWorkspace.cpp @@ -8,7 +8,7 @@ namespace Mantid { namespace Algorithms { // Register the algorithm -DECLARE_ALGORITHM(DeleteWorkspace); +DECLARE_ALGORITHM(DeleteWorkspace) //-------------------------------------------------------------------------- // Private member functions diff --git a/Code/Mantid/Framework/Algorithms/src/DetectorDiagnostic.cpp b/Code/Mantid/Framework/Algorithms/src/DetectorDiagnostic.cpp index 2b6ab8e2618e..35dafe442d11 100644 --- a/Code/Mantid/Framework/Algorithms/src/DetectorDiagnostic.cpp +++ b/Code/Mantid/Framework/Algorithms/src/DetectorDiagnostic.cpp @@ -737,6 +737,6 @@ double DetectorDiagnostic::advanceProgress(double toAdd) { void DetectorDiagnostic::failProgress(RunTime aborted) { advanceProgress(-aborted); m_TotalTime -= aborted; -}; +} } } diff --git a/Code/Mantid/Framework/Algorithms/src/DetectorEfficiencyCorUser.cpp b/Code/Mantid/Framework/Algorithms/src/DetectorEfficiencyCorUser.cpp index 4c92103f327c..559a747688bc 100644 --- a/Code/Mantid/Framework/Algorithms/src/DetectorEfficiencyCorUser.cpp +++ b/Code/Mantid/Framework/Algorithms/src/DetectorEfficiencyCorUser.cpp @@ -29,10 +29,10 @@ DetectorEfficiencyCorUser::~DetectorEfficiencyCorUser() {} /// Algorithm's name for identification. @see Algorithm::name const std::string DetectorEfficiencyCorUser::name() const { return "DetectorEfficiencyCorUser"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int DetectorEfficiencyCorUser::version() const { return 1; }; +int DetectorEfficiencyCorUser::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string DetectorEfficiencyCorUser::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/FilterByXValue.cpp b/Code/Mantid/Framework/Algorithms/src/FilterByXValue.cpp index a73f536d6edf..29a8be14083c 100644 --- a/Code/Mantid/Framework/Algorithms/src/FilterByXValue.cpp +++ b/Code/Mantid/Framework/Algorithms/src/FilterByXValue.cpp @@ -17,9 +17,9 @@ FilterByXValue::FilterByXValue() {} FilterByXValue::~FilterByXValue() {} /// Algorithm's name for identification. @see Algorithm::name -const std::string FilterByXValue::name() const { return "FilterByXValue"; }; +const std::string FilterByXValue::name() const { return "FilterByXValue"; } /// Algorithm's version for identification. @see Algorithm::version -int FilterByXValue::version() const { return 1; }; +int FilterByXValue::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string FilterByXValue::category() const { return "Events\\EventFiltering"; diff --git a/Code/Mantid/Framework/Algorithms/src/GroupWorkspaces.cpp b/Code/Mantid/Framework/Algorithms/src/GroupWorkspaces.cpp index fd55a82efa03..110b07a9e15a 100644 --- a/Code/Mantid/Framework/Algorithms/src/GroupWorkspaces.cpp +++ b/Code/Mantid/Framework/Algorithms/src/GroupWorkspaces.cpp @@ -7,7 +7,7 @@ namespace Mantid { namespace Algorithms { -DECLARE_ALGORITHM(GroupWorkspaces); +DECLARE_ALGORITHM(GroupWorkspaces) using namespace Kernel; using namespace API; diff --git a/Code/Mantid/Framework/Algorithms/src/IntegrateByComponent.cpp b/Code/Mantid/Framework/Algorithms/src/IntegrateByComponent.cpp index f5e1a98e61b3..3736939ef44d 100644 --- a/Code/Mantid/Framework/Algorithms/src/IntegrateByComponent.cpp +++ b/Code/Mantid/Framework/Algorithms/src/IntegrateByComponent.cpp @@ -25,10 +25,10 @@ IntegrateByComponent::~IntegrateByComponent() {} /// Algorithm's name for identification. @see Algorithm::name const std::string IntegrateByComponent::name() const { return "IntegrateByComponent"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int IntegrateByComponent::version() const { return 1; }; +int IntegrateByComponent::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string IntegrateByComponent::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/LorentzCorrection.cpp b/Code/Mantid/Framework/Algorithms/src/LorentzCorrection.cpp index 0100a0000efc..2d42cd4b7ccf 100644 --- a/Code/Mantid/Framework/Algorithms/src/LorentzCorrection.cpp +++ b/Code/Mantid/Framework/Algorithms/src/LorentzCorrection.cpp @@ -31,7 +31,7 @@ LorentzCorrection::~LorentzCorrection() {} //---------------------------------------------------------------------------------------------- /// Algorithm's version for identification. @see Algorithm::version -int LorentzCorrection::version() const { return 1; }; +int LorentzCorrection::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string LorentzCorrection::category() const { return "Crystal"; } @@ -39,7 +39,7 @@ const std::string LorentzCorrection::category() const { return "Crystal"; } /// Algorithm's summary for use in the GUI and help. @see Algorithm::summary const std::string LorentzCorrection::summary() const { return "Performs a white beam Lorentz Correction"; -}; +} const std::string LorentzCorrection::name() const { return "LorentzCorrection"; diff --git a/Code/Mantid/Framework/Algorithms/src/MedianDetectorTest.cpp b/Code/Mantid/Framework/Algorithms/src/MedianDetectorTest.cpp index db2e7c678a22..a6798977247c 100644 --- a/Code/Mantid/Framework/Algorithms/src/MedianDetectorTest.cpp +++ b/Code/Mantid/Framework/Algorithms/src/MedianDetectorTest.cpp @@ -19,7 +19,7 @@ using namespace Geometry; MedianDetectorTest::MedianDetectorTest() : DetectorDiagnostic(), m_inputWS(), m_loFrac(0.1), m_hiFrac(1.5), m_minSpec(0), m_maxSpec(EMPTY_INT()), m_rangeLower(0.0), - m_rangeUpper(0.0){}; + m_rangeUpper(0.0){} const std::string MedianDetectorTest::category() const { return "Diagnostics"; } diff --git a/Code/Mantid/Framework/Algorithms/src/ModeratorTzero.cpp b/Code/Mantid/Framework/Algorithms/src/ModeratorTzero.cpp index 36224d81a0e9..c7a22c2a1632 100644 --- a/Code/Mantid/Framework/Algorithms/src/ModeratorTzero.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ModeratorTzero.cpp @@ -14,7 +14,7 @@ namespace Mantid { namespace Algorithms { // Register the algorithm into the AlgorithmFactory -DECLARE_ALGORITHM(ModeratorTzero); +DECLARE_ALGORITHM(ModeratorTzero) using namespace Mantid::Kernel; using namespace Mantid::API; diff --git a/Code/Mantid/Framework/Algorithms/src/MuonGroupDetectors.cpp b/Code/Mantid/Framework/Algorithms/src/MuonGroupDetectors.cpp index b1d711f7e208..105188cee04e 100644 --- a/Code/Mantid/Framework/Algorithms/src/MuonGroupDetectors.cpp +++ b/Code/Mantid/Framework/Algorithms/src/MuonGroupDetectors.cpp @@ -26,10 +26,10 @@ MuonGroupDetectors::~MuonGroupDetectors() {} /// Algorithm's name for identification. @see Algorithm::name const std::string MuonGroupDetectors::name() const { return "MuonGroupDetectors"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int MuonGroupDetectors::version() const { return 1; }; +int MuonGroupDetectors::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string MuonGroupDetectors::category() const { return "Muon"; } diff --git a/Code/Mantid/Framework/Algorithms/src/NormaliseByDetector.cpp b/Code/Mantid/Framework/Algorithms/src/NormaliseByDetector.cpp index 3c4cfc0867cd..97e2ee6a72ee 100644 --- a/Code/Mantid/Framework/Algorithms/src/NormaliseByDetector.cpp +++ b/Code/Mantid/Framework/Algorithms/src/NormaliseByDetector.cpp @@ -39,10 +39,10 @@ NormaliseByDetector::~NormaliseByDetector() {} /// Algorithm's name for identification. @see Algorithm::name const std::string NormaliseByDetector::name() const { return "NormaliseByDetector"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int NormaliseByDetector::version() const { return 1; }; +int NormaliseByDetector::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string NormaliseByDetector::category() const { @@ -199,7 +199,7 @@ NormaliseByDetector::processHistograms(MatrixWorkspace_sptr inWS) { } return denominatorWS; -}; +} //---------------------------------------------------------------------------------------------- /** Execute the algorithm. diff --git a/Code/Mantid/Framework/Algorithms/src/Pause.cpp b/Code/Mantid/Framework/Algorithms/src/Pause.cpp index 007f5e10f8dd..170559caff20 100644 --- a/Code/Mantid/Framework/Algorithms/src/Pause.cpp +++ b/Code/Mantid/Framework/Algorithms/src/Pause.cpp @@ -24,10 +24,10 @@ Pause::~Pause() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string Pause::name() const { return "Pause"; }; +const std::string Pause::name() const { return "Pause"; } /// Algorithm's version for identification. @see Algorithm::version -int Pause::version() const { return 1; }; +int Pause::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string Pause::category() const { return "Utility\\Development"; } diff --git a/Code/Mantid/Framework/Algorithms/src/PerformIndexOperations.cpp b/Code/Mantid/Framework/Algorithms/src/PerformIndexOperations.cpp index 3a8fb0f7dd75..a3d760f3e67e 100644 --- a/Code/Mantid/Framework/Algorithms/src/PerformIndexOperations.cpp +++ b/Code/Mantid/Framework/Algorithms/src/PerformIndexOperations.cpp @@ -268,10 +268,10 @@ PerformIndexOperations::~PerformIndexOperations() {} /// Algorithm's name for identification. @see Algorithm::name const std::string PerformIndexOperations::name() const { return "PerformIndexOperations"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int PerformIndexOperations::version() const { return 1; }; +int PerformIndexOperations::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string PerformIndexOperations::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/PolarizationCorrection.cpp b/Code/Mantid/Framework/Algorithms/src/PolarizationCorrection.cpp index b2a1760dd6fc..4a9ef9b303a1 100644 --- a/Code/Mantid/Framework/Algorithms/src/PolarizationCorrection.cpp +++ b/Code/Mantid/Framework/Algorithms/src/PolarizationCorrection.cpp @@ -119,10 +119,10 @@ PolarizationCorrection::~PolarizationCorrection() {} /// Algorithm's name for identification. @see Algorithm::name const std::string PolarizationCorrection::name() const { return "PolarizationCorrection"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int PolarizationCorrection::version() const { return 1; }; +int PolarizationCorrection::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string PolarizationCorrection::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/RebinByPulseTimes.cpp b/Code/Mantid/Framework/Algorithms/src/RebinByPulseTimes.cpp index 2bbe560658f4..fce9355eb4d9 100644 --- a/Code/Mantid/Framework/Algorithms/src/RebinByPulseTimes.cpp +++ b/Code/Mantid/Framework/Algorithms/src/RebinByPulseTimes.cpp @@ -29,10 +29,10 @@ RebinByPulseTimes::~RebinByPulseTimes() {} /// Algorithm's name for identification. @see Algorithm::name const std::string RebinByPulseTimes::name() const { return "RebinByPulseTimes"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int RebinByPulseTimes::version() const { return 1; }; +int RebinByPulseTimes::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string RebinByPulseTimes::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/RebinByTimeAtSample.cpp b/Code/Mantid/Framework/Algorithms/src/RebinByTimeAtSample.cpp index c7d3f0491c98..ff2234d2fec9 100644 --- a/Code/Mantid/Framework/Algorithms/src/RebinByTimeAtSample.cpp +++ b/Code/Mantid/Framework/Algorithms/src/RebinByTimeAtSample.cpp @@ -28,7 +28,7 @@ RebinByTimeAtSample::~RebinByTimeAtSample() {} //---------------------------------------------------------------------------------------------- /// Algorithm's version for identification. @see Algorithm::version -int RebinByTimeAtSample::version() const { return 1; }; +int RebinByTimeAtSample::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string RebinByTimeAtSample::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/ReflectometryReductionOne.cpp b/Code/Mantid/Framework/Algorithms/src/ReflectometryReductionOne.cpp index ab6ebf78f1ac..dfb1a2932196 100644 --- a/Code/Mantid/Framework/Algorithms/src/ReflectometryReductionOne.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ReflectometryReductionOne.cpp @@ -95,10 +95,10 @@ ReflectometryReductionOne::~ReflectometryReductionOne() {} /// Algorithm's name for identification. @see Algorithm::name const std::string ReflectometryReductionOne::name() const { return "ReflectometryReductionOne"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int ReflectometryReductionOne::version() const { return 1; }; +int ReflectometryReductionOne::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ReflectometryReductionOne::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp b/Code/Mantid/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp index f29229096e23..884848559d96 100644 --- a/Code/Mantid/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp @@ -31,10 +31,10 @@ ReflectometryReductionOneAuto::~ReflectometryReductionOneAuto() {} /// Algorithm's name for identification. @see Algorithm::name const std::string ReflectometryReductionOneAuto::name() const { return "ReflectometryReductionOneAuto"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int ReflectometryReductionOneAuto::version() const { return 1; }; +int ReflectometryReductionOneAuto::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ReflectometryReductionOneAuto::category() const { @@ -45,7 +45,7 @@ const std::string ReflectometryReductionOneAuto::category() const { const std::string ReflectometryReductionOneAuto::summary() const { return "Reduces a single TOF/Lambda reflectometry run into a mod Q vs I/I0 " "workspace. Performs transmission corrections."; -}; +} //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. diff --git a/Code/Mantid/Framework/Algorithms/src/RemoveBackground.cpp b/Code/Mantid/Framework/Algorithms/src/RemoveBackground.cpp index 706570edca10..8601d1e2c38e 100644 --- a/Code/Mantid/Framework/Algorithms/src/RemoveBackground.cpp +++ b/Code/Mantid/Framework/Algorithms/src/RemoveBackground.cpp @@ -150,7 +150,7 @@ void RemoveBackground::exec() { BackgroundHelper::BackgroundHelper() : m_WSUnit(), m_bgWs(), m_wkWS(), m_pgLog(NULL), m_inPlace(true), m_singleValueBackground(false), m_NBg(0), m_dtBg(1), // m_ErrSq(0), - m_Emode(0), m_L1(0), m_Efix(0), m_Sample(){}; + m_Emode(0), m_L1(0), m_Efix(0), m_Sample(){} /// Destructor BackgroundHelper::~BackgroundHelper() { this->deleteUnitsConverters(); } diff --git a/Code/Mantid/Framework/Algorithms/src/RemoveWorkspaceHistory.cpp b/Code/Mantid/Framework/Algorithms/src/RemoveWorkspaceHistory.cpp index 8d30c4fa14d1..4d6ecc74b7c0 100644 --- a/Code/Mantid/Framework/Algorithms/src/RemoveWorkspaceHistory.cpp +++ b/Code/Mantid/Framework/Algorithms/src/RemoveWorkspaceHistory.cpp @@ -24,10 +24,10 @@ RemoveWorkspaceHistory::~RemoveWorkspaceHistory() {} /// Algorithm's name for identification. @see Algorithm::name const std::string RemoveWorkspaceHistory::name() const { return "RemoveWorkspaceHistory"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int RemoveWorkspaceHistory::version() const { return 1; }; +int RemoveWorkspaceHistory::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string RemoveWorkspaceHistory::category() const { return "Utility"; } @@ -35,7 +35,7 @@ const std::string RemoveWorkspaceHistory::category() const { return "Utility"; } /// Algorithm's summary for identification. @see Algorithm::summary const std::string RemoveWorkspaceHistory::summary() const { return "Removes all algorithm history records from a given workspace."; -}; +} //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. diff --git a/Code/Mantid/Framework/Algorithms/src/ResizeRectangularDetector.cpp b/Code/Mantid/Framework/Algorithms/src/ResizeRectangularDetector.cpp index bb719da64251..d5c40de7a071 100644 --- a/Code/Mantid/Framework/Algorithms/src/ResizeRectangularDetector.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ResizeRectangularDetector.cpp @@ -30,10 +30,10 @@ ResizeRectangularDetector::~ResizeRectangularDetector() {} /// Algorithm's name for identification. @see Algorithm::name const std::string ResizeRectangularDetector::name() const { return "ResizeRectangularDetector"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int ResizeRectangularDetector::version() const { return 1; }; +int ResizeRectangularDetector::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ResizeRectangularDetector::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/RingProfile.cpp b/Code/Mantid/Framework/Algorithms/src/RingProfile.cpp index b558c1a8584d..21be96faae17 100644 --- a/Code/Mantid/Framework/Algorithms/src/RingProfile.cpp +++ b/Code/Mantid/Framework/Algorithms/src/RingProfile.cpp @@ -582,7 +582,7 @@ void RingProfile::getBinForPixel(const API::MatrixWorkspace_sptr ws, // call fromAngleToBin (radians) bins_pos[i] = fromAngleToBin(angle, false); } -}; +} /* Return the bin position for a given angle. * @@ -618,7 +618,7 @@ int RingProfile::fromAngleToBin(double angle, bool degree) { angle /= bin_size; return (int)angle; -}; +} } // namespace Algorithms } // namespace Mantid diff --git a/Code/Mantid/Framework/Algorithms/src/SassenaFFT.cpp b/Code/Mantid/Framework/Algorithms/src/SassenaFFT.cpp index c51071190ef9..bd0e048fd713 100644 --- a/Code/Mantid/Framework/Algorithms/src/SassenaFFT.cpp +++ b/Code/Mantid/Framework/Algorithms/src/SassenaFFT.cpp @@ -13,7 +13,7 @@ namespace Mantid { namespace Algorithms { // Register the class into the algorithm factory -DECLARE_ALGORITHM(SassenaFFT); +DECLARE_ALGORITHM(SassenaFFT) /// Override Algorithm::checkGroups bool SassenaFFT::checkGroups() { return false; } diff --git a/Code/Mantid/Framework/Algorithms/src/SetInstrumentParameter.cpp b/Code/Mantid/Framework/Algorithms/src/SetInstrumentParameter.cpp index 487d95665918..e06d9b1f72eb 100644 --- a/Code/Mantid/Framework/Algorithms/src/SetInstrumentParameter.cpp +++ b/Code/Mantid/Framework/Algorithms/src/SetInstrumentParameter.cpp @@ -30,10 +30,10 @@ SetInstrumentParameter::~SetInstrumentParameter() {} /// Algorithm's name for identification. @see Algorithm::name const std::string SetInstrumentParameter::name() const { return "SetInstrumentParameter"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int SetInstrumentParameter::version() const { return 1; }; +int SetInstrumentParameter::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string SetInstrumentParameter::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/SignalOverError.cpp b/Code/Mantid/Framework/Algorithms/src/SignalOverError.cpp index 2354d0369c33..9d36340512c7 100644 --- a/Code/Mantid/Framework/Algorithms/src/SignalOverError.cpp +++ b/Code/Mantid/Framework/Algorithms/src/SignalOverError.cpp @@ -25,10 +25,10 @@ SignalOverError::~SignalOverError() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string SignalOverError::name() const { return "SignalOverError"; }; +const std::string SignalOverError::name() const { return "SignalOverError"; } /// Algorithm's version for identification. @see Algorithm::version -int SignalOverError::version() const { return 1; }; +int SignalOverError::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string SignalOverError::category() const { return "Arithmetic"; } diff --git a/Code/Mantid/Framework/Algorithms/src/SpecularReflectionCalculateTheta.cpp b/Code/Mantid/Framework/Algorithms/src/SpecularReflectionCalculateTheta.cpp index 917f3aa741e1..ac7c575361fc 100644 --- a/Code/Mantid/Framework/Algorithms/src/SpecularReflectionCalculateTheta.cpp +++ b/Code/Mantid/Framework/Algorithms/src/SpecularReflectionCalculateTheta.cpp @@ -35,10 +35,10 @@ SpecularReflectionCalculateTheta::~SpecularReflectionCalculateTheta() {} /// Algorithm's name for identification. @see Algorithm::name const std::string SpecularReflectionCalculateTheta::name() const { return "SpecularReflectionCalculateTheta"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int SpecularReflectionCalculateTheta::version() const { return 1; }; +int SpecularReflectionCalculateTheta::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string SpecularReflectionCalculateTheta::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/SpecularReflectionPositionCorrect.cpp b/Code/Mantid/Framework/Algorithms/src/SpecularReflectionPositionCorrect.cpp index b69a6128a5e1..3497a23d437b 100644 --- a/Code/Mantid/Framework/Algorithms/src/SpecularReflectionPositionCorrect.cpp +++ b/Code/Mantid/Framework/Algorithms/src/SpecularReflectionPositionCorrect.cpp @@ -70,10 +70,10 @@ SpecularReflectionPositionCorrect::~SpecularReflectionPositionCorrect() {} /// Algorithm's name for identification. @see Algorithm::name const std::string SpecularReflectionPositionCorrect::name() const { return "SpecularReflectionPositionCorrect"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int SpecularReflectionPositionCorrect::version() const { return 1; }; +int SpecularReflectionPositionCorrect::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string SpecularReflectionPositionCorrect::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/SumEventsByLogValue.cpp b/Code/Mantid/Framework/Algorithms/src/SumEventsByLogValue.cpp index 7829bd0452a0..48f47cff4a6f 100644 --- a/Code/Mantid/Framework/Algorithms/src/SumEventsByLogValue.cpp +++ b/Code/Mantid/Framework/Algorithms/src/SumEventsByLogValue.cpp @@ -10,7 +10,7 @@ namespace Mantid { namespace Algorithms { // Register the class into the algorithm factory -DECLARE_ALGORITHM(SumEventsByLogValue); +DECLARE_ALGORITHM(SumEventsByLogValue) using namespace Kernel; using namespace API; diff --git a/Code/Mantid/Framework/Algorithms/src/UpdateScriptRepository.cpp b/Code/Mantid/Framework/Algorithms/src/UpdateScriptRepository.cpp index b56a1c0be37f..45e620542ce1 100644 --- a/Code/Mantid/Framework/Algorithms/src/UpdateScriptRepository.cpp +++ b/Code/Mantid/Framework/Algorithms/src/UpdateScriptRepository.cpp @@ -22,10 +22,10 @@ UpdateScriptRepository::~UpdateScriptRepository() {} /// Algorithm's name for identification. @see Algorithm::name const std::string UpdateScriptRepository::name() const { return "UpdateScriptRepository"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int UpdateScriptRepository::version() const { return 1; }; +int UpdateScriptRepository::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string UpdateScriptRepository::category() const { return "Utility"; } diff --git a/Code/Mantid/Framework/Algorithms/src/WeightedMeanOfWorkspace.cpp b/Code/Mantid/Framework/Algorithms/src/WeightedMeanOfWorkspace.cpp index baf8f5094140..4703eb91d2f8 100644 --- a/Code/Mantid/Framework/Algorithms/src/WeightedMeanOfWorkspace.cpp +++ b/Code/Mantid/Framework/Algorithms/src/WeightedMeanOfWorkspace.cpp @@ -28,10 +28,10 @@ WeightedMeanOfWorkspace::~WeightedMeanOfWorkspace() {} /// Algorithm's name for identification. @see Algorithm::name const std::string WeightedMeanOfWorkspace::name() const { return "WeightedMeanOfWorkspace"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int WeightedMeanOfWorkspace::version() const { return 1; }; +int WeightedMeanOfWorkspace::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string WeightedMeanOfWorkspace::category() const { diff --git a/Code/Mantid/Framework/Algorithms/src/WeightingStrategy.cpp b/Code/Mantid/Framework/Algorithms/src/WeightingStrategy.cpp index f09fd1e66583..17af7d37dede 100644 --- a/Code/Mantid/Framework/Algorithms/src/WeightingStrategy.cpp +++ b/Code/Mantid/Framework/Algorithms/src/WeightingStrategy.cpp @@ -15,10 +15,10 @@ namespace Algorithms { Constructor @param cutOff : radius cutoff */ -WeightingStrategy::WeightingStrategy(const double cutOff) : m_cutOff(cutOff){}; +WeightingStrategy::WeightingStrategy(const double cutOff) : m_cutOff(cutOff){} /// Constructor -WeightingStrategy::WeightingStrategy() : m_cutOff(0){}; +WeightingStrategy::WeightingStrategy() : m_cutOff(0){} /// Destructor WeightingStrategy::~WeightingStrategy() {} diff --git a/Code/Mantid/Framework/Algorithms/src/WienerSmooth.cpp b/Code/Mantid/Framework/Algorithms/src/WienerSmooth.cpp index e4baaba6d2b0..f8762cd5a566 100644 --- a/Code/Mantid/Framework/Algorithms/src/WienerSmooth.cpp +++ b/Code/Mantid/Framework/Algorithms/src/WienerSmooth.cpp @@ -38,7 +38,7 @@ WienerSmooth::~WienerSmooth() {} //---------------------------------------------------------------------------------------------- /// Algorithm's version for identification. @see Algorithm::version -int WienerSmooth::version() const { return 1; }; +int WienerSmooth::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string WienerSmooth::category() const { @@ -48,7 +48,7 @@ const std::string WienerSmooth::category() const { /// Algorithm's summary for use in the GUI and help. @see Algorithm::summary const std::string WienerSmooth::summary() const { return "Smooth spectra using Wiener filter."; -}; +} //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. diff --git a/Code/Mantid/Framework/Crystal/src/AddPeakHKL.cpp b/Code/Mantid/Framework/Crystal/src/AddPeakHKL.cpp index 78c563d096e9..2e770043c2b4 100644 --- a/Code/Mantid/Framework/Crystal/src/AddPeakHKL.cpp +++ b/Code/Mantid/Framework/Crystal/src/AddPeakHKL.cpp @@ -39,13 +39,13 @@ namespace Crystal const std::string AddPeakHKL::name() const { return "AddPeakHKL"; } /// Algorithm's version for identification. @see Algorithm::version - int AddPeakHKL::version() const { return 1;}; + int AddPeakHKL::version() const { return 1;} /// Algorithm's category for identification. @see Algorithm::category const std::string AddPeakHKL::category() const { return "Crystal";} /// Algorithm's summary for use in the GUI and help. @see Algorithm::summary - const std::string AddPeakHKL::summary() const { return "Add a peak in the hkl frame";}; + const std::string AddPeakHKL::summary() const { return "Add a peak in the hkl frame";} //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. diff --git a/Code/Mantid/Framework/Crystal/src/CalculatePeaksHKL.cpp b/Code/Mantid/Framework/Crystal/src/CalculatePeaksHKL.cpp index 46cac8737cdf..10dc1653c945 100644 --- a/Code/Mantid/Framework/Crystal/src/CalculatePeaksHKL.cpp +++ b/Code/Mantid/Framework/Crystal/src/CalculatePeaksHKL.cpp @@ -30,10 +30,10 @@ CalculatePeaksHKL::~CalculatePeaksHKL() {} /// Algorithm's name for identification. @see Algorithm::name const std::string CalculatePeaksHKL::name() const { return "CalculatePeaksHKL"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int CalculatePeaksHKL::version() const { return 1; }; +int CalculatePeaksHKL::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string CalculatePeaksHKL::category() const { return "Crystal"; } diff --git a/Code/Mantid/Framework/Crystal/src/ClearUB.cpp b/Code/Mantid/Framework/Crystal/src/ClearUB.cpp index fdcefa2a8939..54f27de7e263 100644 --- a/Code/Mantid/Framework/Crystal/src/ClearUB.cpp +++ b/Code/Mantid/Framework/Crystal/src/ClearUB.cpp @@ -22,10 +22,10 @@ ClearUB::~ClearUB() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string ClearUB::name() const { return "ClearUB"; }; +const std::string ClearUB::name() const { return "ClearUB"; } /// Algorithm's version for identification. @see Algorithm::version -int ClearUB::version() const { return 1; }; +int ClearUB::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ClearUB::category() const { return "Crystal"; } diff --git a/Code/Mantid/Framework/Crystal/src/CombinePeaksWorkspaces.cpp b/Code/Mantid/Framework/Crystal/src/CombinePeaksWorkspaces.cpp index f59b28b0a0af..e4e518348f73 100644 --- a/Code/Mantid/Framework/Crystal/src/CombinePeaksWorkspaces.cpp +++ b/Code/Mantid/Framework/Crystal/src/CombinePeaksWorkspaces.cpp @@ -27,9 +27,9 @@ CombinePeaksWorkspaces::~CombinePeaksWorkspaces() {} /// Algorithm's name for identification. @see Algorithm::name const std::string CombinePeaksWorkspaces::name() const { return "CombinePeaksWorkspaces"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int CombinePeaksWorkspaces::version() const { return 1; }; +int CombinePeaksWorkspaces::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string CombinePeaksWorkspaces::category() const { return "Crystal"; } diff --git a/Code/Mantid/Framework/Crystal/src/DiffPeaksWorkspaces.cpp b/Code/Mantid/Framework/Crystal/src/DiffPeaksWorkspaces.cpp index 00a3cb839e66..34337d74f916 100644 --- a/Code/Mantid/Framework/Crystal/src/DiffPeaksWorkspaces.cpp +++ b/Code/Mantid/Framework/Crystal/src/DiffPeaksWorkspaces.cpp @@ -25,9 +25,9 @@ DiffPeaksWorkspaces::~DiffPeaksWorkspaces() {} /// Algorithm's name for identification. @see Algorithm::name const std::string DiffPeaksWorkspaces::name() const { return "DiffPeaksWorkspaces"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int DiffPeaksWorkspaces::version() const { return 1; }; +int DiffPeaksWorkspaces::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string DiffPeaksWorkspaces::category() const { return "Crystal"; } diff --git a/Code/Mantid/Framework/Crystal/src/FilterPeaks.cpp b/Code/Mantid/Framework/Crystal/src/FilterPeaks.cpp index efecf7a037a3..86ff9a78ccc8 100644 --- a/Code/Mantid/Framework/Crystal/src/FilterPeaks.cpp +++ b/Code/Mantid/Framework/Crystal/src/FilterPeaks.cpp @@ -40,9 +40,9 @@ FilterPeaks::FilterPeaks() {} FilterPeaks::~FilterPeaks() {} /// Algorithm's name for identification. @see Algorithm::name -const std::string FilterPeaks::name() const { return "FilterPeaks"; }; +const std::string FilterPeaks::name() const { return "FilterPeaks"; } /// Algorithm's version for identification. @see Algorithm::version -int FilterPeaks::version() const { return 1; }; +int FilterPeaks::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string FilterPeaks::category() const { return "Crystal"; } diff --git a/Code/Mantid/Framework/Crystal/src/FindClusterFaces.cpp b/Code/Mantid/Framework/Crystal/src/FindClusterFaces.cpp index fe9266df134f..2332de051847 100644 --- a/Code/Mantid/Framework/Crystal/src/FindClusterFaces.cpp +++ b/Code/Mantid/Framework/Crystal/src/FindClusterFaces.cpp @@ -270,10 +270,10 @@ FindClusterFaces::~FindClusterFaces() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string FindClusterFaces::name() const { return "FindClusterFaces"; }; +const std::string FindClusterFaces::name() const { return "FindClusterFaces"; } /// Algorithm's version for identification. @see Algorithm::version -int FindClusterFaces::version() const { return 1; }; +int FindClusterFaces::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string FindClusterFaces::category() const { return "Crystal"; } diff --git a/Code/Mantid/Framework/Crystal/src/HasUB.cpp b/Code/Mantid/Framework/Crystal/src/HasUB.cpp index fcc9477ff9ff..2bf028caa4c0 100644 --- a/Code/Mantid/Framework/Crystal/src/HasUB.cpp +++ b/Code/Mantid/Framework/Crystal/src/HasUB.cpp @@ -21,10 +21,10 @@ HasUB::~HasUB() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string HasUB::name() const { return "HasUB"; }; +const std::string HasUB::name() const { return "HasUB"; } /// Algorithm's version for identification. @see Algorithm::version -int HasUB::version() const { return 1; }; +int HasUB::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string HasUB::category() const { return "Crystal"; } diff --git a/Code/Mantid/Framework/Crystal/src/IntegratePeaksHybrid.cpp b/Code/Mantid/Framework/Crystal/src/IntegratePeaksHybrid.cpp index 83c00772d38c..c7d2f6fd8ede 100644 --- a/Code/Mantid/Framework/Crystal/src/IntegratePeaksHybrid.cpp +++ b/Code/Mantid/Framework/Crystal/src/IntegratePeaksHybrid.cpp @@ -101,10 +101,10 @@ IntegratePeaksHybrid::~IntegratePeaksHybrid() {} /// Algorithm's name for identification. @see Algorithm::name const std::string IntegratePeaksHybrid::name() const { return "IntegratePeaksHybrid"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int IntegratePeaksHybrid::version() const { return 1; }; +int IntegratePeaksHybrid::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string IntegratePeaksHybrid::category() const { diff --git a/Code/Mantid/Framework/Crystal/src/IntegratePeaksUsingClusters.cpp b/Code/Mantid/Framework/Crystal/src/IntegratePeaksUsingClusters.cpp index 84843b0b2b34..5b6aeeb76773 100644 --- a/Code/Mantid/Framework/Crystal/src/IntegratePeaksUsingClusters.cpp +++ b/Code/Mantid/Framework/Crystal/src/IntegratePeaksUsingClusters.cpp @@ -48,10 +48,10 @@ IntegratePeaksUsingClusters::~IntegratePeaksUsingClusters() {} /// Algorithm's name for identification. @see Algorithm::name const std::string IntegratePeaksUsingClusters::name() const { return "IntegratePeaksUsingClusters"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int IntegratePeaksUsingClusters::version() const { return 1; }; +int IntegratePeaksUsingClusters::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string IntegratePeaksUsingClusters::category() const { diff --git a/Code/Mantid/Framework/Crystal/src/LoadIsawPeaks.cpp b/Code/Mantid/Framework/Crystal/src/LoadIsawPeaks.cpp index 1e4e7a331a11..9612ce7b2638 100644 --- a/Code/Mantid/Framework/Crystal/src/LoadIsawPeaks.cpp +++ b/Code/Mantid/Framework/Crystal/src/LoadIsawPeaks.cpp @@ -28,7 +28,7 @@ using Mantid::Kernel::Units::Wavelength; namespace Mantid { namespace Crystal { -DECLARE_FILELOADER_ALGORITHM(LoadIsawPeaks); +DECLARE_FILELOADER_ALGORITHM(LoadIsawPeaks) using namespace Mantid::Kernel; using namespace Mantid::API; diff --git a/Code/Mantid/Framework/Crystal/src/PeakIntensityVsRadius.cpp b/Code/Mantid/Framework/Crystal/src/PeakIntensityVsRadius.cpp index 53ccf36f9059..e1381d541dab 100644 --- a/Code/Mantid/Framework/Crystal/src/PeakIntensityVsRadius.cpp +++ b/Code/Mantid/Framework/Crystal/src/PeakIntensityVsRadius.cpp @@ -29,10 +29,10 @@ PeakIntensityVsRadius::~PeakIntensityVsRadius() {} /// Algorithm's name for identification. @see Algorithm::name const std::string PeakIntensityVsRadius::name() const { return "PeakIntensityVsRadius"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int PeakIntensityVsRadius::version() const { return 1; }; +int PeakIntensityVsRadius::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string PeakIntensityVsRadius::category() const { return "Crystal"; } diff --git a/Code/Mantid/Framework/Crystal/src/PeaksInRegion.cpp b/Code/Mantid/Framework/Crystal/src/PeaksInRegion.cpp index b8b112cb7a46..dc590f5b4c62 100644 --- a/Code/Mantid/Framework/Crystal/src/PeaksInRegion.cpp +++ b/Code/Mantid/Framework/Crystal/src/PeaksInRegion.cpp @@ -26,10 +26,10 @@ PeaksInRegion::~PeaksInRegion() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string PeaksInRegion::name() const { return "PeaksInRegion"; }; +const std::string PeaksInRegion::name() const { return "PeaksInRegion"; } /// Algorithm's version for identification. @see Algorithm::version -int PeaksInRegion::version() const { return 1; }; +int PeaksInRegion::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string PeaksInRegion::category() const { return "Crystal"; } diff --git a/Code/Mantid/Framework/Crystal/src/PeaksOnSurface.cpp b/Code/Mantid/Framework/Crystal/src/PeaksOnSurface.cpp index f0dded52a842..3bd6da8e03fd 100644 --- a/Code/Mantid/Framework/Crystal/src/PeaksOnSurface.cpp +++ b/Code/Mantid/Framework/Crystal/src/PeaksOnSurface.cpp @@ -25,10 +25,10 @@ PeaksOnSurface::~PeaksOnSurface() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string PeaksOnSurface::name() const { return "PeaksOnSurface"; }; +const std::string PeaksOnSurface::name() const { return "PeaksOnSurface"; } /// Algorithm's version for identification. @see Algorithm::version -int PeaksOnSurface::version() const { return 1; }; +int PeaksOnSurface::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string PeaksOnSurface::category() const { return "Crystal"; } diff --git a/Code/Mantid/Framework/Crystal/src/SetSpecialCoordinates.cpp b/Code/Mantid/Framework/Crystal/src/SetSpecialCoordinates.cpp index 784d7244d529..61ecc88afb96 100644 --- a/Code/Mantid/Framework/Crystal/src/SetSpecialCoordinates.cpp +++ b/Code/Mantid/Framework/Crystal/src/SetSpecialCoordinates.cpp @@ -56,10 +56,10 @@ SetSpecialCoordinates::~SetSpecialCoordinates() {} /// Algorithm's name for identification. @see Algorithm::name const std::string SetSpecialCoordinates::name() const { return "SetSpecialCoordinates"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int SetSpecialCoordinates::version() const { return 1; }; +int SetSpecialCoordinates::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string SetSpecialCoordinates::category() const { return "Crystal"; } diff --git a/Code/Mantid/Framework/Crystal/src/SortPeaksWorkspace.cpp b/Code/Mantid/Framework/Crystal/src/SortPeaksWorkspace.cpp index d9422413e6c5..2045ca8d73f8 100644 --- a/Code/Mantid/Framework/Crystal/src/SortPeaksWorkspace.cpp +++ b/Code/Mantid/Framework/Crystal/src/SortPeaksWorkspace.cpp @@ -29,10 +29,10 @@ SortPeaksWorkspace::~SortPeaksWorkspace() {} /// Algorithm's name for identification. @see Algorithm::name const std::string SortPeaksWorkspace::name() const { return "SortPeaksWorkspace"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int SortPeaksWorkspace::version() const { return 1; }; +int SortPeaksWorkspace::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string SortPeaksWorkspace::category() const { return "Crystal"; } diff --git a/Code/Mantid/Framework/CurveFitting/CMakeLists.txt b/Code/Mantid/Framework/CurveFitting/CMakeLists.txt index 7b1cd0ed1c9c..987301cf78bc 100644 --- a/Code/Mantid/Framework/CurveFitting/CMakeLists.txt +++ b/Code/Mantid/Framework/CurveFitting/CMakeLists.txt @@ -68,6 +68,8 @@ set ( SRC_FILES src/NormaliseByPeakArea.cpp src/PRConjugateGradientMinimizer.cpp src/ParDomain.cpp + src/PawleyFit.cpp + src/PawleyFunction.cpp src/PeakParameterFunction.cpp src/PlotPeakByLogValue.cpp src/Polynomial.cpp @@ -181,6 +183,8 @@ set ( INC_FILES inc/MantidCurveFitting/NormaliseByPeakArea.h inc/MantidCurveFitting/PRConjugateGradientMinimizer.h inc/MantidCurveFitting/ParDomain.h + inc/MantidCurveFitting/PawleyFit.h + inc/MantidCurveFitting/PawleyFunction.h inc/MantidCurveFitting/PeakParameterFunction.h inc/MantidCurveFitting/PlotPeakByLogValue.h inc/MantidCurveFitting/Polynomial.h @@ -260,14 +264,14 @@ set ( TEST_FILES FullprofPolynomialTest.h FunctionDomain1DSpectrumCreatorTest.h FunctionFactoryConstraintTest.h - FunctionParameterDecoratorFitTest.h + FunctionParameterDecoratorFitTest.h GSLMatrixTest.h GausDecayTest.h GausOscTest.h GaussianComptonProfileTest.h GaussianTest.h GramCharlierComptonProfileTest.h - IPeakFunctionCentreParameterNameTest.h + IPeakFunctionCentreParameterNameTest.h IPeakFunctionIntensityTest.h IkedaCarpenterPVTest.h LeBailFitTest.h @@ -285,6 +289,8 @@ set ( TEST_FILES NeutronBk2BkExpConvPVoigtTest.h NormaliseByPeakAreaTest.h PRConjugateGradientTest.h + PawleyFitTest.h + PawleyFunctionTest.h PeakParameterFunctionTest.h PlotPeakByLogValueTest.h PolynomialTest.h diff --git a/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/AugmentedLagrangianOptimizer.h b/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/AugmentedLagrangianOptimizer.h index ae06a79fe7bf..8bbc05dd38b5 100644 --- a/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/AugmentedLagrangianOptimizer.h +++ b/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/AugmentedLagrangianOptimizer.h @@ -154,8 +154,8 @@ class MANTID_CURVEFITTING_DLL AugmentedLagrangianOptimizer { void minimize(std::vector &xv) const; private: - DISABLE_DEFAULT_CONSTRUCT(AugmentedLagrangianOptimizer); - DISABLE_COPY_AND_ASSIGN(AugmentedLagrangianOptimizer); + DISABLE_DEFAULT_CONSTRUCT(AugmentedLagrangianOptimizer) + DISABLE_COPY_AND_ASSIGN(AugmentedLagrangianOptimizer) friend class UnconstrainedCostFunction; /// Using gradient optimizer to perform limited optimization of current set diff --git a/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFit.h b/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFit.h new file mode 100644 index 000000000000..4c00d9b1c35c --- /dev/null +++ b/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFit.h @@ -0,0 +1,83 @@ +#ifndef MANTID_CURVEFITTING_PAWLEYFIT_H_ +#define MANTID_CURVEFITTING_PAWLEYFIT_H_ + +#include "MantidKernel/System.h" +#include "MantidAPI/Algorithm.h" +#include "MantidCurveFitting/PawleyFunction.h" +#include "MantidKernel/Unit.h" + +namespace Mantid { +namespace CurveFitting { + +/** PawleyFit + + This algorithm uses the Pawley-method to refine lattice parameters using a + powder diffractogram and a list of unique Miller indices. From the initial + lattice parameters, theoretical reflection positions are calculated. Each + reflection is described by the peak profile function supplied by the user and + all parameters except the one for location of the reflection are freely + refined. Available lattice parameters depend on the selected crystal system. + + @author Michael Wedel, Paul Scherrer Institut - SINQ + @date 15/03/2015 + + Copyright © 2015 PSI-NXMM + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + File change history is stored at: + Code Documentation is available at: +*/ +class DLLExport PawleyFit : public API::Algorithm { +public: + PawleyFit(); + virtual ~PawleyFit() {} + + const std::string name() const { return "PawleyFit"; } + int version() const { return 1; } + const std::string summary() const; + const std::string category() const { return "Diffraction"; } + +protected: + double getTransformedCenter(double d, const Kernel::Unit_sptr &unit) const; + + void addHKLsToFunction(PawleyFunction_sptr &pawleyFn, + const API::ITableWorkspace_sptr &tableWs, + const Kernel::Unit_sptr &unit, double startX, + double endX) const; + + Kernel::V3D getHKLFromColumn(size_t i, + const API::Column_const_sptr &hklColumn) const; + Kernel::V3D getHkl(const std::string &hklString) const; + + API::ITableWorkspace_sptr + getLatticeFromFunction(const PawleyFunction_sptr &pawleyFn) const; + API::ITableWorkspace_sptr + getPeakParametersFromFunction(const PawleyFunction_sptr &pawleyFn) const; + + API::IFunction_sptr + getCompositeFunction(const PawleyFunction_sptr &pawleyFn) const; + + void init(); + void exec(); + + Kernel::Unit_sptr m_dUnit; +}; + +} // namespace CurveFitting +} // namespace Mantid + +#endif /* MANTID_CURVEFITTING_PAWLEYFIT_H_ */ diff --git a/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h b/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h new file mode 100644 index 000000000000..cb0e9fb7acae --- /dev/null +++ b/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h @@ -0,0 +1,166 @@ +#ifndef MANTID_CURVEFITTING_PAWLEYFUNCTION_H_ +#define MANTID_CURVEFITTING_PAWLEYFUNCTION_H_ + +#include "MantidKernel/System.h" +#include "MantidAPI/CompositeFunction.h" +#include "MantidAPI/FunctionParameterDecorator.h" +#include "MantidAPI/MatrixWorkspace.h" +#include "MantidAPI/IPeakFunction.h" +#include "MantidAPI/ParamFunction.h" + +#include "MantidGeometry/Crystal/PointGroup.h" +#include "MantidGeometry/Crystal/UnitCell.h" + +namespace Mantid { +namespace CurveFitting { + +/** @class PawleyParameterFunction + + This function is used internally by PawleyFunction to hold the unit cell + parameters as well as the ZeroShift parameter. The function and functionDeriv- + methods have been implemented to do nothing, the calculation of the spectrum + that results from the unit cell is calculated in PawleyFunction. + + Additionally it stores the crystal system and the name of the profile function + that is used to model the Bragg peaks as attributes. +*/ +class DLLExport PawleyParameterFunction : virtual public API::IFunction, + virtual public API::ParamFunction { +public: + PawleyParameterFunction(); + virtual ~PawleyParameterFunction() {} + + /// Returns the function name + std::string name() const { return "PawleyParameterFunction"; } + + void setAttribute(const std::string &attName, const Attribute &attValue); + + Geometry::PointGroup::CrystalSystem getCrystalSystem() const; + Geometry::UnitCell getUnitCellFromParameters() const; + void setParametersFromUnitCell(const Geometry::UnitCell &cell); + + /// Returns the stored profile function name + std::string getProfileFunctionName() const { + return getAttribute("ProfileFunction").asString(); + } + + /// Returns the name of the stored function's center parameter + std::string getProfileFunctionCenterParameterName() const { + return m_profileFunctionCenterParameterName; + } + + void function(const API::FunctionDomain &domain, + API::FunctionValues &values) const; + void functionDeriv(const API::FunctionDomain &domain, + API::Jacobian &jacobian); + +protected: + void init(); + + void setProfileFunction(const std::string &profileFunction); + void setCrystalSystem(const std::string &crystalSystem); + + void createCrystalSystemParameters( + Geometry::PointGroup::CrystalSystem crystalSystem); + void setCenterParameterNameFromFunction( + const API::IPeakFunction_sptr &profileFunction); + + Geometry::PointGroup::CrystalSystem m_crystalSystem; + std::string m_profileFunctionCenterParameterName; +}; + +typedef boost::shared_ptr PawleyParameterFunction_sptr; + +/** @class PawleyFunction + + The Pawley approach to obtain lattice parameters from a powder diffractogram + works by placing peak profiles at d-values (which result from the lattice + parameters and the Miller indices of each peak) and fitting the total profile + to the recorded diffractogram. + + Depending on the chosen crystal system, this function exposes the appropriate + lattice parameters as parameters, as well as profile parameters of the + individual peak functions, except the peak locations, which are a direct + result of their HKLs in combination with the unit cell. + + @author Michael Wedel, Paul Scherrer Institut - SINQ + @date 11/03/2015 + + Copyright © 2015 PSI-NXMM + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + File change history is stored at: + Code Documentation is available at: +*/ +class DLLExport PawleyFunction : public API::FunctionParameterDecorator { +public: + PawleyFunction(); + virtual ~PawleyFunction() {} + + /// Returns the name of the function. + std::string name() const { return "PawleyFunction"; } + + void + setMatrixWorkspace(boost::shared_ptr workspace, + size_t wi, double startX, double endX); + + void setCrystalSystem(const std::string &crystalSystem); + void setProfileFunction(const std::string &profileFunction); + void setUnitCell(const std::string &unitCellString); + + void function(const API::FunctionDomain &domain, + API::FunctionValues &values) const; + + /// Derivates are calculated numerically. + void functionDeriv(const API::FunctionDomain &domain, + API::Jacobian &jacobian) { + calNumericalDeriv(domain, jacobian); + } + + void setPeaks(const std::vector &hkls, double fwhm, + double height); + void clearPeaks(); + + void addPeak(const Kernel::V3D &hkl, double fwhm, double height); + size_t getPeakCount() const; + API::IPeakFunction_sptr getPeakFunction(size_t i) const; + Kernel::V3D getPeakHKL(size_t i) const; + + PawleyParameterFunction_sptr getPawleyParameterFunction() const; + +protected: + double getTransformedCenter(double d) const; + + void init(); + void beforeDecoratedFunctionSet(const API::IFunction_sptr &fn); + + API::CompositeFunction_sptr m_compositeFunction; + PawleyParameterFunction_sptr m_pawleyParameterFunction; + API::CompositeFunction_sptr m_peakProfileComposite; + + std::vector m_hkls; + + Kernel::Unit_sptr m_dUnit; + Kernel::Unit_sptr m_wsUnit; +}; + +typedef boost::shared_ptr PawleyFunction_sptr; + +} // namespace CurveFitting +} // namespace Mantid + +#endif /* MANTID_CURVEFITTING_PAWLEYFUNCTION_H_ */ diff --git a/Code/Mantid/Framework/CurveFitting/src/CalculateGammaBackground.cpp b/Code/Mantid/Framework/CurveFitting/src/CalculateGammaBackground.cpp index 6e1ab71224a5..d4dfeb2503d7 100644 --- a/Code/Mantid/Framework/CurveFitting/src/CalculateGammaBackground.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/CalculateGammaBackground.cpp @@ -21,7 +21,7 @@ using namespace Kernel; using namespace std; // Subscription -DECLARE_ALGORITHM(CalculateGammaBackground); +DECLARE_ALGORITHM(CalculateGammaBackground) namespace { /// Number of elements in theta direction integration diff --git a/Code/Mantid/Framework/CurveFitting/src/Chebyshev.cpp b/Code/Mantid/Framework/CurveFitting/src/Chebyshev.cpp index eb0330594383..7da4e1d0b883 100644 --- a/Code/Mantid/Framework/CurveFitting/src/Chebyshev.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/Chebyshev.cpp @@ -20,7 +20,7 @@ Chebyshev::Chebyshev() : m_n(0), m_StartX(-1.), m_EndX(1.) { declareAttribute("n", Attribute(m_n)); declareAttribute("StartX", Attribute(m_StartX)); declareAttribute("EndX", Attribute(m_EndX)); -}; +} void Chebyshev::function1D(double *out, const double *xValues, const size_t nData) const { diff --git a/Code/Mantid/Framework/CurveFitting/src/ComptonPeakProfile.cpp b/Code/Mantid/Framework/CurveFitting/src/ComptonPeakProfile.cpp index 45de68597850..92328afbcff1 100644 --- a/Code/Mantid/Framework/CurveFitting/src/ComptonPeakProfile.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/ComptonPeakProfile.cpp @@ -8,7 +8,7 @@ namespace Mantid { namespace CurveFitting { -DECLARE_FUNCTION(ComptonPeakProfile); +DECLARE_FUNCTION(ComptonPeakProfile) namespace { ///@cond diff --git a/Code/Mantid/Framework/CurveFitting/src/ComptonScatteringCountRate.cpp b/Code/Mantid/Framework/CurveFitting/src/ComptonScatteringCountRate.cpp index 7bb7dd9b2a53..c0862428093e 100644 --- a/Code/Mantid/Framework/CurveFitting/src/ComptonScatteringCountRate.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/ComptonScatteringCountRate.cpp @@ -20,7 +20,7 @@ const char *BKGD_ORDER_ATTR_NAME = "BackgroundOrderAttr"; Logger g_log("ComptonScatteringCountRate"); } -DECLARE_FUNCTION(ComptonScatteringCountRate); +DECLARE_FUNCTION(ComptonScatteringCountRate) //---------------------------------------------------------------------------------------------- /** Constructor diff --git a/Code/Mantid/Framework/CurveFitting/src/ConvertToYSpace.cpp b/Code/Mantid/Framework/CurveFitting/src/ConvertToYSpace.cpp index 456d7355884f..5cb55c3d2aa4 100644 --- a/Code/Mantid/Framework/CurveFitting/src/ConvertToYSpace.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/ConvertToYSpace.cpp @@ -10,7 +10,7 @@ namespace Mantid { namespace CurveFitting { // Register the algorithm into the AlgorithmFactory -DECLARE_ALGORITHM(ConvertToYSpace); +DECLARE_ALGORITHM(ConvertToYSpace) using namespace API; using namespace Kernel; diff --git a/Code/Mantid/Framework/CurveFitting/src/CubicSpline.cpp b/Code/Mantid/Framework/CurveFitting/src/CubicSpline.cpp index 893e0f59420f..6b0d2815989e 100644 --- a/Code/Mantid/Framework/CurveFitting/src/CubicSpline.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/CubicSpline.cpp @@ -41,7 +41,7 @@ CubicSpline::CubicSpline() declareParameter("y0", 0); declareParameter("y1", 0); declareParameter("y2", 0); -}; +} /** Execute the function * diff --git a/Code/Mantid/Framework/CurveFitting/src/DiffRotDiscreteCircle.cpp b/Code/Mantid/Framework/CurveFitting/src/DiffRotDiscreteCircle.cpp index 1c2042fbdeef..1d7fc6948be0 100644 --- a/Code/Mantid/Framework/CurveFitting/src/DiffRotDiscreteCircle.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/DiffRotDiscreteCircle.cpp @@ -11,9 +11,9 @@ namespace Mantid { namespace CurveFitting { -DECLARE_FUNCTION(ElasticDiffRotDiscreteCircle); -DECLARE_FUNCTION(InelasticDiffRotDiscreteCircle); -DECLARE_FUNCTION(DiffRotDiscreteCircle); +DECLARE_FUNCTION(ElasticDiffRotDiscreteCircle) +DECLARE_FUNCTION(InelasticDiffRotDiscreteCircle) +DECLARE_FUNCTION(DiffRotDiscreteCircle) ElasticDiffRotDiscreteCircle::ElasticDiffRotDiscreteCircle() { // declareParameter("Height", 1.0); //parameter "Height" already declared in @@ -54,6 +54,7 @@ InelasticDiffRotDiscreteCircle::InelasticDiffRotDiscreteCircle() declareParameter("Decay", 1.0, "Inverse of transition rate, in nanoseconds " "if energy in micro-ev, or picoseconds if " "energy in mili-eV"); + declareParameter("Shift", 0.0, "Shift in domain"); declareAttribute("Q", API::IFunction::Attribute(0.5)); declareAttribute("N", API::IFunction::Attribute(3)); @@ -82,6 +83,7 @@ void InelasticDiffRotDiscreteCircle::function1D(double *out, const double rate = m_hbar / getParameter("Decay"); // micro-eV or mili-eV const double Q = getAttribute("Q").asDouble(); const int N = getAttribute("N").asInt(); + const double S = getParameter("Shift"); std::vector sph(N); for (int k = 1; k < N; k++) { @@ -97,7 +99,7 @@ void InelasticDiffRotDiscreteCircle::function1D(double *out, } for (size_t i = 0; i < nData; i++) { - double w = xValues[i]; + double w = xValues[i] - S; double S = 0.0; for (int l = 1; l < N; l++) // l goes up to N-1 { @@ -166,6 +168,7 @@ void DiffRotDiscreteCircle::init() { setAlias("f1.Intensity", "Intensity"); setAlias("f1.Radius", "Radius"); setAlias("f1.Decay", "Decay"); + setAlias("f1.Shift", "Shift"); // Set the ties between Elastic and Inelastic parameters addDefaultTies("f0.Height=f1.Intensity,f0.Radius=f1.Radius"); diff --git a/Code/Mantid/Framework/CurveFitting/src/DiffSphere.cpp b/Code/Mantid/Framework/CurveFitting/src/DiffSphere.cpp index aafd90d88c51..28688f243db3 100644 --- a/Code/Mantid/Framework/CurveFitting/src/DiffSphere.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/DiffSphere.cpp @@ -16,9 +16,9 @@ namespace CurveFitting { using namespace Kernel; using namespace API; -DECLARE_FUNCTION(ElasticDiffSphere); -DECLARE_FUNCTION(InelasticDiffSphere); -DECLARE_FUNCTION(DiffSphere); +DECLARE_FUNCTION(ElasticDiffSphere) +DECLARE_FUNCTION(InelasticDiffSphere) +DECLARE_FUNCTION(DiffSphere) ElasticDiffSphere::ElasticDiffSphere() { // declareParameter("Height", 1.0); //parameter "Height" already declared in @@ -145,6 +145,7 @@ InelasticDiffSphere::InelasticDiffSphere() declareParameter("Diffusion", 0.05, "Diffusion coefficient, in units of " "A^2*THz, if energy in meV, or A^2*PHz " "if energy in ueV"); + declareParameter("Shift", 0.0, "Shift in domain"); declareAttribute("Q", API::IFunction::Attribute(1.0)); } @@ -194,6 +195,7 @@ void InelasticDiffSphere::function1D(double *out, const double *xValues, const double R = getParameter("Radius"); const double D = getParameter("Diffusion"); const double Q = getAttribute("Q").asDouble(); + const double S = getParameter("Shift"); // // Penalize negative parameters if (I < std::numeric_limits::epsilon() || @@ -216,7 +218,7 @@ void InelasticDiffSphere::function1D(double *out, const double *xValues, std::vector YJ; YJ = LorentzianCoefficients(Q * R); // The (2l+1)*A_{n,l} for (size_t i = 0; i < nData; i++) { - double energy = xValues[i]; // from meV to THz (or from micro-eV to PHz) + double energy = xValues[i] - S; // from meV to THz (or from micro-eV to PHz) out[i] = 0.0; for (size_t n = 0; n < ncoeff; n++) { double L = (1.0 / M_PI) * HWHM[n] / @@ -272,6 +274,7 @@ void DiffSphere::init() { setAlias("f1.Intensity", "Intensity"); setAlias("f1.Radius", "Radius"); setAlias("f1.Diffusion", "Diffusion"); + setAlias("f1.Shift", "Shift"); // Set the ties between Elastic and Inelastic parameters addDefaultTies("f0.Height=f1.Intensity,f0.Radius=f1.Radius"); diff --git a/Code/Mantid/Framework/CurveFitting/src/EstimatePeakErrors.cpp b/Code/Mantid/Framework/CurveFitting/src/EstimatePeakErrors.cpp index b2d70ca84b52..a57f7e2cfd20 100644 --- a/Code/Mantid/Framework/CurveFitting/src/EstimatePeakErrors.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/EstimatePeakErrors.cpp @@ -17,7 +17,7 @@ using namespace Kernel; using namespace std; // Subscription -DECLARE_ALGORITHM(EstimatePeakErrors); +DECLARE_ALGORITHM(EstimatePeakErrors) //-------------------------------------------------------------------------------------------------------- // Public members diff --git a/Code/Mantid/Framework/CurveFitting/src/GaussianComptonProfile.cpp b/Code/Mantid/Framework/CurveFitting/src/GaussianComptonProfile.cpp index f1600c26fc8a..b77daafba109 100644 --- a/Code/Mantid/Framework/CurveFitting/src/GaussianComptonProfile.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/GaussianComptonProfile.cpp @@ -6,7 +6,7 @@ namespace Mantid { namespace CurveFitting { -DECLARE_FUNCTION(GaussianComptonProfile); +DECLARE_FUNCTION(GaussianComptonProfile) const char *WIDTH_PARAM = "Width"; const char *AMP_PARAM = "Intensity"; diff --git a/Code/Mantid/Framework/CurveFitting/src/GramCharlierComptonProfile.cpp b/Code/Mantid/Framework/CurveFitting/src/GramCharlierComptonProfile.cpp index c6a64b0fbb44..fe20a841b141 100644 --- a/Code/Mantid/Framework/CurveFitting/src/GramCharlierComptonProfile.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/GramCharlierComptonProfile.cpp @@ -14,7 +14,7 @@ namespace Mantid { namespace CurveFitting { // Register into factory -DECLARE_FUNCTION(GramCharlierComptonProfile); +DECLARE_FUNCTION(GramCharlierComptonProfile) namespace { ///@cond diff --git a/Code/Mantid/Framework/CurveFitting/src/IkedaCarpenterPV.cpp b/Code/Mantid/Framework/CurveFitting/src/IkedaCarpenterPV.cpp index e9d8a908511a..527a9c396980 100644 --- a/Code/Mantid/Framework/CurveFitting/src/IkedaCarpenterPV.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/IkedaCarpenterPV.cpp @@ -49,7 +49,7 @@ void IkedaCarpenterPV::setHeight(const double h) { // The intensity is then estimated to be h/h0 setParameter("I", h / h0); -}; +} double IkedaCarpenterPV::height() const { // return the function value at centre() @@ -59,7 +59,7 @@ double IkedaCarpenterPV::height() const { toCentre[0] = centre(); constFunction(h0, toCentre, 1); return h0[0]; -}; +} double IkedaCarpenterPV::fwhm() const { double sigmaSquared = getParameter("SigmaSquared"); @@ -83,14 +83,14 @@ double IkedaCarpenterPV::fwhm() const { ; } return sqrt(8.0 * M_LN2 * sigmaSquared) + gamma; -}; +} void IkedaCarpenterPV::setFwhm(const double w) { setParameter("SigmaSquared", w * w / (32.0 * M_LN2)); // used 4.0 * 8.0 = 32.0 setParameter("Gamma", w / 2.0); -}; +} -void IkedaCarpenterPV::setCentre(const double c) { setParameter("X0", c); }; +void IkedaCarpenterPV::setCentre(const double c) { setParameter("X0", c); } void IkedaCarpenterPV::init() { declareParameter("I", 0.0, "The integrated intensity of the peak. I.e. " diff --git a/Code/Mantid/Framework/CurveFitting/src/Lorentzian.cpp b/Code/Mantid/Framework/CurveFitting/src/Lorentzian.cpp index 7791d92f6eab..8d58c9a3915b 100644 --- a/Code/Mantid/Framework/CurveFitting/src/Lorentzian.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/Lorentzian.cpp @@ -11,7 +11,7 @@ namespace CurveFitting { using namespace Kernel; using namespace API; -DECLARE_FUNCTION(Lorentzian); +DECLARE_FUNCTION(Lorentzian) void Lorentzian::init() { declareParameter("Amplitude", 1.0, "Intensity scaling"); diff --git a/Code/Mantid/Framework/CurveFitting/src/PawleyFit.cpp b/Code/Mantid/Framework/CurveFitting/src/PawleyFit.cpp new file mode 100644 index 000000000000..11a110f20013 --- /dev/null +++ b/Code/Mantid/Framework/CurveFitting/src/PawleyFit.cpp @@ -0,0 +1,405 @@ +#include "MantidCurveFitting/PawleyFit.h" + +#include "MantidAPI/FunctionFactory.h" +#include "MantidCurveFitting/PawleyFunction.h" +#include "MantidAPI/TableRow.h" + +#include "MantidGeometry/Crystal/UnitCell.h" +#include "MantidKernel/ListValidator.h" +#include "MantidKernel/UnitFactory.h" +#include "MantidKernel/UnitConversion.h" + +#include + +namespace Mantid { +namespace CurveFitting { + +using namespace API; +using namespace Kernel; +using namespace Geometry; + +DECLARE_ALGORITHM(PawleyFit) + +/// Default constructor +PawleyFit::PawleyFit() : Algorithm(), m_dUnit() {} + +/// Returns the summary +const std::string PawleyFit::summary() const { + return "This algorithm performs a Pawley-fit on the supplied workspace."; +} + +/// Transforms the specified value from d-spacing to the supplied unit. +double PawleyFit::getTransformedCenter(double d, const Unit_sptr &unit) const { + if (boost::dynamic_pointer_cast(unit) || + boost::dynamic_pointer_cast(unit)) { + return d; + } + + return UnitConversion::run(*m_dUnit, *unit, d, 0, 0, 0, DeltaEMode::Elastic, + 0); +} + +/** + * Add HKLs from a TableWorkspace to the PawleyFunction. + * + * This method tries to extract reflections from the specified TableWorkspace. + * For the extraction to work properly it needs to have columns with the + * following labels: + * HKL, d, Intensity, FWHM (rel.) + * + * The latter three must be convertible to double, otherwise the there will be + * no peaks in the function. The value of d is converted to the unit of the + * workspace to obtain an absolute FWHM-value, since FWHM (rel.) is defined + * as FWHM / center. + * + * The HKLs can either be a column of V3D or a string column that contains 3 + * numbers separated by space, comma, semi-colon, or [ ] + * + * @param pawleyFn :: PawleyFunction which the HKLs should be added to. + * @param tableWs :: TableWorkspace that contains the reflection information. + * @param unit :: Unit of the workspace. + * @param startX :: Lowest allowed x-value for reflection position. + * @param endX :: Highest allowed x-value for reflection position. + */ +void PawleyFit::addHKLsToFunction(PawleyFunction_sptr &pawleyFn, + const ITableWorkspace_sptr &tableWs, + const Unit_sptr &unit, double startX, + double endX) const { + if (!tableWs || !pawleyFn) { + throw std::invalid_argument("Can only process non-null function & table."); + } + + pawleyFn->clearPeaks(); + + try { + Column_const_sptr hklColumn = tableWs->getColumn("HKL"); + Column_const_sptr dColumn = tableWs->getColumn("d"); + Column_const_sptr intensityColumn = tableWs->getColumn("Intensity"); + Column_const_sptr fwhmColumn = tableWs->getColumn("FWHM (rel.)"); + + for (size_t i = 0; i < tableWs->rowCount(); ++i) { + try { + V3D hkl = getHKLFromColumn(i, hklColumn); + + double d = (*dColumn)[i]; + double center = getTransformedCenter(d, unit); + double fwhm = (*fwhmColumn)[i] * center; + double height = (*intensityColumn)[i]; + + if (center > startX && center < endX) { + pawleyFn->addPeak(hkl, fwhm, height); + } + } + catch (std::bad_alloc) { + // do nothing. + } + } + } + catch (std::runtime_error) { + // Column does not exist + throw std::runtime_error("Can not process table, the following columns are " + "required: HKL, d, Intensity, FWHM (rel.)"); + } +} + +/// Tries to extract Miller indices as V3D from column. +V3D PawleyFit::getHKLFromColumn(size_t i, + const Column_const_sptr &hklColumn) const { + if (hklColumn->type() == "V3D") { + return hklColumn->cell(i); + } + + return getHkl(hklColumn->cell(i)); +} + +/// Try to extract a V3D from the given string with different separators. +V3D PawleyFit::getHkl(const std::string &hklString) const { + auto delimiters = boost::is_any_of(" ,[];"); + + std::string workingCopy = boost::trim_copy_if(hklString, delimiters); + std::vector indicesStr; + boost::split(indicesStr, workingCopy, delimiters); + + if (indicesStr.size() != 3) { + throw std::invalid_argument("Input string cannot be parsed as HKL."); + } + + V3D hkl; + hkl.setX(boost::lexical_cast(indicesStr[0])); + hkl.setY(boost::lexical_cast(indicesStr[1])); + hkl.setZ(boost::lexical_cast(indicesStr[2])); + + return hkl; +} + +/// Creates a table containing the cell parameters stored in the supplied +/// function. +ITableWorkspace_sptr +PawleyFit::getLatticeFromFunction(const PawleyFunction_sptr &pawleyFn) const { + if (!pawleyFn) { + throw std::invalid_argument( + "Cannot extract lattice parameters from null function."); + } + + ITableWorkspace_sptr latticeParameterTable = + WorkspaceFactory::Instance().createTable(); + + latticeParameterTable->addColumn("str", "Parameter"); + latticeParameterTable->addColumn("double", "Value"); + latticeParameterTable->addColumn("double", "Error"); + + PawleyParameterFunction_sptr parameters = + pawleyFn->getPawleyParameterFunction(); + + for (size_t i = 0; i < parameters->nParams(); ++i) { + TableRow newRow = latticeParameterTable->appendRow(); + newRow << parameters->parameterName(i) << parameters->getParameter(i) + << parameters->getError(i); + } + + return latticeParameterTable; +} + +/// Extracts all profile parameters from the supplied function. +ITableWorkspace_sptr PawleyFit::getPeakParametersFromFunction( + const PawleyFunction_sptr &pawleyFn) const { + if (!pawleyFn) { + throw std::invalid_argument( + "Cannot extract peak parameters from null function."); + } + + ITableWorkspace_sptr peakParameterTable = + WorkspaceFactory::Instance().createTable(); + + peakParameterTable->addColumn("int", "Peak"); + peakParameterTable->addColumn("V3D", "HKL"); + peakParameterTable->addColumn("str", "Parameter"); + peakParameterTable->addColumn("double", "Value"); + peakParameterTable->addColumn("double", "Error"); + + for (size_t i = 0; i < pawleyFn->getPeakCount(); ++i) { + + IPeakFunction_sptr currentPeak = pawleyFn->getPeakFunction(i); + + int peakNumber = static_cast(i + 1); + V3D peakHKL = pawleyFn->getPeakHKL(i); + + for (size_t j = 0; j < currentPeak->nParams(); ++j) { + TableRow newRow = peakParameterTable->appendRow(); + newRow << peakNumber << peakHKL << currentPeak->parameterName(j) + << currentPeak->getParameter(j) << currentPeak->getError(j); + } + } + + return peakParameterTable; +} + +/// Returns a composite function consisting of the Pawley function and Chebyshev +/// background if enabled in the algorithm. +IFunction_sptr +PawleyFit::getCompositeFunction(const PawleyFunction_sptr &pawleyFn) const { + CompositeFunction_sptr composite = boost::make_shared(); + composite->addFunction(pawleyFn); + + bool enableChebyshev = getProperty("EnableChebyshevBackground"); + if (enableChebyshev) { + int degree = getProperty("ChebyshevBackgroundDegree"); + IFunction_sptr chebyshev = + FunctionFactory::Instance().createFunction("Chebyshev"); + chebyshev->setAttributeValue("n", degree); + + composite->addFunction(chebyshev); + } + + return composite; +} + +/// Initialization of properties. +void PawleyFit::init() { + declareProperty(new WorkspaceProperty("InputWorkspace", "", + Direction::Input), + "Input workspace that contains the spectrum on which to " + "perform the Pawley fit."); + + declareProperty("WorkspaceIndex", 0, + "Spectrum on which the fit should be performed."); + + declareProperty("StartX", 0.0, "Lower border of fitted data range."); + declareProperty("EndX", 0.0, "Upper border of fitted data range."); + + std::vector crystalSystems; + crystalSystems.push_back("Cubic"); + crystalSystems.push_back("Tetragonal"); + crystalSystems.push_back("Hexagonal"); + crystalSystems.push_back("Trigonal"); + crystalSystems.push_back("Orthorhombic"); + crystalSystems.push_back("Monoclinic"); + crystalSystems.push_back("Triclinic"); + + auto crystalSystemValidator = + boost::make_shared(crystalSystems); + + declareProperty("CrystalSystem", crystalSystems.back(), + crystalSystemValidator, + "Crystal system to use for refinement."); + + declareProperty("InitialCell", "1.0 1.0 1.0 90.0 90.0 90.0", + "Specification of initial unit cell, given as 'a, b, c, " + "alpha, beta, gamma'."); + + declareProperty( + new WorkspaceProperty("PeakTable", "", Direction::Input), + "Table with peak information. Can be used instead of " + "supplying a list of indices for better starting parameters."); + + declareProperty("RefineZeroShift", false, "If checked, a zero-shift with the " + "same unit as the spectrum is " + "refined."); + + auto peakFunctionValidator = boost::make_shared( + FunctionFactory::Instance().getFunctionNames()); + + declareProperty("PeakProfileFunction", "Gaussian", peakFunctionValidator, + "Profile function that is used for each peak."); + + declareProperty("EnableChebyshevBackground", false, + "If checked, a Chebyshev " + "polynomial will be added " + "to model the background."); + + declareProperty("ChebyshevBackgroundDegree", 0, + "Degree of the Chebyshev polynomial, if used as background."); + + declareProperty("CalculationOnly", false, "If enabled, no fit is performed, " + "the function is only evaluated " + "and output is generated."); + + declareProperty(new WorkspaceProperty("OutputWorkspace", "", + Direction::Output), + "Workspace that contains measured spectrum, calculated " + "spectrum and difference curve."); + + declareProperty( + new WorkspaceProperty("RefinedCellTable", "", + Direction::Output), + "TableWorkspace with refined lattice parameters, including errors."); + + declareProperty( + new WorkspaceProperty("RefinedPeakParameterTable", "", + Direction::Output), + "TableWorkspace with refined peak parameters, including errors."); + + declareProperty("ReducedChiSquare", 0.0, "Outputs the reduced chi square " + "value as a measure for the quality " + "of the fit.", + Direction::Output); + + m_dUnit = UnitFactory::Instance().create("dSpacing"); +} + +/// Execution of algorithm. +void PawleyFit::exec() { + // Setup PawleyFunction with cell from input parameters + PawleyFunction_sptr pawleyFn = boost::dynamic_pointer_cast( + FunctionFactory::Instance().createFunction("PawleyFunction")); + g_log.information() << "Setting up Pawley function..." << std::endl; + + std::string profileFunction = getProperty("PeakProfileFunction"); + pawleyFn->setProfileFunction(profileFunction); + g_log.information() << " Selected profile function: " << profileFunction + << std::endl; + + std::string crystalSystem = getProperty("CrystalSystem"); + pawleyFn->setCrystalSystem(crystalSystem); + g_log.information() << " Selected crystal system: " << crystalSystem + << std::endl; + + pawleyFn->setUnitCell(getProperty("InitialCell")); + PawleyParameterFunction_sptr pawleyParameterFunction = + pawleyFn->getPawleyParameterFunction(); + g_log.information() + << " Initial unit cell: " + << unitCellToStr(pawleyParameterFunction->getUnitCellFromParameters()) + << std::endl; + + // Get the input workspace with the data + MatrixWorkspace_const_sptr ws = getProperty("InputWorkspace"); + int wsIndex = getProperty("WorkspaceIndex"); + + // Get x-range start and end values, depending on user input + const MantidVec &xData = ws->readX(static_cast(wsIndex)); + double startX = xData.front(); + double endX = xData.back(); + + Property *startXProperty = getPointerToProperty("StartX"); + if (!startXProperty->isDefault()) { + double startXInput = getProperty("StartX"); + startX = std::max(startX, startXInput); + } + + Property *endXProperty = getPointerToProperty("EndX"); + if (!endXProperty->isDefault()) { + double endXInput = getProperty("EndX"); + endX = std::min(endX, endXInput); + } + + g_log.information() << " Refined range: " << startX << " - " << endX + << std::endl; + + // Get HKLs from TableWorkspace + ITableWorkspace_sptr peakTable = getProperty("PeakTable"); + Axis *xAxis = ws->getAxis(0); + Unit_sptr xUnit = xAxis->unit(); + addHKLsToFunction(pawleyFn, peakTable, xUnit, startX, endX); + + g_log.information() << " Peaks in PawleyFunction: " + << pawleyFn->getPeakCount() << std::endl; + + // Determine if zero-shift should be refined + bool refineZeroShift = getProperty("RefineZeroShift"); + if (!refineZeroShift) { + pawleyFn->fix(pawleyFn->parameterIndex("f0.ZeroShift")); + } else { + g_log.information() << " Refining ZeroShift." << std::endl; + } + + pawleyFn->setMatrixWorkspace(ws, static_cast(wsIndex), startX, endX); + + g_log.information() << "Setting up Fit..." << std::endl; + + // Generate Fit-algorithm with required properties. + Algorithm_sptr fit = createChildAlgorithm("Fit", -1, -1, true); + fit->setProperty("Function", getCompositeFunction(pawleyFn)); + fit->setProperty("InputWorkspace", + boost::const_pointer_cast(ws)); + fit->setProperty("StartX", startX); + fit->setProperty("EndX", endX); + fit->setProperty("WorkspaceIndex", wsIndex); + + bool calculationOnly = getProperty("CalculationOnly"); + if (calculationOnly) { + fit->setProperty("MaxIterations", 0); + } + + fit->setProperty("CreateOutput", true); + + fit->execute(); + double chiSquare = fit->getProperty("OutputChi2overDoF"); + + g_log.information() << "Fit finished, reduced ChiSquare = " << chiSquare + << std::endl; + + g_log.information() << "Generating output..." << std::endl; + + // Create output + MatrixWorkspace_sptr output = fit->getProperty("OutputWorkspace"); + setProperty("OutputWorkspace", output); + setProperty("RefinedCellTable", getLatticeFromFunction(pawleyFn)); + setProperty("RefinedPeakParameterTable", + getPeakParametersFromFunction(pawleyFn)); + + setProperty("ReducedChiSquare", chiSquare); +} + +} // namespace CurveFitting +} // namespace Mantid diff --git a/Code/Mantid/Framework/CurveFitting/src/PawleyFunction.cpp b/Code/Mantid/Framework/CurveFitting/src/PawleyFunction.cpp new file mode 100644 index 000000000000..58f597657779 --- /dev/null +++ b/Code/Mantid/Framework/CurveFitting/src/PawleyFunction.cpp @@ -0,0 +1,498 @@ +#include "MantidCurveFitting/PawleyFunction.h" + +#include "MantidAPI/FunctionFactory.h" +#include "MantidKernel/UnitConversion.h" +#include "MantidKernel/UnitFactory.h" + +#include +#include + +namespace Mantid { +namespace CurveFitting { + +DECLARE_FUNCTION(PawleyParameterFunction) + +using namespace API; +using namespace Geometry; +using namespace Kernel; + +/// Constructor +PawleyParameterFunction::PawleyParameterFunction() + : ParamFunction(), m_crystalSystem(PointGroup::Triclinic), + m_profileFunctionCenterParameterName() {} + +/** + * @brief Sets the supplied attribute value + * + * The function calls ParamFunction::setAttribute, but performs additional + * actions for CrystalSystem and ProfileFunction. + * + * @param attName :: Name of the attribute + * @param attValue :: Value of the attribute + */ +void PawleyParameterFunction::setAttribute(const std::string &attName, + const Attribute &attValue) { + if (attName == "CrystalSystem") { + setCrystalSystem(attValue.asString()); + } else if (attName == "ProfileFunction") { + setProfileFunction(attValue.asString()); + } + + ParamFunction::setAttribute(attName, attValue); +} + +/// Returns the crystal system +PointGroup::CrystalSystem PawleyParameterFunction::getCrystalSystem() const { + return m_crystalSystem; +} + +/// Returns a UnitCell object constructed from the function's parameters. +UnitCell PawleyParameterFunction::getUnitCellFromParameters() const { + switch (m_crystalSystem) { + case PointGroup::Cubic: { + double a = getParameter("a"); + return UnitCell(a, a, a); + } + case PointGroup::Tetragonal: { + double a = getParameter("a"); + return UnitCell(a, a, getParameter("c")); + } + case PointGroup::Hexagonal: { + double a = getParameter("a"); + return UnitCell(a, a, getParameter("c"), 90, 90, 120); + } + case PointGroup::Trigonal: { + double a = getParameter("a"); + double alpha = getParameter("Alpha"); + return UnitCell(a, a, a, alpha, alpha, alpha); + } + case PointGroup::Orthorhombic: { + return UnitCell(getParameter("a"), getParameter("b"), getParameter("c")); + } + case PointGroup::Monoclinic: { + return UnitCell(getParameter("a"), getParameter("b"), getParameter("c"), 90, + getParameter("Beta"), 90); + } + case PointGroup::Triclinic: { + return UnitCell(getParameter("a"), getParameter("b"), getParameter("c"), + getParameter("Alpha"), getParameter("Beta"), + getParameter("Gamma")); + } + } + + return UnitCell(); +} + +/// Sets the function's parameters from the supplied UnitCell. +void PawleyParameterFunction::setParametersFromUnitCell(const UnitCell &cell) { + // Parameter "a" exists in all crystal systems. + setParameter("a", cell.a()); + + try { + setParameter("b", cell.b()); + } + catch (std::invalid_argument) { + // do nothing. + } + + try { + setParameter("c", cell.c()); + } + catch (std::invalid_argument) { + // do nothing + } + + try { + setParameter("Alpha", cell.alpha()); + } + catch (std::invalid_argument) { + // do nothing. + } + try { + setParameter("Beta", cell.beta()); + } + catch (std::invalid_argument) { + // do nothing. + } + try { + setParameter("Gamma", cell.gamma()); + } + catch (std::invalid_argument) { + // do nothing. + } +} + +/// This method does nothing. +void PawleyParameterFunction::function(const FunctionDomain &domain, + FunctionValues &values) const { + UNUSED_ARG(domain); + UNUSED_ARG(values); +} + +/// This method does nothing. +void PawleyParameterFunction::functionDeriv(const FunctionDomain &domain, + Jacobian &jacobian) { + UNUSED_ARG(domain) + UNUSED_ARG(jacobian); +} + +/// Declares attributes and generates parameters based on the defaults. +void PawleyParameterFunction::init() { + declareAttribute("CrystalSystem", IFunction::Attribute("Triclinic")); + declareAttribute("ProfileFunction", IFunction::Attribute("Gaussian")); + + setCrystalSystem("Triclinic"); + setProfileFunction("Gaussian"); +} + +/** + * Sets the profile function + * + * This method takes a function name and tries to create the corresponding + * function through FunctionFactory. Then it checks whether the function + * inherits from IPeakFunction and determines the centre parameter to store it. + * + * @param profileFunction :: Name of an IPeakFunction implementation. + */ +void PawleyParameterFunction::setProfileFunction( + const std::string &profileFunction) { + IPeakFunction_sptr peakFunction = boost::dynamic_pointer_cast( + FunctionFactory::Instance().createFunction(profileFunction)); + + if (!peakFunction) { + throw std::invalid_argument("PawleyFunction can only use IPeakFunctions to " + "calculate peak profiles."); + } + + setCenterParameterNameFromFunction(peakFunction); +} + +/** + * Assigns the crystal system + * + * This method takes the name of a crystal system (case insensitive) and stores + * it. Furthermore it creates the necessary parameters, which means that after + * calling this function, PawleyParameterFunction potentially exposes a + * different number of parameters. + * + * @param crystalSystem :: Crystal system, case insensitive. + */ +void +PawleyParameterFunction::setCrystalSystem(const std::string &crystalSystem) { + std::string crystalSystemLC = boost::algorithm::to_lower_copy(crystalSystem); + + if (crystalSystemLC == "cubic") { + m_crystalSystem = PointGroup::Cubic; + } else if (crystalSystemLC == "tetragonal") { + m_crystalSystem = PointGroup::Tetragonal; + } else if (crystalSystemLC == "hexagonal") { + m_crystalSystem = PointGroup::Hexagonal; + } else if (crystalSystemLC == "trigonal") { + m_crystalSystem = PointGroup::Trigonal; + } else if (crystalSystemLC == "orthorhombic") { + m_crystalSystem = PointGroup::Orthorhombic; + } else if (crystalSystemLC == "monoclinic") { + m_crystalSystem = PointGroup::Monoclinic; + } else if (crystalSystemLC == "triclinic") { + m_crystalSystem = PointGroup::Triclinic; + } else { + throw std::invalid_argument("Not a valid crystal system: '" + + crystalSystem + "'."); + } + + createCrystalSystemParameters(m_crystalSystem); +} + +/// This method clears all parameters and declares parameters according to the +/// supplied crystal system. +void PawleyParameterFunction::createCrystalSystemParameters( + PointGroup::CrystalSystem crystalSystem) { + + clearAllParameters(); + switch (crystalSystem) { + case PointGroup::Cubic: + declareParameter("a", 1.0); + break; + + case PointGroup::Hexagonal: + case PointGroup::Tetragonal: + declareParameter("a", 1.0); + declareParameter("c", 1.0); + break; + + case PointGroup::Orthorhombic: + declareParameter("a", 1.0); + declareParameter("b", 1.0); + declareParameter("c", 1.0); + break; + + case PointGroup::Monoclinic: + declareParameter("a", 1.0); + declareParameter("b", 1.0); + declareParameter("c", 1.0); + declareParameter("Beta", 90.0); + break; + + case PointGroup::Trigonal: + declareParameter("a", 1.0); + declareParameter("Alpha", 90.0); + break; + + default: + // triclinic + declareParameter("a", 1.0); + declareParameter("b", 1.0); + declareParameter("c", 1.0); + + declareParameter("Alpha", 90.0); + declareParameter("Beta", 90.0); + declareParameter("Gamma", 90.0); + break; + } + + declareParameter("ZeroShift", 0.0); +} + +/// Tries to extract and store the center parameter name from the function. +void PawleyParameterFunction::setCenterParameterNameFromFunction( + const IPeakFunction_sptr &profileFunction) { + m_profileFunctionCenterParameterName.clear(); + if (profileFunction) { + m_profileFunctionCenterParameterName = + profileFunction->getCentreParameterName(); + } +} + +DECLARE_FUNCTION(PawleyFunction) + +/// Constructor +PawleyFunction::PawleyFunction() + : FunctionParameterDecorator(), m_compositeFunction(), + m_pawleyParameterFunction(), m_peakProfileComposite(), m_hkls(), + m_dUnit(), m_wsUnit() {} + +void PawleyFunction::setMatrixWorkspace( + boost::shared_ptr workspace, size_t wi, + double startX, double endX) { + if (workspace) { + Axis *xAxis = workspace->getAxis(wi); + Kernel::Unit_sptr wsUnit = xAxis->unit(); + + if (boost::dynamic_pointer_cast(wsUnit) || + boost::dynamic_pointer_cast(wsUnit)) { + m_wsUnit = m_dUnit; + } else { + double factor, power; + if (wsUnit->quickConversion(*m_dUnit, factor, power)) { + m_wsUnit = wsUnit; + } else { + throw std::invalid_argument("Can not use quick conversion for unit."); + } + } + } + + m_wrappedFunction->setMatrixWorkspace(workspace, wi, startX, endX); +} + +/// Sets the crystal system on the internal parameter function and updates the +/// exposed parameters +void PawleyFunction::setCrystalSystem(const std::string &crystalSystem) { + m_pawleyParameterFunction->setAttributeValue("CrystalSystem", crystalSystem); + m_compositeFunction->checkFunction(); +} + +/// Sets the profile function and replaces already existing functions in the +/// internally stored CompositeFunction. +void PawleyFunction::setProfileFunction(const std::string &profileFunction) { + m_pawleyParameterFunction->setAttributeValue("ProfileFunction", + profileFunction); + + /* At this point PawleyParameterFunction guarantees that it's an IPeakFunction + * and all existing profile functions are replaced. + */ + for (size_t i = 0; i < m_peakProfileComposite->nFunctions(); ++i) { + IPeakFunction_sptr oldFunction = boost::dynamic_pointer_cast( + m_peakProfileComposite->getFunction(i)); + + IPeakFunction_sptr newFunction = boost::dynamic_pointer_cast( + FunctionFactory::Instance().createFunction( + m_pawleyParameterFunction->getProfileFunctionName())); + + newFunction->setCentre(oldFunction->centre()); + try { + newFunction->setFwhm(oldFunction->fwhm()); + } + catch (...) { + // do nothing. + } + newFunction->setHeight(oldFunction->height()); + + m_peakProfileComposite->replaceFunction(i, newFunction); + } + + // Update exposed parameters. + m_compositeFunction->checkFunction(); +} + +/// Sets the unit cell from a string with either 6 or 3 space-separated numbers. +void PawleyFunction::setUnitCell(const std::string &unitCellString) { + m_pawleyParameterFunction->setParametersFromUnitCell( + strToUnitCell(unitCellString)); +} + +/// Transform d value to workspace unit +double PawleyFunction::getTransformedCenter(double d) const { + if ((m_dUnit && m_wsUnit) && m_dUnit != m_wsUnit) { + return UnitConversion::run(*m_dUnit, *m_wsUnit, d, 0, 0, 0, + DeltaEMode::Elastic, 0); + } + + return d; +} + +/** + * Calculates the function values on the supplied domain + * + * This function is the core of PawleyFunction. It calculates the d-value for + * each stored HKL from the unit cell that is the result of the parameters + * stored in the internal PawleyParameterFunction and adds the ZeroShift + * parameter. The value is set as center parameter on the internally stored + * PeakFunctions. + * + * @param domain :: Function domain. + * @param values :: Function values. + */ +void PawleyFunction::function(const FunctionDomain &domain, + FunctionValues &values) const { + UnitCell cell = m_pawleyParameterFunction->getUnitCellFromParameters(); + double zeroShift = m_pawleyParameterFunction->getParameter("ZeroShift"); + + for (size_t i = 0; i < m_hkls.size(); ++i) { + double centre = getTransformedCenter(cell.d(m_hkls[i])); + + m_peakProfileComposite->getFunction(i)->setParameter( + m_pawleyParameterFunction->getProfileFunctionCenterParameterName(), + centre + zeroShift); + } + + m_peakProfileComposite->function(domain, values); +} + +/// Removes all peaks from the function. +void PawleyFunction::clearPeaks() { + m_peakProfileComposite = boost::dynamic_pointer_cast( + FunctionFactory::Instance().createFunction("CompositeFunction")); + m_compositeFunction->replaceFunction(1, m_peakProfileComposite); + m_hkls.clear(); +} + +/// Clears peaks and adds a peak for each hkl, all with the same FWHM and +/// height. +void PawleyFunction::setPeaks(const std::vector &hkls, double fwhm, + double height) { + clearPeaks(); + + for (size_t i = 0; i < hkls.size(); ++i) { + addPeak(hkls[i], fwhm, height); + } +} + +/// Adds a peak with the supplied FWHM and height. +void PawleyFunction::addPeak(const Kernel::V3D &hkl, double fwhm, + double height) { + m_hkls.push_back(hkl); + + IPeakFunction_sptr peak = boost::dynamic_pointer_cast( + FunctionFactory::Instance().createFunction( + m_pawleyParameterFunction->getProfileFunctionName())); + + peak->fix(peak->parameterIndex( + m_pawleyParameterFunction->getProfileFunctionCenterParameterName())); + + try { + peak->setFwhm(fwhm); + } + catch (...) { + // do nothing. + } + + peak->setHeight(height); + + m_peakProfileComposite->addFunction(peak); + + m_compositeFunction->checkFunction(); +} + +/// Returns the number of peaks that are stored in the function. +size_t PawleyFunction::getPeakCount() const { return m_hkls.size(); } + +IPeakFunction_sptr PawleyFunction::getPeakFunction(size_t i) const { + if (i >= m_hkls.size()) { + throw std::out_of_range("Peak index out of range."); + } + + return boost::dynamic_pointer_cast( + m_peakProfileComposite->getFunction(i)); +} + +/// Return the HKL of the i-th peak. +Kernel::V3D PawleyFunction::getPeakHKL(size_t i) const { + if (i >= m_hkls.size()) { + throw std::out_of_range("Peak index out of range."); + } + + return m_hkls[i]; +} + +/// Returns the internally stored PawleyParameterFunction. +PawleyParameterFunction_sptr +PawleyFunction::getPawleyParameterFunction() const { + return m_pawleyParameterFunction; +} + +void PawleyFunction::init() { + setDecoratedFunction("CompositeFunction"); + + if (!m_compositeFunction) { + throw std::runtime_error( + "PawleyFunction could not construct internal CompositeFunction."); + } + + m_dUnit = UnitFactory::Instance().create("dSpacing"); +} + +/// Checks that the decorated function has the correct structure. +void PawleyFunction::beforeDecoratedFunctionSet(const API::IFunction_sptr &fn) { + CompositeFunction_sptr composite = + boost::dynamic_pointer_cast(fn); + + if (!composite) { + throw std::invalid_argument("PawleyFunction only works with " + "CompositeFunction. Selecting another " + "decorated function is not possible."); + } + + m_compositeFunction = composite; + + if (m_compositeFunction->nFunctions() == 0) { + m_peakProfileComposite = boost::dynamic_pointer_cast( + FunctionFactory::Instance().createFunction("CompositeFunction")); + + m_pawleyParameterFunction = + boost::dynamic_pointer_cast( + FunctionFactory::Instance().createFunction( + "PawleyParameterFunction")); + + m_compositeFunction->addFunction(m_pawleyParameterFunction); + m_compositeFunction->addFunction(m_peakProfileComposite); + } else { + m_pawleyParameterFunction = + boost::dynamic_pointer_cast( + m_compositeFunction->getFunction(0)); + m_peakProfileComposite = boost::dynamic_pointer_cast( + m_compositeFunction->getFunction(1)); + } +} + +} // namespace CurveFitting +} // namespace Mantid diff --git a/Code/Mantid/Framework/CurveFitting/src/PseudoVoigt.cpp b/Code/Mantid/Framework/CurveFitting/src/PseudoVoigt.cpp index 585d1d6eb8b0..a492df6add65 100644 --- a/Code/Mantid/Framework/CurveFitting/src/PseudoVoigt.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/PseudoVoigt.cpp @@ -9,7 +9,7 @@ namespace CurveFitting { using namespace API; -DECLARE_FUNCTION(PseudoVoigt); +DECLARE_FUNCTION(PseudoVoigt) void PseudoVoigt::functionLocal(double *out, const double *xValues, const size_t nData) const { diff --git a/Code/Mantid/Framework/CurveFitting/src/SplineInterpolation.cpp b/Code/Mantid/Framework/CurveFitting/src/SplineInterpolation.cpp index 266f44f7e919..d476c8013e8a 100644 --- a/Code/Mantid/Framework/CurveFitting/src/SplineInterpolation.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/SplineInterpolation.cpp @@ -7,7 +7,7 @@ namespace Mantid { namespace CurveFitting { // Register the algorithm into the AlgorithmFactory -DECLARE_ALGORITHM(SplineInterpolation); +DECLARE_ALGORITHM(SplineInterpolation) using namespace API; using namespace Kernel; diff --git a/Code/Mantid/Framework/CurveFitting/src/SplineSmoothing.cpp b/Code/Mantid/Framework/CurveFitting/src/SplineSmoothing.cpp index 0d1f3d560a03..cd8f927f1b60 100644 --- a/Code/Mantid/Framework/CurveFitting/src/SplineSmoothing.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/SplineSmoothing.cpp @@ -12,7 +12,7 @@ namespace Mantid { namespace CurveFitting { // Register the algorithm into the AlgorithmFactory -DECLARE_ALGORITHM(SplineSmoothing); +DECLARE_ALGORITHM(SplineSmoothing) using namespace API; using namespace Kernel; @@ -32,10 +32,10 @@ SplineSmoothing::~SplineSmoothing() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string SplineSmoothing::name() const { return "SplineSmoothing"; }; +const std::string SplineSmoothing::name() const { return "SplineSmoothing"; } /// Algorithm's version for identification. @see Algorithm::version -int SplineSmoothing::version() const { return 1; }; +int SplineSmoothing::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string SplineSmoothing::category() const { diff --git a/Code/Mantid/Framework/CurveFitting/src/VesuvioResolution.cpp b/Code/Mantid/Framework/CurveFitting/src/VesuvioResolution.cpp index d13a8297536c..fac486c744a4 100644 --- a/Code/Mantid/Framework/CurveFitting/src/VesuvioResolution.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/VesuvioResolution.cpp @@ -17,7 +17,7 @@ const double STDDEV_TO_HWHM = std::sqrt(std::log(4.0)); } // Register into factory -DECLARE_FUNCTION(VesuvioResolution); +DECLARE_FUNCTION(VesuvioResolution) //--------------------------------------------------------------------------- // Static functions diff --git a/Code/Mantid/Framework/CurveFitting/src/Voigt.cpp b/Code/Mantid/Framework/CurveFitting/src/Voigt.cpp index fd5205345589..9e006da4d314 100644 --- a/Code/Mantid/Framework/CurveFitting/src/Voigt.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/Voigt.cpp @@ -9,7 +9,7 @@ namespace Mantid { namespace CurveFitting { -DECLARE_FUNCTION(Voigt); +DECLARE_FUNCTION(Voigt) namespace { /// @cond diff --git a/Code/Mantid/Framework/CurveFitting/test/CompositeFunctionTest.h b/Code/Mantid/Framework/CurveFitting/test/CompositeFunctionTest.h index ec353f5b2a61..678334f2bd19 100644 --- a/Code/Mantid/Framework/CurveFitting/test/CompositeFunctionTest.h +++ b/Code/Mantid/Framework/CurveFitting/test/CompositeFunctionTest.h @@ -135,8 +135,8 @@ class CurveFittingLinear: public ParamFunction, public IFunction1D }; -DECLARE_FUNCTION(CurveFittingLinear); -DECLARE_FUNCTION(CurveFittingGauss); +DECLARE_FUNCTION(CurveFittingLinear) +DECLARE_FUNCTION(CurveFittingGauss) class CompositeFunctionTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/CurveFitting/test/ConvolutionTest.h b/Code/Mantid/Framework/CurveFitting/test/ConvolutionTest.h index afc285cfb1c4..c548fc161273 100644 --- a/Code/Mantid/Framework/CurveFitting/test/ConvolutionTest.h +++ b/Code/Mantid/Framework/CurveFitting/test/ConvolutionTest.h @@ -191,9 +191,9 @@ class ConvolutionTest_Linear: public ParamFunction, public IFunction1D }; -DECLARE_FUNCTION(ConvolutionTest_Gauss); -DECLARE_FUNCTION(ConvolutionTest_Lorentz); -DECLARE_FUNCTION(ConvolutionTest_Linear); +DECLARE_FUNCTION(ConvolutionTest_Gauss) +DECLARE_FUNCTION(ConvolutionTest_Lorentz) +DECLARE_FUNCTION(ConvolutionTest_Linear) class ConvolutionTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/CurveFitting/test/DiffRotDiscreteCircleTest.h b/Code/Mantid/Framework/CurveFitting/test/DiffRotDiscreteCircleTest.h index 8eeffacaaff2..f0dba53f28f9 100644 --- a/Code/Mantid/Framework/CurveFitting/test/DiffRotDiscreteCircleTest.h +++ b/Code/Mantid/Framework/CurveFitting/test/DiffRotDiscreteCircleTest.h @@ -25,6 +25,7 @@ class DiffRotDiscreteCircleTest : public CxxTest::TestSuite static DiffRotDiscreteCircleTest *createSuite() { return new DiffRotDiscreteCircleTest(); } static void destroySuite( DiffRotDiscreteCircleTest *suite ) { delete suite; } + // convolve the elastic part with a resolution function, here a Gaussian void testDiffRotDiscreteCircleElastic() { @@ -75,58 +76,17 @@ class DiffRotDiscreteCircleTest : public CxxTest::TestSuite } // testDiffRotDiscreteCircleElastic - /// Fit the convolution of the inelastic part with a Gaussian resolution function void testDiffRotDiscreteCircleInelastic() { - /* Note: it turns out that parameters Intensity and Radius are highly covariant, so that more than one minimum exists. - * Thus, I tied parameter Radius. This is OK since one usually knows the radius of the circle of the jumping diffusion - */ - - // initialize the fitting function in a Fit algorithm - // Parameter units are assumed in micro-eV, Angstroms, Angstroms**(-1), and nano-seconds. Intensities have arbitrary units - std::string funtion_string = "(composite=Convolution,FixResolution=true,NumDeriv=true;name=Gaussian,Height=1.0,PeakCentre=0.0,Sigma=20.0,ties=(Height=1.0,PeakCentre=0.0,Sigma=20.0);name=InelasticDiffRotDiscreteCircle,N=3,Q=0.5,Intensity=47.014,Radius=1.567,Decay=7.567)"; - - // Initialize the fit function in the Fit algorithm - Mantid::CurveFitting::Fit fitalg; - TS_ASSERT_THROWS_NOTHING( fitalg.initialize() ); - TS_ASSERT( fitalg.isInitialized() ); - fitalg.setProperty( "Function", funtion_string ); - - // create the data workspace by evaluating the fit function in the Fit algorithm - auto data_workspace = generateWorkspaceFromFitAlgorithm( fitalg ); - //saveWorkspace( data_workspace, "/tmp/junk.nxs" ); // for debugging purposes only - - //override the function with new parameters, then do the Fit - funtion_string = "(composite=Convolution,FixResolution=true,NumDeriv=true;name=Gaussian,Height=1.0,PeakCentre=0.0,Sigma=20.0,ties=(Height=1.0,PeakCentre=0.0,Sigma=20.0);name=InelasticDiffRotDiscreteCircle,N=3,Q=0.5,Intensity=10.0,Radius=1.567,Decay=20.0,ties=(Radius=1.567))"; - fitalg.setProperty( "Function", funtion_string ); - fitalg.setProperty( "InputWorkspace", data_workspace ); - fitalg.setPropertyValue( "WorkspaceIndex", "0" ); - TS_ASSERT_THROWS_NOTHING( TS_ASSERT( fitalg.execute() ) ); - TS_ASSERT( fitalg.isExecuted() ); + runDiffRotDiscreteCircleInelasticTest(0.0); + } - // check Chi-square is small - const double chi_squared = fitalg.getProperty("OutputChi2overDoF"); - TS_ASSERT_LESS_THAN( chi_squared, 0.001 ); - //std::cout << "\nchi_squared = " << chi_squared << "\n"; // only for debugging purposes - // check the parameters of the resolution did not change - Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty( "Function" ); - auto fitalg_conv = boost::dynamic_pointer_cast( fitalg_function ) ; - Mantid::API::IFunction_sptr fitalg_resolution = fitalg_conv->getFunction( 0 ); - TS_ASSERT_DELTA( fitalg_resolution -> getParameter( "PeakCentre" ), 0.0, 0.00001 ); // allow for a small percent variation - TS_ASSERT_DELTA( fitalg_resolution -> getParameter( "Height" ), 1.0, 1.0 * 0.001 ); // allow for a small percent variation - TS_ASSERT_DELTA( fitalg_resolution -> getParameter( "Sigma" ), 20.0, 20.0* 0.001 ); // allow for a small percent variation - //std::cout << "\nPeakCentre = " << fitalg_resolution->getParameter("PeakCentre") << " Height= " << fitalg_resolution->getParameter("Height") << " Sigma=" << fitalg_resolution->getParameter("Sigma") << "\n"; // only for debugging purposes - - // check the parameters of the inelastic part - Mantid::API::IFunction_sptr fitalg_structure_factor = fitalg_conv->getFunction( 1 ); - TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Intensity" ), 47.014, 47.014 * 0.05 ); // allow for a small percent variation - TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Radius" ), 1.567, 1.567 * 0.05 ); // allow for a small percent variation - TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Decay" ), 7.567, 7.567 * 0.05 ); // allow for a small percent variation - //std::cout << "\nGOAL: Intensity = 47.014, Radius = 1.567, Decay = 7.567\n"; // only for debugging purposes - //std::cout << "OPTIMIZED: Intensity = " << fitalg_structure_factor->getParameter("Intensity") << " Radius = " << fitalg_structure_factor->getParameter("Radius") << " Decay = " << fitalg_structure_factor->getParameter("Decay") << "\n"; // only for debugging purposes + void testDiffRotDiscreteCircleInelasticWithShift() + { + runDiffRotDiscreteCircleInelasticTest(0.5); + } - } // testDiffRotDiscreteCircleElastic /* Check the particular case for N = 3 * In this case, the inelastic part should reduce to a single Lorentzian in 'w': @@ -293,6 +253,79 @@ class DiffRotDiscreteCircleTest : public CxxTest::TestSuite private: + /// Fit the convolution of the inelastic part with a Gaussian resolution function + void runDiffRotDiscreteCircleInelasticTest(const double S) + { + /* Note: it turns out that parameters Intensity and Radius are highly covariant, so that more than one minimum exists. + * Thus, I tied parameter Radius. This is OK since one usually knows the radius of the circle of the jumping diffusion + */ + const double I(47.014); + const double R(1.567); + const double tao(7.567); + + // initialize the fitting function in a Fit algorithm + // Parameter units are assumed in micro-eV, Angstroms, Angstroms**(-1), and nano-seconds. Intensities have arbitrary units + std::ostringstream function_stream; + function_stream << "(composite=Convolution,FixResolution=true,NumDeriv=true;" + << "name=Gaussian,Height=1.0,PeakCentre=0.0,Sigma=20.0," + << "ties=(Height=1.0,PeakCentre=0.0,Sigma=20.0);" + << "name=InelasticDiffRotDiscreteCircle,N=3,Q=0.5," + << "Intensity=" << I + << ",Radius=" << R + << ",Decay=" << tao + << ",Shift=" << S << ")"; + + // Initialize the fit function in the Fit algorithm + Mantid::CurveFitting::Fit fitalg; + TS_ASSERT_THROWS_NOTHING( fitalg.initialize() ); + TS_ASSERT( fitalg.isInitialized() ); + fitalg.setProperty( "Function", function_stream.str() ); + + function_stream.str( std::string() ); + function_stream.clear(); + + // create the data workspace by evaluating the fit function in the Fit algorithm + auto data_workspace = generateWorkspaceFromFitAlgorithm( fitalg ); + //saveWorkspace( data_workspace, "/tmp/junk.nxs" ); // for debugging purposes only + + //override the function with new parameters, then do the Fit + function_stream << "(composite=Convolution,FixResolution=true,NumDeriv=true;" + << "name=Gaussian,Height=1.0,PeakCentre=0.0,Sigma=20.0," + << "ties=(Height=1.0,PeakCentre=0.0,Sigma=20.0);" + << "name=InelasticDiffRotDiscreteCircle,N=3,Q=0.5," + << "Intensity=10.0,Radius=1.567,Decay=20.0" + << ",ties=(Radius=" << R << "))"; + fitalg.setProperty( "Function", function_stream.str() ); + fitalg.setProperty( "InputWorkspace", data_workspace ); + fitalg.setPropertyValue( "WorkspaceIndex", "0" ); + TS_ASSERT_THROWS_NOTHING( TS_ASSERT( fitalg.execute() ) ); + TS_ASSERT( fitalg.isExecuted() ); + + // check Chi-square is small + const double chi_squared = fitalg.getProperty("OutputChi2overDoF"); + TS_ASSERT_LESS_THAN( chi_squared, 0.001 ); + //std::cout << "\nchi_squared = " << chi_squared << "\n"; // only for debugging purposes + + // check the parameters of the resolution did not change + Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty( "Function" ); + auto fitalg_conv = boost::dynamic_pointer_cast( fitalg_function ) ; + Mantid::API::IFunction_sptr fitalg_resolution = fitalg_conv->getFunction( 0 ); + TS_ASSERT_DELTA( fitalg_resolution -> getParameter( "PeakCentre" ), 0.0, 0.00001 ); // allow for a small percent variation + TS_ASSERT_DELTA( fitalg_resolution -> getParameter( "Height" ), 1.0, 1.0 * 0.001 ); // allow for a small percent variation + TS_ASSERT_DELTA( fitalg_resolution -> getParameter( "Sigma" ), 20.0, 20.0* 0.001 ); // allow for a small percent variation + //std::cout << "\nPeakCentre = " << fitalg_resolution->getParameter("PeakCentre") << " Height= " << fitalg_resolution->getParameter("Height") << " Sigma=" << fitalg_resolution->getParameter("Sigma") << "\n"; // only for debugging purposes + + // check the parameters of the inelastic part + Mantid::API::IFunction_sptr fitalg_structure_factor = fitalg_conv->getFunction( 1 ); + TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Intensity" ), I, I * 0.05 ); // allow for a small percent variation + TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Radius" ), R, R * 0.05 ); // allow for a small percent variation + TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Decay" ), tao, tao * 0.05 ); // allow for a small percent variation + TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Shift" ), S, 0.00001 ); // allow for a small percent variation + //std::cout << "\nGOAL: Intensity = 47.014, Radius = 1.567, Decay = 7.567\n"; // only for debugging purposes + //std::cout << "OPTIMIZED: Intensity = " << fitalg_structure_factor->getParameter("Intensity") << " Radius = " << fitalg_structure_factor->getParameter("Radius") << " Decay = " << fitalg_structure_factor->getParameter("Decay") << "\n"; // only for debugging purposes + + } // runDiffRotDiscreteCircleInelasticTest + /// returns a real value from a uniform distribution double random_value(const double & a, const double & b) diff --git a/Code/Mantid/Framework/CurveFitting/test/DiffSphereTest.h b/Code/Mantid/Framework/CurveFitting/test/DiffSphereTest.h index 6b0baeaf008b..9242cb31729d 100644 --- a/Code/Mantid/Framework/CurveFitting/test/DiffSphereTest.h +++ b/Code/Mantid/Framework/CurveFitting/test/DiffSphereTest.h @@ -128,7 +128,17 @@ class DiffSphereTest : public CxxTest::TestSuite void testDiffSphereInelastic() { - // target fitting parameters + runDiffSphereInelasticTest(0.0); + } + + void testDiffSphereInelasticWithShift() + { + runDiffSphereInelasticTest(0.2); + } + + void testDiffSphere() + { + // target parameters const double I_0(47.014); const double R_0(2.1); const double D_0(0.049); @@ -141,14 +151,32 @@ class DiffSphereTest : public CxxTest::TestSuite std::ostringstream funtion_stream; funtion_stream << "(composite=Convolution,FixResolution=true,NumDeriv=true;name=Gaussian,Height=1.0," << "PeakCentre=0.0,Sigma=0.002,ties=(Height=1.0,PeakCentre=0.0,Sigma=0.002);" - << "name=InelasticDiffSphere,Q=" << boost::lexical_cast( Q ) << ",Intensity=" + << "name=DiffSphere,Q=" << boost::lexical_cast( Q ) << ",Intensity=" << boost::lexical_cast( I_0 ) << ",Radius=" << boost::lexical_cast( R_0 ) << ",Diffusion=" << boost::lexical_cast( D_0 ) << ")"; fitalg.setProperty( "Function", funtion_stream.str() ); - // create the data workspace by evaluating the fit function in the Fit algorithm - auto data_workspace = generateWorkspaceFromFitAlgorithm( fitalg ); - //saveWorkspace( data_workspace, "/tmp/junk_data.nxs" ); // for debugging purposes only + // Find out whether ties were correctly applied + Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty( "Function" ); // main function + fitalg_function->initialize(); + auto fitalg_conv = boost::dynamic_pointer_cast( fitalg_function ) ; // cast to Convolution + fitalg_function = fitalg_conv->getFunction( 1 ); // DiffSphere + auto fitalg_structure_factor = boost::dynamic_pointer_cast( fitalg_function ); + + fitalg_function = fitalg_structure_factor->getFunction( 0 ); + auto fitalg_elastic = boost::dynamic_pointer_cast( fitalg_function ) ; + TS_ASSERT_DELTA( fitalg_elastic -> getParameter( "Height" ), I_0, std::numeric_limits::epsilon() ); + TS_ASSERT_DELTA( fitalg_elastic -> getParameter( "Radius" ), R_0, std::numeric_limits::epsilon() ); + TS_ASSERT_DELTA( fitalg_elastic -> getAttribute( "Q" ).asDouble(), Q, std::numeric_limits::epsilon() ); + //std::cout << "Height=" << fitalg_elastic -> getParameter( "Height" ) << " Radius=" << fitalg_elastic -> getParameter( "Radius" ) << "\n"; // for debugging purposes only + + fitalg_function = fitalg_structure_factor->getFunction( 1 ); + auto fitalg_inelastic = boost::dynamic_pointer_cast( fitalg_function ) ; + TS_ASSERT_DELTA( fitalg_inelastic -> getParameter( "Intensity" ), I_0, std::numeric_limits::epsilon() ); + TS_ASSERT_DELTA( fitalg_inelastic -> getParameter( "Radius" ), R_0, std::numeric_limits::epsilon() ); + TS_ASSERT_DELTA( fitalg_inelastic -> getParameter( "Diffusion" ), D_0, std::numeric_limits::epsilon() ); + TS_ASSERT_DELTA( fitalg_inelastic -> getAttribute( "Q" ).asDouble(), Q, std::numeric_limits::epsilon() ); + //std::cout << "Intensity=" << fitalg_inelastic->getParameter( "Intensity" ) << " Radius=" << fitalg_inelastic->getParameter( "Radius" ) << " Diffusion=" << fitalg_inelastic->getParameter( "Diffusion" ) <<"\n"; // for debugging purposes only // override the function with new parameters, our initial guess. double I = I_0 * ( 0.75 + ( 0.5 * std::rand() ) / RAND_MAX ); @@ -158,20 +186,20 @@ class DiffSphereTest : public CxxTest::TestSuite funtion_stream.clear(); funtion_stream << "(composite=Convolution,FixResolution=true,NumDeriv=true;name=Gaussian,Height=1.0," << "PeakCentre=0.0,Sigma=0.002,ties=(Height=1.0,PeakCentre=0.0,Sigma=0.002);" - << "name=InelasticDiffSphere,Q=" << boost::lexical_cast( Q ) << ",Intensity=" + << "name=DiffSphere,Q=" << boost::lexical_cast( Q ) << ",Intensity=" << boost::lexical_cast( I ) << ",Radius=" << boost::lexical_cast( R ) << ",Diffusion=" << boost::lexical_cast( D ) << ")"; fitalg.setProperty( "Function", funtion_stream.str() ); - //auto before_workspace = generateWorkspaceFromFitAlgorithm( fitalg ); // for debugging purposes only - //saveWorkspace( before_workspace, "/tmp/junk_before_fitting.nxs" ); // for debugging purposes only + + // create the data workspace by evaluating the fit function in the Fit algorithm + auto data_workspace = generateWorkspaceFromFitAlgorithm( fitalg ); + //saveWorkspace( data_workspace, "/tmp/junk_data.nxs" ); // for debugging purposes only // Do the fit fitalg.setProperty( "InputWorkspace", data_workspace ); fitalg.setPropertyValue( "WorkspaceIndex", "0" ); TS_ASSERT_THROWS_NOTHING( TS_ASSERT( fitalg.execute() ) ); TS_ASSERT( fitalg.isExecuted() ); - //auto after_workspace = generateWorkspaceFromFitAlgorithm( fitalg ); // for debugging purposes only - //saveWorkspace( after_workspace, "/tmp/junk_after_fitting.nxs" ); // for debugging purposes only // check Chi-square is small const double chi_squared = fitalg.getProperty("OutputChi2overDoF"); @@ -179,28 +207,25 @@ class DiffSphereTest : public CxxTest::TestSuite //std::cout << "\nchi_squared = " << chi_squared << "\n"; // only for debugging purposes // check the parameters of the resolution did not change - Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty( "Function" ); - auto fitalg_conv = boost::dynamic_pointer_cast( fitalg_function ) ; Mantid::API::IFunction_sptr fitalg_resolution = fitalg_conv->getFunction( 0 ); - TS_ASSERT_DELTA( fitalg_resolution -> getParameter( "PeakCentre" ), 0.0, 0.00001 ); // allow for a small percent variation TS_ASSERT_DELTA( fitalg_resolution -> getParameter( "Height" ), 1.0, 1.0 * 0.001 ); // allow for a small percent variation TS_ASSERT_DELTA( fitalg_resolution -> getParameter( "Sigma" ), 0.002, 0.002* 0.001 ); // allow for a small percent variation //std::cout << "\nPeakCentre = " << fitalg_resolution->getParameter("PeakCentre") << " Height= " << fitalg_resolution->getParameter("Height") << " Sigma=" << fitalg_resolution->getParameter("Sigma") << "\n"; // only for debugging purposes - // check the parameters of the inelastic part close to the target parameters - Mantid::API::IFunction_sptr fitalg_structure_factor = fitalg_conv->getFunction( 1 ); + // check the parameters of the DiffSphere close to the target parameters TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Intensity" ), I_0, I_0 * 0.05 ); // allow for a small percent variation - TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Radius" ), R_0, R_0 * 0.05 ); // allow for a small percent variation - TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Diffusion" ), D_0, D_0 * 0.05 ); // allow for a small percent variation + TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Radius" ), R_0, R_0 * 0.05 ); // allow for a small percent variation + TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Diffusion" ), D_0, D_0 * 0.05 ); // allow for a small percent variation //std::cout << "\nINITIAL GUESS: Intensity = "<(I)<<", Radius ="<(R)<<", Diffusion = "<(D)<<"\n"; // only for debugging purposes //std::cout << "GOAL: Intensity = "<(I_0)<<", Radius = "<(R_0)<<", Diffusion = "<(D_0)<<"\n"; // only for debugging purposes //std::cout << "OPTIMIZED: Intensity = " << fitalg_structure_factor->getParameter("Intensity") << " Radius = " << fitalg_structure_factor->getParameter("Radius") << " Diffusion = " << fitalg_structure_factor->getParameter("Diffusion") << "\n"; // only for debugging purposes } - void testDiffSphere() +private: + void runDiffSphereInelasticTest(const double S) { - // target parameters + // target fitting parameters const double I_0(47.014); const double R_0(2.1); const double D_0(0.049); @@ -212,33 +237,16 @@ class DiffSphereTest : public CxxTest::TestSuite TS_ASSERT( fitalg.isInitialized() ); std::ostringstream funtion_stream; funtion_stream << "(composite=Convolution,FixResolution=true,NumDeriv=true;name=Gaussian,Height=1.0," - << "PeakCentre=0.0,Sigma=0.002,ties=(Height=1.0,PeakCentre=0.0,Sigma=0.002);" - << "name=DiffSphere,Q=" << boost::lexical_cast( Q ) << ",Intensity=" + << "PeakCentre=0.0,Sigma=0.002,ties=(Height=1.0,PeakCentre=" << S << ",Sigma=0.002);" + << "name=InelasticDiffSphere,Q=" << boost::lexical_cast( Q ) << ",Intensity=" << boost::lexical_cast( I_0 ) << ",Radius=" << boost::lexical_cast( R_0 ) - << ",Diffusion=" << boost::lexical_cast( D_0 ) << ")"; + << ",Diffusion=" << boost::lexical_cast( D_0 ) + << ",Shift=" << boost::lexical_cast(S) << ")"; fitalg.setProperty( "Function", funtion_stream.str() ); - // Find out whether ties were correctly applied - Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty( "Function" ); // main function - fitalg_function->initialize(); - auto fitalg_conv = boost::dynamic_pointer_cast( fitalg_function ) ; // cast to Convolution - fitalg_function = fitalg_conv->getFunction( 1 ); // DiffSphere - auto fitalg_structure_factor = boost::dynamic_pointer_cast( fitalg_function ); - - fitalg_function = fitalg_structure_factor->getFunction( 0 ); - auto fitalg_elastic = boost::dynamic_pointer_cast( fitalg_function ) ; - TS_ASSERT_DELTA( fitalg_elastic -> getParameter( "Height" ), I_0, std::numeric_limits::epsilon() ); - TS_ASSERT_DELTA( fitalg_elastic -> getParameter( "Radius" ), R_0, std::numeric_limits::epsilon() ); - TS_ASSERT_DELTA( fitalg_elastic -> getAttribute( "Q" ).asDouble(), Q, std::numeric_limits::epsilon() ); - //std::cout << "Height=" << fitalg_elastic -> getParameter( "Height" ) << " Radius=" << fitalg_elastic -> getParameter( "Radius" ) << "\n"; // for debugging purposes only - - fitalg_function = fitalg_structure_factor->getFunction( 1 ); - auto fitalg_inelastic = boost::dynamic_pointer_cast( fitalg_function ) ; - TS_ASSERT_DELTA( fitalg_inelastic -> getParameter( "Intensity" ), I_0, std::numeric_limits::epsilon() ); - TS_ASSERT_DELTA( fitalg_inelastic -> getParameter( "Radius" ), R_0, std::numeric_limits::epsilon() ); - TS_ASSERT_DELTA( fitalg_inelastic -> getParameter( "Diffusion" ), D_0, std::numeric_limits::epsilon() ); - TS_ASSERT_DELTA( fitalg_inelastic -> getAttribute( "Q" ).asDouble(), Q, std::numeric_limits::epsilon() ); - //std::cout << "Intensity=" << fitalg_inelastic->getParameter( "Intensity" ) << " Radius=" << fitalg_inelastic->getParameter( "Radius" ) << " Diffusion=" << fitalg_inelastic->getParameter( "Diffusion" ) <<"\n"; // for debugging purposes only + // create the data workspace by evaluating the fit function in the Fit algorithm + auto data_workspace = generateWorkspaceFromFitAlgorithm( fitalg ); + //saveWorkspace( data_workspace, "/tmp/junk_data.nxs" ); // for debugging purposes only // override the function with new parameters, our initial guess. double I = I_0 * ( 0.75 + ( 0.5 * std::rand() ) / RAND_MAX ); @@ -247,21 +255,22 @@ class DiffSphereTest : public CxxTest::TestSuite funtion_stream.str( std::string() ); funtion_stream.clear(); funtion_stream << "(composite=Convolution,FixResolution=true,NumDeriv=true;name=Gaussian,Height=1.0," - << "PeakCentre=0.0,Sigma=0.002,ties=(Height=1.0,PeakCentre=0.0,Sigma=0.002);" - << "name=DiffSphere,Q=" << boost::lexical_cast( Q ) << ",Intensity=" + << "PeakCentre=0.0,Sigma=0.002,ties=(Height=1.0,PeakCentre=" << S << ",Sigma=0.002);" + << "name=InelasticDiffSphere,Q=" << boost::lexical_cast( Q ) << ",Intensity=" << boost::lexical_cast( I ) << ",Radius=" << boost::lexical_cast( R ) - << ",Diffusion=" << boost::lexical_cast( D ) << ")"; + << ",Diffusion=" << boost::lexical_cast( D ) + << ",Shift=" << boost::lexical_cast(S) << ")"; fitalg.setProperty( "Function", funtion_stream.str() ); - - // create the data workspace by evaluating the fit function in the Fit algorithm - auto data_workspace = generateWorkspaceFromFitAlgorithm( fitalg ); - //saveWorkspace( data_workspace, "/tmp/junk_data.nxs" ); // for debugging purposes only + //auto before_workspace = generateWorkspaceFromFitAlgorithm( fitalg ); // for debugging purposes only + //saveWorkspace( before_workspace, "/tmp/junk_before_fitting.nxs" ); // for debugging purposes only // Do the fit fitalg.setProperty( "InputWorkspace", data_workspace ); fitalg.setPropertyValue( "WorkspaceIndex", "0" ); TS_ASSERT_THROWS_NOTHING( TS_ASSERT( fitalg.execute() ) ); TS_ASSERT( fitalg.isExecuted() ); + //auto after_workspace = generateWorkspaceFromFitAlgorithm( fitalg ); // for debugging purposes only + //saveWorkspace( after_workspace, "/tmp/junk_after_fitting.nxs" ); // for debugging purposes only // check Chi-square is small const double chi_squared = fitalg.getProperty("OutputChi2overDoF"); @@ -269,24 +278,26 @@ class DiffSphereTest : public CxxTest::TestSuite //std::cout << "\nchi_squared = " << chi_squared << "\n"; // only for debugging purposes // check the parameters of the resolution did not change + Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty( "Function" ); + auto fitalg_conv = boost::dynamic_pointer_cast( fitalg_function ) ; Mantid::API::IFunction_sptr fitalg_resolution = fitalg_conv->getFunction( 0 ); - TS_ASSERT_DELTA( fitalg_resolution -> getParameter( "PeakCentre" ), 0.0, 0.00001 ); // allow for a small percent variation + + TS_ASSERT_DELTA( fitalg_resolution -> getParameter( "PeakCentre" ), S, 0.00001 ); // allow for a small percent variation TS_ASSERT_DELTA( fitalg_resolution -> getParameter( "Height" ), 1.0, 1.0 * 0.001 ); // allow for a small percent variation TS_ASSERT_DELTA( fitalg_resolution -> getParameter( "Sigma" ), 0.002, 0.002* 0.001 ); // allow for a small percent variation //std::cout << "\nPeakCentre = " << fitalg_resolution->getParameter("PeakCentre") << " Height= " << fitalg_resolution->getParameter("Height") << " Sigma=" << fitalg_resolution->getParameter("Sigma") << "\n"; // only for debugging purposes - // check the parameters of the DiffSphere close to the target parameters + // check the parameters of the inelastic part close to the target parameters + Mantid::API::IFunction_sptr fitalg_structure_factor = fitalg_conv->getFunction( 1 ); TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Intensity" ), I_0, I_0 * 0.05 ); // allow for a small percent variation - TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Radius" ), R_0, R_0 * 0.05 ); // allow for a small percent variation - TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Diffusion" ), D_0, D_0 * 0.05 ); // allow for a small percent variation + TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Radius" ), R_0, R_0 * 0.05 ); // allow for a small percent variation + TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Diffusion" ), D_0, D_0 * 0.05 ); // allow for a small percent variation + TS_ASSERT_DELTA( fitalg_structure_factor -> getParameter( "Shift" ), S, 0.0005 ); // allow for a small percent variation //std::cout << "\nINITIAL GUESS: Intensity = "<(I)<<", Radius ="<(R)<<", Diffusion = "<(D)<<"\n"; // only for debugging purposes //std::cout << "GOAL: Intensity = "<(I_0)<<", Radius = "<(R_0)<<", Diffusion = "<(D_0)<<"\n"; // only for debugging purposes //std::cout << "OPTIMIZED: Intensity = " << fitalg_structure_factor->getParameter("Intensity") << " Radius = " << fitalg_structure_factor->getParameter("Radius") << " Diffusion = " << fitalg_structure_factor->getParameter("Diffusion") << "\n"; // only for debugging purposes - } -private: - /// save a worskapece to a nexus file void saveWorkspace( Mantid::DataObjects::Workspace2D_sptr &ws, const std::string &filename ) { diff --git a/Code/Mantid/Framework/CurveFitting/test/FunctionFactoryConstraintTest.h b/Code/Mantid/Framework/CurveFitting/test/FunctionFactoryConstraintTest.h index af5617975a9b..16b1c76cc47f 100644 --- a/Code/Mantid/Framework/CurveFitting/test/FunctionFactoryConstraintTest.h +++ b/Code/Mantid/Framework/CurveFitting/test/FunctionFactoryConstraintTest.h @@ -134,10 +134,10 @@ class FunctionFactoryConstraintTest_CompFunctB: public CompositeFunction }; -DECLARE_FUNCTION(FunctionFactoryConstraintTest_FunctA); -DECLARE_FUNCTION(FunctionFactoryConstraintTest_FunctB); -DECLARE_FUNCTION(FunctionFactoryConstraintTest_CompFunctA); -DECLARE_FUNCTION(FunctionFactoryConstraintTest_CompFunctB); +DECLARE_FUNCTION(FunctionFactoryConstraintTest_FunctA) +DECLARE_FUNCTION(FunctionFactoryConstraintTest_FunctB) +DECLARE_FUNCTION(FunctionFactoryConstraintTest_CompFunctA) +DECLARE_FUNCTION(FunctionFactoryConstraintTest_CompFunctB) class FunctionFactoryConstraintTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h b/Code/Mantid/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h index 47cc259f3558..592a90b7305f 100644 --- a/Code/Mantid/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h +++ b/Code/Mantid/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h @@ -46,7 +46,7 @@ class SimpleFunctionParameterDecorator : public FunctionParameterDecorator { } }; -DECLARE_FUNCTION(SimpleFunctionParameterDecorator); +DECLARE_FUNCTION(SimpleFunctionParameterDecorator) class FunctionParameterDecoratorFitTest : public CxxTest::TestSuite { public: diff --git a/Code/Mantid/Framework/CurveFitting/test/GaussianTest.h b/Code/Mantid/Framework/CurveFitting/test/GaussianTest.h index 40a9a43251b5..dcbddf65af1e 100644 --- a/Code/Mantid/Framework/CurveFitting/test/GaussianTest.h +++ b/Code/Mantid/Framework/CurveFitting/test/GaussianTest.h @@ -51,7 +51,7 @@ class SimplexGaussian : public Gaussian } }; -DECLARE_FUNCTION(SimplexGaussian); +DECLARE_FUNCTION(SimplexGaussian) class GaussianTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/CurveFitting/test/PawleyFitTest.h b/Code/Mantid/Framework/CurveFitting/test/PawleyFitTest.h new file mode 100644 index 000000000000..30b0ca92e8d4 --- /dev/null +++ b/Code/Mantid/Framework/CurveFitting/test/PawleyFitTest.h @@ -0,0 +1,261 @@ +#ifndef MANTID_CURVEFITTING_PAWLEYFITTEST_H_ +#define MANTID_CURVEFITTING_PAWLEYFITTEST_H_ + +#include + +#include "MantidCurveFitting/PawleyFit.h" +#include "MantidAPI/AlgorithmManager.h" +#include "MantidAPI/FunctionFactory.h" +#include "MantidAPI/TableRow.h" +#include "MantidAPI/WorkspaceFactory.h" +#include "MantidKernel/V3D.h" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" + +using Mantid::CurveFitting::PawleyFit; +using namespace Mantid::API; +using namespace Mantid::Kernel; + +class PawleyFitTest : public CxxTest::TestSuite { +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static PawleyFitTest *createSuite() { return new PawleyFitTest(); } + static void destroySuite(PawleyFitTest *suite) { delete suite; } + + void testGetHKL() { + TestablePawleyFit pfit; + + V3D referenceHKL(1, 2, 3); + + TS_ASSERT_EQUALS(pfit.getHkl("1 2 3"), referenceHKL); + TS_ASSERT_EQUALS(pfit.getHkl(" 1 2 3 "), referenceHKL); + TS_ASSERT_EQUALS(pfit.getHkl("1 2 3"), referenceHKL); + TS_ASSERT_EQUALS(pfit.getHkl("1,2,3"), referenceHKL); + TS_ASSERT_EQUALS(pfit.getHkl("1;2;3"), referenceHKL); + TS_ASSERT_EQUALS(pfit.getHkl("[1,2,3]"), referenceHKL); + TS_ASSERT_EQUALS(pfit.getHkl("[1;2 3]"), referenceHKL); + } + + void testFitHexagonalCellQ() { + /* Like in the PawleyFunctionTest, some reflections are needed. + * In this case, 5 reflections that belong to a hexagonal cell + * are used and stored in a TableWorkspace that has a suitable + * format for PawleyFit. The unit of the workspace is MomentumTransfer. + */ + + ITableWorkspace_sptr hkls = getHCPTable(); + MatrixWorkspace_sptr ws = + getWorkspace(getFunctionString(hkls, true), (2.0 * M_PI) / 2.1, + (2.0 * M_PI) / 1.0, 1000, "MomentumTransfer"); + + IAlgorithm_sptr pFit = AlgorithmManager::Instance().create("PawleyFit"); + pFit->setProperty("InputWorkspace", ws); + pFit->setProperty("WorkspaceIndex", 0); + pFit->setProperty("CrystalSystem", "Hexagonal"); + pFit->setProperty("InitialCell", "2.444 2.441 3.937 90 90 120"); + pFit->setProperty("PeakTable", hkls); + pFit->setProperty("OutputWorkspace", "HCP_output"); + pFit->setProperty("RefinedPeakParameterTable", "HCP_peaks"); + pFit->setProperty("RefinedCellTable", "HCP_cell"); + + TS_ASSERT_THROWS_NOTHING(pFit->execute()); + + // Examine table with cell parameters. + ITableWorkspace_sptr cellWs = + AnalysisDataService::Instance().retrieveWS("HCP_cell"); + + // Three rows (a, c, ZeroShift) + TS_ASSERT_EQUALS(cellWs->rowCount(), 3); + + // Error of 'a' should be small + TS_ASSERT_LESS_THAN(fabs(cellWs->cell(0, 2)), 1e-5); + // a should be almost equal to 2.45 + TS_ASSERT_DELTA(cellWs->cell(0, 1), 2.45, 1e-5); + + // Error of 'c' should also be small + TS_ASSERT_LESS_THAN(fabs(cellWs->cell(1, 2)), 1e-6); + // c should be almost equal to 3.93 + TS_ASSERT_DELTA(cellWs->cell(1, 1), 3.93, 1e-6); + + // Check number of peak parameters. + ITableWorkspace_sptr peakWs = + AnalysisDataService::Instance().retrieveWS( + "HCP_peaks"); + TS_ASSERT_EQUALS(peakWs->rowCount(), 5 * 3); // 5 functions with 3 params. + + AnalysisDataService::Instance().remove("HCP_output"); + AnalysisDataService::Instance().remove("HCP_peaks"); + AnalysisDataService::Instance().remove("HCP_cell"); + } + + void testFitOrthorhombicCelld() { + /* In analogy to the above example, an orthorhombic cell is fitted, + * this time in dSpacing and with a FlatBackground added. + */ + + ITableWorkspace_sptr hkls = getOrthorhombicTable(); + MatrixWorkspace_sptr ws = getWorkspace(getFunctionString(hkls, false), 1.5, + 2.1, 1000, "dSpacing"); + + IAlgorithm_sptr pFit = AlgorithmManager::Instance().create("PawleyFit"); + pFit->setProperty("InputWorkspace", ws); + pFit->setProperty("WorkspaceIndex", 0); + pFit->setProperty("CrystalSystem", "Orthorhombic"); + pFit->setProperty("InitialCell", "2.44 3.13 4.07 90 90 90"); + pFit->setProperty("PeakTable", hkls); + pFit->setProperty("EnableChebyshevBackground", true); + pFit->setProperty("ChebyshevBackgroundDegree", 0); + pFit->setProperty("OutputWorkspace", "OP_output"); + pFit->setProperty("RefinedPeakParameterTable", "OP_peaks"); + pFit->setProperty("RefinedCellTable", "OP_cell"); + + pFit->execute(); + + // Examine table with cell parameters. + ITableWorkspace_sptr cellWs = + AnalysisDataService::Instance().retrieveWS("OP_cell"); + + // Three rows (a, b, c, ZeroShift) + TS_ASSERT_EQUALS(cellWs->rowCount(), 4); + + // Error of 'a' should be small + TS_ASSERT_LESS_THAN(fabs(cellWs->cell(0, 2)), 1e-4); + // a should be almost equal to 2.45 + TS_ASSERT_DELTA(cellWs->cell(0, 1), 2.45, 2e-3); + + // Error of 'b' should also be small + TS_ASSERT_LESS_THAN(fabs(cellWs->cell(1, 2)), 1e-4); + // b should be almost equal to 3.12 + TS_ASSERT_DELTA(cellWs->cell(1, 1), 3.12, 2e-3); + + // Error of 'c' should also be small + TS_ASSERT_LESS_THAN(fabs(cellWs->cell(2, 2)), 1e-4); + // b should be almost equal to 4.06 + TS_ASSERT_DELTA(cellWs->cell(2, 1), 4.06, 2e-3); + + // Check number of peak parameters. + ITableWorkspace_sptr peakWs = + AnalysisDataService::Instance().retrieveWS("OP_peaks"); + TS_ASSERT_EQUALS(peakWs->rowCount(), 7 * 3); // 5 functions with 3 params. + + AnalysisDataService::Instance().remove("OP_output"); + AnalysisDataService::Instance().remove("OP_peaks"); + AnalysisDataService::Instance().remove("OP_cell"); + } + +private: + class TestablePawleyFit : public PawleyFit { + friend class PawleyFitTest; + + public: + TestablePawleyFit() : PawleyFit() {} + ~TestablePawleyFit() {} + }; + + ITableWorkspace_sptr getHCPTable() { + ITableWorkspace_sptr tableWs = WorkspaceFactory::Instance().createTable(); + tableWs->addColumn("V3D", "HKL"); + tableWs->addColumn("double", "d"); + tableWs->addColumn("double", "FWHM (rel.)"); + // Check that string columns are converted if they contain numbers + tableWs->addColumn("str", "Intensity"); + + TableRow row0 = tableWs->appendRow(); + row0 << V3D(0, 0, 2) << 1.965 << 0.004 << "3800.0"; + + TableRow row1 = tableWs->appendRow(); + row1 << V3D(1, 0, 1) << 1.867037 << 0.004 << "16400.0"; + TableRow row2 = tableWs->appendRow(); + row2 << V3D(1, 0, 2) << 1.441702 << 0.005 << "3700.0"; + TableRow row3 = tableWs->appendRow(); + row3 << V3D(1, 0, 3) << 1.114663 << 0.006 << "5900.0"; + TableRow row4 = tableWs->appendRow(); + row4 << V3D(2, -1, 0) << 1.225 << 0.004 << "5100.0"; + + return tableWs; + } + + ITableWorkspace_sptr getOrthorhombicTable() { + ITableWorkspace_sptr tableWs = WorkspaceFactory::Instance().createTable(); + tableWs->addColumn("V3D", "HKL"); + tableWs->addColumn("double", "d"); + tableWs->addColumn("double", "FWHM (rel.)"); + // Check that string columns are converted if they contain numbers + tableWs->addColumn("str", "Intensity"); + + TableRow row0 = tableWs->appendRow(); + row0 << V3D(0, 0, 2) << 2.03000 << 0.004 << "110.628118"; + + TableRow row1 = tableWs->appendRow(); + row1 << V3D(0, 1, 2) << 1.701542 << 0.0042 << "180.646775"; + + TableRow row2 = tableWs->appendRow(); + row2 << V3D(0, 2, 0) << 1.560000 << 0.00483 << "79.365613"; + + TableRow row3 = tableWs->appendRow(); + row3 << V3D(1, 0, 1) << 2.097660 << 0.0041 << "228.086161"; + + TableRow row4 = tableWs->appendRow(); + row4 << V3D(1, 0, 2) << 1.563144 << 0.004 << "159.249424"; + + TableRow row5 = tableWs->appendRow(); + row5 << V3D(1, 1, 0) << 1.926908 << 0.004 << "209.913635"; + + TableRow row6 = tableWs->appendRow(); + row6 << V3D(1, 1, 1) << 1.740797 << 0.00472 << "372.446264"; + + return tableWs; + } + + std::string getFunctionString(const ITableWorkspace_sptr &table, bool useQ) { + std::vector functionStrings; + + for (size_t i = 0; i < table->rowCount(); ++i) { + TableRow row = table->getRow(i); + std::ostringstream fn; + double d = row.Double(1); + double center = useQ ? (2.0 * M_PI) / d : d; + double fwhmAbs = row.Double(2) * center; + fn << "name=Gaussian,PeakCentre=" << center + << ",Sigma=" << fwhmAbs / (2.0 * sqrt(2.0 * log(2.0))) + << ",Height=" << row.String(3); + + functionStrings.push_back(fn.str()); + } + + return boost::join(functionStrings, ";"); + } + + MatrixWorkspace_sptr getWorkspace(const std::string &functionString, + double xMin, double xMax, size_t n, + const std::string &unit, double bg = 0.0) { + IFunction_sptr siFn = + FunctionFactory::Instance().createInitialized(functionString); + + auto ws = WorkspaceFactory::Instance().create("Workspace2D", 1, n, n); + + FunctionDomain1DVector xValues(xMin, xMax, n); + FunctionValues yValues(xValues); + std::vector eValues(n, 1.0); + + siFn->function(xValues, yValues); + + std::vector &xData = ws->dataX(0); + std::vector &yData = ws->dataY(0); + std::vector &eData = ws->dataE(0); + + for (size_t i = 0; i < n; ++i) { + xData[i] = xValues[i]; + yData[i] = yValues[i] + bg; + eData[i] = eValues[i]; + } + + WorkspaceCreationHelper::addNoise(ws, 0, -0.5, 0.5); + + ws->getAxis(0)->setUnit(unit); + + return ws; + } +}; + +#endif /* MANTID_CURVEFITTING_PAWLEYFITTEST_H_ */ diff --git a/Code/Mantid/Framework/CurveFitting/test/PawleyFunctionTest.h b/Code/Mantid/Framework/CurveFitting/test/PawleyFunctionTest.h new file mode 100644 index 000000000000..141f4d008e47 --- /dev/null +++ b/Code/Mantid/Framework/CurveFitting/test/PawleyFunctionTest.h @@ -0,0 +1,523 @@ +#ifndef MANTID_CURVEFITTING_PAWLEYFUNCTIONTEST_H_ +#define MANTID_CURVEFITTING_PAWLEYFUNCTIONTEST_H_ + +#include + +#include "MantidCurveFitting/PawleyFunction.h" +#include "MantidGeometry/Crystal/PointGroup.h" +#include "MantidAPI/AlgorithmManager.h" +#include "MantidAPI/FunctionFactory.h" +#include "MantidAPI/WorkspaceFactory.h" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" + +using namespace Mantid::CurveFitting; +using namespace Mantid::API; +using namespace Mantid::Geometry; +using namespace Mantid::Kernel; + +class PawleyFunctionTest : public CxxTest::TestSuite { +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static PawleyFunctionTest *createSuite() { return new PawleyFunctionTest(); } + static void destroySuite(PawleyFunctionTest *suite) { delete suite; } + + void testCrystalSystem() { + PawleyParameterFunction fn; + fn.initialize(); + + TS_ASSERT(fn.hasAttribute("CrystalSystem")); + + // Cubic, check case insensitivity + TS_ASSERT_THROWS_NOTHING(fn.setAttributeValue("CrystalSystem", "cubic")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Cubic); + TS_ASSERT_THROWS_NOTHING(fn.setAttributeValue("CrystalSystem", "Cubic")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Cubic); + TS_ASSERT_THROWS_NOTHING(fn.setAttributeValue("CrystalSystem", "CUBIC")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Cubic); + + // Tetragonal + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "tetragonal")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Tetragonal); + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "Tetragonal")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Tetragonal); + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "TETRAGONAL")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Tetragonal); + + // Hexagonal + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "hexagonal")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Hexagonal); + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "Hexagonal")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Hexagonal); + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "HEXAGONAL")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Hexagonal); + + // Orthorhombic + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "orthorhombic")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Orthorhombic); + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "Orthorhombic")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Orthorhombic); + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "ORTHORHOMBIC")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Orthorhombic); + + // Monoclinic + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "monoclinic")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Monoclinic); + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "Monoclinic")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Monoclinic); + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "MONOCLINIC")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Monoclinic); + + // Triclinic + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "triclinic")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Triclinic); + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "Triclinic")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Triclinic); + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("CrystalSystem", "TRICLINIC")); + TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::Triclinic); + + // invalid string + TS_ASSERT_THROWS(fn.setAttributeValue("CrystalSystem", "invalid"), + std::invalid_argument); + } + + void testCrystalSystemConstraintsCubic() { + PawleyParameterFunction fn; + fn.initialize(); + + fn.setAttributeValue("CrystalSystem", "Cubic"); + + TS_ASSERT_EQUALS(fn.nParams(), 2); + + fn.setParameter("a", 3.0); + TS_ASSERT_EQUALS(fn.getParameter("a"), 3.0); + + TS_ASSERT_THROWS(fn.getParameter("b"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("c"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Alpha"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Beta"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Gamma"), std::invalid_argument); + + UnitCell cell = fn.getUnitCellFromParameters(); + cellParametersAre(cell, 3.0, 3.0, 3.0, 90.0, 90.0, 90.0); + } + + void testCrystalSystemConstraintsTetragonal() { + PawleyParameterFunction fn; + fn.initialize(); + + fn.setAttributeValue("CrystalSystem", "Tetragonal"); + + TS_ASSERT_EQUALS(fn.nParams(), 3); + + fn.setParameter("a", 3.0); + TS_ASSERT_EQUALS(fn.getParameter("a"), 3.0); + fn.setParameter("c", 5.0); + TS_ASSERT_EQUALS(fn.getParameter("c"), 5.0); + + TS_ASSERT_THROWS(fn.getParameter("b"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Alpha"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Beta"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Gamma"), std::invalid_argument); + + UnitCell cell = fn.getUnitCellFromParameters(); + cellParametersAre(cell, 3.0, 3.0, 5.0, 90.0, 90.0, 90.0); + } + + void testCrystalSystemConstraintsHexagonal() { + PawleyParameterFunction fn; + fn.initialize(); + + fn.setAttributeValue("CrystalSystem", "Hexagonal"); + + TS_ASSERT_EQUALS(fn.nParams(), 3); + + fn.setParameter("a", 3.0); + TS_ASSERT_EQUALS(fn.getParameter("a"), 3.0); + fn.setParameter("c", 5.0); + TS_ASSERT_EQUALS(fn.getParameter("c"), 5.0); + + TS_ASSERT_THROWS(fn.getParameter("b"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Alpha"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Beta"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Gamma"), std::invalid_argument); + + UnitCell cell = fn.getUnitCellFromParameters(); + cellParametersAre(cell, 3.0, 3.0, 5.0, 90.0, 90.0, 120.0); + } + + void testCrystalSystemConstraintsTrigonal() { + PawleyParameterFunction fn; + fn.initialize(); + + fn.setAttributeValue("CrystalSystem", "Trigonal"); + + TS_ASSERT_EQUALS(fn.nParams(), 3); + + fn.setParameter("a", 3.0); + TS_ASSERT_EQUALS(fn.getParameter("a"), 3.0); + fn.setParameter("Alpha", 101.0); + TS_ASSERT_EQUALS(fn.getParameter("Alpha"), 101.0); + + TS_ASSERT_THROWS(fn.getParameter("b"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("c"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Beta"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Gamma"), std::invalid_argument); + + UnitCell cell = fn.getUnitCellFromParameters(); + cellParametersAre(cell, 3.0, 3.0, 3.0, 101.0, 101.0, 101.0); + } + + void testCrystalSystemConstraintsOrthorhombic() { + PawleyParameterFunction fn; + fn.initialize(); + + fn.setAttributeValue("CrystalSystem", "Orthorhombic"); + + TS_ASSERT_EQUALS(fn.nParams(), 4); + + fn.setParameter("a", 3.0); + TS_ASSERT_EQUALS(fn.getParameter("a"), 3.0); + fn.setParameter("b", 4.0); + TS_ASSERT_EQUALS(fn.getParameter("b"), 4.0); + fn.setParameter("c", 5.0); + TS_ASSERT_EQUALS(fn.getParameter("c"), 5.0); + + TS_ASSERT_THROWS(fn.getParameter("Alpha"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Beta"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Gamma"), std::invalid_argument); + + UnitCell cell = fn.getUnitCellFromParameters(); + cellParametersAre(cell, 3.0, 4.0, 5.0, 90.0, 90.0, 90.0); + } + + void testCrystalSystemConstraintsMonoclinic() { + PawleyParameterFunction fn; + fn.initialize(); + + fn.setAttributeValue("CrystalSystem", "Monoclinic"); + + TS_ASSERT_EQUALS(fn.nParams(), 5); + + fn.setParameter("a", 3.0); + TS_ASSERT_EQUALS(fn.getParameter("a"), 3.0); + fn.setParameter("b", 4.0); + TS_ASSERT_EQUALS(fn.getParameter("b"), 4.0); + fn.setParameter("c", 5.0); + TS_ASSERT_EQUALS(fn.getParameter("c"), 5.0); + fn.setParameter("Beta", 101.0); + TS_ASSERT_EQUALS(fn.getParameter("Beta"), 101.0); + + TS_ASSERT_THROWS(fn.getParameter("Alpha"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Gamma"), std::invalid_argument); + + UnitCell cell = fn.getUnitCellFromParameters(); + cellParametersAre(cell, 3.0, 4.0, 5.0, 90.0, 101.0, 90.0); + } + + void testCrystalSystemConstraintsTriclinic() { + PawleyParameterFunction fn; + fn.initialize(); + + fn.setAttributeValue("CrystalSystem", "Triclinic"); + + TS_ASSERT_EQUALS(fn.nParams(), 7); + + fn.setParameter("a", 3.0); + TS_ASSERT_EQUALS(fn.getParameter("a"), 3.0); + fn.setParameter("b", 4.0); + TS_ASSERT_EQUALS(fn.getParameter("b"), 4.0); + fn.setParameter("c", 5.0); + TS_ASSERT_EQUALS(fn.getParameter("c"), 5.0); + fn.setParameter("Alpha", 101.0); + TS_ASSERT_EQUALS(fn.getParameter("Alpha"), 101.0); + fn.setParameter("Beta", 111.0); + TS_ASSERT_EQUALS(fn.getParameter("Beta"), 111.0); + fn.setParameter("Gamma", 103.0); + TS_ASSERT_EQUALS(fn.getParameter("Gamma"), 103.0); + + UnitCell cell = fn.getUnitCellFromParameters(); + cellParametersAre(cell, 3.0, 4.0, 5.0, 101.0, 111.0, 103.0); + } + + void testSetParametersFromUnitCell() { + PawleyParameterFunction fn; + fn.initialize(); + + fn.setAttributeValue("CrystalSystem", "Triclinic"); + + UnitCell cell(3., 4., 5., 101., 111., 103.); + + TS_ASSERT_THROWS_NOTHING(fn.setParametersFromUnitCell(cell)); + + TS_ASSERT_EQUALS(fn.getParameter("a"), 3.0); + TS_ASSERT_EQUALS(fn.getParameter("b"), 4.0); + TS_ASSERT_EQUALS(fn.getParameter("c"), 5.0); + TS_ASSERT_EQUALS(fn.getParameter("Alpha"), 101.0); + TS_ASSERT_EQUALS(fn.getParameter("Beta"), 111.0); + TS_ASSERT_EQUALS(fn.getParameter("Gamma"), 103.0); + + fn.setAttributeValue("CrystalSystem", "Cubic"); + + cell.seta(5.43); + TS_ASSERT_THROWS_NOTHING(fn.setParametersFromUnitCell(cell)); + + TS_ASSERT_EQUALS(fn.getParameter("a"), 5.43); + } + + void testProfileFunctionName() { + PawleyParameterFunction fn; + fn.initialize(); + + TS_ASSERT_THROWS_NOTHING( + fn.setAttributeValue("ProfileFunction", "Gaussian")); + TS_ASSERT_EQUALS(fn.getProfileFunctionName(), "Gaussian"); + + // works only with IPeakFunctions + TS_ASSERT_THROWS(fn.setAttributeValue("ProfileFunction", "Chebyshev"), + std::invalid_argument); + + TS_ASSERT_THROWS(fn.setAttributeValue("ProfileFunction", "DoesNotExist"), + Exception::NotFoundError); + } + + void testPawleyFunctionInitialization() { + PawleyFunction fn; + fn.initialize(); + + TS_ASSERT(boost::dynamic_pointer_cast( + fn.getDecoratedFunction())); + + // The base parameters of PawleyParameterFunction + TS_ASSERT_EQUALS(fn.nParams(), 7); + } + + void testPawleyFunctionSetCrystalSystem() { + PawleyFunction fn; + fn.initialize(); + + TS_ASSERT_EQUALS(fn.nParams(), 7); + + fn.setCrystalSystem("Cubic"); + + TS_ASSERT_EQUALS(fn.nParams(), 2); + } + + void testPawleyFunctionAddPeak() { + PawleyFunction fn; + fn.initialize(); + TS_ASSERT_EQUALS(fn.getPeakCount(), 0); + + TS_ASSERT_EQUALS(fn.nParams(), 7); + + fn.addPeak(V3D(), 3.0, 4.0); + + TS_ASSERT_EQUALS(fn.nParams(), 10); + TS_ASSERT_EQUALS(fn.getPeakCount(), 1); + } + + void testPawleyFunctionClearPeaks() { + PawleyFunction fn; + fn.initialize(); + + fn.addPeak(V3D(), 3.0, 4.0); + TS_ASSERT_EQUALS(fn.getPeakCount(), 1); + TS_ASSERT_THROWS_NOTHING(fn.clearPeaks()); + TS_ASSERT_EQUALS(fn.getPeakCount(), 0); + } + + void testPawleyFunctionGetPeakHKL() { + PawleyFunction fn; + fn.initialize(); + + fn.addPeak(V3D(1, 1, 1), 3.0, 4.0); + TS_ASSERT_EQUALS(fn.getPeakCount(), 1); + TS_ASSERT_EQUALS(fn.getPeakHKL(0), V3D(1, 1, 1)); + } + + void testPawleyFunctionGetPeakFunction() { + PawleyFunction fn; + fn.initialize(); + + fn.addPeak(V3D(1, 1, 1), 3.0, 4.0); + TS_ASSERT_EQUALS(fn.getPeakCount(), 1); + + IPeakFunction_sptr peak = fn.getPeakFunction(0); + TS_ASSERT(peak); + TS_ASSERT_EQUALS(peak->fwhm(), 3.0); + TS_ASSERT_EQUALS(peak->height(), 4.0); + } + + void testPawleyFunctionSetProfileFunction() { + PawleyFunction fn; + fn.initialize(); + + TS_ASSERT_EQUALS(fn.nParams(), 7); + + fn.addPeak(V3D(), 3.0, 4.0); + + TS_ASSERT_EQUALS(fn.nParams(), 10); + + fn.setProfileFunction("PseudoVoigt"); + + TS_ASSERT_EQUALS(fn.nParams(), 11); + } + + void testPawleyFunctionGetParameterFunction() { + PawleyFunction fn; + fn.initialize(); + + TS_ASSERT(fn.getPawleyParameterFunction()); + } + + void testPawleyFunctionSetUnitCell() { + PawleyFunction fn; + fn.initialize(); + + TS_ASSERT_THROWS_NOTHING(fn.setUnitCell("1.0 2.0 3.0 90 91 92")); + + PawleyParameterFunction_sptr parameters = fn.getPawleyParameterFunction(); + TS_ASSERT_EQUALS(parameters->getParameter("a"), 1.0); + TS_ASSERT_EQUALS(parameters->getParameter("b"), 2.0); + TS_ASSERT_EQUALS(parameters->getParameter("c"), 3.0); + TS_ASSERT_EQUALS(parameters->getParameter("Alpha"), 90.0); + TS_ASSERT_EQUALS(parameters->getParameter("Beta"), 91.0); + TS_ASSERT_EQUALS(parameters->getParameter("Gamma"), 92.0); + + TS_ASSERT_THROWS_NOTHING(fn.setUnitCell("2.0 3.0 4.0")); + + TS_ASSERT_EQUALS(parameters->getParameter("a"), 2.0); + TS_ASSERT_EQUALS(parameters->getParameter("b"), 3.0); + TS_ASSERT_EQUALS(parameters->getParameter("c"), 4.0); + TS_ASSERT_EQUALS(parameters->getParameter("Alpha"), 90.0); + TS_ASSERT_EQUALS(parameters->getParameter("Beta"), 90.0); + TS_ASSERT_EQUALS(parameters->getParameter("Gamma"), 90.0); + } + + void testFunctionFitSi() { + /* This example generates a spectrum with the first two reflections + * of Silicon with lattice parameter a = 5.4311946 Angstr. + * hkl d height fwhm + * 1 1 1 3.13570 40.0 0.006 + * 2 2 0 1.92022 110.0 0.004 + */ + auto ws = getWorkspace( + "name=Gaussian,PeakCentre=3.13570166,Height=40.0,Sigma=0.003;name=" + "Gaussian,PeakCentre=1.92021727,Height=110.0,Sigma=0.002", + 1.85, 3.2, 400); + + PawleyFunction_sptr pawleyFn = boost::make_shared(); + pawleyFn->initialize(); + pawleyFn->setCrystalSystem("Cubic"); + pawleyFn->addPeak(V3D(1, 1, 1), 0.0065, 35.0); + pawleyFn->addPeak(V3D(2, 2, 0), 0.0045, 110.0); + pawleyFn->setUnitCell("5.4295 5.4295 5.4295"); + + // fix ZeroShift + pawleyFn->fix(pawleyFn->parameterIndex("f0.ZeroShift")); + + IAlgorithm_sptr fit = AlgorithmManager::Instance().create("Fit"); + fit->setProperty("Function", + boost::dynamic_pointer_cast(pawleyFn)); + fit->setProperty("InputWorkspace", ws); + fit->execute(); + + PawleyParameterFunction_sptr parameters = + pawleyFn->getPawleyParameterFunction(); + + TS_ASSERT_DELTA(parameters->getParameter("a"), 5.4311946, 1e-6); + } + + void testFunctionFitSiZeroShift() { + /* This example generates a spectrum with the first three reflections + * of Silicon with lattice parameter a = 5.4311946 Angstr. + * hkl d height ca. fwhm + * 1 1 1 3.13570 40.0 0.006 + * 2 2 0 1.92022 110.0 0.004 + * 3 1 1 1.63757 101.0 0.003 + */ + auto ws = getWorkspace( + "name=Gaussian,PeakCentre=3.13870166,Height=40.0,Sigma=0.003;name=" + "Gaussian,PeakCentre=1.92321727,Height=110.0,Sigma=0.002;name=Gaussian," + "PeakCentre=1.6405667,Height=105.0,Sigma=0.0016", + 1.6, 3.2, 800); + + PawleyFunction_sptr pawleyFn = boost::make_shared(); + pawleyFn->initialize(); + pawleyFn->setCrystalSystem("Cubic"); + pawleyFn->addPeak(V3D(1, 1, 1), 0.0065, 35.0); + pawleyFn->addPeak(V3D(2, 2, 0), 0.0045, 115.0); + pawleyFn->addPeak(V3D(3, 1, 1), 0.0035, 115.0); + pawleyFn->setUnitCell("5.433 5.433 5.433"); + pawleyFn->setParameter("f0.ZeroShift", 0.001); + + IAlgorithm_sptr fit = AlgorithmManager::Instance().create("Fit"); + fit->setProperty("Function", + boost::dynamic_pointer_cast(pawleyFn)); + fit->setProperty("InputWorkspace", ws); + fit->execute(); + + PawleyParameterFunction_sptr parameters = + pawleyFn->getPawleyParameterFunction(); + + TS_ASSERT_DELTA(parameters->getParameter("a"), 5.4311946, 1e-5); + TS_ASSERT_DELTA(parameters->getParameter("ZeroShift"), 0.003, 1e-4); + } + +private: + MatrixWorkspace_sptr getWorkspace(const std::string &functionString, + double xMin, double xMax, size_t n) { + IFunction_sptr siFn = + FunctionFactory::Instance().createInitialized(functionString); + + auto ws = WorkspaceFactory::Instance().create("Workspace2D", 1, n, n); + + FunctionDomain1DVector xValues(xMin, xMax, n); + FunctionValues yValues(xValues); + std::vector eValues(n, 1.0); + + siFn->function(xValues, yValues); + + std::vector &xData = ws->dataX(0); + std::vector &yData = ws->dataY(0); + std::vector &eData = ws->dataE(0); + + for (size_t i = 0; i < n; ++i) { + xData[i] = xValues[i]; + yData[i] = yValues[i]; + eData[i] = eValues[i]; + } + + WorkspaceCreationHelper::addNoise(ws, 0, -0.1, 0.1); + + return ws; + } + + void cellParametersAre(const UnitCell &cell, double a, double b, double c, + double alpha, double beta, double gamma) { + TS_ASSERT_DELTA(cell.a(), a, 1e-9); + TS_ASSERT_DELTA(cell.b(), b, 1e-9); + TS_ASSERT_DELTA(cell.c(), c, 1e-9); + + TS_ASSERT_DELTA(cell.alpha(), alpha, 1e-9); + TS_ASSERT_DELTA(cell.beta(), beta, 1e-9); + TS_ASSERT_DELTA(cell.gamma(), gamma, 1e-9); + } +}; + +#endif /* MANTID_CURVEFITTING_PAWLEYFUNCTIONTEST_H_ */ diff --git a/Code/Mantid/Framework/CurveFitting/test/ProductFunctionTest.h b/Code/Mantid/Framework/CurveFitting/test/ProductFunctionTest.h index 3232dc248cbc..22833a6a4bf1 100644 --- a/Code/Mantid/Framework/CurveFitting/test/ProductFunctionTest.h +++ b/Code/Mantid/Framework/CurveFitting/test/ProductFunctionTest.h @@ -121,8 +121,8 @@ class ProductFunctionMWTest_Linear: public Mantid::API::ParamFunction, public Ma }; -DECLARE_FUNCTION(ProductFunctionMWTest_Gauss); -DECLARE_FUNCTION(ProductFunctionMWTest_Linear); +DECLARE_FUNCTION(ProductFunctionMWTest_Gauss) +DECLARE_FUNCTION(ProductFunctionMWTest_Linear) class ProductFunctionTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/CurveFitting/test/ResolutionTest.h b/Code/Mantid/Framework/CurveFitting/test/ResolutionTest.h index ea03a3aa0123..e4df7ce1a5ca 100644 --- a/Code/Mantid/Framework/CurveFitting/test/ResolutionTest.h +++ b/Code/Mantid/Framework/CurveFitting/test/ResolutionTest.h @@ -99,7 +99,7 @@ class ResolutionTest_Jacobian: public Jacobian } }; -DECLARE_FUNCTION(ResolutionTest_Gauss); +DECLARE_FUNCTION(ResolutionTest_Gauss) class ResolutionTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/ISISRunLogs.h b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/ISISRunLogs.h index f1e2f3064e39..a939a0aa63dc 100644 --- a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/ISISRunLogs.h +++ b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/ISISRunLogs.h @@ -54,7 +54,7 @@ class DLLExport ISISRunLogs { void addPeriodLogs(const int period, API::Run &exptRun); private: - DISABLE_DEFAULT_CONSTRUCT(ISISRunLogs); + DISABLE_DEFAULT_CONSTRUCT(ISISRunLogs) /// A LogParser object boost::scoped_ptr m_logParser; diff --git a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadSINQFocus.h b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadSINQFocus.h index caa363519fdd..10e6588a8a0d 100644 --- a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadSINQFocus.h +++ b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadSINQFocus.h @@ -77,7 +77,6 @@ class DLLExport LoadSINQFocus std::vector m_supportedInstruments; std::string m_instrumentName; std::string m_instrumentPath; - ; API::MatrixWorkspace_sptr m_localWorkspace; size_t m_numberOfTubes; // number of tubes - X size_t m_numberOfPixelsPerTube; // number of pixels per tube - Y diff --git a/Code/Mantid/Framework/DataHandling/src/CreateChopperModel.cpp b/Code/Mantid/Framework/DataHandling/src/CreateChopperModel.cpp index b3284c6ee7f1..48274f1aa5f6 100644 --- a/Code/Mantid/Framework/DataHandling/src/CreateChopperModel.cpp +++ b/Code/Mantid/Framework/DataHandling/src/CreateChopperModel.cpp @@ -7,7 +7,7 @@ namespace Mantid { namespace DataHandling { // Register the algorithm into the AlgorithmFactory -DECLARE_ALGORITHM(CreateChopperModel); +DECLARE_ALGORITHM(CreateChopperModel) using Kernel::Direction; using API::WorkspaceProperty; @@ -21,10 +21,10 @@ using Kernel::MandatoryValidator; /// Algorithm's name for identification. @see Algorithm::name const std::string CreateChopperModel::name() const { return "CreateChopperModel"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int CreateChopperModel::version() const { return 1; }; +int CreateChopperModel::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string CreateChopperModel::category() const { diff --git a/Code/Mantid/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp b/Code/Mantid/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp index d19f7f04c25a..49ef716f071d 100644 --- a/Code/Mantid/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp +++ b/Code/Mantid/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp @@ -57,10 +57,10 @@ CreateChunkingFromInstrument::~CreateChunkingFromInstrument() {} /// Algorithm's name for identification. @see Algorithm::name const string CreateChunkingFromInstrument::name() const { return "CreateChunkingFromInstrument"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int CreateChunkingFromInstrument::version() const { return 1; }; +int CreateChunkingFromInstrument::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const string CreateChunkingFromInstrument::category() const { diff --git a/Code/Mantid/Framework/DataHandling/src/CreateModeratorModel.cpp b/Code/Mantid/Framework/DataHandling/src/CreateModeratorModel.cpp index a1f51bbddd71..d2008b1d47e5 100644 --- a/Code/Mantid/Framework/DataHandling/src/CreateModeratorModel.cpp +++ b/Code/Mantid/Framework/DataHandling/src/CreateModeratorModel.cpp @@ -19,10 +19,10 @@ DECLARE_ALGORITHM(CreateModeratorModel) /// Algorithm's name for identification. @see Algorithm::name const std::string CreateModeratorModel::name() const { return "CreateModeratorModel"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int CreateModeratorModel::version() const { return 1; }; +int CreateModeratorModel::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string CreateModeratorModel::category() const { diff --git a/Code/Mantid/Framework/DataHandling/src/CreateSimulationWorkspace.cpp b/Code/Mantid/Framework/DataHandling/src/CreateSimulationWorkspace.cpp index 3652a1d48ce0..512b02efd72c 100644 --- a/Code/Mantid/Framework/DataHandling/src/CreateSimulationWorkspace.cpp +++ b/Code/Mantid/Framework/DataHandling/src/CreateSimulationWorkspace.cpp @@ -19,7 +19,7 @@ namespace Mantid { namespace DataHandling { // Register the algorithm into the AlgorithmFactory -DECLARE_ALGORITHM(CreateSimulationWorkspace); +DECLARE_ALGORITHM(CreateSimulationWorkspace) using namespace API; @@ -27,10 +27,10 @@ using namespace API; /// Algorithm's name for identification. @see Algorithm::name const std::string CreateSimulationWorkspace::name() const { return "CreateSimulationWorkspace"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int CreateSimulationWorkspace::version() const { return 1; }; +int CreateSimulationWorkspace::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string CreateSimulationWorkspace::category() const { diff --git a/Code/Mantid/Framework/DataHandling/src/DeleteTableRows.cpp b/Code/Mantid/Framework/DataHandling/src/DeleteTableRows.cpp index 84502532b0a1..3a9b1c3bbb4c 100644 --- a/Code/Mantid/Framework/DataHandling/src/DeleteTableRows.cpp +++ b/Code/Mantid/Framework/DataHandling/src/DeleteTableRows.cpp @@ -13,7 +13,7 @@ namespace Mantid { namespace DataHandling { // Register the algorithm into the algorithm factory -DECLARE_ALGORITHM(DeleteTableRows); +DECLARE_ALGORITHM(DeleteTableRows) using namespace Kernel; using namespace API; diff --git a/Code/Mantid/Framework/DataHandling/src/ExtractMonitorWorkspace.cpp b/Code/Mantid/Framework/DataHandling/src/ExtractMonitorWorkspace.cpp index ca9a49e80fee..3461ebea7d90 100644 --- a/Code/Mantid/Framework/DataHandling/src/ExtractMonitorWorkspace.cpp +++ b/Code/Mantid/Framework/DataHandling/src/ExtractMonitorWorkspace.cpp @@ -15,10 +15,10 @@ ExtractMonitorWorkspace::~ExtractMonitorWorkspace() {} /// Algorithm's name for identification. @see Algorithm::name const std::string ExtractMonitorWorkspace::name() const { return "ExtractMonitorWorkspace"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int ExtractMonitorWorkspace::version() const { return 1; }; +int ExtractMonitorWorkspace::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ExtractMonitorWorkspace::category() const { diff --git a/Code/Mantid/Framework/DataHandling/src/FindDetectorsPar.cpp b/Code/Mantid/Framework/DataHandling/src/FindDetectorsPar.cpp index a0babedbc04b..0a01cab4a09f 100644 --- a/Code/Mantid/Framework/DataHandling/src/FindDetectorsPar.cpp +++ b/Code/Mantid/Framework/DataHandling/src/FindDetectorsPar.cpp @@ -23,8 +23,8 @@ DECLARE_ALGORITHM(FindDetectorsPar) using namespace Kernel; using namespace API; // nothing here according to mantid -FindDetectorsPar::FindDetectorsPar() : m_SizesAreLinear(false){}; -FindDetectorsPar::~FindDetectorsPar(){}; +FindDetectorsPar::FindDetectorsPar() : m_SizesAreLinear(false){} +FindDetectorsPar::~FindDetectorsPar(){} void FindDetectorsPar::init() { auto wsValidator = boost::make_shared(); diff --git a/Code/Mantid/Framework/DataHandling/src/ISISDataArchive.cpp b/Code/Mantid/Framework/DataHandling/src/ISISDataArchive.cpp index df3faa501c68..4e5f2d69d3f2 100644 --- a/Code/Mantid/Framework/DataHandling/src/ISISDataArchive.cpp +++ b/Code/Mantid/Framework/DataHandling/src/ISISDataArchive.cpp @@ -21,7 +21,7 @@ namespace { Kernel::Logger g_log("ISISDataArchive"); } -DECLARE_ARCHIVESEARCH(ISISDataArchive, ISISDataSearch); +DECLARE_ARCHIVESEARCH(ISISDataArchive, ISISDataSearch) namespace { #ifdef _WIN32 diff --git a/Code/Mantid/Framework/DataHandling/src/Load.cpp b/Code/Mantid/Framework/DataHandling/src/Load.cpp index 9ca1b7ac270d..cc23bd0ae14b 100644 --- a/Code/Mantid/Framework/DataHandling/src/Load.cpp +++ b/Code/Mantid/Framework/DataHandling/src/Load.cpp @@ -85,7 +85,7 @@ flattenVecOfVec(std::vector> vecOfVec) { namespace Mantid { namespace DataHandling { // Register the algorithm into the algorithm factory -DECLARE_ALGORITHM(Load); +DECLARE_ALGORITHM(Load) // The mutex Poco::Mutex Load::m_mutex; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadAscii.cpp b/Code/Mantid/Framework/DataHandling/src/LoadAscii.cpp index 6beb06f3fbfb..747bd5422b98 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadAscii.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadAscii.cpp @@ -18,7 +18,7 @@ namespace Mantid { namespace DataHandling { -DECLARE_FILELOADER_ALGORITHM(LoadAscii); +DECLARE_FILELOADER_ALGORITHM(LoadAscii) using namespace Kernel; using namespace API; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadAscii2.cpp b/Code/Mantid/Framework/DataHandling/src/LoadAscii2.cpp index 37dc4a4e6436..3d603570fc4d 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadAscii2.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadAscii2.cpp @@ -19,7 +19,7 @@ namespace Mantid { namespace DataHandling { -DECLARE_FILELOADER_ALGORITHM(LoadAscii2); +DECLARE_FILELOADER_ALGORITHM(LoadAscii2) using namespace Kernel; using namespace API; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp b/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp index 6794b27e1190..daddef4a35dc 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadBBY.cpp @@ -14,7 +14,7 @@ namespace Mantid { namespace DataHandling { // register the algorithm into the AlgorithmFactory -DECLARE_FILELOADER_ALGORITHM(LoadBBY); +DECLARE_FILELOADER_ALGORITHM(LoadBBY) // consts static const size_t HISTO_BINS_X = 240; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadCanSAS1D.cpp b/Code/Mantid/Framework/DataHandling/src/LoadCanSAS1D.cpp index 1d07a5bb7525..b30663623408 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadCanSAS1D.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadCanSAS1D.cpp @@ -35,7 +35,7 @@ using namespace Mantid::DataObjects; namespace Mantid { namespace DataHandling { -DECLARE_FILELOADER_ALGORITHM(LoadCanSAS1D); +DECLARE_FILELOADER_ALGORITHM(LoadCanSAS1D) /// constructor LoadCanSAS1D::LoadCanSAS1D() : m_groupNumber(0) {} diff --git a/Code/Mantid/Framework/DataHandling/src/LoadCanSAS1D2.cpp b/Code/Mantid/Framework/DataHandling/src/LoadCanSAS1D2.cpp index 7dff9888a52e..378569dbbbb0 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadCanSAS1D2.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadCanSAS1D2.cpp @@ -33,7 +33,7 @@ using namespace Mantid::DataObjects; namespace Mantid { namespace DataHandling { -DECLARE_FILELOADER_ALGORITHM(LoadCanSAS1D2); +DECLARE_FILELOADER_ALGORITHM(LoadCanSAS1D2) /// constructor LoadCanSAS1D2::LoadCanSAS1D2() : LoadCanSAS1D() {} diff --git a/Code/Mantid/Framework/DataHandling/src/LoadDaveGrp.cpp b/Code/Mantid/Framework/DataHandling/src/LoadDaveGrp.cpp index 8ceabc67d964..45ddef1b6dcf 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadDaveGrp.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadDaveGrp.cpp @@ -12,7 +12,7 @@ namespace Mantid { namespace DataHandling { -DECLARE_FILELOADER_ALGORITHM(LoadDaveGrp); +DECLARE_FILELOADER_ALGORITHM(LoadDaveGrp) LoadDaveGrp::LoadDaveGrp() : ifile(), line(), nGroups(0), xLength(0) {} diff --git a/Code/Mantid/Framework/DataHandling/src/LoadEventPreNexus.cpp b/Code/Mantid/Framework/DataHandling/src/LoadEventPreNexus.cpp index d8d0ab699c66..6fa76790f671 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadEventPreNexus.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadEventPreNexus.cpp @@ -36,7 +36,7 @@ namespace Mantid { namespace DataHandling { -DECLARE_FILELOADER_ALGORITHM(LoadEventPreNexus); +DECLARE_FILELOADER_ALGORITHM(LoadEventPreNexus) using namespace Kernel; using namespace API; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadFITS.cpp b/Code/Mantid/Framework/DataHandling/src/LoadFITS.cpp index 5d21f759abc3..86df82bf489c 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadFITS.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadFITS.cpp @@ -38,7 +38,7 @@ bool IsNotFits(std::string s) { namespace Mantid { namespace DataHandling { // Register the algorithm into the AlgorithmFactory -DECLARE_FILELOADER_ALGORITHM(LoadFITS); +DECLARE_FILELOADER_ALGORITHM(LoadFITS) /** * Constructor. Just initialize everything to prevent issues. diff --git a/Code/Mantid/Framework/DataHandling/src/LoadILL.cpp b/Code/Mantid/Framework/DataHandling/src/LoadILL.cpp index 783927212fdd..0f84c252a6f8 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadILL.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadILL.cpp @@ -25,7 +25,7 @@ using namespace Kernel; using namespace API; using namespace NeXus; -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadILL); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadILL) //--------------------------------------------------- // Private member functions diff --git a/Code/Mantid/Framework/DataHandling/src/LoadILLIndirect.cpp b/Code/Mantid/Framework/DataHandling/src/LoadILLIndirect.cpp index 8309a686e68a..37e810ffae28 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadILLIndirect.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadILLIndirect.cpp @@ -18,7 +18,7 @@ using namespace API; using namespace NeXus; // Register the algorithm into the AlgorithmFactory -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadILLIndirect); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadILLIndirect) //---------------------------------------------------------------------------------------------- /** Constructor @@ -37,10 +37,10 @@ LoadILLIndirect::~LoadILLIndirect() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string LoadILLIndirect::name() const { return "LoadILLIndirect"; }; +const std::string LoadILLIndirect::name() const { return "LoadILLIndirect"; } /// Algorithm's version for identification. @see Algorithm::version -int LoadILLIndirect::version() const { return 1; }; +int LoadILLIndirect::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string LoadILLIndirect::category() const { return "DataHandling"; } diff --git a/Code/Mantid/Framework/DataHandling/src/LoadILLReflectometry.cpp b/Code/Mantid/Framework/DataHandling/src/LoadILLReflectometry.cpp index 331795f61c3f..739c5f9a6f6c 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadILLReflectometry.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadILLReflectometry.cpp @@ -23,7 +23,7 @@ using namespace API; using namespace NeXus; // Register the algorithm into the AlgorithmFactory -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadILLReflectometry); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadILLReflectometry) //---------------------------------------------------------------------------------------------- /** Constructor @@ -47,10 +47,10 @@ LoadILLReflectometry::~LoadILLReflectometry() {} /// Algorithm's name for identification. @see Algorithm::name const std::string LoadILLReflectometry::name() const { return "LoadILLReflectometry"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int LoadILLReflectometry::version() const { return 1; }; +int LoadILLReflectometry::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string LoadILLReflectometry::category() const { diff --git a/Code/Mantid/Framework/DataHandling/src/LoadILLSANS.cpp b/Code/Mantid/Framework/DataHandling/src/LoadILLSANS.cpp index 6c3b96b5807b..b29c361ef19f 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadILLSANS.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadILLSANS.cpp @@ -30,10 +30,10 @@ LoadILLSANS::~LoadILLSANS() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string LoadILLSANS::name() const { return "LoadILLSANS"; }; +const std::string LoadILLSANS::name() const { return "LoadILLSANS"; } /// Algorithm's version for identification. @see Algorithm::version -int LoadILLSANS::version() const { return 1; }; +int LoadILLSANS::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string LoadILLSANS::category() const { return "DataHandling"; } diff --git a/Code/Mantid/Framework/DataHandling/src/LoadISISNexus2.cpp b/Code/Mantid/Framework/DataHandling/src/LoadISISNexus2.cpp index ca7d7a0dcf2b..9df850ea0981 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadISISNexus2.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadISISNexus2.cpp @@ -9,7 +9,7 @@ #include "MantidKernel/BoundedValidator.h" #include "MantidKernel/ConfigService.h" #include "MantidKernel/ListValidator.h" -#include "MantidKernel/LogParser.h" +//#include "MantidKernel/LogParser.h" #include "MantidKernel/LogFilter.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidKernel/UnitFactory.h" @@ -38,7 +38,7 @@ namespace Mantid { namespace DataHandling { -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadISISNexus2); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadISISNexus2) using namespace Kernel; using namespace API; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadLLB.cpp b/Code/Mantid/Framework/DataHandling/src/LoadLLB.cpp index b6fa8df3d966..ab280168840e 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadLLB.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadLLB.cpp @@ -18,7 +18,7 @@ using namespace Kernel; using namespace API; using namespace NeXus; -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadLLB); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadLLB) //---------------------------------------------------------------------------------------------- /** Constructor @@ -36,10 +36,10 @@ LoadLLB::~LoadLLB() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string LoadLLB::name() const { return "LoadLLB"; }; +const std::string LoadLLB::name() const { return "LoadLLB"; } /// Algorithm's version for identification. @see Algorithm::version -int LoadLLB::version() const { return 1; }; +int LoadLLB::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string LoadLLB::category() const { return "DataHandling"; } diff --git a/Code/Mantid/Framework/DataHandling/src/LoadMask.cpp b/Code/Mantid/Framework/DataHandling/src/LoadMask.cpp index 18b3017942cc..732ae455b6e9 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadMask.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadMask.cpp @@ -833,8 +833,9 @@ void LoadMask::parseISISStringToVector(string ins, /** Initialize the Mask Workspace with instrument */ void LoadMask::intializeMaskWorkspace() { + const bool ignoreDirs(true); const std::string idfPath = - API::FileFinder::Instance().getFullPath(m_instrumentPropValue); + API::FileFinder::Instance().getFullPath(m_instrumentPropValue, ignoreDirs); MatrixWorkspace_sptr tempWs(new DataObjects::Workspace2D()); diff --git a/Code/Mantid/Framework/DataHandling/src/LoadMcStas.cpp b/Code/Mantid/Framework/DataHandling/src/LoadMcStas.cpp index 027c60f08be6..26c18005d880 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadMcStas.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadMcStas.cpp @@ -24,7 +24,7 @@ using namespace API; using namespace DataObjects; // Register the algorithm into the AlgorithmFactory -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadMcStas); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadMcStas) //---------------------------------------------------------------------------------------------- /** Constructor @@ -38,10 +38,10 @@ LoadMcStas::~LoadMcStas() {} //---------------------------------------------------------------------------------------------- // Algorithm's name for identification. @see Algorithm::name -const std::string LoadMcStas::name() const { return "LoadMcStas"; }; +const std::string LoadMcStas::name() const { return "LoadMcStas"; } // Algorithm's version for identification. @see Algorithm::version -int LoadMcStas::version() const { return 1; }; +int LoadMcStas::version() const { return 1; } // Algorithm's category for identification. @see Algorithm::category const std::string LoadMcStas::category() const { return "DataHandling"; } diff --git a/Code/Mantid/Framework/DataHandling/src/LoadMcStasNexus.cpp b/Code/Mantid/Framework/DataHandling/src/LoadMcStasNexus.cpp index ca5c88515d92..b9d6986d76df 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadMcStasNexus.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadMcStasNexus.cpp @@ -15,7 +15,7 @@ namespace DataHandling { using namespace Kernel; using namespace API; -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadMcStasNexus); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadMcStasNexus) //---------------------------------------------------------------------------------------------- /** Constructor @@ -29,10 +29,10 @@ LoadMcStasNexus::~LoadMcStasNexus() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string LoadMcStasNexus::name() const { return "LoadMcStasNexus"; }; +const std::string LoadMcStasNexus::name() const { return "LoadMcStasNexus"; } /// Algorithm's version for identification. @see Algorithm::version -int LoadMcStasNexus::version() const { return 1; }; +int LoadMcStasNexus::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string LoadMcStasNexus::category() const { return "DataHandling"; } diff --git a/Code/Mantid/Framework/DataHandling/src/LoadMuonLog.cpp b/Code/Mantid/Framework/DataHandling/src/LoadMuonLog.cpp index efcf09a27060..2cb1e7f47756 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadMuonLog.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadMuonLog.cpp @@ -6,7 +6,7 @@ #include "MantidKernel/TimeSeriesProperty.h" #include "MantidAPI/FileProperty.h" #include "MantidDataObjects/Workspace2D.h" -#include "MantidKernel/LogParser.h" +//#include "MantidKernel/LogParser.h" #include diff --git a/Code/Mantid/Framework/DataHandling/src/LoadMuonNexus1.cpp b/Code/Mantid/Framework/DataHandling/src/LoadMuonNexus1.cpp index 7a71f4f24f5d..6f59be7278a4 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadMuonNexus1.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadMuonNexus1.cpp @@ -30,7 +30,7 @@ namespace DataHandling { using namespace DataObjects; // Register the algorithm into the algorithm factory -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadMuonNexus1); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadMuonNexus1) using namespace Kernel; using namespace API; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadMuonNexus2.cpp b/Code/Mantid/Framework/DataHandling/src/LoadMuonNexus2.cpp index d3876404a283..a885a97ada66 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadMuonNexus2.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadMuonNexus2.cpp @@ -27,7 +27,7 @@ namespace Mantid { namespace DataHandling { // Register the algorithm into the algorithm factory -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadMuonNexus2); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadMuonNexus2) using namespace Kernel; using namespace API; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadNXSPE.cpp b/Code/Mantid/Framework/DataHandling/src/LoadNXSPE.cpp index 5c5b4dc64163..e9da8a302a8c 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadNXSPE.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadNXSPE.cpp @@ -22,7 +22,7 @@ namespace Mantid { namespace DataHandling { -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadNXSPE); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadNXSPE) using namespace Mantid::Kernel; using namespace Mantid::API; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadNexusLogs.cpp b/Code/Mantid/Framework/DataHandling/src/LoadNexusLogs.cpp index ebbde7d28c0d..a2c2054368e6 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadNexusLogs.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadNexusLogs.cpp @@ -4,7 +4,7 @@ #include "MantidDataHandling/LoadNexusLogs.h" #include #include "MantidKernel/TimeSeriesProperty.h" -#include "MantidKernel/LogParser.h" +//#include "MantidKernel/LogParser.h" #include "MantidAPI/FileProperty.h" #include diff --git a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp index ffbfaac2167d..21f97ef9eb2d 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -43,7 +43,7 @@ namespace Mantid { namespace DataHandling { // Register the algorithm into the algorithm factory -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadNexusProcessed); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadNexusProcessed) using namespace Mantid::NeXus; using namespace DataObjects; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadPDFgetNFile.cpp b/Code/Mantid/Framework/DataHandling/src/LoadPDFgetNFile.cpp index a0f89f596194..108723a73f57 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadPDFgetNFile.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadPDFgetNFile.cpp @@ -25,7 +25,7 @@ using namespace boost; namespace Mantid { namespace DataHandling { -DECLARE_FILELOADER_ALGORITHM(LoadPDFgetNFile); +DECLARE_FILELOADER_ALGORITHM(LoadPDFgetNFile) //---------------------------------------------------------------------------------------------- /** Constructor diff --git a/Code/Mantid/Framework/DataHandling/src/LoadPreNexus.cpp b/Code/Mantid/Framework/DataHandling/src/LoadPreNexus.cpp index 55090665c093..4d0766518532 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadPreNexus.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadPreNexus.cpp @@ -31,7 +31,7 @@ using std::vector; namespace Mantid { namespace DataHandling { -DECLARE_FILELOADER_ALGORITHM(LoadPreNexus); +DECLARE_FILELOADER_ALGORITHM(LoadPreNexus) static const string RUNINFO_PARAM("Filename"); static const string MAP_PARAM("MappingFilename"); diff --git a/Code/Mantid/Framework/DataHandling/src/LoadQKK.cpp b/Code/Mantid/Framework/DataHandling/src/LoadQKK.cpp index cee4c47b1cd1..859b592c087d 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadQKK.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadQKK.cpp @@ -26,7 +26,7 @@ namespace Mantid { namespace DataHandling { // Register the algorithm into the AlgorithmFactory -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadQKK); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadQKK) /** * Return the confidence with with this algorithm can load the file diff --git a/Code/Mantid/Framework/DataHandling/src/LoadRKH.cpp b/Code/Mantid/Framework/DataHandling/src/LoadRKH.cpp index 453b4745c08f..6ee8786c72d6 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadRKH.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadRKH.cpp @@ -24,7 +24,7 @@ namespace DataHandling { using namespace Mantid::API; using namespace Mantid::Kernel; -DECLARE_FILELOADER_ALGORITHM(LoadRKH); +DECLARE_FILELOADER_ALGORITHM(LoadRKH) /** * Return the confidence with with this algorithm can load the file diff --git a/Code/Mantid/Framework/DataHandling/src/LoadRaw3.cpp b/Code/Mantid/Framework/DataHandling/src/LoadRaw3.cpp index 421add0dc041..9d95242111e2 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadRaw3.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadRaw3.cpp @@ -24,7 +24,7 @@ namespace Mantid { namespace DataHandling { -DECLARE_FILELOADER_ALGORITHM(LoadRaw3); +DECLARE_FILELOADER_ALGORITHM(LoadRaw3) using namespace Kernel; using namespace API; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadRawHelper.cpp b/Code/Mantid/Framework/DataHandling/src/LoadRawHelper.cpp index 7be90aaaf9eb..cd4c235958d1 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadRawHelper.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadRawHelper.cpp @@ -1197,13 +1197,15 @@ LoadRawHelper::searchForLogFiles(const std::string &pathToRawFile) { try { Kernel::Glob::glob(Poco::Path(dir).resolve(pattern), potentialLogFiles); - // push potential log files from set to list. - potentialLogFilesList.insert(potentialLogFilesList.begin(), - potentialLogFiles.begin(), - potentialLogFiles.end()); } catch (std::exception &) { } } + + // push potential log files from set to list. + potentialLogFilesList.insert(potentialLogFilesList.begin(), + potentialLogFiles.begin(), + potentialLogFiles.end()); + // Remove extension from path, and append .log to path. std::string logName = pathToRawFile.substr(0, pathToRawFile.rfind('.')) + ".log"; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadReflTBL.cpp b/Code/Mantid/Framework/DataHandling/src/LoadReflTBL.cpp index bdbd87357b83..31c713233a6b 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadReflTBL.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadReflTBL.cpp @@ -15,7 +15,7 @@ namespace Mantid { namespace DataHandling { -DECLARE_FILELOADER_ALGORITHM(LoadReflTBL); +DECLARE_FILELOADER_ALGORITHM(LoadReflTBL) using namespace Kernel; using namespace API; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadSINQFocus.cpp b/Code/Mantid/Framework/DataHandling/src/LoadSINQFocus.cpp index 482729016aae..c06cdf04b68c 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadSINQFocus.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadSINQFocus.cpp @@ -18,7 +18,7 @@ using namespace Kernel; using namespace API; using namespace NeXus; -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadSINQFocus); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadSINQFocus) //---------------------------------------------------------------------------------------------- /** Constructor @@ -38,10 +38,10 @@ LoadSINQFocus::~LoadSINQFocus() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string LoadSINQFocus::name() const { return "LoadSINQFocus"; }; +const std::string LoadSINQFocus::name() const { return "LoadSINQFocus"; } /// Algorithm's version for identification. @see Algorithm::version -int LoadSINQFocus::version() const { return 1; }; +int LoadSINQFocus::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string LoadSINQFocus::category() const { return "DataHandling"; } diff --git a/Code/Mantid/Framework/DataHandling/src/LoadSNSspec.cpp b/Code/Mantid/Framework/DataHandling/src/LoadSNSspec.cpp index a1c3ffd90e60..bbef0ccaf558 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadSNSspec.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadSNSspec.cpp @@ -13,7 +13,7 @@ namespace Mantid { namespace DataHandling { -DECLARE_FILELOADER_ALGORITHM(LoadSNSspec); +DECLARE_FILELOADER_ALGORITHM(LoadSNSspec) /** * Return the confidence with with this algorithm can load the file diff --git a/Code/Mantid/Framework/DataHandling/src/LoadSPE.cpp b/Code/Mantid/Framework/DataHandling/src/LoadSPE.cpp index 25e3b4c72b79..004b48b0a2b1 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadSPE.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadSPE.cpp @@ -18,7 +18,7 @@ namespace DataHandling { using namespace Kernel; using namespace API; -DECLARE_FILELOADER_ALGORITHM(LoadSPE); +DECLARE_FILELOADER_ALGORITHM(LoadSPE) /** * Return the confidence with with this algorithm can load the file diff --git a/Code/Mantid/Framework/DataHandling/src/LoadSassena.cpp b/Code/Mantid/Framework/DataHandling/src/LoadSassena.cpp index e1f23f9bd4b9..2f749d8a0784 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadSassena.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadSassena.cpp @@ -15,7 +15,7 @@ namespace Mantid { namespace DataHandling { -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadSassena); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadSassena) /** * Return the confidence with with this algorithm can load the file diff --git a/Code/Mantid/Framework/DataHandling/src/LoadSavuTomoConfig.cpp b/Code/Mantid/Framework/DataHandling/src/LoadSavuTomoConfig.cpp index 172ca4b47c5b..50184d1d4eab 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadSavuTomoConfig.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadSavuTomoConfig.cpp @@ -12,7 +12,7 @@ namespace Mantid { namespace DataHandling { // Register the algorithm into the algorithm factory -DECLARE_ALGORITHM(LoadSavuTomoConfig); +DECLARE_ALGORITHM(LoadSavuTomoConfig) using namespace Mantid::API; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadSpice2D.cpp b/Code/Mantid/Framework/DataHandling/src/LoadSpice2D.cpp index 1d8a877675e9..49b271ef9221 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadSpice2D.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadSpice2D.cpp @@ -36,7 +36,7 @@ using Poco::XML::Text; namespace Mantid { namespace DataHandling { // Register the algorithm into the AlgorithmFactory -DECLARE_FILELOADER_ALGORITHM(LoadSpice2D); +DECLARE_FILELOADER_ALGORITHM(LoadSpice2D) // Parse string and convert to numeric type template diff --git a/Code/Mantid/Framework/DataHandling/src/LoadTOFRawNexus.cpp b/Code/Mantid/Framework/DataHandling/src/LoadTOFRawNexus.cpp index 549ddc74278a..d477812c6246 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadTOFRawNexus.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadTOFRawNexus.cpp @@ -13,7 +13,7 @@ namespace Mantid { namespace DataHandling { -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadTOFRawNexus); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadTOFRawNexus) using namespace Kernel; using namespace API; diff --git a/Code/Mantid/Framework/DataHandling/src/NexusTester.cpp b/Code/Mantid/Framework/DataHandling/src/NexusTester.cpp index 19657640086d..2f1ed8f0471b 100644 --- a/Code/Mantid/Framework/DataHandling/src/NexusTester.cpp +++ b/Code/Mantid/Framework/DataHandling/src/NexusTester.cpp @@ -30,10 +30,10 @@ NexusTester::~NexusTester() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string NexusTester::name() const { return "NexusTester"; }; +const std::string NexusTester::name() const { return "NexusTester"; } /// Algorithm's version for identification. @see Algorithm::version -int NexusTester::version() const { return 1; }; +int NexusTester::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string NexusTester::category() const { diff --git a/Code/Mantid/Framework/DataHandling/src/PDLoadCharacterizations.cpp b/Code/Mantid/Framework/DataHandling/src/PDLoadCharacterizations.cpp index 8e73ca0e825c..34b98ec08a15 100644 --- a/Code/Mantid/Framework/DataHandling/src/PDLoadCharacterizations.cpp +++ b/Code/Mantid/Framework/DataHandling/src/PDLoadCharacterizations.cpp @@ -36,10 +36,10 @@ PDLoadCharacterizations::~PDLoadCharacterizations() {} /// Algorithm's name for identification. @see Algorithm::name const std::string PDLoadCharacterizations::name() const { return "PDLoadCharacterizations"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int PDLoadCharacterizations::version() const { return 1; }; +int PDLoadCharacterizations::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string PDLoadCharacterizations::category() const { diff --git a/Code/Mantid/Framework/DataHandling/src/SNSDataArchive.cpp b/Code/Mantid/Framework/DataHandling/src/SNSDataArchive.cpp index 2ecc8bd1680a..ca088cab0faf 100644 --- a/Code/Mantid/Framework/DataHandling/src/SNSDataArchive.cpp +++ b/Code/Mantid/Framework/DataHandling/src/SNSDataArchive.cpp @@ -32,7 +32,7 @@ const std::string BASE_URL("http://icat.sns.gov:2080/icat-rest-ws/datafile/filename/"); } -DECLARE_ARCHIVESEARCH(SNSDataArchive, SNSDataSearch); +DECLARE_ARCHIVESEARCH(SNSDataArchive, SNSDataSearch) /** * @param filenames : List of files to search diff --git a/Code/Mantid/Framework/DataHandling/src/SavePAR.cpp b/Code/Mantid/Framework/DataHandling/src/SavePAR.cpp index 8d2ff9739bf6..d318f94f549b 100644 --- a/Code/Mantid/Framework/DataHandling/src/SavePAR.cpp +++ b/Code/Mantid/Framework/DataHandling/src/SavePAR.cpp @@ -14,7 +14,7 @@ namespace Mantid { namespace DataHandling { // Register the algorithm into the AlgorithmFactory -DECLARE_ALGORITHM(SavePAR); +DECLARE_ALGORITHM(SavePAR) using namespace Mantid::Kernel; using namespace Mantid::API; diff --git a/Code/Mantid/Framework/DataHandling/src/SavePHX.cpp b/Code/Mantid/Framework/DataHandling/src/SavePHX.cpp index ecb428de9af8..7c221896f8be 100644 --- a/Code/Mantid/Framework/DataHandling/src/SavePHX.cpp +++ b/Code/Mantid/Framework/DataHandling/src/SavePHX.cpp @@ -14,7 +14,7 @@ namespace Mantid { namespace DataHandling { // Register the algorithm into the AlgorithmFactory -DECLARE_ALGORITHM(SavePHX); +DECLARE_ALGORITHM(SavePHX) using namespace Mantid::Kernel; using namespace Mantid::API; diff --git a/Code/Mantid/Framework/DataHandling/src/SaveParameterFile.cpp b/Code/Mantid/Framework/DataHandling/src/SaveParameterFile.cpp index 9bee776e07f2..931538cbb948 100644 --- a/Code/Mantid/Framework/DataHandling/src/SaveParameterFile.cpp +++ b/Code/Mantid/Framework/DataHandling/src/SaveParameterFile.cpp @@ -36,10 +36,10 @@ SaveParameterFile::~SaveParameterFile() {} /// Algorithm's name for identification. @see Algorithm::name const std::string SaveParameterFile::name() const { return "SaveParameterFile"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int SaveParameterFile::version() const { return 1; }; +int SaveParameterFile::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string SaveParameterFile::category() const { diff --git a/Code/Mantid/Framework/DataHandling/src/SaveSPE.cpp b/Code/Mantid/Framework/DataHandling/src/SaveSPE.cpp index 772c86749749..6b6878a8e890 100644 --- a/Code/Mantid/Framework/DataHandling/src/SaveSPE.cpp +++ b/Code/Mantid/Framework/DataHandling/src/SaveSPE.cpp @@ -25,12 +25,34 @@ DECLARE_ALGORITHM(SaveSPE) * @throws std::runtime_error :: throws when there is a problem writing to disk, * usually disk space or permissions based */ + +// use macro on platforms without variadic templates. +#if defined(__INTEL_COMPILER) || ( defined(_MSC_VER) && _MSC_VER < 1800 ) + #define FPRINTF_WITH_EXCEPTION(stream, format, ...) \ if (fprintf(stream, format, ##__VA_ARGS__) <= 0) { \ throw std::runtime_error( \ "Error writing to file. Check folder permissions and disk space."); \ } +#else +namespace { + +template +void FPRINTF_WITH_EXCEPTION(FILE *stream, const char *format, vargs... args) { + if (fprintf(stream, format, args...) <= 0) { + throw std::runtime_error( + "Error writing to file. Check folder permissions and disk space."); + } +} + +// special case needed for case with only two arguments. +void FPRINTF_WITH_EXCEPTION(FILE *stream, const char *format) { + FPRINTF_WITH_EXCEPTION(stream, format, ""); +} +} +#endif + using namespace Kernel; using namespace API; diff --git a/Code/Mantid/Framework/DataHandling/src/SortTableWorkspace.cpp b/Code/Mantid/Framework/DataHandling/src/SortTableWorkspace.cpp index 98b38f0fe8e4..6909250252c2 100644 --- a/Code/Mantid/Framework/DataHandling/src/SortTableWorkspace.cpp +++ b/Code/Mantid/Framework/DataHandling/src/SortTableWorkspace.cpp @@ -24,7 +24,7 @@ SortTableWorkspace::~SortTableWorkspace() {} //---------------------------------------------------------------------------------------------- /// Algorithm's version for identification. @see Algorithm::version -int SortTableWorkspace::version() const { return 1; }; +int SortTableWorkspace::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string SortTableWorkspace::category() const { return "Utility"; } @@ -32,7 +32,7 @@ const std::string SortTableWorkspace::category() const { return "Utility"; } /// Algorithm's summary for use in the GUI and help. @see Algorithm::summary const std::string SortTableWorkspace::summary() const { return "Sort a TableWorkspace."; -}; +} //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. diff --git a/Code/Mantid/Framework/DataHandling/test/LoadRaw3Test.h b/Code/Mantid/Framework/DataHandling/test/LoadRaw3Test.h index 77b4a90852d1..30aea2518a58 100644 --- a/Code/Mantid/Framework/DataHandling/test/LoadRaw3Test.h +++ b/Code/Mantid/Framework/DataHandling/test/LoadRaw3Test.h @@ -115,6 +115,7 @@ class LoadRaw3Test : public CxxTest::TestSuite // boost::shared_ptr sample = output2D->getSample(); Property *l_property = output2D->run().getLogData( std::string("TEMP1") ); TimeSeriesProperty *l_timeSeriesDouble = dynamic_cast*>(l_property); + std::string timeSeriesString = l_timeSeriesDouble->value(); TS_ASSERT_EQUALS( timeSeriesString.substr(0,23), "2007-Nov-13 15:16:20 0" ); diff --git a/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/VectorColumn.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/VectorColumn.h index 72c1e5031354..54952d823c76 100644 --- a/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/VectorColumn.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/VectorColumn.h @@ -171,7 +171,7 @@ template class DLLExport VectorColumn : public API::Column { #define DECLARE_VECTORCOLUMN(Type, TypeName) \ template <> std::string VectorColumn::typeName() { \ return #TypeName; \ - }; \ + } \ Kernel::RegistrationHelper register_column_##TypeName(( \ API::ColumnFactory::Instance().subscribe>(#TypeName), \ 0)); diff --git a/Code/Mantid/Framework/DataObjects/src/PeakColumn.cpp b/Code/Mantid/Framework/DataObjects/src/PeakColumn.cpp index b844cf396877..b3d7e129cc92 100644 --- a/Code/Mantid/Framework/DataObjects/src/PeakColumn.cpp +++ b/Code/Mantid/Framework/DataObjects/src/PeakColumn.cpp @@ -67,7 +67,7 @@ const std::string typeFromName(const std::string &name) { "\"" "Peak column names/types must be explicitly marked in PeakColumn.cpp"); } -}; +} } //---------------------------------------------------------------------------------------------- diff --git a/Code/Mantid/Framework/DataObjects/src/PeaksWorkspace.cpp b/Code/Mantid/Framework/DataObjects/src/PeaksWorkspace.cpp index 4259cce7f869..890e3e1e447e 100644 --- a/Code/Mantid/Framework/DataObjects/src/PeaksWorkspace.cpp +++ b/Code/Mantid/Framework/DataObjects/src/PeaksWorkspace.cpp @@ -36,7 +36,7 @@ using namespace Mantid::Geometry; namespace Mantid { namespace DataObjects { /// Register the workspace as a type -DECLARE_WORKSPACE(PeaksWorkspace); +DECLARE_WORKSPACE(PeaksWorkspace) //--------------------------------------------------------------------------------------------- /** Constructor. Create a table with all the required columns. diff --git a/Code/Mantid/Framework/DataObjects/src/TableWorkspace.cpp b/Code/Mantid/Framework/DataObjects/src/TableWorkspace.cpp index 138856ae152e..d2eac1267795 100644 --- a/Code/Mantid/Framework/DataObjects/src/TableWorkspace.cpp +++ b/Code/Mantid/Framework/DataObjects/src/TableWorkspace.cpp @@ -204,7 +204,7 @@ TableWorkspace *TableWorkspace::clone() const { // copy logs/properties. copy->m_LogManager = boost::make_shared(*this->m_LogManager); return copy; -}; +} /** * Sort. diff --git a/Code/Mantid/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp b/Code/Mantid/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp index 40b6ba8c633a..cdf42076ca54 100644 --- a/Code/Mantid/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp +++ b/Code/Mantid/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp @@ -425,11 +425,11 @@ void SymmetryElementFactoryImpl::insertPrototype( m_prototypes.insert(std::make_pair(identifier, prototype)); } -DECLARE_SYMMETRY_ELEMENT_GENERATOR(SymmetryElementIdentityGenerator); -DECLARE_SYMMETRY_ELEMENT_GENERATOR(SymmetryElementTranslationGenerator); -DECLARE_SYMMETRY_ELEMENT_GENERATOR(SymmetryElementInversionGenerator); -DECLARE_SYMMETRY_ELEMENT_GENERATOR(SymmetryElementRotationGenerator); -DECLARE_SYMMETRY_ELEMENT_GENERATOR(SymmetryElementMirrorGenerator); +DECLARE_SYMMETRY_ELEMENT_GENERATOR(SymmetryElementIdentityGenerator) +DECLARE_SYMMETRY_ELEMENT_GENERATOR(SymmetryElementTranslationGenerator) +DECLARE_SYMMETRY_ELEMENT_GENERATOR(SymmetryElementInversionGenerator) +DECLARE_SYMMETRY_ELEMENT_GENERATOR(SymmetryElementRotationGenerator) +DECLARE_SYMMETRY_ELEMENT_GENERATOR(SymmetryElementMirrorGenerator) } // namespace Geometry } // namespace Mantid diff --git a/Code/Mantid/Framework/ISISLiveData/src/FakeISISEventDAE.cpp b/Code/Mantid/Framework/ISISLiveData/src/FakeISISEventDAE.cpp index 6d5a6fa75c92..c699dfb94119 100644 --- a/Code/Mantid/Framework/ISISLiveData/src/FakeISISEventDAE.cpp +++ b/Code/Mantid/Framework/ISISLiveData/src/FakeISISEventDAE.cpp @@ -19,7 +19,7 @@ namespace Mantid { namespace ISISLiveData { // Register the algorithm into the algorithm factory -DECLARE_ALGORITHM(FakeISISEventDAE); +DECLARE_ALGORITHM(FakeISISEventDAE) using namespace Kernel; using namespace API; diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/ChecksumHelper.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/ChecksumHelper.h index 5a4f70794fe3..54a6b5fcf22e 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/ChecksumHelper.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/ChecksumHelper.h @@ -40,7 +40,7 @@ MANTID_KERNEL_DLL std::string sha1FromString(const std::string &input); MANTID_KERNEL_DLL std::string sha1FromFile(const std::string &filepath); /// create a git checksum from a file (these match the git hash-object command) MANTID_KERNEL_DLL std::string gitSha1FromFile(const std::string &filepath); -}; +} } // namespace Kernel } // namespace Mantid diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/FileDescriptor.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/FileDescriptor.h index bb5a73ee5e12..ec76acae46bb 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/FileDescriptor.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/FileDescriptor.h @@ -78,8 +78,8 @@ class MANTID_KERNEL_DLL FileDescriptor { void resetStreamToStart(); private: - DISABLE_DEFAULT_CONSTRUCT(FileDescriptor); - DISABLE_COPY_AND_ASSIGN(FileDescriptor); + DISABLE_DEFAULT_CONSTRUCT(FileDescriptor) + DISABLE_COPY_AND_ASSIGN(FileDescriptor) /// Open the file and cache description elements void initialize(const std::string &filename); diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/FilteredTimeSeriesProperty.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/FilteredTimeSeriesProperty.h index 74a31555811d..6c4d23a45cab 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/FilteredTimeSeriesProperty.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/FilteredTimeSeriesProperty.h @@ -49,7 +49,7 @@ class DLLExport FilteredTimeSeriesProperty const TimeSeriesProperty *unfiltered() const; private: - DISABLE_DEFAULT_CONSTRUCT(FilteredTimeSeriesProperty); + DISABLE_DEFAULT_CONSTRUCT(FilteredTimeSeriesProperty) /// The original unfiltered property as an owned pointer const TimeSeriesProperty *m_unfiltered; diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/LogFilter.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/LogFilter.h index e9384a4ea1aa..7f5b755c6219 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/LogFilter.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/LogFilter.h @@ -68,8 +68,8 @@ class MANTID_KERNEL_DLL LogFilter { void clear(); private: - DISABLE_DEFAULT_CONSTRUCT(LogFilter); - DISABLE_COPY_AND_ASSIGN(LogFilter); + DISABLE_DEFAULT_CONSTRUCT(LogFilter) + DISABLE_COPY_AND_ASSIGN(LogFilter) /// Converts the given property to a TimeSeriesProperty, throws if /// invalid. diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/MagneticFormFactorTable.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/MagneticFormFactorTable.h index 0e21199f3fed..00bd8c8e67bd 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/MagneticFormFactorTable.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/MagneticFormFactorTable.h @@ -45,8 +45,8 @@ class MANTID_KERNEL_DLL MagneticFormFactorTable { double value(const double qsqr) const; private: - DISABLE_DEFAULT_CONSTRUCT(MagneticFormFactorTable); - DISABLE_COPY_AND_ASSIGN(MagneticFormFactorTable); + DISABLE_DEFAULT_CONSTRUCT(MagneticFormFactorTable) + DISABLE_COPY_AND_ASSIGN(MagneticFormFactorTable) /// Setup the table with the values void setup(const MagneticIon &ion, const uint16_t j, const uint16_t l); diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/Math/Optimization/SLSQPMinimizer.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/Math/Optimization/SLSQPMinimizer.h index f536e4caebba..193b623fcfc4 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/Math/Optimization/SLSQPMinimizer.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/Math/Optimization/SLSQPMinimizer.h @@ -106,8 +106,8 @@ class DLLExport SLSQPMinimizer { std::vector minimize(const std::vector &x0) const; private: - DISABLE_DEFAULT_CONSTRUCT(SLSQPMinimizer); - DISABLE_COPY_AND_ASSIGN(SLSQPMinimizer); + DISABLE_DEFAULT_CONSTRUCT(SLSQPMinimizer) + DISABLE_COPY_AND_ASSIGN(SLSQPMinimizer) /** * Compute the value of the objective function diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/MersenneTwister.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/MersenneTwister.h index 3b08e05e46c4..5764a762678e 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/MersenneTwister.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/MersenneTwister.h @@ -80,8 +80,8 @@ class MANTID_KERNEL_DLL MersenneTwister : public PseudoRandomNumberGenerator { virtual void restore(); private: - DISABLE_DEFAULT_CONSTRUCT(MersenneTwister); - DISABLE_COPY_AND_ASSIGN(MersenneTwister); + DISABLE_DEFAULT_CONSTRUCT(MersenneTwister) + DISABLE_COPY_AND_ASSIGN(MersenneTwister) /// The boost Mersenne Twister generator boost::mt19937 m_generator; diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/NDPseudoRandomNumberGenerator.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/NDPseudoRandomNumberGenerator.h index b75134878895..29066b78b3b7 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/NDPseudoRandomNumberGenerator.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/NDPseudoRandomNumberGenerator.h @@ -65,8 +65,8 @@ class DLLExport NDPseudoRandomNumberGenerator : public NDRandomNumberGenerator { void restore(); private: - DISABLE_DEFAULT_CONSTRUCT(NDPseudoRandomNumberGenerator); - DISABLE_COPY_AND_ASSIGN(NDPseudoRandomNumberGenerator); + DISABLE_DEFAULT_CONSTRUCT(NDPseudoRandomNumberGenerator) + DISABLE_COPY_AND_ASSIGN(NDPseudoRandomNumberGenerator) /// The single value generator SingleValueGenerator m_singleValueGen; diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/NDRandomNumberGenerator.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/NDRandomNumberGenerator.h index 4d62f842c950..cbeae096e625 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/NDRandomNumberGenerator.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/NDRandomNumberGenerator.h @@ -72,8 +72,8 @@ class MANTID_KERNEL_DLL NDRandomNumberGenerator { inline std::vector &getNextPointCache() { return m_nextPoint; } private: - DISABLE_DEFAULT_CONSTRUCT(NDRandomNumberGenerator); - DISABLE_COPY_AND_ASSIGN(NDRandomNumberGenerator); + DISABLE_DEFAULT_CONSTRUCT(NDRandomNumberGenerator) + DISABLE_COPY_AND_ASSIGN(NDRandomNumberGenerator) /// The number of dimensions const unsigned int m_ndims; diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/NexusDescriptor.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/NexusDescriptor.h index 5ae344033873..f46774eebf53 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/NexusDescriptor.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/NexusDescriptor.h @@ -98,8 +98,8 @@ class MANTID_KERNEL_DLL NexusDescriptor { bool classTypeExists(const std::string &classType) const; private: - DISABLE_DEFAULT_CONSTRUCT(NexusDescriptor); - DISABLE_COPY_AND_ASSIGN(NexusDescriptor); + DISABLE_DEFAULT_CONSTRUCT(NexusDescriptor) + DISABLE_COPY_AND_ASSIGN(NexusDescriptor) /// Initialize object with filename void initialize(const std::string &filename); diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyWithValue.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyWithValue.h index 85f67ac066da..bd55cf9b501c 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyWithValue.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/PropertyWithValue.h @@ -198,10 +198,10 @@ void toValue(const std::string &strvalue, std::vector> &value, } \ } -PROPERTYWITHVALUE_TOVALUE(int); -PROPERTYWITHVALUE_TOVALUE(long); -PROPERTYWITHVALUE_TOVALUE(uint32_t); -PROPERTYWITHVALUE_TOVALUE(uint64_t); +PROPERTYWITHVALUE_TOVALUE(int) +PROPERTYWITHVALUE_TOVALUE(long) +PROPERTYWITHVALUE_TOVALUE(uint32_t) +PROPERTYWITHVALUE_TOVALUE(uint64_t) #if defined(__APPLE__) PROPERTYWITHVALUE_TOVALUE(unsigned long); #endif diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/PseudoRandomNumberGenerator.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/PseudoRandomNumberGenerator.h index c6c1805f4938..06d1c067c571 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/PseudoRandomNumberGenerator.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/PseudoRandomNumberGenerator.h @@ -51,7 +51,7 @@ class MANTID_KERNEL_DLL PseudoRandomNumberGenerator virtual void generateNextPoint(); private: - DISABLE_COPY_AND_ASSIGN(PseudoRandomNumberGenerator); + DISABLE_COPY_AND_ASSIGN(PseudoRandomNumberGenerator) }; } } diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/SobolSequence.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/SobolSequence.h index 4d0be933d00f..b45ed71c2dee 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/SobolSequence.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/SobolSequence.h @@ -57,8 +57,8 @@ class MANTID_KERNEL_DLL SobolSequence : public QuasiRandomNumberSequence { void restore(); private: - DISABLE_DEFAULT_CONSTRUCT(SobolSequence); - DISABLE_COPY_AND_ASSIGN(SobolSequence); + DISABLE_DEFAULT_CONSTRUCT(SobolSequence) + DISABLE_COPY_AND_ASSIGN(SobolSequence) /// Set the number of dimensions void setNumberOfDimensions(const unsigned int ndims); diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/UnitLabel.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/UnitLabel.h index 6cb1eb6cdc35..0cd9829df37d 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/UnitLabel.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/UnitLabel.h @@ -80,7 +80,7 @@ class MANTID_KERNEL_DLL UnitLabel { operator std::string() const; private: - DISABLE_DEFAULT_CONSTRUCT(UnitLabel); + DISABLE_DEFAULT_CONSTRUCT(UnitLabel) /// Value of plain-text label std::string m_ascii; diff --git a/Code/Mantid/Framework/Kernel/src/FilteredTimeSeriesProperty.cpp b/Code/Mantid/Framework/Kernel/src/FilteredTimeSeriesProperty.cpp index 07d01c24be0b..52a8e817ddbf 100644 --- a/Code/Mantid/Framework/Kernel/src/FilteredTimeSeriesProperty.cpp +++ b/Code/Mantid/Framework/Kernel/src/FilteredTimeSeriesProperty.cpp @@ -53,16 +53,16 @@ FilteredTimeSeriesProperty::unfiltered() const { // -------------------------- Concrete instantiation // ----------------------------------------------- -INSTANTIATE(int); -INSTANTIATE(long); -INSTANTIATE(long long); -INSTANTIATE(unsigned int); -INSTANTIATE(unsigned long); -INSTANTIATE(unsigned long long); -INSTANTIATE(float); -INSTANTIATE(double); -INSTANTIATE(std::string); -INSTANTIATE(bool); +INSTANTIATE(int) +INSTANTIATE(long) +INSTANTIATE(long long) +INSTANTIATE(unsigned int) +INSTANTIATE(unsigned long) +INSTANTIATE(unsigned long long) +INSTANTIATE(float) +INSTANTIATE(double) +INSTANTIATE(std::string) +INSTANTIATE(bool) ///@endcond diff --git a/Code/Mantid/Framework/Kernel/src/IPropertyManager.cpp b/Code/Mantid/Framework/Kernel/src/IPropertyManager.cpp index 0d1730b581d7..36961d439154 100644 --- a/Code/Mantid/Framework/Kernel/src/IPropertyManager.cpp +++ b/Code/Mantid/Framework/Kernel/src/IPropertyManager.cpp @@ -7,23 +7,23 @@ #include ///@cond -DEFINE_IPROPERTYMANAGER_GETVALUE(int16_t); -DEFINE_IPROPERTYMANAGER_GETVALUE(uint16_t); -DEFINE_IPROPERTYMANAGER_GETVALUE(int32_t); -DEFINE_IPROPERTYMANAGER_GETVALUE(uint32_t); -DEFINE_IPROPERTYMANAGER_GETVALUE(int64_t); -DEFINE_IPROPERTYMANAGER_GETVALUE(uint64_t); -DEFINE_IPROPERTYMANAGER_GETVALUE(bool); -DEFINE_IPROPERTYMANAGER_GETVALUE(double); -DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector); -DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector); -DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector); -DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector); -DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector); -DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector); -DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector); -DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector); -DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector>); +DEFINE_IPROPERTYMANAGER_GETVALUE(int16_t) +DEFINE_IPROPERTYMANAGER_GETVALUE(uint16_t) +DEFINE_IPROPERTYMANAGER_GETVALUE(int32_t) +DEFINE_IPROPERTYMANAGER_GETVALUE(uint32_t) +DEFINE_IPROPERTYMANAGER_GETVALUE(int64_t) +DEFINE_IPROPERTYMANAGER_GETVALUE(uint64_t) +DEFINE_IPROPERTYMANAGER_GETVALUE(bool) +DEFINE_IPROPERTYMANAGER_GETVALUE(double) +DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector) +DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector) +DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector) +DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector) +DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector) +DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector) +DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector) +DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector) +DEFINE_IPROPERTYMANAGER_GETVALUE(std::vector>) namespace Mantid { namespace Kernel { diff --git a/Code/Mantid/Framework/Kernel/src/LogParser.cpp b/Code/Mantid/Framework/Kernel/src/LogParser.cpp index c58b0d771555..e88d7f883f30 100644 --- a/Code/Mantid/Framework/Kernel/src/LogParser.cpp +++ b/Code/Mantid/Framework/Kernel/src/LogParser.cpp @@ -45,7 +45,7 @@ Kernel::Property *LogParser::createLogProperty(const std::string &logFName, } // Change times and new values read from file - std::map change_times; + std::multimap change_times; // Read in the data and determin if it is numeric std::string str, old_data; @@ -70,8 +70,16 @@ Kernel::Property *LogParser::createLogProperty(const std::string &logFName, g_log.error(mess); throw std::logic_error(mess); } - change_times[stime] += std::string(" ") + str; - continue; + auto range = change_times.equal_range(stime); + if ( range.first != range.second ){ + auto last = range.first; + for(auto it = last; it != range.second; ++it){ + last = it; + } + last->second += std::string(" ") + str; + old_data = last->second; + continue; + } } stime = str.substr(0, 19); sdata = str.substr(19); @@ -86,12 +94,7 @@ Kernel::Property *LogParser::createLogProperty(const std::string &logFName, isNumeric = !istr.fail(); old_data = sdata; - // if time is repeated and the data aren't numeric append the new string to - // the old one - if (!isNumeric && change_times[stime].size() > 0) - change_times[stime] += std::string(" ") + sdata; - else - change_times[stime] = sdata; + change_times.insert( std::make_pair(stime,sdata) ); } if (change_times.empty()) @@ -100,7 +103,7 @@ Kernel::Property *LogParser::createLogProperty(const std::string &logFName, if (isNumeric) { Kernel::TimeSeriesProperty *logv = new Kernel::TimeSeriesProperty(name); - std::map::iterator it = change_times.begin(); + auto it = change_times.begin(); for (; it != change_times.end(); ++it) { std::istringstream istr(it->second); double d; @@ -111,7 +114,7 @@ Kernel::Property *LogParser::createLogProperty(const std::string &logFName, } else { Kernel::TimeSeriesProperty *logv = new Kernel::TimeSeriesProperty(name); - std::map::iterator it = change_times.begin(); + auto it = change_times.begin(); for (; it != change_times.end(); ++it) { logv->addValue(it->first, it->second); } @@ -218,7 +221,7 @@ LogParser::LogParser(const Kernel::Property *log) : m_nOfPeriods(1) { m_nOfPeriods = 1; - std::map::const_iterator it = logm.begin(); + auto it = logm.begin(); for (; it != logm.end(); ++it) { std::string scom; @@ -253,7 +256,7 @@ Kernel::TimeSeriesProperty *LogParser::createPeriodLog(int period) const { Kernel::TimeSeriesProperty *p = new Kernel::TimeSeriesProperty("period " + ostr.str()); std::map pMap = periods->valueAsMap(); - std::map::const_iterator it = pMap.begin(); + auto it = pMap.begin(); if (it->second != period) p->addValue(it->first, false); for (; it != pMap.end(); ++it) diff --git a/Code/Mantid/Framework/Kernel/src/Matrix.cpp b/Code/Mantid/Framework/Kernel/src/Matrix.cpp index e6a50066fe5d..425b07ab4f3d 100644 --- a/Code/Mantid/Framework/Kernel/src/Matrix.cpp +++ b/Code/Mantid/Framework/Kernel/src/Matrix.cpp @@ -351,11 +351,15 @@ V3D Matrix::operator*(const V3D &Vx) const @return Matrix(This * A) */ { - if (ny != 3 || nx != 3) + if (ny != 3 || nx > 3) throw Kernel::Exception::MisMatch(ny, 3, "Matrix::operator*(V3D)"); - return V3D(V[0][0] * Vx.X() + V[0][1] * Vx.Y() + V[0][2] * Vx.Z(), - V[1][0] * Vx.X() + V[1][1] * Vx.Y() + V[1][2] * Vx.Z(), - V[2][0] * Vx.X() + V[2][1] * Vx.Y() + V[2][2] * Vx.Z()); + + V3D v; + for(size_t i = 0; i < nx; ++i) { + v[i] = V[i][0] * Vx.X() + V[i][1] * Vx.Y() + V[i][2] * Vx.Z(); + } + + return v; } template diff --git a/Code/Mantid/Framework/Kernel/src/MatrixProperty.cpp b/Code/Mantid/Framework/Kernel/src/MatrixProperty.cpp index 3ff63a07bf74..ddd680bdac9e 100644 --- a/Code/Mantid/Framework/Kernel/src/MatrixProperty.cpp +++ b/Code/Mantid/Framework/Kernel/src/MatrixProperty.cpp @@ -43,7 +43,7 @@ template class MANTID_KERNEL_DLL MatrixProperty; /** * IPropertyManager::getValue definitions */ -DEFINE_IPROPERTYMANAGER_GETVALUE(Mantid::Kernel::DblMatrix); -DEFINE_IPROPERTYMANAGER_GETVALUE(Mantid::Kernel::IntMatrix); -DEFINE_IPROPERTYMANAGER_GETVALUE(Mantid::Kernel::Matrix); +DEFINE_IPROPERTYMANAGER_GETVALUE(Mantid::Kernel::DblMatrix) +DEFINE_IPROPERTYMANAGER_GETVALUE(Mantid::Kernel::IntMatrix) +DEFINE_IPROPERTYMANAGER_GETVALUE(Mantid::Kernel::Matrix) ///@endcond diff --git a/Code/Mantid/Framework/Kernel/src/PropertyWithValue.cpp b/Code/Mantid/Framework/Kernel/src/PropertyWithValue.cpp index e087f25a23fc..038a26cc359a 100644 --- a/Code/Mantid/Framework/Kernel/src/PropertyWithValue.cpp +++ b/Code/Mantid/Framework/Kernel/src/PropertyWithValue.cpp @@ -10,16 +10,16 @@ namespace Kernel { template DLLExport class PropertyWithValue>; // Explicit instantiations -INSTANTIATE(int); -INSTANTIATE(long); -INSTANTIATE(long long); -INSTANTIATE(unsigned short int); -INSTANTIATE(unsigned int); -INSTANTIATE(unsigned long); -INSTANTIATE(unsigned long long); -INSTANTIATE(bool); -INSTANTIATE(double); -INSTANTIATE(std::string); +INSTANTIATE(int) +INSTANTIATE(long) +INSTANTIATE(long long) +INSTANTIATE(unsigned short int) +INSTANTIATE(unsigned int) +INSTANTIATE(unsigned long) +INSTANTIATE(unsigned long long) +INSTANTIATE(bool) +INSTANTIATE(double) +INSTANTIATE(std::string) /// @endcond } // namespace Kernel diff --git a/Code/Mantid/Framework/Kernel/src/Statistics.cpp b/Code/Mantid/Framework/Kernel/src/Statistics.cpp index 9af3f0335c5d..6a021e757806 100644 --- a/Code/Mantid/Framework/Kernel/src/Statistics.cpp +++ b/Code/Mantid/Framework/Kernel/src/Statistics.cpp @@ -405,14 +405,14 @@ std::vector getMomentsAboutMean(const std::vector &x, // --------------------------- Concrete instantiations // --------------------------------------------- -INSTANTIATE(float); -INSTANTIATE(double); -INSTANTIATE(int); -INSTANTIATE(long); -INSTANTIATE(long long); -INSTANTIATE(unsigned int); -INSTANTIATE(unsigned long); -INSTANTIATE(unsigned long long); +INSTANTIATE(float) +INSTANTIATE(double) +INSTANTIATE(int) +INSTANTIATE(long) +INSTANTIATE(long long) +INSTANTIATE(unsigned int) +INSTANTIATE(unsigned long) +INSTANTIATE(unsigned long long) } // namespace Kernel } // namespace Mantid diff --git a/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp b/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp index e129b7010c28..c6057895d5fd 100644 --- a/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp +++ b/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp @@ -2026,16 +2026,16 @@ TimeSeriesProperty::setValueFromProperty(const Property &right) { // -------------------------- Concrete instantiation // ----------------------------------------------- -INSTANTIATE(int); -INSTANTIATE(long); -INSTANTIATE(long long); -INSTANTIATE(unsigned int); -INSTANTIATE(unsigned long); -INSTANTIATE(unsigned long long); -INSTANTIATE(float); -INSTANTIATE(double); -INSTANTIATE(std::string); -INSTANTIATE(bool); +INSTANTIATE(int) +INSTANTIATE(long) +INSTANTIATE(long long) +INSTANTIATE(unsigned int) +INSTANTIATE(unsigned long) +INSTANTIATE(unsigned long long) +INSTANTIATE(float) +INSTANTIATE(double) +INSTANTIATE(std::string) +INSTANTIATE(bool) /// @endcond diff --git a/Code/Mantid/Framework/Kernel/src/Unit.cpp b/Code/Mantid/Framework/Kernel/src/Unit.cpp index 82e3541bc80d..8495405f2101 100644 --- a/Code/Mantid/Framework/Kernel/src/Unit.cpp +++ b/Code/Mantid/Framework/Kernel/src/Unit.cpp @@ -1108,10 +1108,10 @@ double Time::singleFromTOF(const double tof) const { double Time::conversionTOFMax() const { return std::numeric_limits::quiet_NaN(); -}; +} double Time::conversionTOFMin() const { return std::numeric_limits::quiet_NaN(); -}; +} Unit *Time::clone() const { return new Time(*this); } diff --git a/Code/Mantid/Framework/Kernel/test/LogParserTest.h b/Code/Mantid/Framework/Kernel/test/LogParserTest.h index 790a09ecef12..8ae8ca054154 100644 --- a/Code/Mantid/Framework/Kernel/test/LogParserTest.h +++ b/Code/Mantid/Framework/Kernel/test/LogParserTest.h @@ -21,26 +21,30 @@ class LogParserTest : public CxxTest::TestSuite static LogParserTest *createSuite() { return new LogParserTest(); } static void destroySuite(LogParserTest *suite) { delete suite; } + + class TmpFile{ + Poco::File m_file; + public: + TmpFile(const std::string& fname):m_file(fname){} + ~TmpFile(){remove();} + const std::string& path() const {return m_file.path();} + bool exists() const {return m_file.exists();} + void remove() {if (m_file.exists()) m_file.remove();} + }; + LogParserTest() :log_num_good("TST000000_good.txt"), log_num_late("TST000000_late.txt"), log_num_early("TST000000_early.txt"), log_num_single("TST000000_single.txt"), log_str("TST000000_str.txt"), - icp_file("TST000000_icpevent.txt") + icp_file("TST000000_icpevent.txt"), + log_str_repeat("TST000000_repeat.txt"), + log_num_repeat("TST000000_num_repeat.txt"), + log_str_continuations("TST000000_str_continue.txt") { } - ~LogParserTest() - { - if ( log_num_good.exists() ) log_num_good.remove(); - if ( log_num_late.exists() ) log_num_late.remove(); - if ( log_num_early.exists() ) log_num_early.remove(); - if ( log_num_single.exists() ) log_num_single.remove(); - if ( log_str.exists() ) log_str.remove(); - if ( icp_file.exists() ) icp_file.remove(); - } - void testGood() { mkICP(); @@ -515,7 +519,67 @@ class LogParserTest : public CxxTest::TestSuite delete log; } -//*/ + void test_str_repeat() + { + mkStrRepeat(); + Property *prop = LogParser::createLogProperty(log_str_repeat.path(),"log"); + const auto *log = dynamic_cast*>(prop); + TS_ASSERT(log); + auto logm = log->valueAsMultiMap(); + auto it = logm.begin(); + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:22:34"); + TS_ASSERT_EQUALS( it->second, " First line"); ++it; + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:22:34"); + TS_ASSERT_EQUALS( it->second, " Second line"); ++it; + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:23:33"); + TS_ASSERT_EQUALS( it->second, " First line"); ++it; + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:23:33"); + TS_ASSERT_EQUALS( it->second, " Second line"); ++it; + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:23:33"); + TS_ASSERT_EQUALS( it->second, " Third line"); ++it; + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:23:33"); + TS_ASSERT_EQUALS( it->second, " Fourth line"); ++it; + } + + void test_num_repeat() + { + mkNumRepeat(); + Property *prop = LogParser::createLogProperty(log_str_repeat.path(),"log"); + const auto *log = dynamic_cast*>(prop); + TS_ASSERT(log); + auto logm = log->valueAsMultiMap(); + auto it = logm.begin(); + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:22:34"); + TS_ASSERT_EQUALS( it->second, 1); ++it; + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:22:34"); + TS_ASSERT_EQUALS( it->second, 2); ++it; + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:23:33"); + TS_ASSERT_EQUALS( it->second, 3); ++it; + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:23:33"); + TS_ASSERT_EQUALS( it->second, 4); ++it; + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:23:33"); + TS_ASSERT_EQUALS( it->second, 5); ++it; + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:23:33"); + TS_ASSERT_EQUALS( it->second, 6); ++it; + } + + void test_str_continuation() + { + mkStrContinuations(); + Property *prop = LogParser::createLogProperty(log_str_continuations.path(),"log"); + const auto *log = dynamic_cast*>(prop); + TS_ASSERT(log); + auto logm = log->valueAsMultiMap(); + auto it = logm.begin(); + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:22:31"); + TS_ASSERT_EQUALS( it->second, " First line Second line"); ++it; + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:22:34"); + TS_ASSERT_EQUALS( it->second, " First line"); ++it; + TS_ASSERT_EQUALS( it->first.toISO8601String(), "2000-09-05T12:22:34"); + TS_ASSERT_EQUALS( it->second, " Second line Third line"); ++it; + } + + private: /// Helper method to run common test code for checking period logs. @@ -646,13 +710,52 @@ class LogParserTest : public CxxTest::TestSuite f << "2000-09-05T14:03:56 line "<<9<<'\n'; f.close(); } -//*/ - Poco::File log_num_good;// run time interval is within first - last times of the log - Poco::File log_num_late;// first time is later than run start - Poco::File log_num_early;// last time is earlier than run ends - Poco::File log_num_single;// single value - Poco::File log_str;// file of strings - Poco::File icp_file;// icpevent file + + void mkStrContinuations() + { + std::ofstream f( log_str_continuations.path().c_str() ); + f << "2000-09-05T12:22:31 First line" << std::endl; + f << "Second line" << std::endl; + f << "2000-09-05T12:22:34 First line" << std::endl; + f << "2000-09-05T12:22:34 Second line" << std::endl; + f << "Third line" << std::endl; + f.close(); + } + + void mkStrRepeat() + { + std::ofstream f( log_str_repeat.path().c_str() ); + f << "2000-09-05T12:22:34 First line" << std::endl; + f << "2000-09-05T12:22:34 Second line" << std::endl; + f << "2000-09-05T12:23:33 First line" << std::endl; + f << "2000-09-05T12:23:33 Second line" << std::endl; + f << "2000-09-05T12:23:33 Third line" << std::endl; + f << "2000-09-05T12:23:33 Fourth line" << std::endl; + f.close(); + } + + void mkNumRepeat() + { + std::ofstream f( log_str_repeat.path().c_str() ); + f << "2000-09-05T12:22:34 1" << std::endl; + f << "2000-09-05T12:22:34 2" << std::endl; + f << "2000-09-05T12:23:33 3" << std::endl; + f << "2000-09-05T12:23:33 4" << std::endl; + f << "2000-09-05T12:23:33 5" << std::endl; + f << "2000-09-05T12:23:33 6" << std::endl; + f.close(); + } + + TmpFile log_num_good;// run time interval is within first - last times of the log + TmpFile log_num_late;// first time is later than run start + TmpFile log_num_early;// last time is earlier than run ends + TmpFile log_num_single;// single value + TmpFile log_str;// file of strings + TmpFile icp_file;// icpevent file + TmpFile log_str_repeat;// string log with repeating lines + TmpFile log_num_repeat;// num log with repeating lines + TmpFile log_str_continuations;// string log with continuation lines + tm ti_data; tm * ti; diff --git a/Code/Mantid/Framework/Kernel/test/MatrixTest.h b/Code/Mantid/Framework/Kernel/test/MatrixTest.h index f504f2436584..d27c2752545a 100644 --- a/Code/Mantid/Framework/Kernel/test/MatrixTest.h +++ b/Code/Mantid/Framework/Kernel/test/MatrixTest.h @@ -429,6 +429,18 @@ class MatrixTest: public CxxTest::TestSuite DblMatrix M4(4,4, true); TS_ASSERT_THROWS(M4.operator *(v), Mantid::Kernel::Exception::MisMatch); + + DblMatrix M23 = boost::lexical_cast("Matrix(2,3)-0.23,0.55,5.22,2.96,4.2,0.1"); + TS_ASSERT_THROWS_NOTHING(M23.operator *(v)); + + nv = M23 * v; + + TS_ASSERT_DELTA(nv.X(), -0.403000000000000, 1e-15); + TS_ASSERT_DELTA(nv.Y(), 25.663000000000000, 1e-15); + TS_ASSERT_EQUALS(nv.Z(), 0); + + DblMatrix M43 = boost::lexical_cast("Matrix(4,3)-0.23,0.55,5.22,2.96,4.2,0.1,-0.23,0.55,5.22,2.96,4.2,0.1"); + TS_ASSERT_THROWS(M43.operator *(v), Mantid::Kernel::Exception::MisMatch); } private: diff --git a/Code/Mantid/Framework/Kernel/test/TypedValidatorTest.h b/Code/Mantid/Framework/Kernel/test/TypedValidatorTest.h index 79693e0335b9..124c4655af43 100644 --- a/Code/Mantid/Framework/Kernel/test/TypedValidatorTest.h +++ b/Code/Mantid/Framework/Kernel/test/TypedValidatorTest.h @@ -24,8 +24,8 @@ namespace /// Dummy object to hold in a shared_ptr for test struct Holder {}; - DECLARE_TEST_VALIDATOR(SharedPtrTypedValidator, boost::shared_ptr); - DECLARE_TEST_VALIDATOR(PODTypedValidator, double); + DECLARE_TEST_VALIDATOR(SharedPtrTypedValidator, boost::shared_ptr) + DECLARE_TEST_VALIDATOR(PODTypedValidator, double) class FakeDataItem : public Mantid::Kernel::DataItem { public: @@ -34,7 +34,7 @@ namespace virtual bool threadSafe() const { return true; } virtual const std::string toString() const { return "FakeDataItem{}"; } }; - DECLARE_TEST_VALIDATOR(DataItemSptrTypedValidator, boost::shared_ptr); + DECLARE_TEST_VALIDATOR(DataItemSptrTypedValidator, boost::shared_ptr) } class TypedValidatorTest : public CxxTest::TestSuite diff --git a/Code/Mantid/Framework/LiveData/inc/MantidLiveData/ADARA/ADARA.h b/Code/Mantid/Framework/LiveData/inc/MantidLiveData/ADARA/ADARA.h index a6a6afb3ab11..97757097758d 100644 --- a/Code/Mantid/Framework/LiveData/inc/MantidLiveData/ADARA/ADARA.h +++ b/Code/Mantid/Framework/LiveData/inc/MantidLiveData/ADARA/ADARA.h @@ -29,7 +29,7 @@ enum Enum { DEVICE_DESC_V0 = ADARA_PKT_TYPE(0x8000, 0), VAR_VALUE_U32_V0 = ADARA_PKT_TYPE(0x8001, 0), VAR_VALUE_DOUBLE_V0 = ADARA_PKT_TYPE(0x8002, 0), - VAR_VALUE_STRING_V0 = ADARA_PKT_TYPE(0x8003, 0), + VAR_VALUE_STRING_V0 = ADARA_PKT_TYPE(0x8003, 0) }; } @@ -57,7 +57,7 @@ enum Enum { RUN_EOF = 2, RUN_BOF = 3, END_RUN = 4, - STATE = 5, + STATE = 5 }; } @@ -86,7 +86,7 @@ enum Enum { READ_PERMISSION = 20, WRITE_PERMISSION = 21, UPSTREAM_DISCONNECTED = 0xfffe, - NOT_REPORTED = 0xffff, + NOT_REPORTED = 0xffff }; } @@ -96,7 +96,7 @@ enum Enum { MINOR_ALARM = 1, MAJOR_ALARM = 2, INVALID = 3, - NOT_REPORTED = 0xffff, + NOT_REPORTED = 0xffff }; } @@ -107,7 +107,7 @@ enum Enum { SCAN_STOP, PAUSE, RESUME, - OVERALL_RUN_COMMENT, + OVERALL_RUN_COMMENT }; } diff --git a/Code/Mantid/Framework/LiveData/inc/MantidLiveData/ADARA/ADARAPackets.h b/Code/Mantid/Framework/LiveData/inc/MantidLiveData/ADARA/ADARAPackets.h index a331a294c25b..9a616c43892a 100644 --- a/Code/Mantid/Framework/LiveData/inc/MantidLiveData/ADARA/ADARAPackets.h +++ b/Code/Mantid/Framework/LiveData/inc/MantidLiveData/ADARA/ADARAPackets.h @@ -162,7 +162,7 @@ class DLLExport BankedEventPkt : public Packet { PULSE_VETO = 0x0004, MISSING_RTDL = 0x0008, MAPPING_ERROR = 0x0010, - DUPLICATE_PULSE = 0x0020, + DUPLICATE_PULSE = 0x0020 }; uint32_t pulseCharge(void) const { return m_fields[0]; } diff --git a/Code/Mantid/Framework/LiveData/src/MonitorLiveData.cpp b/Code/Mantid/Framework/LiveData/src/MonitorLiveData.cpp index 8262af09878f..8491c3d349bd 100644 --- a/Code/Mantid/Framework/LiveData/src/MonitorLiveData.cpp +++ b/Code/Mantid/Framework/LiveData/src/MonitorLiveData.cpp @@ -27,7 +27,7 @@ MonitorLiveData::~MonitorLiveData() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string MonitorLiveData::name() const { return "MonitorLiveData"; }; +const std::string MonitorLiveData::name() const { return "MonitorLiveData"; } /// Algorithm's category for identification. @see Algorithm::category const std::string MonitorLiveData::category() const { @@ -35,7 +35,7 @@ const std::string MonitorLiveData::category() const { } /// Algorithm's version for identification. @see Algorithm::version -int MonitorLiveData::version() const { return 1; }; +int MonitorLiveData::version() const { return 1; } //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. diff --git a/Code/Mantid/Framework/LiveData/src/SNSLiveEventDataListener.cpp b/Code/Mantid/Framework/LiveData/src/SNSLiveEventDataListener.cpp index 50b2621e222a..b70faa984ea9 100644 --- a/Code/Mantid/Framework/LiveData/src/SNSLiveEventDataListener.cpp +++ b/Code/Mantid/Framework/LiveData/src/SNSLiveEventDataListener.cpp @@ -54,7 +54,7 @@ Mantid::Kernel::DateAndTime timeFromPacket(const ADARA::PacketHeader &hdr) { namespace Mantid { namespace LiveData { -DECLARE_LISTENER(SNSLiveEventDataListener); +DECLARE_LISTENER(SNSLiveEventDataListener) // The DECLARE_LISTENER macro seems to confuse some editors' syntax checking. // The semi-colon limits the complaints to one line. It has no actual effect // on the code. diff --git a/Code/Mantid/Framework/LiveData/src/StartLiveData.cpp b/Code/Mantid/Framework/LiveData/src/StartLiveData.cpp index c890cac2ab60..49338ad3a41d 100644 --- a/Code/Mantid/Framework/LiveData/src/StartLiveData.cpp +++ b/Code/Mantid/Framework/LiveData/src/StartLiveData.cpp @@ -37,10 +37,10 @@ StartLiveData::~StartLiveData() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string StartLiveData::name() const { return "StartLiveData"; }; +const std::string StartLiveData::name() const { return "StartLiveData"; } /// Algorithm's version for identification. @see Algorithm::version -int StartLiveData::version() const { return 1; }; +int StartLiveData::version() const { return 1; } //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/CachedExperimentInfo.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/CachedExperimentInfo.h index a4a590186b0c..22d7b317caca 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/CachedExperimentInfo.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/CachedExperimentInfo.h @@ -78,8 +78,8 @@ class DLLExport CachedExperimentInfo { const Kernel::DblMatrix &sampleToDetectorTransform() const; private: - DISABLE_DEFAULT_CONSTRUCT(CachedExperimentInfo); - DISABLE_COPY_AND_ASSIGN(CachedExperimentInfo); + DISABLE_DEFAULT_CONSTRUCT(CachedExperimentInfo) + DISABLE_COPY_AND_ASSIGN(CachedExperimentInfo) /// Cache frequently used values void initCaches(const Geometry::Instrument_const_sptr &instrument, diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/ForegroundModel.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/ForegroundModel.h index a7e03768a32f..29a258d31bf3 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/ForegroundModel.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/ForegroundModel.h @@ -107,7 +107,7 @@ class DLLExport ForegroundModel : public API::ParamFunction { double &arlu2, double &arlu3); private: - DISABLE_COPY_AND_ASSIGN(ForegroundModel); + DISABLE_COPY_AND_ASSIGN(ForegroundModel) /// Required by the interface void function(const Mantid::API::FunctionDomain &, diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/ForegroundModelFactory.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/ForegroundModelFactory.h index 7a2ce0cf3e36..5bb9e80788bd 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/ForegroundModelFactory.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/ForegroundModelFactory.h @@ -57,7 +57,7 @@ class MANTID_MDALGORITHMS_DLL ForegroundModelFactoryImpl friend struct Kernel::CreateUsingNew; /// Default constructor ForegroundModelFactoryImpl(); - DISABLE_COPY_AND_ASSIGN(ForegroundModelFactoryImpl); + DISABLE_COPY_AND_ASSIGN(ForegroundModelFactoryImpl) // Do not allow the default create & createUnwrapped to be called using BaseClass::create; diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/MDResolutionConvolution.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/MDResolutionConvolution.h index 5e2184882dc6..3be84661565f 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/MDResolutionConvolution.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/MDResolutionConvolution.h @@ -117,7 +117,7 @@ class DLLExport MDResolutionConvolution : public API::ParamFunction { const API::IFunctionMD &getFittingFunction() const; private: - DISABLE_COPY_AND_ASSIGN(MDResolutionConvolution); + DISABLE_COPY_AND_ASSIGN(MDResolutionConvolution) /// Required for function interface void function(const Mantid::API::FunctionDomain &, diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/MDResolutionConvolutionFactory.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/MDResolutionConvolutionFactory.h index 1c3d66d59226..005d9af1314d 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/MDResolutionConvolutionFactory.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/MDResolutionConvolutionFactory.h @@ -56,7 +56,7 @@ class MANTID_MDALGORITHMS_DLL MDResolutionConvolutionFactoryImpl friend struct Kernel::CreateUsingNew; /// Default constructor. Private for singleton holder MDResolutionConvolutionFactoryImpl(); - DISABLE_COPY_AND_ASSIGN(MDResolutionConvolutionFactoryImpl); + DISABLE_COPY_AND_ASSIGN(MDResolutionConvolutionFactoryImpl) // Do not allow the default create & createUnwrapped to be called using BaseClass::create; diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/Resolution/ModeratorChopperResolution.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/Resolution/ModeratorChopperResolution.h index 27fea7faefba..429d7b56bf15 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/Resolution/ModeratorChopperResolution.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/Resolution/ModeratorChopperResolution.h @@ -57,8 +57,8 @@ class DLLExport ModeratorChopperResolution { double energyWidth(const double deltaE) const; private: - DISABLE_DEFAULT_CONSTRUCT(ModeratorChopperResolution); - DISABLE_COPY_AND_ASSIGN(ModeratorChopperResolution); + DISABLE_DEFAULT_CONSTRUCT(ModeratorChopperResolution) + DISABLE_COPY_AND_ASSIGN(ModeratorChopperResolution) /// Store required cached variables void initCaches(); diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/Resolution/TobyFitResolutionModel.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/Resolution/TobyFitResolutionModel.h index 11822cc28d30..df512cf7df71 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/Resolution/TobyFitResolutionModel.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/Resolution/TobyFitResolutionModel.h @@ -77,7 +77,7 @@ class DLLExport TobyFitResolutionModel : public MDResolutionConvolution { const size_t eventIndex) const; private: - DISABLE_COPY_AND_ASSIGN(TobyFitResolutionModel); + DISABLE_COPY_AND_ASSIGN(TobyFitResolutionModel) friend class TobyFitYVector; diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/Resolution/TobyFitYVector.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/Resolution/TobyFitYVector.h index d5dd3631ca87..6993c3e3656b 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/Resolution/TobyFitYVector.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/Resolution/TobyFitYVector.h @@ -77,7 +77,7 @@ class DLLExport TobyFitYVector { 8, // width-coordinate of point of detection in detector frame DetectorHeightCoord = 9, // height-coordinate of point of detection in detector frame - DetectionTime = 10, // deviation in detection time of neutron + DetectionTime = 10 // deviation in detection time of neutron }; /// Returns the number of parameters, i.e. length of the Y vector diff --git a/Code/Mantid/Framework/MDAlgorithms/src/AndMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/AndMD.cpp index 613414e8bec2..4f18cf8d1850 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/AndMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/AndMD.cpp @@ -22,10 +22,10 @@ AndMD::~AndMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string AndMD::name() const { return "AndMD"; }; +const std::string AndMD::name() const { return "AndMD"; } /// Algorithm's version for identification. @see Algorithm::version -int AndMD::version() const { return 1; }; +int AndMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand diff --git a/Code/Mantid/Framework/MDAlgorithms/src/BinaryOperationMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/BinaryOperationMD.cpp index 5868cf52579e..c618b3692d45 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/BinaryOperationMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/BinaryOperationMD.cpp @@ -32,10 +32,10 @@ BinaryOperationMD::~BinaryOperationMD() {} /// Algorithm's name for identification. @see Algorithm::name const std::string BinaryOperationMD::name() const { return "BinaryOperationMD"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int BinaryOperationMD::version() const { return 1; }; +int BinaryOperationMD::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string BinaryOperationMD::category() const { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/BooleanBinaryOperationMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/BooleanBinaryOperationMD.cpp index 3c000629af72..26d6ce085794 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/BooleanBinaryOperationMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/BooleanBinaryOperationMD.cpp @@ -22,10 +22,10 @@ BooleanBinaryOperationMD::~BooleanBinaryOperationMD() {} /// Algorithm's name for identification. @see Algorithm::name const std::string BooleanBinaryOperationMD::name() const { return "BooleanBinaryOperationMD"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int BooleanBinaryOperationMD::version() const { return 1; }; +int BooleanBinaryOperationMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- /// diff --git a/Code/Mantid/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp b/Code/Mantid/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp index 82b7e4dabb17..9a435bf5db1b 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp @@ -52,7 +52,7 @@ const std::string CalculateCoverageDGS::name() const { } /// Algorithm's version for identification. @see Algorithm::version -int CalculateCoverageDGS::version() const { return 1; }; +int CalculateCoverageDGS::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string CalculateCoverageDGS::category() const { @@ -63,7 +63,7 @@ const std::string CalculateCoverageDGS::category() const { const std::string CalculateCoverageDGS::summary() const { return "Calculate the reciprocal space coverage for direct geometry " "spectrometers"; -}; +} /** *Stores the X values from each H,K,L dimension as member variables diff --git a/Code/Mantid/Framework/MDAlgorithms/src/CompareMDWorkspaces.cpp b/Code/Mantid/Framework/MDAlgorithms/src/CompareMDWorkspaces.cpp index e7959d9c9fbb..28178f447fa3 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/CompareMDWorkspaces.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/CompareMDWorkspaces.cpp @@ -43,10 +43,10 @@ CompareMDWorkspaces::~CompareMDWorkspaces() {} /// Algorithm's name for identification. @see Algorithm::name const std::string CompareMDWorkspaces::name() const { return "CompareMDWorkspaces"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int CompareMDWorkspaces::version() const { return 1; }; +int CompareMDWorkspaces::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string CompareMDWorkspaces::category() const { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp index 414eb440975e..a2adcd804e46 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp @@ -37,10 +37,10 @@ ConvertToDetectorFaceMD::~ConvertToDetectorFaceMD() {} /// Algorithm's name for identification. @see Algorithm::name const std::string ConvertToDetectorFaceMD::name() const { return "ConvertToDetectorFaceMD"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int ConvertToDetectorFaceMD::version() const { return 1; }; +int ConvertToDetectorFaceMD::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ConvertToDetectorFaceMD::category() const { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp index b4ccc704bb3a..a20bd7ded854 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp @@ -34,10 +34,10 @@ ConvertToMDMinMaxGlobal::~ConvertToMDMinMaxGlobal() {} /// Algorithm's name for identification. @see Algorithm::name const std::string ConvertToMDMinMaxGlobal::name() const { return "ConvertToMDMinMaxGlobal"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int ConvertToMDMinMaxGlobal::version() const { return 1; }; +int ConvertToMDMinMaxGlobal::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ConvertToMDMinMaxGlobal::category() const { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/CreateMDHistoWorkspace.cpp b/Code/Mantid/Framework/MDAlgorithms/src/CreateMDHistoWorkspace.cpp index 6684e1cac420..71f53a681177 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/CreateMDHistoWorkspace.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/CreateMDHistoWorkspace.cpp @@ -32,10 +32,10 @@ CreateMDHistoWorkspace::~CreateMDHistoWorkspace() {} /// Algorithm's name for identification. @see Algorithm::name const std::string CreateMDHistoWorkspace::name() const { return "CreateMDHistoWorkspace"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int CreateMDHistoWorkspace::version() const { return 1; }; +int CreateMDHistoWorkspace::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string CreateMDHistoWorkspace::category() const { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/DivideMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/DivideMD.cpp index a471bc0c91f1..d5a31cf34ce8 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/DivideMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/DivideMD.cpp @@ -27,10 +27,10 @@ DivideMD::~DivideMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string DivideMD::name() const { return "DivideMD"; }; +const std::string DivideMD::name() const { return "DivideMD"; } /// Algorithm's version for identification. @see Algorithm::version -int DivideMD::version() const { return 1; }; +int DivideMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- diff --git a/Code/Mantid/Framework/MDAlgorithms/src/EqualToMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/EqualToMD.cpp index f53d3f33f7f2..32216e09f5f1 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/EqualToMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/EqualToMD.cpp @@ -22,10 +22,10 @@ EqualToMD::~EqualToMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string EqualToMD::name() const { return "EqualToMD"; }; +const std::string EqualToMD::name() const { return "EqualToMD"; } /// Algorithm's version for identification. @see Algorithm::version -int EqualToMD::version() const { return 1; }; +int EqualToMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- /// Extra properties diff --git a/Code/Mantid/Framework/MDAlgorithms/src/EvaluateMDFunction.cpp b/Code/Mantid/Framework/MDAlgorithms/src/EvaluateMDFunction.cpp index d395663cb7ba..10f64648dac4 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/EvaluateMDFunction.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/EvaluateMDFunction.cpp @@ -28,7 +28,7 @@ EvaluateMDFunction::~EvaluateMDFunction() {} //---------------------------------------------------------------------------------------------- /// Algorithm's version for identification. @see Algorithm::version -int EvaluateMDFunction::version() const { return 1; }; +int EvaluateMDFunction::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string EvaluateMDFunction::category() const { @@ -38,7 +38,7 @@ const std::string EvaluateMDFunction::category() const { /// Algorithm's summary for use in the GUI and help. @see Algorithm::summary const std::string EvaluateMDFunction::summary() const { return "Evaluates an MD function on a MD histo workspace."; -}; +} //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ExponentialMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ExponentialMD.cpp index 50ffffa72ead..7da6298e57aa 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ExponentialMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ExponentialMD.cpp @@ -22,10 +22,10 @@ ExponentialMD::~ExponentialMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string ExponentialMD::name() const { return "ExponentialMD"; }; +const std::string ExponentialMD::name() const { return "ExponentialMD"; } /// Algorithm's version for identification. @see Algorithm::version -int ExponentialMD::version() const { return 1; }; +int ExponentialMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- diff --git a/Code/Mantid/Framework/MDAlgorithms/src/GreaterThanMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/GreaterThanMD.cpp index 8818bc87c81e..f98766cfff7d 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/GreaterThanMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/GreaterThanMD.cpp @@ -22,10 +22,10 @@ GreaterThanMD::~GreaterThanMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string GreaterThanMD::name() const { return "GreaterThanMD"; }; +const std::string GreaterThanMD::name() const { return "GreaterThanMD"; } /// Algorithm's version for identification. @see Algorithm::version -int GreaterThanMD::version() const { return 1; }; +int GreaterThanMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand diff --git a/Code/Mantid/Framework/MDAlgorithms/src/IntegrateFlux.cpp b/Code/Mantid/Framework/MDAlgorithms/src/IntegrateFlux.cpp index 95092d1e84b7..1bb592d391f3 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/IntegrateFlux.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/IntegrateFlux.cpp @@ -32,7 +32,7 @@ class NoEventWorkspaceDeleting { const std::string IntegrateFlux::name() const { return "IntegrateFlux"; } /// Algorithm's version for identification. @see Algorithm::version -int IntegrateFlux::version() const { return 1; }; +int IntegrateFlux::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string IntegrateFlux::category() const { return "MDAlgorithms"; } @@ -40,7 +40,7 @@ const std::string IntegrateFlux::category() const { return "MDAlgorithms"; } /// Algorithm's summary for use in the GUI and help. @see Algorithm::summary const std::string IntegrateFlux::summary() const { return "Interates spectra in a matrix workspace at a set of points."; -}; +} //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. diff --git a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp index e756c4d49ea1..83009e5e60fb 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp @@ -103,10 +103,12 @@ void IntegratePeaksMD2::init() { "Only warning if all of peak outer radius is not on detector (default).\n" "If false, do not integrate if the outer radius is not on a detector."); - declareProperty("AdaptiveQRadius", false, - "Default is false. If true, all input radii are multiplied " - "by the magnitude of Q at the peak center so each peak has a " - "different integration radius. Q includes the 2*pi factor."); + declareProperty("AdaptiveQBackground", false, + "Default is false. If true, all background values" + "vary on a line so that they are" + "background plus AdaptiveQMultiplier multiplied" + "by the magnitude of Q at the peak center so each peak has a " + "different integration radius. Q includes the 2*pi factor."); declareProperty("Cylinder", false, "Default is sphere. Use next five parameters for cylinder."); @@ -142,6 +144,12 @@ void IntegratePeaksMD2::init() { new FileProperty("ProfilesFile", "", FileProperty::OptionalSave, std::vector(1, "profiles")), "Save (Optionally) as Isaw peaks file with profiles included"); + + declareProperty("AdaptiveQMultiplier", 0.0, + "Peak integration radius varies on a line so that it is" + "PeakRadius plus this value multiplied" + "by the magnitude of Q at the peak center so each peak has a " + "different integration radius. Q includes the 2*pi factor."); } //---------------------------------------------------------------------------------------------- @@ -191,7 +199,10 @@ void IntegratePeaksMD2::integrate(typename MDEventWorkspace::sptr ws) { Workspace2D_sptr wsProfile2D, wsFit2D, wsDiff2D; size_t numSteps = 0; bool cylinderBool = getProperty("Cylinder"); - bool adaptiveQRadius = getProperty("AdaptiveQRadius"); + bool adaptiveQBackground = getProperty("AdaptiveQBackground"); + double adaptiveQMultiplier = getProperty("AdaptiveQMultiplier"); + double adaptiveQBackgroundMultiplier = 0.0; + if (adaptiveQBackground) adaptiveQBackgroundMultiplier = adaptiveQMultiplier; std::vector PeakRadiusVector(peakWS->getNumberPeaks(), PeakRadius); std::vector BackgroundInnerRadiusVector(peakWS->getNumberPeaks(), BackgroundInnerRadius); @@ -316,8 +327,8 @@ void IntegratePeaksMD2::integrate(typename MDEventWorkspace::sptr ws) { double background_total = 0.0; if (!cylinderBool) { // modulus of Q - coord_t lenQpeak = 1.0; - if (adaptiveQRadius) { + coord_t lenQpeak = 0.0; + if (adaptiveQMultiplier > 0.0) { lenQpeak = 0.0; for (size_t d = 0; d < nd; d++) { lenQpeak += center[d] * center[d]; @@ -325,9 +336,9 @@ void IntegratePeaksMD2::integrate(typename MDEventWorkspace::sptr ws) { lenQpeak = std::sqrt(lenQpeak); } - PeakRadiusVector[i] = lenQpeak * PeakRadius; - BackgroundInnerRadiusVector[i] = lenQpeak * BackgroundInnerRadius; - BackgroundOuterRadiusVector[i] = lenQpeak * BackgroundOuterRadius; + PeakRadiusVector[i] = adaptiveQMultiplier * lenQpeak + PeakRadius; + BackgroundInnerRadiusVector[i] = adaptiveQBackgroundMultiplier * lenQpeak + BackgroundInnerRadius; + BackgroundOuterRadiusVector[i] = adaptiveQBackgroundMultiplier * lenQpeak + BackgroundOuterRadius; CoordTransformDistance sphere(nd, center, dimensionsUsed); if(Peak* shapeablePeak = dynamic_cast(&p)){ @@ -340,7 +351,7 @@ void IntegratePeaksMD2::integrate(typename MDEventWorkspace::sptr ws) { // Perform the integration into whatever box is contained within. ws->getBox()->integrateSphere( sphere, - static_cast(lenQpeak * PeakRadius * lenQpeak * PeakRadius), + static_cast((adaptiveQMultiplier * lenQpeak + PeakRadius) * (adaptiveQMultiplier * lenQpeak + PeakRadius)), signal, errorSquared); // Integrate around the background radius @@ -348,8 +359,8 @@ void IntegratePeaksMD2::integrate(typename MDEventWorkspace::sptr ws) { if (BackgroundOuterRadius > PeakRadius) { // Get the total signal inside "BackgroundOuterRadius" ws->getBox()->integrateSphere( - sphere, static_cast(lenQpeak * BackgroundOuterRadius * - lenQpeak * BackgroundOuterRadius), + sphere, static_cast((adaptiveQBackgroundMultiplier * lenQpeak + BackgroundOuterRadius) * + (adaptiveQBackgroundMultiplier * lenQpeak + BackgroundOuterRadius)), bgSignal, bgErrorSquared); // Evaluate the signal inside "BackgroundInnerRadius" @@ -359,8 +370,8 @@ void IntegratePeaksMD2::integrate(typename MDEventWorkspace::sptr ws) { // Integrate this 3rd radius, if needed if (BackgroundInnerRadius != PeakRadius) { ws->getBox()->integrateSphere( - sphere, static_cast(lenQpeak * BackgroundInnerRadius * - lenQpeak * BackgroundInnerRadius), + sphere, static_cast((adaptiveQBackgroundMultiplier * lenQpeak + BackgroundInnerRadius) * + (adaptiveQBackgroundMultiplier * lenQpeak + BackgroundInnerRadius)), interiorSignal, interiorErrorSquared); } else { // PeakRadius == BackgroundInnerRadius, so use the previous value diff --git a/Code/Mantid/Framework/MDAlgorithms/src/LessThanMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/LessThanMD.cpp index da8b7db1879f..ba6e3f654cb3 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/LessThanMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/LessThanMD.cpp @@ -22,10 +22,10 @@ LessThanMD::~LessThanMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string LessThanMD::name() const { return "LessThanMD"; }; +const std::string LessThanMD::name() const { return "LessThanMD"; } /// Algorithm's version for identification. @see Algorithm::version -int LessThanMD::version() const { return 1; }; +int LessThanMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand diff --git a/Code/Mantid/Framework/MDAlgorithms/src/LoadILLAscii.cpp b/Code/Mantid/Framework/MDAlgorithms/src/LoadILLAscii.cpp index ffe7780809d4..aff2b3ba119c 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/LoadILLAscii.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/LoadILLAscii.cpp @@ -82,10 +82,10 @@ int LoadILLAscii::confidence(Kernel::FileDescriptor &descriptor) const { //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string LoadILLAscii::name() const { return "LoadILLAscii"; }; +const std::string LoadILLAscii::name() const { return "LoadILLAscii"; } /// Algorithm's version for identification. @see Algorithm::version -int LoadILLAscii::version() const { return 1; }; +int LoadILLAscii::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string LoadILLAscii::category() const { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp index d50f3f3a3686..7b7d5eafaad1 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp @@ -34,7 +34,7 @@ using namespace Mantid::MDEvents; namespace Mantid { namespace MDAlgorithms { -DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadMD); +DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadMD) //---------------------------------------------------------------------------------------------- /** Constructor diff --git a/Code/Mantid/Framework/MDAlgorithms/src/LoadSQW.cpp b/Code/Mantid/Framework/MDAlgorithms/src/LoadSQW.cpp index 30682a7f2d17..5f2e8770c49c 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/LoadSQW.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/LoadSQW.cpp @@ -43,7 +43,7 @@ template T interpretAs(std::vector &Buf, size_t ind = 0) { } } -DECLARE_FILELOADER_ALGORITHM(LoadSQW); +DECLARE_FILELOADER_ALGORITHM(LoadSQW) /// Constructor LoadSQW::LoadSQW() : m_fileName(""), m_fileStream(), diff --git a/Code/Mantid/Framework/MDAlgorithms/src/LogarithmMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/LogarithmMD.cpp index e60b1f162cef..2111d83e333a 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/LogarithmMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/LogarithmMD.cpp @@ -22,10 +22,10 @@ LogarithmMD::~LogarithmMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string LogarithmMD::name() const { return "LogarithmMD"; }; +const std::string LogarithmMD::name() const { return "LogarithmMD"; } /// Algorithm's version for identification. @see Algorithm::version -int LogarithmMD::version() const { return 1; }; +int LogarithmMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- diff --git a/Code/Mantid/Framework/MDAlgorithms/src/MaskMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MaskMD.cpp index 8a9110bf3397..a9f49837d990 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/MaskMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MaskMD.cpp @@ -41,10 +41,10 @@ MaskMD::~MaskMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string MaskMD::name() const { return "MaskMD"; }; +const std::string MaskMD::name() const { return "MaskMD"; } /// Algorithm's version for identification. @see Algorithm::version -int MaskMD::version() const { return 1; }; +int MaskMD::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string MaskMD::category() const { return "MDAlgorithms"; } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/MergeMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MergeMD.cpp index c21455165f31..2ab9e5075111 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/MergeMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MergeMD.cpp @@ -31,10 +31,10 @@ MergeMD::~MergeMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string MergeMD::name() const { return "MergeMD"; }; +const std::string MergeMD::name() const { return "MergeMD"; } /// Algorithm's version for identification. @see Algorithm::version -int MergeMD::version() const { return 1; }; +int MergeMD::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string MergeMD::category() const { return "MDAlgorithms"; } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/MinusMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MinusMD.cpp index 5b16eb8e592d..7985cc9b0eb0 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/MinusMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MinusMD.cpp @@ -27,10 +27,10 @@ MinusMD::~MinusMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string MinusMD::name() const { return "MinusMD"; }; +const std::string MinusMD::name() const { return "MinusMD"; } /// Algorithm's version for identification. @see Algorithm::version -int MinusMD::version() const { return 1; }; +int MinusMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- diff --git a/Code/Mantid/Framework/MDAlgorithms/src/MultiplyMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MultiplyMD.cpp index 38dd9296568b..5ba0de5c4512 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/MultiplyMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MultiplyMD.cpp @@ -27,10 +27,10 @@ MultiplyMD::~MultiplyMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string MultiplyMD::name() const { return "MultiplyMD"; }; +const std::string MultiplyMD::name() const { return "MultiplyMD"; } /// Algorithm's version for identification. @see Algorithm::version -int MultiplyMD::version() const { return 1; }; +int MultiplyMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- diff --git a/Code/Mantid/Framework/MDAlgorithms/src/NotMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/NotMD.cpp index fbe2573df7e9..00757fb06ef3 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/NotMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/NotMD.cpp @@ -22,10 +22,10 @@ NotMD::~NotMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string NotMD::name() const { return "NotMD"; }; +const std::string NotMD::name() const { return "NotMD"; } /// Algorithm's version for identification. @see Algorithm::version -int NotMD::version() const { return 1; }; +int NotMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- diff --git a/Code/Mantid/Framework/MDAlgorithms/src/OrMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/OrMD.cpp index 2dc5f30133e4..1ff0932783ea 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/OrMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/OrMD.cpp @@ -22,10 +22,10 @@ OrMD::~OrMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string OrMD::name() const { return "OrMD"; }; +const std::string OrMD::name() const { return "OrMD"; } /// Algorithm's version for identification. @see Algorithm::version -int OrMD::version() const { return 1; }; +int OrMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand diff --git a/Code/Mantid/Framework/MDAlgorithms/src/PowerMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/PowerMD.cpp index 90cdcc44f543..d4e03afa6bcd 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/PowerMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/PowerMD.cpp @@ -22,10 +22,10 @@ PowerMD::~PowerMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string PowerMD::name() const { return "PowerMD"; }; +const std::string PowerMD::name() const { return "PowerMD"; } /// Algorithm's version for identification. @see Algorithm::version -int PowerMD::version() const { return 1; }; +int PowerMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- diff --git a/Code/Mantid/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp index d8cec796d70f..f705eaaab279 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp @@ -12,7 +12,7 @@ namespace MDAlgorithms { // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(PreprocessDetectorsToMD) -PreprocessDetectorsToMD::PreprocessDetectorsToMD(){}; +PreprocessDetectorsToMD::PreprocessDetectorsToMD(){} //---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. */ void PreprocessDetectorsToMD::init() { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/FitResolutionConvolvedModel.cpp b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/FitResolutionConvolvedModel.cpp index dbe250985149..da845673529e 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/FitResolutionConvolvedModel.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/FitResolutionConvolvedModel.cpp @@ -11,7 +11,7 @@ namespace Mantid { namespace MDAlgorithms { // Register the algorithm into the AlgorithmFactory -DECLARE_ALGORITHM(FitResolutionConvolvedModel); +DECLARE_ALGORITHM(FitResolutionConvolvedModel) using Kernel::Direction; using Kernel::ListValidator; diff --git a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Models/MullerAnsatz.cpp b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Models/MullerAnsatz.cpp index 2afe41cc2bd2..708ae56914c0 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Models/MullerAnsatz.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Models/MullerAnsatz.cpp @@ -8,7 +8,7 @@ namespace Mantid { namespace MDAlgorithms { -DECLARE_FOREGROUNDMODEL(MullerAnsatz); +DECLARE_FOREGROUNDMODEL(MullerAnsatz) using Kernel::Math::BoseEinsteinDistribution; diff --git a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Models/QCoordinate.cpp b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Models/QCoordinate.cpp index cb3d62350f17..ca3ed919e0ad 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Models/QCoordinate.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Models/QCoordinate.cpp @@ -4,7 +4,7 @@ namespace Mantid { namespace MDAlgorithms { -DECLARE_FOREGROUNDMODEL(QCoordinate); +DECLARE_FOREGROUNDMODEL(QCoordinate) namespace // anonymous { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Models/Strontium122.cpp b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Models/Strontium122.cpp index de1d838c4652..d613b2059c84 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Models/Strontium122.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Models/Strontium122.cpp @@ -5,7 +5,7 @@ namespace Mantid { namespace MDAlgorithms { -DECLARE_FOREGROUNDMODEL(Strontium122); +DECLARE_FOREGROUNDMODEL(Strontium122) using Kernel::Math::BoseEinsteinDistribution; diff --git a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitResolutionModel.cpp b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitResolutionModel.cpp index cabafe77cd99..3ac60433469c 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitResolutionModel.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitResolutionModel.cpp @@ -23,7 +23,7 @@ using API::Run; using API::IFunction; DECLARE_MDRESOLUTIONCONVOLUTION(TobyFitResolutionModel, - "TobyFitResolutionModel"); + "TobyFitResolutionModel") namespace // anonymous { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/ResolutionConvolvedCrossSection.cpp b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/ResolutionConvolvedCrossSection.cpp index 031e84db52c5..ba9dd517a095 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/ResolutionConvolvedCrossSection.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/ResolutionConvolvedCrossSection.cpp @@ -50,7 +50,7 @@ namespace Mantid { namespace MDAlgorithms { -DECLARE_FUNCTION(ResolutionConvolvedCrossSection); +DECLARE_FUNCTION(ResolutionConvolvedCrossSection) namespace { // Attribute names diff --git a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/SimulateResolutionConvolvedModel.cpp b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/SimulateResolutionConvolvedModel.cpp index e7582e636b6d..e9cb4227084c 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/SimulateResolutionConvolvedModel.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/SimulateResolutionConvolvedModel.cpp @@ -18,7 +18,7 @@ namespace Mantid { namespace MDAlgorithms { // Register the algorithm into the AlgorithmFactory -DECLARE_ALGORITHM(SimulateResolutionConvolvedModel); +DECLARE_ALGORITHM(SimulateResolutionConvolvedModel) using namespace API; using namespace Kernel; diff --git a/Code/Mantid/Framework/MDAlgorithms/src/SaveZODS.cpp b/Code/Mantid/Framework/MDAlgorithms/src/SaveZODS.cpp index 1b7ad75e9a5b..df0b220d5799 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/SaveZODS.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/SaveZODS.cpp @@ -28,10 +28,10 @@ SaveZODS::~SaveZODS() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string SaveZODS::name() const { return "SaveZODS"; }; +const std::string SaveZODS::name() const { return "SaveZODS"; } /// Algorithm's version for identification. @see Algorithm::version -int SaveZODS::version() const { return 1; }; +int SaveZODS::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string SaveZODS::category() const { return "MDAlgorithms"; } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/SetMDUsingMask.cpp b/Code/Mantid/Framework/MDAlgorithms/src/SetMDUsingMask.cpp index bb35f8b10486..2363f5970a63 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/SetMDUsingMask.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/SetMDUsingMask.cpp @@ -27,10 +27,10 @@ SetMDUsingMask::~SetMDUsingMask() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string SetMDUsingMask::name() const { return "SetMDUsingMask"; }; +const std::string SetMDUsingMask::name() const { return "SetMDUsingMask"; } /// Algorithm's version for identification. @see Algorithm::version -int SetMDUsingMask::version() const { return 1; }; +int SetMDUsingMask::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string SetMDUsingMask::category() const { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ThresholdMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ThresholdMD.cpp index 217943daffb0..bb03a8dfb786 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ThresholdMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ThresholdMD.cpp @@ -34,10 +34,10 @@ ThresholdMD::~ThresholdMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string ThresholdMD::name() const { return "ThresholdMD"; }; +const std::string ThresholdMD::name() const { return "ThresholdMD"; } /// Algorithm's version for identification. @see Algorithm::version -int ThresholdMD::version() const { return 1; }; +int ThresholdMD::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ThresholdMD::category() const { return "MDAlgorithms"; } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/TransformMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/TransformMD.cpp index 20cd88620837..896c29c74d76 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/TransformMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/TransformMD.cpp @@ -29,10 +29,10 @@ TransformMD::~TransformMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string TransformMD::name() const { return "TransformMD"; }; +const std::string TransformMD::name() const { return "TransformMD"; } /// Algorithm's version for identification. @see Algorithm::version -int TransformMD::version() const { return 1; }; +int TransformMD::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string TransformMD::category() const { return "MDAlgorithms"; } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/UnaryOperationMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/UnaryOperationMD.cpp index 3d6d07f994e7..38862d9c2143 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/UnaryOperationMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/UnaryOperationMD.cpp @@ -25,10 +25,10 @@ UnaryOperationMD::~UnaryOperationMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string UnaryOperationMD::name() const { return "UnaryOperationMD"; }; +const std::string UnaryOperationMD::name() const { return "UnaryOperationMD"; } /// Algorithm's version for identification. @see Algorithm::version -int UnaryOperationMD::version() const { return 1; }; +int UnaryOperationMD::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string UnaryOperationMD::category() const { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/XorMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/XorMD.cpp index 2a388274f38b..c960c27df589 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/XorMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/XorMD.cpp @@ -22,10 +22,10 @@ XorMD::~XorMD() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string XorMD::name() const { return "XorMD"; }; +const std::string XorMD::name() const { return "XorMD"; } /// Algorithm's version for identification. @see Algorithm::version -int XorMD::version() const { return 1; }; +int XorMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformAligned.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformAligned.h index cc57d1f8ca3e..5dd40ca97fbf 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformAligned.h +++ b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformAligned.h @@ -9,13 +9,13 @@ namespace Mantid { namespace MDEvents { /// Unique type declaration for which dimensions are used in the input workspace -DECLARE_VECTOR_PARAMETER(DimensionsToBinFromParam, size_t); +DECLARE_VECTOR_PARAMETER(DimensionsToBinFromParam, size_t) /// Unique type declaration for the offset of coordinates -DECLARE_VECTOR_PARAMETER(OriginOffsetParam, coord_t); +DECLARE_VECTOR_PARAMETER(OriginOffsetParam, coord_t) /// Unique type declaration for the step size in transformation -DECLARE_VECTOR_PARAMETER(ScalingParam, coord_t); +DECLARE_VECTOR_PARAMETER(ScalingParam, coord_t) /** A restricted version of CoordTransform which transforms from one set of dimensions to another, allowing: diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformDistance.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformDistance.h index 2c332767cc17..4da70fdac7e0 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformDistance.h +++ b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformDistance.h @@ -12,11 +12,11 @@ namespace Mantid { namespace MDEvents { /// Unique CoordCenterVectorParam type declaration for ndimensional coordinate /// centers -DECLARE_VECTOR_PARAMETER(CoordCenterVectorParam, coord_t); +DECLARE_VECTOR_PARAMETER(CoordCenterVectorParam, coord_t) /// Unique DimensionsUsedVectorParam type declaration for boolean masks over /// dimensions -DECLARE_VECTOR_PARAMETER(DimensionsUsedVectorParam, bool); +DECLARE_VECTOR_PARAMETER(DimensionsUsedVectorParam, bool) /** A non-linear coordinate transform that takes * a point from nd dimensions and converts it to a diff --git a/Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp b/Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp index 2bb6898f1a07..34beee6fd332 100644 --- a/Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp +++ b/Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp @@ -94,7 +94,7 @@ size_t ConvToMDBase::initialize( m_coordinateSystem = WSD.getCoordinateSystem(); return n_spectra; -}; +} /** empty default constructor */ ConvToMDBase::ConvToMDBase() diff --git a/Code/Mantid/Framework/MDEvents/src/ConvertToReflectometryQ.cpp b/Code/Mantid/Framework/MDEvents/src/ConvertToReflectometryQ.cpp index c8785b26cb21..1c5df9e388a8 100644 --- a/Code/Mantid/Framework/MDEvents/src/ConvertToReflectometryQ.cpp +++ b/Code/Mantid/Framework/MDEvents/src/ConvertToReflectometryQ.cpp @@ -136,10 +136,10 @@ ConvertToReflectometryQ::~ConvertToReflectometryQ() {} /// Algorithm's name for identification. @see Algorithm::name const std::string ConvertToReflectometryQ::name() const { return "ConvertToReflectometryQ"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int ConvertToReflectometryQ::version() const { return 1; }; +int ConvertToReflectometryQ::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ConvertToReflectometryQ::category() const { diff --git a/Code/Mantid/Framework/MDEvents/src/FitMD.cpp b/Code/Mantid/Framework/MDEvents/src/FitMD.cpp index dbb17e2e1f4f..64d2ce71eb3e 100644 --- a/Code/Mantid/Framework/MDEvents/src/FitMD.cpp +++ b/Code/Mantid/Framework/MDEvents/src/FitMD.cpp @@ -23,7 +23,7 @@ namespace Mantid { namespace MDEvents { -DECLARE_DOMAINCREATOR(FitMD); +DECLARE_DOMAINCREATOR(FitMD) using namespace API; using namespace Kernel; diff --git a/Code/Mantid/Framework/MDEvents/src/ImportMDEventWorkspace.cpp b/Code/Mantid/Framework/MDEvents/src/ImportMDEventWorkspace.cpp index 778dae5954c6..25613ad38949 100644 --- a/Code/Mantid/Framework/MDEvents/src/ImportMDEventWorkspace.cpp +++ b/Code/Mantid/Framework/MDEvents/src/ImportMDEventWorkspace.cpp @@ -81,10 +81,10 @@ ImportMDEventWorkspace::~ImportMDEventWorkspace() {} /// Algorithm's name for identification. @see Algorithm::name const std::string ImportMDEventWorkspace::name() const { return "ImportMDEventWorkspace"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int ImportMDEventWorkspace::version() const { return 1; }; +int ImportMDEventWorkspace::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ImportMDEventWorkspace::category() const { diff --git a/Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspace.cpp b/Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspace.cpp index 3773fc180231..134a84b5007e 100644 --- a/Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspace.cpp +++ b/Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspace.cpp @@ -31,10 +31,10 @@ ImportMDHistoWorkspace::~ImportMDHistoWorkspace() {} /// Algorithm's name for identification. @see Algorithm::name const std::string ImportMDHistoWorkspace::name() const { return "ImportMDHistoWorkspace"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int ImportMDHistoWorkspace::version() const { return 1; }; +int ImportMDHistoWorkspace::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string ImportMDHistoWorkspace::category() const { diff --git a/Code/Mantid/Framework/MDEvents/src/MDBox.cpp b/Code/Mantid/Framework/MDEvents/src/MDBox.cpp index 510d96f65f5f..6f4964c01fdd 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDBox.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDBox.cpp @@ -296,7 +296,7 @@ TMDE(void MDBox)::getEventsData(std::vector &coordTable, #ifdef MDBOX_TRACK_CENTROID this->calculateCentroid(this->m_centroid); #endif -}; +} /** The method to convert the table of data into vector of events * Used to load events from plain binary file * @param coordTable -- vector of events parameters, which will be converted @@ -305,7 +305,7 @@ TMDE(void MDBox)::getEventsData(std::vector &coordTable, */ TMDE(void MDBox)::setEventsData(const std::vector &coordTable) { MDE::dataToEvents(coordTable, this->data); -}; +} //----------------------------------------------------------------------------------------------- /** Allocate and return a vector with a copy of all events contained diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp b/Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp index c5066f6a2b21..64150e9fa8a1 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp @@ -4,7 +4,7 @@ namespace Mantid { namespace MDEvents { // register the class, whith conversion factory under ModQ name -DECLARE_MD_TRANSFID(MDTransfModQ, |Q|); +DECLARE_MD_TRANSFID(MDTransfModQ, |Q|) /**method calculates the units, the transformation expects the input ws to be in. If the input ws is in different units, diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfNoQ.cpp b/Code/Mantid/Framework/MDEvents/src/MDTransfNoQ.cpp index ea013bd32395..f8022527affa 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfNoQ.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDTransfNoQ.cpp @@ -4,7 +4,7 @@ namespace Mantid { namespace MDEvents { // register the class, whith conversion factory under NoQ name -DECLARE_MD_TRANSFID(MDTransfNoQ, CopyToMD); +DECLARE_MD_TRANSFID(MDTransfNoQ, CopyToMD) /** Method fills-in all additional properties requested by user and not defined *by matrix workspace itselt. @@ -177,7 +177,7 @@ MDTransfNoQ::inputUnitID(Kernel::DeltaEMode::Type mode, return pXAxis->unit()->unitID(); } -MDTransfNoQ::MDTransfNoQ() : m_NMatrixDim(0), m_YAxis(NULL), m_Det(NULL){}; +MDTransfNoQ::MDTransfNoQ() : m_NMatrixDim(0), m_YAxis(NULL), m_Det(NULL){} } // End MDAlgorighms namespace } // End Mantid namespace diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp b/Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp index aacc63c1c093..4b28ee722568 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp @@ -4,7 +4,7 @@ namespace Mantid { namespace MDEvents { // register the class, whith conversion factory under Q3D name -DECLARE_MD_TRANSFID(MDTransfQ3D, Q3D); +DECLARE_MD_TRANSFID(MDTransfQ3D, Q3D) /** method returns number of matrix dimensions calculated by this class * as function of energy analysis mode */ diff --git a/Code/Mantid/Framework/MDEvents/src/MDWSDescription.cpp b/Code/Mantid/Framework/MDEvents/src/MDWSDescription.cpp index 43dc60fae2e7..fe787634d1dc 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDWSDescription.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDWSDescription.cpp @@ -128,7 +128,7 @@ Kernel::Matrix MDWSDescription::getGoniometerMatr() const { return m_InWS->run().getGoniometer().getR(); else return Kernel::Matrix(3, 3, true); -}; +} /** the function builds MD event WS description from existing workspace. * Primary used to obtain existing ws parameters diff --git a/Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp b/Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp index 9ef8f0b06ef0..8ae927468775 100644 --- a/Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp +++ b/Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp @@ -366,7 +366,7 @@ UnitsConversionHelper::UnitsConversionHelper() : m_UnitCnvrsn(CnvrtToMD::ConvertNo), m_Factor(1), m_Power(1), m_Emode(-1), // undefined m_L1(1), m_Efix(1), m_TwoTheta(0), m_L2(1), m_pTwoThetas(NULL), - m_pL2s(NULL), m_pEfixedArray(NULL){}; + m_pL2s(NULL), m_pEfixedArray(NULL){} } // endNamespace MDEvents } // endNamespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/src/UserFunctionMD.cpp b/Code/Mantid/Framework/MDEvents/src/UserFunctionMD.cpp index 7b2eb2d1dd07..bb44a5191855 100644 --- a/Code/Mantid/Framework/MDEvents/src/UserFunctionMD.cpp +++ b/Code/Mantid/Framework/MDEvents/src/UserFunctionMD.cpp @@ -11,7 +11,7 @@ namespace Mantid { namespace MDEvents { // Subscribe the function into the factory. -DECLARE_FUNCTION(UserFunctionMD); +DECLARE_FUNCTION(UserFunctionMD) /// Default constructor UserFunctionMD::UserFunctionMD() { diff --git a/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/FitFunctions/IFunction1DAdapter.h b/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/FitFunctions/IFunction1DAdapter.h index f8eb459d600f..4dfd15fa5952 100644 --- a/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/FitFunctions/IFunction1DAdapter.h +++ b/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/FitFunctions/IFunction1DAdapter.h @@ -62,8 +62,8 @@ class IFunction1DAdapter : public virtual API::ParamFunction, private: /// The PyObject must be supplied to construct the object - DISABLE_DEFAULT_CONSTRUCT(IFunction1DAdapter); - DISABLE_COPY_AND_ASSIGN(IFunction1DAdapter); + DISABLE_DEFAULT_CONSTRUCT(IFunction1DAdapter) + DISABLE_COPY_AND_ASSIGN(IFunction1DAdapter) /// Flag if the functionDeriv1D method is overridden (avoids multiple checks) bool m_derivOveridden; diff --git a/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/FitFunctions/IFunctionAdapter.h b/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/FitFunctions/IFunctionAdapter.h index 791e261ac94a..30479217d156 100644 --- a/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/FitFunctions/IFunctionAdapter.h +++ b/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/FitFunctions/IFunctionAdapter.h @@ -106,8 +106,8 @@ class IFunctionAdapter : virtual public API::IFunction { private: /// The PyObject must be supplied to construct the object - DISABLE_DEFAULT_CONSTRUCT(IFunctionAdapter); - DISABLE_COPY_AND_ASSIGN(IFunctionAdapter); + DISABLE_DEFAULT_CONSTRUCT(IFunctionAdapter) + DISABLE_COPY_AND_ASSIGN(IFunctionAdapter) /// The name of the function std::string m_name; diff --git a/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/FitFunctions/IPeakFunctionAdapter.h b/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/FitFunctions/IPeakFunctionAdapter.h index 73a5d5a485bc..a9e32e733de2 100644 --- a/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/FitFunctions/IPeakFunctionAdapter.h +++ b/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/FitFunctions/IPeakFunctionAdapter.h @@ -87,8 +87,8 @@ class IPeakFunctionAdapter : public virtual API::IPeakFunction, private: /// The PyObject must be supplied to construct the object - DISABLE_DEFAULT_CONSTRUCT(IPeakFunctionAdapter); - DISABLE_COPY_AND_ASSIGN(IPeakFunctionAdapter); + DISABLE_DEFAULT_CONSTRUCT(IPeakFunctionAdapter) + DISABLE_COPY_AND_ASSIGN(IPeakFunctionAdapter) }; } } diff --git a/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/PythonAlgorithm/AlgorithmAdapter.h b/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/PythonAlgorithm/AlgorithmAdapter.h index 8da49cf8c2fc..4ff4e6147e71 100644 --- a/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/PythonAlgorithm/AlgorithmAdapter.h +++ b/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/PythonAlgorithm/AlgorithmAdapter.h @@ -123,8 +123,8 @@ class AlgorithmAdapter : public BaseAlgorithm { private: /// The PyObject must be supplied to construct the object - DISABLE_DEFAULT_CONSTRUCT(AlgorithmAdapter); - DISABLE_COPY_AND_ASSIGN(AlgorithmAdapter); + DISABLE_DEFAULT_CONSTRUCT(AlgorithmAdapter) + DISABLE_COPY_AND_ASSIGN(AlgorithmAdapter) /// Private init for this algorithm virtual void init(); diff --git a/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/PythonAlgorithm/DataProcessorAdapter.h b/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/PythonAlgorithm/DataProcessorAdapter.h index f635b0bd4651..56d0093b0a8e 100644 --- a/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/PythonAlgorithm/DataProcessorAdapter.h +++ b/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/PythonAlgorithm/DataProcessorAdapter.h @@ -100,8 +100,8 @@ class DataProcessorAdapter private: /// The PyObject must be supplied to construct the object - DISABLE_DEFAULT_CONSTRUCT(DataProcessorAdapter); - DISABLE_COPY_AND_ASSIGN(DataProcessorAdapter); + DISABLE_DEFAULT_CONSTRUCT(DataProcessorAdapter) + DISABLE_COPY_AND_ASSIGN(DataProcessorAdapter) }; } } diff --git a/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/kernel/Converters/NumpyFunctions.h b/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/kernel/Converters/NumpyFunctions.h new file mode 100644 index 000000000000..473189403f99 --- /dev/null +++ b/Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/kernel/Converters/NumpyFunctions.h @@ -0,0 +1,56 @@ +#ifndef NUMPY_FUNCTIONS_H +#define NUMPY_FUNCTIONS_H +/* + Copyright © 2011 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge + National Laboratory & European Spallation Source + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + File change history is stored at: . + Code Documentation is available at: +*/ +#ifdef __GNUC__ +#pragma GCC system_header +#endif + +#include +#include "MantidKernel/WarningSuppressions.h" +GCC_DIAG_OFF(cast - qual) +// See +// http://docs.scipy.org/doc/numpy/reference/c-api.array.html#PY_ARRAY_UNIQUE_SYMBOL +#define PY_ARRAY_UNIQUE_SYMBOL KERNEL_ARRAY_API +#define NO_IMPORT_ARRAY +#include +GCC_DIAG_ON(cast - qual) + +/**functions containing numpy macros. We put them in a separate header file to + *suppress the warning + *ISO C++ forbids casting between pointer-to-function and pointer-to-object + */ +namespace Mantid { +namespace PythonInterface { +namespace Converters { +namespace Impl { +/// equivalent to macro PyArray_IterNew +PyObject *func_PyArray_IterNew(PyArrayObject *arr); +/// equivalent to macro PyArray_NewFromDescr +PyArrayObject *func_PyArray_NewFromDescr(int datatype, const int ndims, + Py_intptr_t *dims); +} +} +} +} +#endif // NUMPY_FUNCTIONS_H diff --git a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/Algorithm.cpp b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/Algorithm.cpp index 71dd4571e321..99e7e215f5d7 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/Algorithm.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/Algorithm.cpp @@ -33,9 +33,9 @@ namespace typedef void(*declarePropertyType4)(boost::python::object & self, const std::string &, const boost::python::object &, const int); // Overload types - BOOST_PYTHON_FUNCTION_OVERLOADS(declarePropertyType1_Overload, PythonAlgorithm::declarePyAlgProperty, 2, 3); - BOOST_PYTHON_FUNCTION_OVERLOADS(declarePropertyType2_Overload, PythonAlgorithm::declarePyAlgProperty, 3, 6); - BOOST_PYTHON_FUNCTION_OVERLOADS(declarePropertyType3_Overload, PythonAlgorithm::declarePyAlgProperty, 4, 5); + BOOST_PYTHON_FUNCTION_OVERLOADS(declarePropertyType1_Overload, PythonAlgorithm::declarePyAlgProperty, 2, 3) + BOOST_PYTHON_FUNCTION_OVERLOADS(declarePropertyType2_Overload, PythonAlgorithm::declarePyAlgProperty, 3, 6) + BOOST_PYTHON_FUNCTION_OVERLOADS(declarePropertyType3_Overload, PythonAlgorithm::declarePyAlgProperty, 4, 5) } void export_leaf_classes() diff --git a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmFactory.cpp b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmFactory.cpp index 12bfc84afbc6..4719f8e95912 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmFactory.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmFactory.cpp @@ -97,7 +97,7 @@ GCC_DIAG_OFF(cast-qual) FileLoaderRegistry::Instance().unsubscribe(descr.first, descr.second); } - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(existsOverloader, exists, 1, 2); + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(existsOverloader, exists, 1, 2) ///@endcond } diff --git a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmManager.cpp b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmManager.cpp index d44c0a1f6063..4296086b4f68 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmManager.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmManager.cpp @@ -59,8 +59,8 @@ namespace ///@cond //------------------------------------------------------------------------------------------------------ /// Define overload generators - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(create_overloads,AlgorithmManagerImpl::create, 1,2); - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(createUnmanaged_overloads,AlgorithmManagerImpl::createUnmanaged, 1,2); + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(create_overloads,AlgorithmManagerImpl::create, 1,2) + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(createUnmanaged_overloads,AlgorithmManagerImpl::createUnmanaged, 1,2) ///@endcond } diff --git a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/Axis.cpp b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/Axis.cpp index 0a1e917bd120..4151bcbebf84 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/Axis.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/Axis.cpp @@ -27,7 +27,7 @@ namespace //------------------------------- Overload macros --------------------------- // Overloads for operator() function which has 1 optional argument - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Axis_getValue, Axis::getValue, 1, 2); + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Axis_getValue, Axis::getValue, 1, 2) /** * Extract the axis values as a sequence. A numpy array is used if the diff --git a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/ExperimentInfo.cpp b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/ExperimentInfo.cpp index 4f784af07eae..b02c444f40f4 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/ExperimentInfo.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/ExperimentInfo.cpp @@ -11,7 +11,7 @@ using Mantid::PythonInterface::Policies::RemoveConstSharedPtr; using namespace boost::python; /// Overload generator for getInstrumentFilename -BOOST_PYTHON_FUNCTION_OVERLOADS(getInstrumentFilename_Overload, ExperimentInfo::getInstrumentFilename, 1, 2); +BOOST_PYTHON_FUNCTION_OVERLOADS(getInstrumentFilename_Overload, ExperimentInfo::getInstrumentFilename, 1, 2) void export_ExperimentInfo() { diff --git a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/FileFinder.cpp b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/FileFinder.cpp index 88eb1d1f94ce..d4bec6851b00 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/FileFinder.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/FileFinder.cpp @@ -1,17 +1,22 @@ #include "MantidAPI/FileFinder.h" #include +#include #include using Mantid::API::FileFinder; using Mantid::API::FileFinderImpl; using namespace boost::python; +namespace { + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getFullPathOverloader, getFullPath, 1, 2) +} + void export_FileFinder() { class_("FileFinderImpl", no_init) .def("getFullPath", &FileFinderImpl::getFullPath, - "Return a full path to the given file if it can be found within datasearch.directories paths. " - "An empty string is returned otherwise.") + getFullPathOverloader((arg("path"), arg("ignoreDirs")=false), + "Return a full path to the given file if it can be found within datasearch.directories paths. Directories can be ignored with ignoreDirs=True. An empty string is returned otherwise.")) .def("findRuns", &FileFinderImpl::findRuns, "Find a list of files file given a hint. " "The hint can be a comma separated list of run numbers and can also include ranges of runs, e.g. 123-135 or equivalently 123-35" "If no instrument prefix is given then the current default is used.") diff --git a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/IFunction.cpp b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/IFunction.cpp index caa28aea2a08..d43ac0538b79 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/IFunction.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/IFunction.cpp @@ -35,10 +35,10 @@ namespace // -- Set property overloads -- // setProperty(index,value,explicit) typedef void(IFunction::*setParameterType1)(size_t,const double & value,bool); - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(setParameterType1_Overloads, setParameter, 2, 3); + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(setParameterType1_Overloads, setParameter, 2, 3) // setProperty(index,value,explicit) typedef void(IFunction::*setParameterType2)(const std::string &,const double & value,bool); - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(setParameterType2_Overloads, setParameter, 2, 3); + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(setParameterType2_Overloads, setParameter, 2, 3) ///@endcond diff --git a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/Workspace.cpp b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/Workspace.cpp index 6ec0dcda804d..11dd4f9b8bff 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/Workspace.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/Workspace.cpp @@ -13,7 +13,7 @@ using namespace boost::python; namespace { ///@cond - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Workspace_isDirtyOverloads, Workspace::isDirty, 0, 1); + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Workspace_isDirtyOverloads, Workspace::isDirty, 0, 1) ///@endcond } diff --git a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceFactory.cpp b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceFactory.cpp index 6ff101d8dddd..e7cc6802b0fa 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceFactory.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceFactory.cpp @@ -34,9 +34,9 @@ namespace } /// Overload generator for create - BOOST_PYTHON_FUNCTION_OVERLOADS(createFromParent_Overload, createFromParentPtr, 2, 5); - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(createTable_Overload, createTable, 0, 1); - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(createPeaks_Overload, createPeaks, 0, 1); + BOOST_PYTHON_FUNCTION_OVERLOADS(createFromParent_Overload, createFromParentPtr, 2, 5) + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(createTable_Overload, createTable, 0, 1) + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(createPeaks_Overload, createPeaks, 0, 1) } void export_WorkspaceFactory() diff --git a/Code/Mantid/Framework/PythonInterface/mantid/geometry/src/Exports/Component.cpp b/Code/Mantid/Framework/PythonInterface/mantid/geometry/src/Exports/Component.cpp index 406a438bcb3d..02856d5765b9 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/geometry/src/Exports/Component.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/geometry/src/Exports/Component.cpp @@ -9,15 +9,15 @@ using namespace boost::python; namespace { // Default parameter function overloads - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getParameterNames,Component::getParameterNames,0,1); - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_hasParameter,Component::hasParameter,1,2); - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getNumberParameter,Component::getNumberParameter,1,2); - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getBoolParameter,Component::getBoolParameter,1,2); - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getPositionParameter,Component::getPositionParameter,1,2); - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getRotationParameter,Component::getRotationParameter,1,2); - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getStringParameter,Component::getStringParameter,1,2); - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getIntParameter,Component::getIntParameter,1,2); - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getParameterType,Component::getParameterType,1,2); + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getParameterNames,Component::getParameterNames,0,1) + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_hasParameter,Component::hasParameter,1,2) + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getNumberParameter,Component::getNumberParameter,1,2) + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getBoolParameter,Component::getBoolParameter,1,2) + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getPositionParameter,Component::getPositionParameter,1,2) + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getRotationParameter,Component::getRotationParameter,1,2) + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getStringParameter,Component::getStringParameter,1,2) + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getIntParameter,Component::getIntParameter,1,2) + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getParameterType,Component::getParameterType,1,2) } diff --git a/Code/Mantid/Framework/PythonInterface/mantid/geometry/src/Exports/Goniometer.cpp b/Code/Mantid/Framework/PythonInterface/mantid/geometry/src/Exports/Goniometer.cpp index 16bcc7cf7b19..74b37cfebead 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/geometry/src/Exports/Goniometer.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/geometry/src/Exports/Goniometer.cpp @@ -14,7 +14,7 @@ namespace // { ///@cond // define overloaded functions - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getEulerAngles_overloads, Goniometer::getEulerAngles, 0, 1); + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getEulerAngles_overloads, Goniometer::getEulerAngles, 0, 1) ///@endcond /// Set the U vector via a numpy array diff --git a/Code/Mantid/Framework/PythonInterface/mantid/kernel/CMakeLists.txt b/Code/Mantid/Framework/PythonInterface/mantid/kernel/CMakeLists.txt index 32975fce4226..02058243e4c2 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/kernel/CMakeLists.txt +++ b/Code/Mantid/Framework/PythonInterface/mantid/kernel/CMakeLists.txt @@ -54,6 +54,7 @@ set ( SRC_FILES src/Converters/CloneToNumpy.cpp src/Converters/NDArrayToVector.cpp src/Converters/NDArrayTypeIndex.cpp + src/Converters/NumpyFunctions.cpp src/Converters/PyArrayType.cpp src/Converters/PyObjectToMatrix.cpp src/Converters/PyObjectToV3D.cpp @@ -71,6 +72,7 @@ set ( SRC_FILES set ( INC_FILES ${HEADER_DIR}/kernel/Converters/CArrayToNDArray.h ${HEADER_DIR}/kernel/Converters/MatrixToNDArray.h + ${HEADER_DIR}/kernel/Converters/NumpyFunctions.h ${HEADER_DIR}/kernel/Converters/NDArrayToVector.h ${HEADER_DIR}/kernel/Converters/NDArrayTypeIndex.h ${HEADER_DIR}/kernel/Converters/WrapWithNumpy.h diff --git a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/CloneToNumpy.cpp b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/CloneToNumpy.cpp index 6213ffb71c9e..55534dbc1cc8 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/CloneToNumpy.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/CloneToNumpy.cpp @@ -3,14 +3,7 @@ //----------------------------------------------------------------------------- #include "MantidPythonInterface/kernel/Converters/CloneToNumpy.h" #include "MantidPythonInterface/kernel/Converters/NDArrayTypeIndex.h" -#include "MantidKernel/WarningSuppressions.h" -#include - -GCC_DIAG_OFF(cast-qual) -#define PY_ARRAY_UNIQUE_SYMBOL KERNEL_ARRAY_API -#define NO_IMPORT_ARRAY -#include -GCC_DIAG_ON(cast-qual) +#include "MantidPythonInterface/kernel/Converters/NumpyFunctions.h" #include @@ -44,13 +37,9 @@ namespace Mantid { namespace PythonInterface { Py_intptr_t dims[1] = { static_cast(cvector.size()) }; int datatype = NDArrayTypeIndex::typenum; - PyArrayObject *nparray = (PyArrayObject*) - PyArray_NewFromDescr(&PyArray_Type, - PyArray_DescrFromType(datatype), - 1, // rank - dims, // Length in each dimension - NULL, NULL, - 0, NULL); + PyArrayObject *nparray = + func_PyArray_NewFromDescr(datatype, 1, &dims[0]); + for(Py_intptr_t i = 0; i < dims[0]; ++i) { void *itemPtr = PyArray_GETPTR1(nparray, i); @@ -71,13 +60,8 @@ namespace Mantid { namespace PythonInterface PyObject *cloneND(const ElementType * carray, const int ndims, Py_intptr_t *dims) { int datatype = NDArrayTypeIndex::typenum; - PyArrayObject *nparray = (PyArrayObject*) - PyArray_NewFromDescr(&PyArray_Type, - PyArray_DescrFromType(datatype), - ndims, // rank - dims, // Length in each dimension - NULL, NULL, - 0, NULL); + PyArrayObject *nparray = + func_PyArray_NewFromDescr(datatype, ndims, &dims[0]); // Compute total number of elements size_t length(dims[0]); if(ndims > 1) @@ -133,18 +117,18 @@ namespace Mantid { namespace PythonInterface INSTANTIATE_CLONEND(ElementType) ///@cond Doxygen doesn't seem to like this... - INSTANTIATE_CLONE(int); - INSTANTIATE_CLONE(long); - INSTANTIATE_CLONE(long long); - INSTANTIATE_CLONE(unsigned int); - INSTANTIATE_CLONE(unsigned long); - INSTANTIATE_CLONE(unsigned long long); - INSTANTIATE_CLONE(double); - INSTANTIATE_CLONE(float); + INSTANTIATE_CLONE(int) + INSTANTIATE_CLONE(long) + INSTANTIATE_CLONE(long long) + INSTANTIATE_CLONE(unsigned int) + INSTANTIATE_CLONE(unsigned long) + INSTANTIATE_CLONE(unsigned long long) + INSTANTIATE_CLONE(double) + INSTANTIATE_CLONE(float) // Need further 1D specialisation for string INSTANTIATE_CLONE1D(std::string) // Need further ND specialisation for bool - INSTANTIATE_CLONEND(bool); + INSTANTIATE_CLONEND(bool) ///@endcond } } diff --git a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/NDArrayToVector.cpp b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/NDArrayToVector.cpp index 8151c09da2f9..98324f55d71d 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/NDArrayToVector.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/NDArrayToVector.cpp @@ -4,11 +4,7 @@ #include "MantidPythonInterface/kernel/Converters/NDArrayToVector.h" #include "MantidPythonInterface/kernel/Converters/NDArrayTypeIndex.h" #include - -// See http://docs.scipy.org/doc/numpy/reference/c-api.array.html#PY_ARRAY_UNIQUE_SYMBOL -#define PY_ARRAY_UNIQUE_SYMBOL KERNEL_ARRAY_API -#define NO_IMPORT_ARRAY -#include +#include "MantidPythonInterface/kernel/Converters/NumpyFunctions.h" namespace Mantid { @@ -30,16 +26,20 @@ namespace Mantid { // Use the iterator API to iterate through the array // and assign each value to the corresponding vector - PyObject *iter = PyArray_IterNew((PyObject*)arr); + typedef union { + DestElementType* output; + void *input; + } npy_union; + npy_union data; + PyObject *iter = Converters::Impl::func_PyArray_IterNew(arr); npy_intp index(0); do { - DestElementType *data = (DestElementType*)PyArray_ITER_DATA(iter); - cvector[index] = *data; + data.input = PyArray_ITER_DATA(iter); + cvector[index] = *data.output; ++index; PyArray_ITER_NEXT(iter); - } - while(PyArray_ITER_NOTDONE(iter)); + } while (PyArray_ITER_NOTDONE(iter)); } }; @@ -163,15 +163,15 @@ namespace Mantid template DLLExport struct NDArrayToVector; ///@cond Doxygen doesn't seem to like this... - INSTANTIATE_TOVECTOR(int); - INSTANTIATE_TOVECTOR(long); - INSTANTIATE_TOVECTOR(long long); - INSTANTIATE_TOVECTOR(unsigned int); - INSTANTIATE_TOVECTOR(unsigned long); - INSTANTIATE_TOVECTOR(unsigned long long); - INSTANTIATE_TOVECTOR(double); - INSTANTIATE_TOVECTOR(bool); - INSTANTIATE_TOVECTOR(std::string); + INSTANTIATE_TOVECTOR(int) + INSTANTIATE_TOVECTOR(long) + INSTANTIATE_TOVECTOR(long long) + INSTANTIATE_TOVECTOR(unsigned int) + INSTANTIATE_TOVECTOR(unsigned long) + INSTANTIATE_TOVECTOR(unsigned long long) + INSTANTIATE_TOVECTOR(double) + INSTANTIATE_TOVECTOR(bool) + INSTANTIATE_TOVECTOR(std::string) ///@endcond } } diff --git a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/NDArrayTypeIndex.cpp b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/NDArrayTypeIndex.cpp index a1efd28e193c..5a7981231fa9 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/NDArrayTypeIndex.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/NDArrayTypeIndex.cpp @@ -24,15 +24,15 @@ namespace Mantid template DLLExport struct NDArrayTypeIndex;\ - DEFINE_TYPE_MAPPING(int, NPY_INT); - DEFINE_TYPE_MAPPING(long, NPY_LONG); - DEFINE_TYPE_MAPPING(long long, NPY_LONGLONG); - DEFINE_TYPE_MAPPING(unsigned int, NPY_UINT); - DEFINE_TYPE_MAPPING(unsigned long, NPY_ULONG); - DEFINE_TYPE_MAPPING(unsigned long long, NPY_ULONGLONG); - DEFINE_TYPE_MAPPING(bool, NPY_BOOL); - DEFINE_TYPE_MAPPING(double, NPY_DOUBLE); - DEFINE_TYPE_MAPPING(float, NPY_FLOAT); + DEFINE_TYPE_MAPPING(int, NPY_INT) + DEFINE_TYPE_MAPPING(long, NPY_LONG) + DEFINE_TYPE_MAPPING(long long, NPY_LONGLONG) + DEFINE_TYPE_MAPPING(unsigned int, NPY_UINT) + DEFINE_TYPE_MAPPING(unsigned long, NPY_ULONG) + DEFINE_TYPE_MAPPING(unsigned long long, NPY_ULONGLONG) + DEFINE_TYPE_MAPPING(bool, NPY_BOOL) + DEFINE_TYPE_MAPPING(double, NPY_DOUBLE) + DEFINE_TYPE_MAPPING(float, NPY_FLOAT) } } } diff --git a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/NumpyFunctions.cpp b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/NumpyFunctions.cpp new file mode 100644 index 000000000000..5696352a6cac --- /dev/null +++ b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/NumpyFunctions.cpp @@ -0,0 +1,22 @@ +#include "MantidPythonInterface/kernel/Converters/NumpyFunctions.h" + +namespace Mantid { +namespace PythonInterface { +namespace Converters { +namespace Impl { + +PyObject *func_PyArray_IterNew(PyArrayObject *arr) { + return PyArray_IterNew((PyObject *)arr); +} + +PyArrayObject *func_PyArray_NewFromDescr(int datatype, const int ndims, + Py_intptr_t *dims) { + return (PyArrayObject *)PyArray_NewFromDescr( + &PyArray_Type, PyArray_DescrFromType(datatype), ndims, // rank + dims, // Length in each dimension + NULL, NULL, 0, NULL); +} +} +} +} +} diff --git a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/WrapWithNumpy.cpp b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/WrapWithNumpy.cpp index d353890b416d..8b56c8eb7a17 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/WrapWithNumpy.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Converters/WrapWithNumpy.cpp @@ -65,14 +65,14 @@ namespace Mantid { namespace PythonInterface template DLLExport PyObject *wrapWithNDArray(const ElementType*, const int ndims, Py_intptr_t *dims, const NumpyWrapMode); ///@cond Doxygen doesn't seem to like this... - INSTANTIATE_WRAPNUMPY(int); - INSTANTIATE_WRAPNUMPY(long); - INSTANTIATE_WRAPNUMPY(long long); - INSTANTIATE_WRAPNUMPY(unsigned int); - INSTANTIATE_WRAPNUMPY(unsigned long); - INSTANTIATE_WRAPNUMPY(unsigned long long); - INSTANTIATE_WRAPNUMPY(double); - INSTANTIATE_WRAPNUMPY(float); + INSTANTIATE_WRAPNUMPY(int) + INSTANTIATE_WRAPNUMPY(long) + INSTANTIATE_WRAPNUMPY(long long) + INSTANTIATE_WRAPNUMPY(unsigned int) + INSTANTIATE_WRAPNUMPY(unsigned long) + INSTANTIATE_WRAPNUMPY(unsigned long long) + INSTANTIATE_WRAPNUMPY(double) + INSTANTIATE_WRAPNUMPY(float) ///@endcond } } diff --git a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Exports/ConfigService.cpp b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Exports/ConfigService.cpp index 762f446435d5..45a9d0f8a559 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Exports/ConfigService.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Exports/ConfigService.cpp @@ -31,9 +31,9 @@ namespace } /// Overload generator for getInstrument - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getInstrument_Overload, getInstrument, 0, 1); + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getInstrument_Overload, getInstrument, 0, 1) /// Overload generator for getString - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getString_Overload, getString, 1, 2); + BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getString_Overload, getString, 1, 2) } void export_ConfigService() diff --git a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Exports/Statistics.cpp b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Exports/Statistics.cpp index 8fc7a039ebfc..3bfa9244083a 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Exports/Statistics.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Exports/Statistics.cpp @@ -94,7 +94,7 @@ namespace } } // Define an overload to handle the default argument - BOOST_PYTHON_FUNCTION_OVERLOADS(getStatisticsOverloads, getStatisticsNumpy, 1, 2); + BOOST_PYTHON_FUNCTION_OVERLOADS(getStatisticsOverloads, getStatisticsNumpy, 1, 2) //============================ Z score ============================================ // Function pointer to real implementation of Zscore functions @@ -132,7 +132,7 @@ namespace return getZScoreNumpyImpl(&getZscore, data, sorted); } // Define an overload to handle the default argument - BOOST_PYTHON_FUNCTION_OVERLOADS(getZscoreOverloads, getZscoreNumpy, 1, 2); + BOOST_PYTHON_FUNCTION_OVERLOADS(getZscoreOverloads, getZscoreNumpy, 1, 2) /** * Proxy for @see Mantid::Kernel::getModifiedZscore so that it can accept numpy arrays, @@ -143,7 +143,7 @@ namespace return getZScoreNumpyImpl(&getModifiedZscore, data, sorted); } // Define an overload to handle the default argument - BOOST_PYTHON_FUNCTION_OVERLOADS(getModifiedZscoreOverloads, getModifiedZscoreNumpy, 1, 2); + BOOST_PYTHON_FUNCTION_OVERLOADS(getModifiedZscoreOverloads, getModifiedZscoreNumpy, 1, 2) //============================ getMoments ============================================ @@ -194,7 +194,7 @@ namespace } // Define an overload to handle the default argument - BOOST_PYTHON_FUNCTION_OVERLOADS(getMomentsAboutOriginOverloads, getMomentsAboutOriginNumpy, 2, 3); + BOOST_PYTHON_FUNCTION_OVERLOADS(getMomentsAboutOriginOverloads, getMomentsAboutOriginNumpy, 2, 3) /** * Proxy for @see Mantid::Kernel::getMomentsAboutMean so that it can accept numpy arrays @@ -207,7 +207,7 @@ namespace } // Define an overload to handle the default argument - BOOST_PYTHON_FUNCTION_OVERLOADS(getMomentsAboutMeanOverloads, getMomentsAboutMeanNumpy, 2, 3); + BOOST_PYTHON_FUNCTION_OVERLOADS(getMomentsAboutMeanOverloads, getMomentsAboutMeanNumpy, 2, 3) ///@endcond } diff --git a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Exports/TimeSeriesProperty.cpp b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Exports/TimeSeriesProperty.cpp index 093438843132..2f9bf5300092 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Exports/TimeSeriesProperty.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Exports/TimeSeriesProperty.cpp @@ -38,7 +38,6 @@ namespace .def("getStatistics", &TimeSeriesProperty::getStatistics) \ .def("timeAverageValue", &TimeSeriesProperty::timeAverageValue) \ ; - ; } void export_TimeSeriesProperty_Double() diff --git a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Registry/SequenceTypeHandler.cpp b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Registry/SequenceTypeHandler.cpp index 067aa64fc4d2..627bc2d4cd00 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Registry/SequenceTypeHandler.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Registry/SequenceTypeHandler.cpp @@ -128,15 +128,15 @@ namespace Mantid #define INSTANTIATE(ElementType)\ template DLLExport struct SequenceTypeHandler >; - INSTANTIATE(int); - INSTANTIATE(long); - INSTANTIATE(long long); - INSTANTIATE(unsigned int); - INSTANTIATE(unsigned long); - INSTANTIATE(unsigned long long); - INSTANTIATE(double); - INSTANTIATE(std::string); - INSTANTIATE(bool); + INSTANTIATE(int) + INSTANTIATE(long) + INSTANTIATE(long long) + INSTANTIATE(unsigned int) + INSTANTIATE(unsigned long) + INSTANTIATE(unsigned long long) + INSTANTIATE(double) + INSTANTIATE(std::string) + INSTANTIATE(bool) ///@endcond } } diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ApplyPaalmanPingsCorrection.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ApplyPaalmanPingsCorrection.py new file mode 100644 index 000000000000..d37d518831a0 --- /dev/null +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ApplyPaalmanPingsCorrection.py @@ -0,0 +1,285 @@ +from mantid.simpleapi import * +from mantid.api import PythonAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, WorkspaceGroupProperty, \ + PropertyMode, MatrixWorkspace +from mantid.kernel import Direction, logger + + +class ApplyPaalmanPingsCorrection(PythonAlgorithm): + + _sample_ws_name = None + _corrections_ws_name = None + _use_can = False + _can_ws_name = None + _use_corrections = False + _can_scale_factor = 1.0 + _scale_can = False + _output_ws_name = None + _corrections = None + _scaled_container = None + + + def category(self): + return "Workflow\\MIDAS;PythonAlgorithms" + + + def summary(self): + return "Applies a calculated absorption correction in the Paalman and Pings factor style." + + + def PyInit(self): + self.declareProperty(MatrixWorkspaceProperty('SampleWorkspace', '', + direction=Direction.Input), + doc='Name for the input Sample workspace.') + + self.declareProperty(WorkspaceGroupProperty('CorrectionsWorkspace', '', + optional=PropertyMode.Optional, direction=Direction.Input), + doc='Name for the input Corrections workspace.') + + self.declareProperty(MatrixWorkspaceProperty('CanWorkspace', '', + optional=PropertyMode.Optional, direction=Direction.Input), + doc='Name for the input Can workspace.') + + self.declareProperty(name='CanScaleFactor', defaultValue=1.0, + doc='Factor to scale the can data') + + self.declareProperty(MatrixWorkspaceProperty('OutputWorkspace', '', + direction=Direction.Output), + doc='The output corrections workspace.') + + + def PyExec(self): + self._setup() + + if not self._use_corrections: + logger.information('Not using corrections') + if not self._use_can: + logger.information('Not using container') + + # Apply container scale factor if needed + if self._use_can: + if self._scale_can: + # Use temp workspace so we don't modify original data + Scale(InputWorkspace=self._can_ws_name, + OutputWorkspace=self._scaled_container, + Factor=self._can_scale_factor, + Operation='Multiply') + logger.information('Container scaled by %f' % self._can_scale_factor) + else: + CloneWorkspace(InputWorkspace=self._can_ws_name, + OutputWorkspace=self._scaled_container) + + if self._use_corrections: + self._pre_process_corrections() + + if self._use_can: + # Use container factors + self._correct_sample_can() + correction_type = 'sample_and_can_corrections' + else: + # Use sample factor only + self._correct_sample() + correction_type = 'sample_corrections_only' + + else: + # Do simple subtraction + self._subtract() + correction_type = 'can_subtraction' + + # Record the container scale factor + if self._use_can and self._scale_can: + AddSampleLog(Workspace=self._output_ws_name, + LogName='apply_corr_can_scale_factor', + LogType='Number', + LogText=str(self._can_scale_factor)) + + # Record the type of corrections applied + AddSampleLog(Workspace=self._output_ws_name, + LogName='corrections_type', + LogType='String', + LogText=correction_type) + + self.setPropertyValue('OutputWorkspace', self._output_ws_name) + + # Remove temporary workspaces + if self._corrections in mtd: + DeleteWorkspace(self._corrections) + if self._scaled_container in mtd: + DeleteWorkspace(self._scaled_container) + + + def validateInputs(self): + """ + Validate user input. + """ + + self._setup() + issues = dict() + + # Need something to get corrections from + if not (self._use_can or self._use_corrections): + error_msg = 'Must provide either CorrectionsWorkspace or CanWorkspace or both' + issues['CorrectionsWorkspace'] = error_msg + issues['CanWorkspace'] = error_msg + + sample_ws = mtd[self._sample_ws_name] + if isinstance(sample_ws, MatrixWorkspace): + sample_unit_id = sample_ws.getAxis(0).getUnit().unitID() + + # Check sample and container X axis units match + if self._use_can: + can_ws = mtd[self._can_ws_name] + if isinstance(can_ws, MatrixWorkspace): + can_unit_id = can_ws.getAxis(0).getUnit().unitID() + if can_unit_id != sample_unit_id: + issues['CanWorkspace'] = 'X axis unit must match SampleWorkspace' + else: + issues['CanWorkspace'] = 'Must be a MatrixWorkspace' + else: + issues['SampleWorkspace'] = 'Must be a MatrixWorkspace' + + return issues + + + def _setup(self): + """ + Get properties and setup instance variables. + """ + + self._sample_ws_name = self.getPropertyValue('SampleWorkspace') + self._output_ws_name = self.getPropertyValue('OutputWorkspace') + + # Get corrections workspace + self._corrections_ws_name = self.getPropertyValue('CorrectionsWorkspace') + self._use_corrections = self._corrections_ws_name != '' + + # Get container workspace + self._can_ws_name = self.getPropertyValue('CanWorkspace') + self._use_can = self._can_ws_name != '' + + self._can_scale_factor = self.getProperty('CanScaleFactor').value + self._scale_can = self._can_scale_factor != 1.0 + + # This temporary WS is needed because ConvertUnits does not like named WS in a Group + self._corrections = '__converted_corrections' + self._scaled_container = '__scaled_container' + + + def _get_correction_factor_ws_name(self, factor_type): + """ + Gets the full name for a correction factor workspace given the correction type. + + @param factor_type Factory type (ass, acc, acsc, assc) + @return Full name of workspace (None if not found) + """ + + corrections_ws = mtd[self._corrections_ws_name] + + for ws_name in corrections_ws.getNames(): + if factor_type in ws_name: + return ws_name + + return None + + + def _pre_process_corrections(self): + """ + If the sample is not in wavelength then convert the corrections to + whatever units the sample is in. + """ + + instrument = mtd[self._sample_ws_name].getInstrument() + unit_id = mtd[self._sample_ws_name].getAxis(0).getUnit().unitID() + logger.information('x-unit is ' + unit_id) + + factor_types = ['ass'] + if self._use_can: + factor_types.extend(['acc', 'acsc', 'assc']) + + for factor_type in factor_types: + input_name = self._get_correction_factor_ws_name(factor_type) + output_name = self._corrections + '_' + factor_type + + if unit_id != 'Wavelength': + # Configure conversion + if unit_id == 'dSpacing': + emode = 'Elastic' + efixed = 0.0 + elif unit_id == 'DeltaE': + emode = 'Indirect' + efixed = instrument.getNumberParameter('efixed-val')[0] + else: + raise ValueError('Unit %s in sample workspace is not supported' % unit_id) + + # Do conversion + ConvertUnits(InputWorkspace=input_name, + OutputWorkspace=output_name, + Target=unit_id, + EMode=emode, + EFixed=efixed) + + else: + # No need to convert + CloneWorkspace(InputWorkspace=input_name, + OutputWorkspace=output_name) + + # Group the temporary factor workspaces (for easy removal later) + GroupWorkspaces(InputWorkspaces=[self._corrections + '_' + f_type for f_type in factor_types], + OutputWorkspace=self._corrections) + + + def _subtract(self): + """ + Do a simple container subtraction (when no corrections are given). + """ + + logger.information('Using simple container subtraction') + + Minus(LHSWorkspace=self._sample_ws_name, + RHSWorkspace=self._scaled_container, + OutputWorkspace=self._output_ws_name) + + + def _correct_sample(self): + """ + Correct for sample only (when no container is given). + """ + + logger.information('Correcting sample') + + # Ass + Divide(LHSWorkspace=self._sample_ws_name, + RHSWorkspace=self._corrections + '_ass', + OutputWorkspace=self._output_ws_name) + + + def _correct_sample_can(self): + """ + Correct for sample and container. + """ + + logger.information('Correcting sample and container') + corrected_can_ws = '__corrected_can' + + # Acc + Divide(LHSWorkspace=self._scaled_container, + RHSWorkspace=self._corrections + '_acc', + OutputWorkspace=corrected_can_ws) + + # Acsc + Multiply(LHSWorkspace=corrected_can_ws, + RHSWorkspace=self._corrections + '_acsc', + OutputWorkspace=corrected_can_ws) + Minus(LHSWorkspace=self._sample_ws_name, + RHSWorkspace=corrected_can_ws, + OutputWorkspace=self._output_ws_name) + + # Assc + Divide(LHSWorkspace=self._output_ws_name, + RHSWorkspace=self._corrections + '_assc', + OutputWorkspace=self._output_ws_name) + + DeleteWorkspace(corrected_can_ws) + + +# Register algorithm with Mantid +AlgorithmFactory.subscribe(ApplyPaalmanPingsCorrection) diff --git a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/ApplyPaalmanPingsCorrectionTest.py b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/ApplyPaalmanPingsCorrectionTest.py new file mode 100644 index 000000000000..581f3c7e413c --- /dev/null +++ b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/ApplyPaalmanPingsCorrectionTest.py @@ -0,0 +1,118 @@ +import unittest +from mantid.kernel import * +from mantid.api import * +from mantid.simpleapi import Load, ConvertUnits, SplineInterpolation, ApplyPaalmanPingsCorrection, DeleteWorkspace + + +class ApplyPaalmanPingsCorrectionTest(unittest.TestCase): + + def setUp(self): + """ + Create sample workspaces. + """ + + # Load the sample and can + sample_ws = Load('irs26176_graphite002_red.nxs') + can_ws = Load('irs26173_graphite002_red.nxs') + + # Convert sample and can to wavelength + sample_ws = ConvertUnits(InputWorkspace=sample_ws, + Target='Wavelength', + EMode='Indirect', + EFixed=1.845) + can_ws = ConvertUnits(InputWorkspace=can_ws, + Target='Wavelength', + EMode='Indirect', + EFixed=1.845) + + self._sample_ws = sample_ws + self._can_ws = can_ws + + # Load the corrections workspace + corrections = Load('irs26176_graphite002_cyl_Abs.nxs') + + # Interpolate each of the correction factor workspaces + # Required to use corrections from the old indirect calculate + # corrections routines + for factor_ws in corrections: + SplineInterpolation(WorkspaceToMatch=sample_ws, + WorkspaceToInterpolate=factor_ws, + OutputWorkspace=factor_ws, + OutputWorkspaceDeriv='') + + self._corrections_ws = corrections + + + def tearDown(self): + """ + Remove workspaces from ADS. + """ + + DeleteWorkspace(self._sample_ws) + DeleteWorkspace(self._can_ws) + DeleteWorkspace(self._corrections_ws) + + + def _verify_workspace(self, ws, correction_type): + """ + Do validation on a correction workspace. + + @param ws Workspace to validate + @param correction_type Type of correction that should hav ebeen applied + """ + + # X axis should be in wavelength + x_unit = ws.getAxis(0).getUnit().unitID() + self.assertEquals(x_unit, 'Wavelength') + + # Sample logs should contain correction type + logs = ws.getSampleDetails() + self.assertTrue('corrections_type' in logs) + + # Ensure value from sample log is correct + if 'corrections_type' in logs: + log_correction_type = logs['corrections_type'].value + self.assertEqual(log_correction_type, correction_type) + + + def test_can_subtraction(self): + corr = ApplyPaalmanPingsCorrection(SampleWorkspace=self._sample_ws, + CanWorkspace=self._can_ws) + + self._verify_workspace(corr, 'can_subtraction') + + + def test_can_subtraction_with_can_scale(self): + corr = ApplyPaalmanPingsCorrection(SampleWorkspace=self._sample_ws, + CanWorkspace=self._can_ws, + CanScaleFactor=0.9) + + self._verify_workspace(corr, 'can_subtraction') + + + def test_sample_corrections_only(self): + corr = ApplyPaalmanPingsCorrection(SampleWorkspace=self._sample_ws, + CorrectionsWorkspace=self._corrections_ws) + + self._verify_workspace(corr, 'sample_corrections_only') + + + def test_sample_and_can_corrections(self): + corr = ApplyPaalmanPingsCorrection(SampleWorkspace=self._sample_ws, + CorrectionsWorkspace=self._corrections_ws, + CanWorkspace=self._can_ws) + + self._verify_workspace(corr, 'sample_and_can_corrections') + + + def test_sample_and_can_corrections_with_can_scale(self): + corr = ApplyPaalmanPingsCorrection(SampleWorkspace=self._sample_ws, + CorrectionsWorkspace=self._corrections_ws, + CanWorkspace=self._can_ws, + CanScaleFactor=0.9) + + self._verify_workspace(corr, 'sample_and_can_corrections') + + +if __name__=="__main__": + unittest.main() diff --git a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt index c47909fcd6b9..7efb5e765f89 100644 --- a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt +++ b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt @@ -4,6 +4,7 @@ set ( TEST_PY_FILES AddSampleLogMultipleTest.py + ApplyPaalmanPingsCorrectionTest.py CalculateSampleTransmissionTest.py CheckForSampleLogsTest.py ConjoinSpectraTest.py diff --git a/Code/Mantid/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp b/Code/Mantid/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp index 032de062643f..0ae46ae14274 100644 --- a/Code/Mantid/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp +++ b/Code/Mantid/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp @@ -16,11 +16,11 @@ using namespace WorkspaceCreationHelper; using namespace Mantid::MDEvents::MDEventsTestHelper; -BOOST_PYTHON_FUNCTION_OVERLOADS(create2DWorkspaceWithFullInstrument_overloads, create2DWorkspaceWithFullInstrument, 2, 4); +BOOST_PYTHON_FUNCTION_OVERLOADS(create2DWorkspaceWithFullInstrument_overloads, create2DWorkspaceWithFullInstrument, 2, 4) -BOOST_PYTHON_FUNCTION_OVERLOADS(makeFakeMDHistoWorkspace_overloads, makeFakeMDHistoWorkspace, 2, 7); +BOOST_PYTHON_FUNCTION_OVERLOADS(makeFakeMDHistoWorkspace_overloads, makeFakeMDHistoWorkspace, 2, 7) -BOOST_PYTHON_FUNCTION_OVERLOADS(create2DWorkspaceWithRectangularInstrument_overloads, create2DWorkspaceWithRectangularInstrument, 3, 3); +BOOST_PYTHON_FUNCTION_OVERLOADS(create2DWorkspaceWithRectangularInstrument_overloads, create2DWorkspaceWithRectangularInstrument, 3, 3) namespace { diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSearch.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSearch.h index 7c28a976d888..fd87762b5bc5 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSearch.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiPeakSearch.h @@ -4,6 +4,7 @@ #include "MantidSINQ/DllConfig.h" #include "MantidKernel/System.h" +#include "MantidKernel/Unit.h" #include "MantidKernel/V2D.h" #include "MantidAPI/Algorithm.h" @@ -93,11 +94,15 @@ class MANTID_SINQ_DLL PoldiPeakSearch : public API::Algorithm { double minimumPeakHeightFromBackground(UncertainValue backgroundWithSigma) const; + + double getTransformedCenter(double value, + const Kernel::Unit_sptr &unit) const; std::vector getPeaks(const MantidVec::const_iterator &baseListStart, const MantidVec::const_iterator &baseListEnd, std::list peakPositions, - const MantidVec &xData) const; + const MantidVec &xData, const Kernel::Unit_sptr &unit) const; + double getFWHMEstimate(const MantidVec::const_iterator &baseListStart, const MantidVec::const_iterator &baseListEnd, MantidVec::const_iterator peakPosition, diff --git a/Code/Mantid/Framework/SINQ/src/PoldiIndexKnownCompounds.cpp b/Code/Mantid/Framework/SINQ/src/PoldiIndexKnownCompounds.cpp index ee0bf9f4dd06..80eb0093d737 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiIndexKnownCompounds.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiIndexKnownCompounds.cpp @@ -201,19 +201,25 @@ std::vector PoldiIndexKnownCompounds::getWorkspaces( std::vector workspaces; for (auto it = workspaceNames.begin(); it != workspaceNames.end(); ++it) { - Workspace_sptr currentWorkspace = - AnalysisDataService::Instance().retrieveWS(*it); - - WorkspaceGroup_sptr groupTest = - boost::dynamic_pointer_cast(currentWorkspace); - if (groupTest) { - std::vector workspacesNextLevel = - getWorkspaces(groupTest->getNames()); - - workspaces.insert(workspaces.end(), workspacesNextLevel.begin(), - workspacesNextLevel.end()); - } else { - workspaces.insert(workspaces.end(), currentWorkspace); + try { + Workspace_sptr currentWorkspace = + AnalysisDataService::Instance().retrieveWS(*it); + + WorkspaceGroup_sptr groupTest = + boost::dynamic_pointer_cast(currentWorkspace); + if (groupTest) { + std::vector workspacesNextLevel = + getWorkspaces(groupTest->getNames()); + + workspaces.insert(workspaces.end(), workspacesNextLevel.begin(), + workspacesNextLevel.end()); + } else { + workspaces.insert(workspaces.end(), currentWorkspace); + } + } + catch (Kernel::Exception::NotFoundError) { + Workspace_sptr invalid; + workspaces.insert(workspaces.end(), invalid); } } @@ -719,8 +725,8 @@ void PoldiIndexKnownCompounds::assignPeakIndex(const IndexCandidatePair &candidate) { candidate.observed->setHKL(candidate.candidate->hkl()); - m_indexedPeaks[candidate.candidateCollectionIndex]->addPeak( - candidate.observed); + m_indexedPeaks[candidate.candidateCollectionIndex] + ->addPeak(candidate.observed); } PoldiPeakCollection_sptr diff --git a/Code/Mantid/Framework/SINQ/src/PoldiPeakSearch.cpp b/Code/Mantid/Framework/SINQ/src/PoldiPeakSearch.cpp index 5c202387a0e5..384743a58340 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiPeakSearch.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiPeakSearch.cpp @@ -3,6 +3,8 @@ #include "MantidAPI/WorkspaceProperty.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidKernel/BoundedValidator.h" +#include "MantidKernel/UnitFactory.h" +#include "MantidKernel/UnitConversion.h" #include "MantidKernel/V2D.h" #include "MantidDataObjects/Workspace2D.h" @@ -197,6 +199,26 @@ PoldiPeakSearch::mapPeakPositionsToCorrelationData( return transformedIndices; } +/// Converts the value-parameter to d-spacing. Assumes unit to be Q if empty. +double PoldiPeakSearch::getTransformedCenter(double value, + const Unit_sptr &unit) const { + if (boost::dynamic_pointer_cast(unit)) { + return value; + } + + // This is required to preserve default behavior which assumes Q. + Unit_sptr transformUnit = unit; + + if (!unit || boost::dynamic_pointer_cast(unit)) { + transformUnit = UnitFactory::Instance().create("MomentumTransfer"); + } + + // Transform value to d-spacing. + Unit_sptr dUnit = UnitFactory::Instance().create("dSpacing"); + return UnitConversion::run((*transformUnit), (*dUnit), value, 0, 0, 0, + DeltaEMode::Elastic, 0.0); +} + /** Creates PoldiPeak-objects from peak position iterators * * In this method, PoldiPeak objects are created from the raw peak position @@ -214,7 +236,7 @@ std::vector PoldiPeakSearch::getPeaks(const MantidVec::const_iterator &baseListStart, const MantidVec::const_iterator &baseListEnd, std::list peakPositions, - const MantidVec &xData) const { + const MantidVec &xData, const Unit_sptr &unit) const { std::vector peakData; peakData.reserve(peakPositions.size()); @@ -223,11 +245,14 @@ PoldiPeakSearch::getPeaks(const MantidVec::const_iterator &baseListStart, peak != peakPositions.end(); ++peak) { size_t index = std::distance(baseListStart, *peak); - PoldiPeak_sptr newPeak = - PoldiPeak::create(UncertainValue(xData[index]), UncertainValue(**peak)); + double xDataD = getTransformedCenter(xData[index], unit); + double fwhmEstimate = getFWHMEstimate(baseListStart, baseListEnd, *peak, xData); - newPeak->setFwhm(UncertainValue(fwhmEstimate)); + UncertainValue fwhm(fwhmEstimate / xData[index]); + + PoldiPeak_sptr newPeak = PoldiPeak::create( + MillerIndices(), UncertainValue(xDataD), UncertainValue(**peak), fwhm); peakData.push_back(newPeak); } @@ -536,6 +561,19 @@ void PoldiPeakSearch::exec() { MantidVec correlatedCounts = correlationWorkspace->readY(0); g_log.information() << " Auto-correlation data read." << std::endl; + Unit_sptr xUnit = correlationWorkspace->getAxis(0)->unit(); + + if (xUnit->caption() == "") { + g_log.information() + << " Workspace does not have unit, defaulting to MomentumTransfer." + << std::endl; + + xUnit = UnitFactory::Instance().create("MomentumTransfer"); + } else { + g_log.information() << " Unit of workspace is " << xUnit->caption() << "." + << std::endl; + } + setMinimumDistance(getProperty("MinimumPeakSeparation")); setMinimumPeakHeight(getProperty("MinimumPeakHeight")); setMaximumPeakNumber(getProperty("MaximumPeakNumber")); @@ -576,7 +614,7 @@ void PoldiPeakSearch::exec() { */ std::vector peakCoordinates = getPeaks(correlatedCounts.begin(), correlatedCounts.end(), - peakPositionsCorrelation, correlationQValues); + peakPositionsCorrelation, correlationQValues, xUnit); g_log.information() << " Extracted peak positions in Q and intensity guesses." << std::endl; diff --git a/Code/Mantid/Framework/SINQ/test/PoldiPeakSearchTest.h b/Code/Mantid/Framework/SINQ/test/PoldiPeakSearchTest.h index 0674bd4c6375..17e0deeedab2 100644 --- a/Code/Mantid/Framework/SINQ/test/PoldiPeakSearchTest.h +++ b/Code/Mantid/Framework/SINQ/test/PoldiPeakSearchTest.h @@ -6,6 +6,7 @@ #include "MantidSINQ/PoldiPeakSearch.h" #include "MantidSINQ/PoldiUtilities/PoldiPeak.h" #include "MantidSINQ/PoldiUtilities/UncertainValue.h" +#include "MantidKernel/UnitFactory.h" using Mantid::Poldi::PoldiPeakSearch; using namespace Mantid::Poldi; @@ -133,7 +134,8 @@ class PoldiPeakSearchTest : public CxxTest::TestSuite maxima.sort(); - std::vector peaks = poldiPeakSearch.getPeaks(baseData.begin(), baseData.end(), maxima, testXData); + Unit_sptr qUnit = UnitFactory::Instance().create("MomentumTransfer"); + std::vector peaks = poldiPeakSearch.getPeaks(baseData.begin(), baseData.end(), maxima, testXData, qUnit); TS_ASSERT_EQUALS(peaks.size(), 4); diff --git a/Code/Mantid/Framework/ScriptRepository/inc/MantidScriptRepository/ScriptRepositoryImpl.h b/Code/Mantid/Framework/ScriptRepository/inc/MantidScriptRepository/ScriptRepositoryImpl.h index 64c0750492af..89900eeee1bc 100644 --- a/Code/Mantid/Framework/ScriptRepository/inc/MantidScriptRepository/ScriptRepositoryImpl.h +++ b/Code/Mantid/Framework/ScriptRepository/inc/MantidScriptRepository/ScriptRepositoryImpl.h @@ -171,7 +171,7 @@ class SCRIPT_DLL_EXPORT ScriptRepositoryImpl : public ScriptRepository { std::string getParentFolder(const std::string &entry); }; -}; // namespace API -}; // namespace Mantid +} // namespace API +} // namespace Mantid #endif // _MANTIDSCRIPTREPOSITORY_SCRIPTREPOSITORYIMPL_H_ diff --git a/Code/Mantid/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp b/Code/Mantid/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp index 1f0f1ea81759..a3e8d448ce08 100644 --- a/Code/Mantid/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp +++ b/Code/Mantid/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp @@ -1200,7 +1200,7 @@ void ScriptRepositoryImpl::setIgnorePatterns(const std::string &patterns) { boost::replace_all(newignore, "*", ".*"); ignoreregex = std::string("(").append(newignore).append(")"); } -}; +} /** @todo describe */ diff --git a/Code/Mantid/Framework/TestHelpers/src/ScopedFileHelper.cpp b/Code/Mantid/Framework/TestHelpers/src/ScopedFileHelper.cpp index e8708decc761..243f36ff1373 100644 --- a/Code/Mantid/Framework/TestHelpers/src/ScopedFileHelper.cpp +++ b/Code/Mantid/Framework/TestHelpers/src/ScopedFileHelper.cpp @@ -41,13 +41,13 @@ ScopedFile &ScopedFile::operator=(const ScopedFile &other) { other.release(); } return *this; -}; +} /// Copy construction. ScopedFile::ScopedFile(const ScopedFile &other) { this->m_filename = other.m_filename; other.release(); -}; +} /** Common method used by all constructors. Creates a file containing the ASCII file diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsAbsoluteUnitsReduction.cpp b/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsAbsoluteUnitsReduction.cpp index f8cff1c7562e..7f146efc89ad 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsAbsoluteUnitsReduction.cpp +++ b/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsAbsoluteUnitsReduction.cpp @@ -30,10 +30,10 @@ DgsAbsoluteUnitsReduction::~DgsAbsoluteUnitsReduction() {} /// Algorithm's name for identification. @see Algorithm::name const std::string DgsAbsoluteUnitsReduction::name() const { return "DgsAbsoluteUnitsReduction"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int DgsAbsoluteUnitsReduction::version() const { return 1; }; +int DgsAbsoluteUnitsReduction::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string DgsAbsoluteUnitsReduction::category() const { diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsConvertToEnergyTransfer.cpp b/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsConvertToEnergyTransfer.cpp index 9b5d8f18600f..643c68fa0c22 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsConvertToEnergyTransfer.cpp +++ b/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsConvertToEnergyTransfer.cpp @@ -42,10 +42,10 @@ DgsConvertToEnergyTransfer::~DgsConvertToEnergyTransfer() {} /// Algorithm's name for identification. @see Algorithm::name const std::string DgsConvertToEnergyTransfer::name() const { return "DgsConvertToEnergyTransfer"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int DgsConvertToEnergyTransfer::version() const { return 1; }; +int DgsConvertToEnergyTransfer::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string DgsConvertToEnergyTransfer::category() const { diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsDiagnose.cpp b/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsDiagnose.cpp index bbb21dc2cd59..85be54fcfc2f 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsDiagnose.cpp +++ b/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsDiagnose.cpp @@ -30,10 +30,10 @@ DgsDiagnose::~DgsDiagnose() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string DgsDiagnose::name() const { return "DgsDiagnose"; }; +const std::string DgsDiagnose::name() const { return "DgsDiagnose"; } /// Algorithm's version for identification. @see Algorithm::version -int DgsDiagnose::version() const { return 1; }; +int DgsDiagnose::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string DgsDiagnose::category() const { diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsPreprocessData.cpp b/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsPreprocessData.cpp index 56bce546f2d6..56258b060d0b 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsPreprocessData.cpp +++ b/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsPreprocessData.cpp @@ -38,10 +38,10 @@ DgsPreprocessData::~DgsPreprocessData() {} /// Algorithm's name for identification. @see Algorithm::name const std::string DgsPreprocessData::name() const { return "DgsPreprocessData"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int DgsPreprocessData::version() const { return 1; }; +int DgsPreprocessData::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string DgsPreprocessData::category() const { diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsReduction.cpp b/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsReduction.cpp index 0b8a08209705..f5dc93a0b54a 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsReduction.cpp +++ b/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsReduction.cpp @@ -39,10 +39,10 @@ DgsReduction::~DgsReduction() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string DgsReduction::name() const { return "DgsReduction"; }; +const std::string DgsReduction::name() const { return "DgsReduction"; } /// Algorithm's version for identification. @see Algorithm::version -int DgsReduction::version() const { return 1; }; +int DgsReduction::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string DgsReduction::category() const { diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsRemap.cpp b/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsRemap.cpp index 5a15d54b2679..d4008ae2aa53 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsRemap.cpp +++ b/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsRemap.cpp @@ -24,10 +24,10 @@ DgsRemap::~DgsRemap() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string DgsRemap::name() const { return "DgsRemap"; }; +const std::string DgsRemap::name() const { return "DgsRemap"; } /// Algorithm's version for identification. @see Algorithm::version -int DgsRemap::version() const { return 1; }; +int DgsRemap::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string DgsRemap::category() const { return "Workflow\\Inelastic"; } diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/src/MuonCalculateAsymmetry.cpp b/Code/Mantid/Framework/WorkflowAlgorithms/src/MuonCalculateAsymmetry.cpp index a508a720150c..a70b9f91146e 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/src/MuonCalculateAsymmetry.cpp +++ b/Code/Mantid/Framework/WorkflowAlgorithms/src/MuonCalculateAsymmetry.cpp @@ -28,10 +28,10 @@ MuonCalculateAsymmetry::~MuonCalculateAsymmetry() {} /// Algorithm's name for identification. @see Algorithm::name const std::string MuonCalculateAsymmetry::name() const { return "MuonCalculateAsymmetry"; -}; +} /// Algorithm's version for identification. @see Algorithm::version -int MuonCalculateAsymmetry::version() const { return 1; }; +int MuonCalculateAsymmetry::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string MuonCalculateAsymmetry::category() const { diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/src/MuonLoad.cpp b/Code/Mantid/Framework/WorkflowAlgorithms/src/MuonLoad.cpp index 9d2771c1ea43..0690f08d3c2c 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/src/MuonLoad.cpp +++ b/Code/Mantid/Framework/WorkflowAlgorithms/src/MuonLoad.cpp @@ -28,10 +28,10 @@ MuonLoad::~MuonLoad() {} //---------------------------------------------------------------------------------------------- /// Algorithm's name for identification. @see Algorithm::name -const std::string MuonLoad::name() const { return "MuonLoad"; }; +const std::string MuonLoad::name() const { return "MuonLoad"; } /// Algorithm's version for identification. @see Algorithm::version -int MuonLoad::version() const { return 1; }; +int MuonLoad::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string MuonLoad::category() const { return "Workflow\\Muon"; } diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/src/StepScan.cpp b/Code/Mantid/Framework/WorkflowAlgorithms/src/StepScan.cpp index 616e1df5844f..4541b25d6eae 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/src/StepScan.cpp +++ b/Code/Mantid/Framework/WorkflowAlgorithms/src/StepScan.cpp @@ -19,10 +19,10 @@ StepScan::StepScan() {} StepScan::~StepScan() {} /// Algorithm's name for identification. @see Algorithm::name -const std::string StepScan::name() const { return "StepScan"; }; +const std::string StepScan::name() const { return "StepScan"; } /// Algorithm's version for identification. @see Algorithm::version -int StepScan::version() const { return 1; }; +int StepScan::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category const std::string StepScan::category() const { return "Workflow\\Alignment"; } diff --git a/Code/Mantid/MantidPlot/CMakeLists.txt b/Code/Mantid/MantidPlot/CMakeLists.txt index 68daaff89d6f..6314b89a3f66 100644 --- a/Code/Mantid/MantidPlot/CMakeLists.txt +++ b/Code/Mantid/MantidPlot/CMakeLists.txt @@ -548,7 +548,7 @@ add_custom_command ( OUTPUT ${SIP_SRC} ) # Needed for sip.h header that can end up in a different place to to the main Python include directory -include_directories ( ${SIP_INCLUDE_DIR} ) +include_directories ( SYSTEM ${SIP_INCLUDE_DIR} ) # Needed for sip generated files to find includes in src include_directories ( ${CMAKE_CURRENT_SOURCE_DIR} ) diff --git a/Code/Mantid/MantidPlot/src/ExpDecayDialog.cpp b/Code/Mantid/MantidPlot/src/ExpDecayDialog.cpp index 98154dc22ff8..cd3347749305 100644 --- a/Code/Mantid/MantidPlot/src/ExpDecayDialog.cpp +++ b/Code/Mantid/MantidPlot/src/ExpDecayDialog.cpp @@ -158,7 +158,7 @@ void ExpDecayDialog::setGraph(Graph *g) connect (graph, SIGNAL(closedGraph()), this, SLOT(close())); connect (graph, SIGNAL(dataRangeChanged()), this, SLOT(changeDataRange())); -}; +} void ExpDecayDialog::activateCurve(const QString& curveName) { @@ -178,7 +178,7 @@ void ExpDecayDialog::activateCurve(const QString& curveName) if (slopes < 2) boxAmplitude->setText(QString::number(c->maxYValue() - c->minYValue(), 'g', precision)); -}; +} void ExpDecayDialog::changeDataRange() { diff --git a/Code/Mantid/MantidPlot/src/FFTDialog.cpp b/Code/Mantid/MantidPlot/src/FFTDialog.cpp index f83ac4f22c94..e6453e17b295 100644 --- a/Code/Mantid/MantidPlot/src/FFTDialog.cpp +++ b/Code/Mantid/MantidPlot/src/FFTDialog.cpp @@ -186,7 +186,7 @@ void FFTDialog::setGraph(Graph *g) graph = g; boxName->insertStringList (g->analysableCurvesList()); activateCurve(boxName->currentText()); -}; +} void FFTDialog::activateCurve(const QString& curveName) { @@ -202,7 +202,7 @@ void FFTDialog::activateCurve(const QString& curveName) double x1 = d_table->text(1, col).toDouble(); boxSampling->setText(QString::number(x1 - x0)); } -}; +} void FFTDialog::setTable(Table *t) { @@ -233,7 +233,7 @@ void FFTDialog::setTable(Table *t) boxReal->setCurrentItem(t->colIndex(l[0])); boxImaginary->setCurrentItem(t->colIndex(l[1])); } -}; +} void FFTDialog::setMatrix(Matrix *m) { diff --git a/Code/Mantid/MantidPlot/src/FilterDialog.cpp b/Code/Mantid/MantidPlot/src/FilterDialog.cpp index 6f02ae0d0fef..1e16d247b595 100644 --- a/Code/Mantid/MantidPlot/src/FilterDialog.cpp +++ b/Code/Mantid/MantidPlot/src/FilterDialog.cpp @@ -190,4 +190,4 @@ void FilterDialog::setGraph(Graph *g) { graph = g; boxName->addItems (g->analysableCurvesList()); -}; +} diff --git a/Code/Mantid/MantidPlot/src/FitDialog.cpp b/Code/Mantid/MantidPlot/src/FitDialog.cpp index 27936290bc3a..701adfc599bc 100644 --- a/Code/Mantid/MantidPlot/src/FitDialog.cpp +++ b/Code/Mantid/MantidPlot/src/FitDialog.cpp @@ -559,7 +559,7 @@ void FitDialog::setGraph(Graph *g) connect (d_graph, SIGNAL(closedGraph()), this, SLOT(close())); connect (d_graph, SIGNAL(dataRangeChanged()), this, SLOT(changeDataRange())); -}; +} void FitDialog::activateCurve(const QString& curveName) { @@ -573,7 +573,7 @@ void FitDialog::activateCurve(const QString& curveName) boxTo->setValue(QMAX(start, end)); //Set the same color as the data curve chosen for fit (Feature Request #4031) boxColor->setColor(c->pen().color()); -}; +} void FitDialog::saveUserFunction() { diff --git a/Code/Mantid/MantidPlot/src/Graph.cpp b/Code/Mantid/MantidPlot/src/Graph.cpp index a36e9a89449c..92123c84c1bd 100644 --- a/Code/Mantid/MantidPlot/src/Graph.cpp +++ b/Code/Mantid/MantidPlot/src/Graph.cpp @@ -5360,9 +5360,11 @@ void Graph::enablePanningMagnifier(bool on) delete d_panner; QwtPlotCanvas *cnvs =d_plot->canvas(); //canvas(); - if (on){ + if (on) { cnvs->setCursor(Qt::pointingHandCursor); d_magnifier = new QwtPlotMagnifier(cnvs); + // Disable the mouse button as it causes issues with the context menu + d_magnifier->setMouseButton(Qt::NoButton); d_magnifier->setAxisEnabled(QwtPlot::yRight,false); d_magnifier->setZoomInKey(Qt::Key_Plus, Qt::ShiftModifier); diff --git a/Code/Mantid/MantidPlot/src/Graph.h b/Code/Mantid/MantidPlot/src/Graph.h index 07cab9df6848..7480107f3b16 100644 --- a/Code/Mantid/MantidPlot/src/Graph.h +++ b/Code/Mantid/MantidPlot/src/Graph.h @@ -881,7 +881,7 @@ private slots: }; -Q_DECLARE_METATYPE(Graph::CurveType); +Q_DECLARE_METATYPE(Graph::CurveType) #endif // GRAPH_H diff --git a/Code/Mantid/MantidPlot/src/InterpolationDialog.cpp b/Code/Mantid/MantidPlot/src/InterpolationDialog.cpp index 4d0ceb1722ec..efc62a720287 100644 --- a/Code/Mantid/MantidPlot/src/InterpolationDialog.cpp +++ b/Code/Mantid/MantidPlot/src/InterpolationDialog.cpp @@ -173,7 +173,7 @@ void InterpolationDialog::setGraph(Graph *g) connect (graph, SIGNAL(closedGraph()), this, SLOT(close())); connect (graph, SIGNAL(dataRangeChanged()), this, SLOT(changeDataRange())); -}; +} void InterpolationDialog::activateCurve(const QString& curveName) { @@ -189,7 +189,7 @@ void InterpolationDialog::activateCurve(const QString& curveName) graph->range(graph->curveIndex(curveName), &start, &end); boxStart->setText(QString::number(QMIN(start, end), 'g', app->d_decimal_digits)); boxEnd->setText(QString::number(QMAX(start, end), 'g', app->d_decimal_digits)); -}; +} void InterpolationDialog::changeDataRange() { diff --git a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentTreeWidget.cpp b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentTreeWidget.cpp index 6caf14cffda8..a2649437b34b 100644 --- a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentTreeWidget.cpp +++ b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentTreeWidget.cpp @@ -17,7 +17,7 @@ InstrumentTreeWidget::InstrumentTreeWidget(QWidget *w):QTreeView(w), m_treeModel(0) { connect(this,SIGNAL(clicked(const QModelIndex)),this,SLOT(sendComponentSelectedSignal(const QModelIndex))); -}; +} void InstrumentTreeWidget::setInstrumentActor(InstrumentActor* instrActor) { diff --git a/Code/Mantid/MantidPlot/src/Mantid/MantidSampleLogDialog.cpp b/Code/Mantid/MantidPlot/src/Mantid/MantidSampleLogDialog.cpp index fb7636c0e760..343c6551c412 100644 --- a/Code/Mantid/MantidPlot/src/Mantid/MantidSampleLogDialog.cpp +++ b/Code/Mantid/MantidPlot/src/Mantid/MantidSampleLogDialog.cpp @@ -462,6 +462,7 @@ void MantidSampleLogDialog::init() m_tree->header()->resizeSection(3, 90); //units column m_tree->header()->setMovable(false); m_tree->setSortingEnabled(true); + m_tree->sortByColumn(0, Qt::AscendingOrder); } diff --git a/Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp b/Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp index 2ef4c3335a47..0b91a054f512 100644 --- a/Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp +++ b/Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp @@ -2310,7 +2310,7 @@ MultiLayer* MantidUI::mergePlots(MultiLayer* mlayer_1, MultiLayer* mlayer_2) mlayer_2->close(); return mlayer_1; -}; +} MantidMatrix* MantidUI::getMantidMatrix(const QString& wsName) { @@ -2530,7 +2530,6 @@ void MantidUI::importNumSeriesLog(const QString &wsName, const QString &logName, t->setColName(1, column1); int iValueCurve = 0; - int iFilterCurve = 1; // Applying filters if (filter > 0) @@ -2634,9 +2633,6 @@ void MantidUI::importNumSeriesLog(const QString &wsName, const QString &logName, } } - iValueCurve = 1; - iFilterCurve = 0; - } //end (valid filter exists) } @@ -2734,19 +2730,23 @@ void MantidUI::importNumSeriesLog(const QString &wsName, const QString &logName, if (filter && flt.filter()) { + int iFilterCurve = 1; QwtPlotCurve *c = g->curve(iFilterCurve); - // Set the right axis as Y axis for the filter curve. - c->setAxis(2,1); - // Set style #3 (HorizontalSteps) for curve 1 - // Set scale of right Y-axis (#3) from 0 to 1 - g->setCurveStyle(iFilterCurve,3); - g->setScale(3,0,1); - // Fill area under the curve with a pattern - QBrush br = QBrush(Qt::gray, Qt::Dense5Pattern); - g->setCurveBrush(iFilterCurve, br); - // Set line colour - QPen pn = QPen(Qt::gray); - g->setCurvePen(iFilterCurve, pn); + if ( c ) + { + // Set the right axis as Y axis for the filter curve. + c->setAxis(2,1); + // Set style #3 (HorizontalSteps) for curve 1 + // Set scale of right Y-axis (#3) from 0 to 1 + g->setCurveStyle(iFilterCurve,3); + g->setScale(3,0,1); + // Fill area under the curve with a pattern + QBrush br = QBrush(Qt::gray, Qt::Dense5Pattern); + g->setCurveBrush(iFilterCurve, br); + // Set line colour + QPen pn = QPen(Qt::gray); + g->setCurvePen(iFilterCurve, pn); + } } g->setXAxisTitle(t->colLabel(0)); g->setYAxisTitle(t->colLabel(1).section(".",0,0)); diff --git a/Code/Mantid/MantidPlot/src/MdiSubWindow.cpp b/Code/Mantid/MantidPlot/src/MdiSubWindow.cpp index 3e003d1b593f..f0b014fb79a8 100644 --- a/Code/Mantid/MantidPlot/src/MdiSubWindow.cpp +++ b/Code/Mantid/MantidPlot/src/MdiSubWindow.cpp @@ -98,7 +98,7 @@ void MdiSubWindow::updateCaption() wrapper->setWindowTitle(windowTitle()); } emit captionChanged(objectName(), d_label); -}; +} void MdiSubWindow::resizeEvent( QResizeEvent* e ) { diff --git a/Code/Mantid/MantidPlot/src/MultiLayer.h b/Code/Mantid/MantidPlot/src/MultiLayer.h index e561a61a0fd4..cba7586a9b75 100644 --- a/Code/Mantid/MantidPlot/src/MultiLayer.h +++ b/Code/Mantid/MantidPlot/src/MultiLayer.h @@ -266,7 +266,7 @@ class LayerButton: public QPushButton void clicked(LayerButton*); }; -Q_DECLARE_METATYPE(MultiLayer*); +Q_DECLARE_METATYPE(MultiLayer*) class WaterfallFillDialog : QDialog diff --git a/Code/Mantid/MantidPlot/src/Plot3DDialog.cpp b/Code/Mantid/MantidPlot/src/Plot3DDialog.cpp index f1cab9fe0ed1..a231acee361e 100644 --- a/Code/Mantid/MantidPlot/src/Plot3DDialog.cpp +++ b/Code/Mantid/MantidPlot/src/Plot3DDialog.cpp @@ -594,7 +594,7 @@ void Plot3DDialog::setPlot(Graph3D *g) connect( boxLegend, SIGNAL(toggled(bool)), d_plot, SLOT(showColorLegend(bool))); connect( boxResolution, SIGNAL(valueChanged(int)), d_plot, SLOT(setResolution(int))); connect( boxDistance, SIGNAL(valueChanged(int)), d_plot, SLOT(setLabelsDistance(int))); -}; +} void Plot3DDialog::worksheet() { diff --git a/Code/Mantid/MantidPlot/src/PlotDialog.h b/Code/Mantid/MantidPlot/src/PlotDialog.h index f5e1d9017a55..bd58dfa8dfaa 100644 --- a/Code/Mantid/MantidPlot/src/PlotDialog.h +++ b/Code/Mantid/MantidPlot/src/PlotDialog.h @@ -181,7 +181,7 @@ protected slots: ColorMapEditor *colorMapEditor; QPushButton* mSelectColormap; QString mCurrentColorMap; - QWidget *curvePlotTypeBox, *layerPage, *layerGeometryPage, *piePage, *fontsPage, *printPage, *contourLinesPage;; + QWidget *curvePlotTypeBox, *layerPage, *layerGeometryPage, *piePage, *fontsPage, *printPage, *contourLinesPage; QTreeWidget* listBox; QCheckBox *boxAntialiasing, *boxAll, *boxScaleLayers, *boxPrintCrops; ColorButton *boxBorderColor, *boxBackgroundColor, *boxCanvasColor, *boxCanvasFrameColor; @@ -236,7 +236,7 @@ protected slots: QLabel *boxRangeLabel, *whiskerCntLabel, *boxCntLabel; QGroupBox *GroupBoxVectEnd; QComboBox *vectPosBox, *boxXAxis, *boxYAxis, *colorScaleBox;//, *boxContourStyle; - PenStyleBox *penContourStyle,*boxContourStyle;; + PenStyleBox *penContourStyle,*boxContourStyle; QSpinBox *levelsBox, *colorScaleWidthBox; DoubleSpinBox *contourWidthBox; QGroupBox *levelsGroupBox, *axisScaleBox, *imageGroupBox; diff --git a/Code/Mantid/MantidPlot/src/PluginFit.cpp b/Code/Mantid/MantidPlot/src/PluginFit.cpp index 708994c0bbb4..7ca2fdbe6df8 100644 --- a/Code/Mantid/MantidPlot/src/PluginFit.cpp +++ b/Code/Mantid/MantidPlot/src/PluginFit.cpp @@ -64,6 +64,39 @@ void PluginFit::init() d_fit_type = Plugin; } + +namespace{ +typedef union { + double (*func)(const gsl_vector *, void *); + void* ptr; +} simplex_union; + +typedef union { + int (*func)(const gsl_vector *, void *, gsl_vector *); + void* ptr; +} f_union; + +typedef union { + int (*func)(const gsl_vector *, void *,gsl_matrix *); + void* ptr; +} df_union; + +typedef union { + int (*func)(const gsl_vector *, void *, gsl_vector *, gsl_matrix *); + void* ptr; +} fdf_union; + +typedef union { + double (*func)(double, double *); + void* ptr; +} ffe_union; + +typedef union { + char* (*func)(); + void* ptr; +} ff_union; +} + bool PluginFit::load(const QString& pluginName) { if (!QFile::exists (pluginName)){ @@ -75,40 +108,52 @@ bool PluginFit::load(const QString& pluginName) QLibrary lib(pluginName); lib.setAutoUnload(false); - d_fsimplex = (fit_function_simplex) lib.resolve( "function_d" ); + simplex_union simplex; + simplex.ptr = lib.resolve( "function_d" ); + d_fsimplex = simplex.func; if (!d_fsimplex){ QMessageBox::critical(static_cast(parent()), tr("MantidPlot - Plugin Error"), tr("The plugin does not implement a %1 method necessary for simplex fitting.").arg("function_d")); return false; } - d_f = (fit_function) lib.resolve( "function_f" ); + f_union f; + f.ptr = lib.resolve( "function_f" ); + d_f = f.func; if (!d_f){ QMessageBox::critical(static_cast(parent()), tr("MantidPlot - Plugin Error"), tr("The plugin does not implement a %1 method necessary for Levenberg-Marquardt fitting.").arg("function_f")); return false; } - d_df = (fit_function_df) lib.resolve( "function_df" ); - if (!d_df){ + df_union df; + df.ptr = lib.resolve( "function_df" ); + d_df = df.func; + if (!(df.ptr)){ QMessageBox::critical(static_cast(parent()), tr("MantidPlot - Plugin Error"), tr("The plugin does not implement a %1 method necessary for Levenberg-Marquardt fitting.").arg("function_df")); return false; } - d_fdf = (fit_function_fdf) lib.resolve( "function_fdf" ); + fdf_union fdf; + fdf.ptr = lib.resolve( "function_fdf" ); + d_fdf = fdf.func; if (!d_fdf){ QMessageBox::critical(static_cast(parent()), tr("MantidPlot - Plugin Error"), tr("The plugin does not implement a %1 method necessary for Levenberg-Marquardt fitting.").arg("function_fdf")); return false; } - f_eval = (fitFunctionEval) lib.resolve("function_eval"); + ffe_union ffe; + ffe.ptr = lib.resolve("function_eval"); + f_eval = ffe.func; if (!f_eval) return false; typedef char* (*fitFunc)(); - fitFunc fitFunction = (fitFunc) lib.resolve("parameters"); + ff_union ff; + ff.ptr = lib.resolve("parameters"); + fitFunc fitFunction = ff.func; if (fitFunction){ d_param_names = QString(fitFunction()).split(",", QString::SkipEmptyParts); d_p = (int)d_param_names.count(); @@ -116,17 +161,20 @@ bool PluginFit::load(const QString& pluginName) } else return false; - fitFunc fitExplain = (fitFunc) lib.resolve("explanations"); + ff.ptr = lib.resolve("explanations"); + fitFunc fitExplain = ff.func; if (fitExplain) d_param_explain = QString(fitExplain()).split(",", QString::SkipEmptyParts); else for (int i=0; isetText(QString::number(start, 'g', 15)); boxEnd->setText(QString::number(end, 'g', 15)); boxPoints->setValue(QMAX(n_points, 100)); -}; +} void PolynomFitDialog::changeDataRange() { diff --git a/Code/Mantid/MantidPlot/src/PythonScript.cpp b/Code/Mantid/MantidPlot/src/PythonScript.cpp index 990bcbf2ab77..6396aef2af39 100644 --- a/Code/Mantid/MantidPlot/src/PythonScript.cpp +++ b/Code/Mantid/MantidPlot/src/PythonScript.cpp @@ -686,7 +686,7 @@ namespace } private: InstallTrace(); - Q_DISABLE_COPY(InstallTrace); + Q_DISABLE_COPY(InstallTrace) PyObject *m_sipWrappedScript; }; } diff --git a/Code/Mantid/MantidPlot/src/PythonThreading.h b/Code/Mantid/MantidPlot/src/PythonThreading.h index 663b68568f40..83a659aa76fc 100644 --- a/Code/Mantid/MantidPlot/src/PythonThreading.h +++ b/Code/Mantid/MantidPlot/src/PythonThreading.h @@ -18,7 +18,7 @@ struct GlobalInterpreterLock PyGILState_Release(m_state); } private: - Q_DISABLE_COPY(GlobalInterpreterLock); + Q_DISABLE_COPY(GlobalInterpreterLock) /// Current GIL state PyGILState_STATE m_state; }; diff --git a/Code/Mantid/MantidPlot/src/ScriptFileInterpreter.h b/Code/Mantid/MantidPlot/src/ScriptFileInterpreter.h index 785f6119a25f..705efe9a4ebe 100644 --- a/Code/Mantid/MantidPlot/src/ScriptFileInterpreter.h +++ b/Code/Mantid/MantidPlot/src/ScriptFileInterpreter.h @@ -123,7 +123,7 @@ private slots: void setStoppedStatus(); private: - Q_DISABLE_COPY(ScriptFileInterpreter); + Q_DISABLE_COPY(ScriptFileInterpreter) void setupChildWidgets(); void setupEditor(const ScriptingEnv & environ, const QString & identifier); diff --git a/Code/Mantid/MantidPlot/src/qti.sip b/Code/Mantid/MantidPlot/src/qti.sip index 2d12a0cb2431..b241c862b0d9 100644 --- a/Code/Mantid/MantidPlot/src/qti.sip +++ b/Code/Mantid/MantidPlot/src/qti.sip @@ -31,6 +31,12 @@ %Module _qti +%UnitCode + #if defined(__GNUC__) && !(defined(__INTEL_COMPILER)) + #pragma GCC system_header + #endif +%End + %Import QtCore/QtCoremod.sip %Import QtGui/QtGuimod.sip %Import mantidqt.sip diff --git a/Code/Mantid/MantidPlot/src/sipqti.cpp.in b/Code/Mantid/MantidPlot/src/sipqti.cpp.in index 750399d6d8f9..b7661e145264 100644 --- a/Code/Mantid/MantidPlot/src/sipqti.cpp.in +++ b/Code/Mantid/MantidPlot/src/sipqti.cpp.in @@ -1,13 +1,7 @@ //------------------------------------------------------------------------------ // A wrapper for the auto-generated sipqtipart?.cpp files to disable warnings -// that we can't control +// that we can't control. The warnings are actually suppressed in qti.sip +// with '#pragma GCC system_header' but that pragma only works if it occurs +// in a file that has been included with '#include' //------------------------------------------------------------------------------ -#if defined(__GNUC__) && !(defined(__INTEL_COMPILER)) - #pragma GCC diagnostic ignored "-Wuninitialized" - #pragma GCC diagnostic ignored "-Wconversion" - #pragma GCC diagnostic ignored "-Wunused-variable" - #pragma GCC diagnostic ignored "-Wparentheses" - #pragma GCC diagnostic ignored "-Wcast-qual" -#endif - #include "sip_qtipart0.cpp" diff --git a/Code/Mantid/MantidPlot/src/zlib123/minigzip.c b/Code/Mantid/MantidPlot/src/zlib123/minigzip.c index 5df454d1a821..6f12762c8ece 100644 --- a/Code/Mantid/MantidPlot/src/zlib123/minigzip.c +++ b/Code/Mantid/MantidPlot/src/zlib123/minigzip.c @@ -252,7 +252,7 @@ void file_uncompress(file) { outfile = file; infile = buf; - // Add the .gz suffix to the filename in buf/infile + /* Add the .gz suffix to the filename in buf/infile */ strcat(buf, GZ_SUFFIX); } in = gzopen(infile, "rb"); diff --git a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/Message.h b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/Message.h index 0f5c32d37b4c..c14f3a1fd7ad 100644 --- a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/Message.h +++ b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/Message.h @@ -58,6 +58,6 @@ namespace MantidQt } /// Required to operate in signals/slots -Q_DECLARE_METATYPE(MantidQt::API::Message); +Q_DECLARE_METATYPE(MantidQt::API::Message) #endif //MESSAGE_H_ diff --git a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/PlotAxis.h b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/PlotAxis.h index 6da97440087d..6cf577e0b7c7 100644 --- a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/PlotAxis.h +++ b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/PlotAxis.h @@ -50,7 +50,7 @@ namespace MantidQt QString title() const; private: - DISABLE_DEFAULT_CONSTRUCT(PlotAxis); + DISABLE_DEFAULT_CONSTRUCT(PlotAxis) /// Creates a title suitable for an axis attached to the given index void titleFromIndex(const Mantid::API::IMDWorkspace & workspace, diff --git a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/QtSignalChannel.h b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/QtSignalChannel.h index 50dfe80ca77d..b598204b47d0 100644 --- a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/QtSignalChannel.h +++ b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/QtSignalChannel.h @@ -66,7 +66,7 @@ namespace MantidQt void messageReceived(const Message & msg); private: - Q_DISABLE_COPY(QtSignalChannel); + Q_DISABLE_COPY(QtSignalChannel) /// Optional source (use std::string to avoid conversion in comparison) QString m_source; diff --git a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/RepoModel.h b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/RepoModel.h index 8ecc05547ef1..f630804187fa 100644 --- a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/RepoModel.h +++ b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/RepoModel.h @@ -223,7 +223,7 @@ const QString DELETABLEENTRY = "deletable"; /// auxiliary method to help populating the model RepoItem * getParent(const QString & folder, QList&parents); - Q_DISABLE_COPY(RepoModel); + Q_DISABLE_COPY(RepoModel) /// auxiliary method to deal with exceptions void handleExceptions(const Mantid::API::ScriptRepoException & ex, @@ -257,7 +257,7 @@ const QString DELETABLEENTRY = "deletable"; }; -}; // namespace API -};// namespace Mantid +} // namespace API +} // namespace Mantid #endif /* MANTID_API_SCRIPTREPOSITORYVIEW_H_ */ diff --git a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/SignalRange.h b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/SignalRange.h index 5e8cf13d9277..99a9ebba7ea6 100644 --- a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/SignalRange.h +++ b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/SignalRange.h @@ -47,7 +47,7 @@ namespace MantidQt QwtDoubleInterval interval() const; private: - DISABLE_DEFAULT_CONSTRUCT(SignalRange); + DISABLE_DEFAULT_CONSTRUCT(SignalRange) /// Find the min/max signal values in the entire workspace void findFullRange(const Mantid::API::IMDWorkspace & workspace, diff --git a/Code/Mantid/MantidQt/API/src/MdConstants.cpp b/Code/Mantid/MantidQt/API/src/MdConstants.cpp index d07c67b26b2e..5eae09154303 100644 --- a/Code/Mantid/MantidQt/API/src/MdConstants.cpp +++ b/Code/Mantid/MantidQt/API/src/MdConstants.cpp @@ -12,9 +12,9 @@ namespace MantidQt { initializeSettingsConstants(); initializeViewConstants(); - }; + } - MdConstants::~MdConstants(){}; + MdConstants::~MdConstants(){} void MdConstants::initializeSettingsConstants() { diff --git a/Code/Mantid/MantidQt/API/src/PropertyWidget.cpp b/Code/Mantid/MantidQt/API/src/PropertyWidget.cpp index 4b938ef3b945..2af591dd9396 100644 --- a/Code/Mantid/MantidQt/API/src/PropertyWidget.cpp +++ b/Code/Mantid/MantidQt/API/src/PropertyWidget.cpp @@ -171,7 +171,7 @@ namespace API /** * Destructor. */ - ClickableLabel::~ClickableLabel() {}; + ClickableLabel::~ClickableLabel() {} /** * Catches the mouse press event and emits the signal. diff --git a/Code/Mantid/MantidQt/API/src/RepoModel.cpp b/Code/Mantid/MantidQt/API/src/RepoModel.cpp index 14e3a8ebbc84..0fd6e88b36bc 100644 --- a/Code/Mantid/MantidQt/API/src/RepoModel.cpp +++ b/Code/Mantid/MantidQt/API/src/RepoModel.cpp @@ -940,21 +940,21 @@ bool RepoModel::isUploading(const QModelIndex & index)const{ /// @return string to define the LOCAL_ONLY state -const QString & RepoModel::localOnlySt(){return LOCALONLY;}; +const QString & RepoModel::localOnlySt(){return LOCALONLY;} /// @return string to define the REMOTE_ONLY state -const QString & RepoModel::remoteOnlySt(){return REMOTEONLY;}; +const QString & RepoModel::remoteOnlySt(){return REMOTEONLY;} /// @return string to define the LOCAL_CHANGED state -const QString & RepoModel::localChangedSt(){return LOCALCHANGED;}; +const QString & RepoModel::localChangedSt(){return LOCALCHANGED;} /// @return string to define the REMOTE_CHANGED state -const QString & RepoModel::remoteChangedSt(){return REMOTECHANGED;}; +const QString & RepoModel::remoteChangedSt(){return REMOTECHANGED;} /// @return string to define the BOTH_UNCHANGED state -const QString & RepoModel::updatedSt(){return BOTHUNCHANGED;}; +const QString & RepoModel::updatedSt(){return BOTHUNCHANGED;} /// @return string to define the BOTH_CHANGED state -const QString & RepoModel::bothChangedSt(){return BOTHCHANGED;}; +const QString & RepoModel::bothChangedSt(){return BOTHCHANGED;} /// @return string to define the downloading state -const QString & RepoModel::downloadSt(){return DOWNLOADST;}; +const QString & RepoModel::downloadSt(){return DOWNLOADST;} /// @return string to define the uploading state -const QString & RepoModel::uploadSt(){return UPLOADST;}; +const QString & RepoModel::uploadSt(){return UPLOADST;} diff --git a/Code/Mantid/MantidQt/API/src/ScriptRepositoryView.cpp b/Code/Mantid/MantidQt/API/src/ScriptRepositoryView.cpp index 96cd7bcd4f4b..5f76e642dc0e 100644 --- a/Code/Mantid/MantidQt/API/src/ScriptRepositoryView.cpp +++ b/Code/Mantid/MantidQt/API/src/ScriptRepositoryView.cpp @@ -377,7 +377,7 @@ bool ScriptRepositoryView::RepoDelegate::editorEvent(QEvent *event, QSize ScriptRepositoryView::RepoDelegate::sizeHint(const QStyleOptionViewItem & /*option*/, const QModelIndex & /*index*/ ) const{ return QSize(35,35); -} ; +} ////////////////////////////////////////////////// diff --git a/Code/Mantid/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/SampleShapeHelpers.h b/Code/Mantid/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/SampleShapeHelpers.h index 4a774a9bfdf3..a83e99cb3bcb 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/SampleShapeHelpers.h +++ b/Code/Mantid/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/SampleShapeHelpers.h @@ -34,7 +34,7 @@ class ShapeDetails; */ class PointGroupBox : public QGroupBox { - Q_OBJECT; + Q_OBJECT public: //Default constructor diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/CatalogPublishDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/CatalogPublishDialog.cpp index 1cad4d1c3eed..e16e6621686d 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/CatalogPublishDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/CatalogPublishDialog.cpp @@ -14,7 +14,7 @@ namespace MantidQt { namespace CustomDialogs { - DECLARE_DIALOG(CatalogPublishDialog); + DECLARE_DIALOG(CatalogPublishDialog) /** * Default constructor. diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/ConvertTableToMatrixWorkspaceDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/ConvertTableToMatrixWorkspaceDialog.cpp index 96b80b7c1a10..314e3b9d9e81 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/ConvertTableToMatrixWorkspaceDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/ConvertTableToMatrixWorkspaceDialog.cpp @@ -22,7 +22,7 @@ namespace MantidQt namespace CustomDialogs { // Declare the dialog. Name must match the class name - DECLARE_DIALOG(ConvertTableToMatrixWorkspaceDialog); + DECLARE_DIALOG(ConvertTableToMatrixWorkspaceDialog) //-------------------------------------------------------------------------- // Public methods diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp index c0345f3727b1..02aa58ba0026 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp @@ -24,7 +24,7 @@ namespace MantidQt { namespace CustomDialogs { - DECLARE_DIALOG(CreateSampleShapeDialog); + DECLARE_DIALOG(CreateSampleShapeDialog) } } diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/FitDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/FitDialog.cpp index 7b4217a2dc42..d39863b1b776 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/FitDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/FitDialog.cpp @@ -31,7 +31,7 @@ namespace CustomDialogs { // Declare the dialog. Name must match the class name -DECLARE_DIALOG(FitDialog); +DECLARE_DIALOG(FitDialog) //------------------------------------------------------ // InputWorkspaceWidget methods diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/LOQScriptInputDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/LOQScriptInputDialog.cpp index 5fdda1e5b182..15280c6c137d 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/LOQScriptInputDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/LOQScriptInputDialog.cpp @@ -13,7 +13,7 @@ namespace MantidQt { namespace CustomDialogs { - DECLARE_DIALOG(LOQScriptInputDialog); + DECLARE_DIALOG(LOQScriptInputDialog) } } diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/LoadDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/LoadDialog.cpp index 2f88ee8c8972..7c4f993de8de 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/LoadDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/LoadDialog.cpp @@ -41,7 +41,7 @@ namespace MantidQt } // Declare the dialog. Name must match the class name - DECLARE_DIALOG(LoadDialog); + DECLARE_DIALOG(LoadDialog) //-------------------------------------------------------------------------- // Public methods diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/LoadInstrumentDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/LoadInstrumentDialog.cpp index 37192b4c2999..5716406111d9 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/LoadInstrumentDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/LoadInstrumentDialog.cpp @@ -11,7 +11,7 @@ namespace MantidQt { namespace CustomDialogs { - DECLARE_DIALOG(LoadInstrumentDialog); + DECLARE_DIALOG(LoadInstrumentDialog) /** Constructor diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/SortTableWorkspaceDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/SortTableWorkspaceDialog.cpp index 5b2a0dc90887..7a81d7a310dc 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/SortTableWorkspaceDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/SortTableWorkspaceDialog.cpp @@ -15,7 +15,7 @@ namespace CustomDialogs { // Declare the dialog. Name must match the class name -DECLARE_DIALOG(SortTableWorkspaceDialog); +DECLARE_DIALOG(SortTableWorkspaceDialog) /// Default constructor diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/StartLiveDataDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/StartLiveDataDialog.cpp index 65330a4d7d5f..0450d6bd8eaf 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/StartLiveDataDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/StartLiveDataDialog.cpp @@ -64,7 +64,7 @@ namespace MantidQt { namespace CustomDialogs { - DECLARE_DIALOG(StartLiveDataDialog); + DECLARE_DIALOG(StartLiveDataDialog) //---------------------- // Public member functions diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IReflPresenter.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IReflPresenter.h index 52720837cbe2..9acf1b47564a 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IReflPresenter.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IReflPresenter.h @@ -64,7 +64,7 @@ namespace MantidQt ImportTableFlag, ExportTableFlag, PlotRowFlag, - PlotGroupFlag, + PlotGroupFlag }; //Tell the presenter something happened diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.h index c4c76a2f20c0..61187efc1176 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.h @@ -67,6 +67,7 @@ namespace CustomInterfaces void deleteSectionSelector(int index); void updateSectionSelector(int index, SectionSelector values); void displayError(const QString& message); + void help(); // -- End of IALCBaselineModellingView interface ------------------------------------------------- private slots: diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.ui index eefba920a9c7..cd4faa0b2f67 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.ui @@ -92,7 +92,20 @@ - + + + + + 25 + 25 + + + + ? + + + + Qt::Horizontal diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h index c7c9ea26d321..e7ae3ae6b3c7 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h @@ -70,6 +70,7 @@ namespace CustomInterfaces void setAvailablePeriods(const std::vector &periods); void setWaitingCursor(); void restoreCursor(); + void help(); // -- End of IALCDataLoadingView interface ----------------------------------------------------- diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui index 99c554af2ebb..41440428b1cb 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui @@ -435,6 +435,19 @@ + + + + + 25 + 25 + + + + ? + + + @@ -498,6 +511,7 @@ differential minTime maxTime + help load diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCPeakFittingView.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCPeakFittingView.h index 50bba6a0348f..4768632e3b77 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCPeakFittingView.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCPeakFittingView.h @@ -59,6 +59,7 @@ namespace CustomInterfaces void setParameter(const QString& funcIndex, const QString& paramName, double value); void setPeakPickerEnabled(bool enabled); void setPeakPicker(const IPeakFunction_const_sptr& peak); + void help(); // -- End of IALCPeakFitting interface --------------------------------------------------------- diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCPeakFittingView.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCPeakFittingView.ui index 3e078a57def0..6b78d095490f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCPeakFittingView.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCPeakFittingView.ui @@ -36,7 +36,20 @@ - + + + + + 25 + 25 + + + + ? + + + + Qt::Horizontal diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCBaselineModellingView.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCBaselineModellingView.h index b158aa6311b2..1c385f484602 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCBaselineModellingView.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCBaselineModellingView.h @@ -131,6 +131,9 @@ namespace CustomInterfaces */ virtual void displayError(const QString& message) = 0; + /// Links help button to wiki page + virtual void help() = 0; + signals: /// Fit requested void fitRequested(); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h index bf6bbc99ad8a..56a61e0bbc23 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h @@ -109,12 +109,16 @@ namespace CustomInterfaces /// Restore the original cursor virtual void restoreCursor() = 0; + /// Opens the Mantid Wiki web page + virtual void help() = 0; + signals: /// Request to load data void loadRequested(); /// User has selected the first run void firstRunSelected(); + }; } // namespace CustomInterfaces diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCPeakFittingView.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCPeakFittingView.h index 150bdc6850ff..34a4704f7358 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCPeakFittingView.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCPeakFittingView.h @@ -86,6 +86,9 @@ namespace CustomInterfaces /// @param peak :: A new peak to represent virtual void setPeakPicker(const IPeakFunction_const_sptr& peak) = 0; + /// Opens the Mantid Wiki web page + virtual void help() = 0; + signals: /// Request to perform peak fitting void fitRequested(); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/SANSRunWindow.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/SANSRunWindow.h index 5535d1f82c21..c8bf9318f1ba 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/SANSRunWindow.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/SANSRunWindow.h @@ -105,7 +105,7 @@ class SANSRunWindow : public MantidQt::API::UserSubWindow enum Tab { RUN_NUMBERS, REDUCTION_SETTINGS, GEOMETRY, MASKING, - LOGGING, ADD_RUNS, DIAGNOSTICS, ONE_D_ANALYSIS, + LOGGING, ADD_RUNS, DIAGNOSTICS, ONE_D_ANALYSIS }; /// Initialize the layout diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/DataComparison.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/DataComparison.cpp index ef9f33f7c4f1..240476a99036 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/DataComparison.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/DataComparison.cpp @@ -17,7 +17,7 @@ namespace MantidQt { namespace CustomInterfaces { - DECLARE_SUBWINDOW(DataComparison); + DECLARE_SUBWINDOW(DataComparison) } } diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/DirectConvertToEnergy.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/DirectConvertToEnergy.cpp index 2220d18b31e6..bbb7e3d71242 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/DirectConvertToEnergy.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/DirectConvertToEnergy.cpp @@ -21,7 +21,7 @@ namespace MantidQt { namespace CustomInterfaces { - DECLARE_SUBWINDOW(DirectConvertToEnergy); + DECLARE_SUBWINDOW(DirectConvertToEnergy) } } diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectBayes.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectBayes.cpp index b1c8f32029d5..5b804a41d513 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectBayes.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectBayes.cpp @@ -14,7 +14,7 @@ namespace MantidQt { namespace CustomInterfaces { - DECLARE_SUBWINDOW(IndirectBayes); + DECLARE_SUBWINDOW(IndirectBayes) } } diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp index 98c151995772..c74a02eaf835 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp @@ -28,7 +28,7 @@ namespace CustomInterfaces namespace IDA { // Add this class to the list of specialised dialogs in this namespace - DECLARE_SUBWINDOW(IndirectDataAnalysis); + DECLARE_SUBWINDOW(IndirectDataAnalysis) /** * Constructor. diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp index f167fa71ea6e..3bc7f982fb87 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReduction.cpp @@ -29,7 +29,7 @@ namespace MantidQt { namespace CustomInterfaces { - DECLARE_SUBWINDOW(IndirectDataReduction); + DECLARE_SUBWINDOW(IndirectDataReduction) } } diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiffractionReduction.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiffractionReduction.cpp index ec4de290209d..9516a1d50162 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiffractionReduction.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDiffractionReduction.cpp @@ -33,7 +33,7 @@ namespace // anon } } // anon namespace -DECLARE_SUBWINDOW(IndirectDiffractionReduction); +DECLARE_SUBWINDOW(IndirectDiffractionReduction) using namespace Mantid::API; using namespace MantidQt::CustomInterfaces; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp index d0e38f7b34a0..79454dfac030 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp @@ -14,7 +14,7 @@ namespace MantidQt { namespace CustomInterfaces { - DECLARE_SUBWINDOW(IndirectSimulation); + DECLARE_SUBWINDOW(IndirectSimulation) } } diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTools.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTools.cpp index f1f20f03fe2e..12d5730862cb 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTools.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTools.cpp @@ -13,7 +13,7 @@ namespace MantidQt { namespace CustomInterfaces { - DECLARE_SUBWINDOW(IndirectTools); + DECLARE_SUBWINDOW(IndirectTools) } } diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/MantidEV.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/MantidEV.cpp index 12e730113c93..39964eda49a6 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/MantidEV.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/MantidEV.cpp @@ -16,7 +16,7 @@ namespace CustomInterfaces { //Register the class with the factory -DECLARE_SUBWINDOW(MantidEV); +DECLARE_SUBWINDOW(MantidEV) using namespace Mantid::Kernel; using namespace Mantid::API; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/MultiDatasetFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/MultiDatasetFit.cpp index d2f78f8aea27..096dd495cc22 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/MultiDatasetFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/MultiDatasetFit.cpp @@ -701,7 +701,7 @@ void EditLocalParameterDialog::valueChanged(int row, int col) /*==========================================================================================*/ //Register the class with the factory -DECLARE_SUBWINDOW(MultiDatasetFit); +DECLARE_SUBWINDOW(MultiDatasetFit) /** * Constructor diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCBaselineModellingView.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCBaselineModellingView.cpp index 4c285e12dfc9..136de6465559 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCBaselineModellingView.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCBaselineModellingView.cpp @@ -3,6 +3,7 @@ #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/AlgorithmManager.h" +#include "MantidQtAPI/HelpWindow.h" #include @@ -63,6 +64,8 @@ namespace CustomInterfaces connect(m_ui.sections, SIGNAL(cellChanged(int,int)), SIGNAL(sectionRowModified(int))); connect(m_selectorModifiedMapper, SIGNAL(mapped(int)), SIGNAL(sectionSelectorModified(int))); + + connect(m_ui.help, SIGNAL(clicked()), this, SLOT(help())); } QString ALCBaselineModellingView::function() const @@ -201,5 +204,9 @@ namespace CustomInterfaces selector->setMaximum(values.second); } + void ALCBaselineModellingView::help() { + MantidQt::API::HelpWindow::showCustomInterface(NULL, QString("Muon_ALC")); + } + } // namespace CustomInterfaces } // namespace MantidQt diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp index 5f47cc637933..1c10a0abf0a1 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp @@ -1,5 +1,7 @@ #include "MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h" +#include "MantidQtAPI/HelpWindow.h" + #include #include @@ -18,6 +20,8 @@ namespace CustomInterfaces connect(m_ui.load, SIGNAL(clicked()), SIGNAL(loadRequested())); connect(m_ui.firstRun, SIGNAL(fileFindingFinished()), SIGNAL(firstRunSelected())); + connect(m_ui.help, SIGNAL(clicked()), this, SLOT(help())); + m_ui.dataPlot->setCanvasBackground(Qt::white); m_ui.dataPlot->setAxisFont(QwtPlot::xBottom, m_widget->font()); m_ui.dataPlot->setAxisFont(QwtPlot::yLeft, m_widget->font()); @@ -159,6 +163,11 @@ namespace CustomInterfaces } } + void ALCDataLoadingView::help() + { + MantidQt::API::HelpWindow::showCustomInterface(NULL, QString("Muon_ALC")); + } + void ALCDataLoadingView::setWaitingCursor() { QApplication::setOverrideCursor(Qt::WaitCursor); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp index cfcce6e7aaef..4de693e73db6 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp @@ -15,7 +15,7 @@ namespace MantidQt { namespace CustomInterfaces { - DECLARE_SUBWINDOW(ALCInterface); + DECLARE_SUBWINDOW(ALCInterface) const QStringList ALCInterface::STEP_NAMES = QStringList() << "Data loading" << "Baseline modelling" << "Peak fitting"; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCPeakFittingView.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCPeakFittingView.cpp index 99c3f9ca4815..d8183fe40bf2 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCPeakFittingView.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/ALCPeakFittingView.cpp @@ -1,5 +1,7 @@ #include "MantidQtCustomInterfaces/Muon/ALCPeakFittingView.h" +#include "MantidQtAPI/HelpWindow.h" + #include namespace MantidQt @@ -54,6 +56,8 @@ void ALCPeakFittingView::initialize() connect(m_ui.peaks, SIGNAL(currentFunctionChanged()), SIGNAL(currentFunctionChanged())); connect(m_ui.peaks, SIGNAL(parameterChanged(QString,QString)), SIGNAL(parameterChanged(QString,QString))); + + connect(m_ui.help, SIGNAL(clicked()), this, SLOT(help())); } void ALCPeakFittingView::setDataCurve(const QwtData& data) @@ -100,6 +104,11 @@ void ALCPeakFittingView::setPeakPicker(const IPeakFunction_const_sptr& peak) m_ui.plot->replot(); } +void ALCPeakFittingView::help() +{ + MantidQt::API::HelpWindow::showCustomInterface(NULL, QString("Muon_ALC")); +} + } // namespace CustomInterfaces } // namespace Mantid diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/MuonAnalysis.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/MuonAnalysis.cpp index 2721c6525869..cb0ee68ee1a4 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/MuonAnalysis.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Muon/MuonAnalysis.cpp @@ -63,7 +63,7 @@ namespace MantidQt { namespace CustomInterfaces { - DECLARE_SUBWINDOW(MuonAnalysis); + DECLARE_SUBWINDOW(MuonAnalysis) using namespace Mantid::API; using namespace Mantid::Kernel; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/QtReflMainView.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/QtReflMainView.cpp index 7882684398a5..11776a19d352 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/QtReflMainView.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/QtReflMainView.cpp @@ -14,7 +14,7 @@ namespace MantidQt { using namespace Mantid::API; - DECLARE_SUBWINDOW(QtReflMainView); + DECLARE_SUBWINDOW(QtReflMainView) //---------------------------------------------------------------------------------------------- /** Constructor diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp index 1767acd57efd..c1be652ce189 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp @@ -59,7 +59,7 @@ namespace MantidQt { namespace CustomInterfaces { - DECLARE_SUBWINDOW(SANSRunWindow); + DECLARE_SUBWINDOW(SANSRunWindow) using namespace MantidQt::MantidWidgets; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/SampleTransmission.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/SampleTransmission.cpp index c44be8a5c1cd..6a95f432c7da 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/SampleTransmission.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/SampleTransmission.cpp @@ -19,7 +19,7 @@ namespace MantidQt { namespace CustomInterfaces { - DECLARE_SUBWINDOW(SampleTransmission); + DECLARE_SUBWINDOW(SampleTransmission) } } diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/StepScan.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/StepScan.cpp index 1281594d11f4..9b5df3cf3c27 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/StepScan.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/StepScan.cpp @@ -21,7 +21,7 @@ namespace CustomInterfaces { //Register the class with the factory -DECLARE_SUBWINDOW(StepScan); +DECLARE_SUBWINDOW(StepScan) using namespace Mantid::Kernel; using namespace Mantid::API; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/test/ALCBaselineModellingPresenterTest.h b/Code/Mantid/MantidQt/CustomInterfaces/test/ALCBaselineModellingPresenterTest.h index 85159616f13a..f597c130acc0 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/test/ALCBaselineModellingPresenterTest.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/test/ALCBaselineModellingPresenterTest.h @@ -49,6 +49,8 @@ class MockALCBaselineModellingView : public IALCBaselineModellingView MOCK_METHOD3(updateSectionSelector, void(size_t, double, double)); MOCK_METHOD1(displayError, void(const QString&)); + + MOCK_METHOD0(help, void()); }; class MockALCBaselineModellingModel : public IALCBaselineModellingModel @@ -338,6 +340,12 @@ class ALCBaselineModellingPresenterTest : public CxxTest::TestSuite m_view->requestFit(); } + + void test_helpPage () + { + EXPECT_CALL(*m_view, help()).Times(1); + m_view->help(); + } }; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h b/Code/Mantid/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h index 35b772c9c4bb..850d5812542e 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h @@ -50,6 +50,7 @@ class MockALCDataLoadingView : public IALCDataLoadingView MOCK_METHOD1(setAvailablePeriods, void(const std::vector&)); MOCK_METHOD0(setWaitingCursor, void()); MOCK_METHOD0(restoreCursor, void()); + MOCK_METHOD0(help, void()); void requestLoading() { emit loadRequested(); } void selectFirstRun() { emit firstRunSelected(); } @@ -260,6 +261,12 @@ class ALCDataLoadingPresenterTest : public CxxTest::TestSuite QwtDataY(2, 0.038717, 1E-6)))); m_view->requestLoading(); } + + void test_helpPage () + { + EXPECT_CALL(*m_view, help()).Times(1); + m_view->help(); + } }; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/test/ALCPeakFittingPresenterTest.h b/Code/Mantid/MantidQt/CustomInterfaces/test/ALCPeakFittingPresenterTest.h index 192811e0ab15..36b8851b2caf 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/test/ALCPeakFittingPresenterTest.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/test/ALCPeakFittingPresenterTest.h @@ -50,6 +50,7 @@ class MockALCPeakFittingView : public IALCPeakFittingView MOCK_METHOD1(setPeakPicker, void(const IPeakFunction_const_sptr&)); MOCK_METHOD1(setFunction, void(const IFunction_const_sptr&)); MOCK_METHOD3(setParameter, void(const QString&, const QString&, double)); + MOCK_METHOD0(help, void()); }; class MockALCPeakFittingModel : public IALCPeakFittingModel @@ -258,6 +259,12 @@ class ALCPeakFittingPresenterTest : public CxxTest::TestSuite m_view->changeParameter(QString("f1"), QString("A0")); } + + void test_helpPage () + { + EXPECT_CALL(*m_view, help()).Times(1); + m_view->help(); + } }; diff --git a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/MessageDisplay.h b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/MessageDisplay.h index 5b5a1393bcb9..11d940adb38f 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/MessageDisplay.h +++ b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/MessageDisplay.h @@ -41,7 +41,7 @@ namespace MantidQt class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS MessageDisplay : public QWidget { Q_OBJECT - Q_PROPERTY(QString source READ source WRITE setSource); + Q_PROPERTY(QString source READ source WRITE setSource) public: /// Controls whether the display is allowed to set the log levels @@ -106,7 +106,7 @@ namespace MantidQt void setGlobalLogLevel(int priority); private: - Q_DISABLE_COPY(MessageDisplay); + Q_DISABLE_COPY(MessageDisplay) /// Setup the actions void initActions(); /// Initialize the text formats diff --git a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/ScriptEditor.h b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/ScriptEditor.h index db4b9699f40a..357f91374e03 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/ScriptEditor.h +++ b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/ScriptEditor.h @@ -81,7 +81,7 @@ struct EXPORT_OPT_MANTIDQT_MANTIDWIDGETS CommandHistory class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS ScriptEditor : public QsciScintilla { // Qt macro - Q_OBJECT; + Q_OBJECT public: /** diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/PreviewPlot.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/PreviewPlot.cpp index 88b8e682820e..2d239741f84d 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/src/PreviewPlot.cpp +++ b/Code/Mantid/MantidQt/MantidWidgets/src/PreviewPlot.cpp @@ -5,7 +5,6 @@ #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/AlgorithmManager.h" -#include "MantidQtAPI/QwtWorkspaceSpectrumData.h" #include #include @@ -17,6 +16,8 @@ #include #include +#include +#include #include using namespace MantidQt::MantidWidgets; @@ -25,6 +26,7 @@ using namespace Mantid::API; namespace { Mantid::Kernel::Logger g_log("PreviewPlot"); + bool isNegative(double v) { return v <= 0.0; } } @@ -328,9 +330,10 @@ bool PreviewPlot::hasCurve(const QString & curveName) /** - * Attaches a RangeSelector to the plot and stores it. + * Creates a RangeSelector, adds it to the plot and stores it. * * @param rsName Name of range selector + * @param type Type of range selector to add * @return RangeSelector object */ RangeSelector * PreviewPlot::addRangeSelector(const QString & rsName, @@ -595,11 +598,31 @@ QwtPlotCurve * PreviewPlot::addCurve(MatrixWorkspace_sptr ws, const size_t specI ws = convertXAlg->getProperty("OutputWorkspace"); } - // Create the plot data - QwtWorkspaceSpectrumData wsData(*ws, static_cast(specIndex), false, false); + std::vector wsDataY = ws->readY(specIndex); + + // If using log scale need to remove all negative Y values + bool logYScale = getAxisType(QwtPlot::yLeft) == "Logarithmic"; + if(logYScale) + { + // Remove negative data in order to search for minimum positive value + std::vector validData(wsDataY.size()); + auto it = std::remove_copy_if(wsDataY.begin(), wsDataY.end(), validData.begin(), isNegative); + validData.resize(std::distance(validData.begin(), it)); + + // Get minimum positive value + double minY = *std::min_element(validData.begin(), validData.end()); + + // Set all negative values to minimum positive value + std::replace_if(wsDataY.begin(), wsDataY.end(), isNegative, minY); + } + + // Create the Qwt data + QwtArray dataX = QVector::fromStdVector(ws->readX(specIndex)); + QwtArray dataY = QVector::fromStdVector(wsDataY); + QwtArrayData wsData(dataX, dataY); // Create the new curve - QwtPlotCurve *curve = new QwtPlotCurve(); + QwtPlotCurve * curve = new QwtPlotCurve(); curve->setData(wsData); curve->setPen(curveColour); curve->attach(m_uiForm.plot); diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/SlicingAlgorithmDialog.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/SlicingAlgorithmDialog.cpp index e6d8d87c6c1c..61a4e257246b 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/src/SlicingAlgorithmDialog.cpp +++ b/Code/Mantid/MantidQt/MantidWidgets/src/SlicingAlgorithmDialog.cpp @@ -16,8 +16,8 @@ namespace MantidQt { namespace MantidWidgets { - DECLARE_DIALOG(SliceMDDialog); - DECLARE_DIALOG(BinMDDialog); + DECLARE_DIALOG(SliceMDDialog) + DECLARE_DIALOG(BinMDDialog) /** Constructor diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/pqHelpWindow.cxx b/Code/Mantid/MantidQt/MantidWidgets/src/pqHelpWindow.cxx index d1254e69fec2..82bb4d84743c 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/src/pqHelpWindow.cxx +++ b/Code/Mantid/MantidQt/MantidWidgets/src/pqHelpWindow.cxx @@ -170,7 +170,7 @@ class pqHelpWindow::pqNetworkAccessManager : public QNetworkAccessManager } private: - Q_DISABLE_COPY(pqNetworkAccessManager); + Q_DISABLE_COPY(pqNetworkAccessManager) }; // **************************************************************************** diff --git a/Code/Mantid/MantidQt/Python/CMakeLists.txt b/Code/Mantid/MantidQt/Python/CMakeLists.txt index 0624231af29b..92a7f22f8f99 100644 --- a/Code/Mantid/MantidQt/Python/CMakeLists.txt +++ b/Code/Mantid/MantidQt/Python/CMakeLists.txt @@ -49,7 +49,7 @@ add_custom_command ( OUTPUT ${SIP_SRC} ) # Needed for sip.h header that can end up in a different place to to the main Python include directory -include_directories ( ${SIP_INCLUDE_DIR} ) +include_directories ( SYSTEM ${SIP_INCLUDE_DIR} ) # Needed for sip generated files to find includes in src include_directories ( ${CMAKE_CURRENT_SOURCE_DIR} ) diff --git a/Code/Mantid/MantidQt/Python/mantidqt.sip b/Code/Mantid/MantidQt/Python/mantidqt.sip index a4f514df9c8a..89b157802ef4 100644 --- a/Code/Mantid/MantidQt/Python/mantidqt.sip +++ b/Code/Mantid/MantidQt/Python/mantidqt.sip @@ -10,6 +10,12 @@ // Define the module name. This has to match the library filename %Module mantidqtpython +%UnitCode + #if defined(__GNUC__) && !(defined(__INTEL_COMPILER)) + #pragma GCC system_header + #endif +%End + /******************************** SIP Imports ****************/ %Import QtCore/QtCoremod.sip %Import QtGui/QtGuimod.sip diff --git a/Code/Mantid/MantidQt/Python/sip_mantidqt.cpp.in b/Code/Mantid/MantidQt/Python/sip_mantidqt.cpp.in index 6e64f1e2b3da..c72a0a422afc 100644 --- a/Code/Mantid/MantidQt/Python/sip_mantidqt.cpp.in +++ b/Code/Mantid/MantidQt/Python/sip_mantidqt.cpp.in @@ -1,13 +1,7 @@ -//------------------------------------------------------------------------------ -// A wrapper for the auto-generated sip*.cpp files to disable warnings -// that we can't control -//------------------------------------------------------------------------------ -#if defined(__GNUC__) && !(defined(__INTEL_COMPILER)) - #pragma GCC diagnostic ignored "-Wuninitialized" - #pragma GCC diagnostic ignored "-Wconversion" - #pragma GCC diagnostic ignored "-Wunused-variable" - #pragma GCC diagnostic ignored "-Wparentheses" - #pragma GCC diagnostic ignored "-Wcast-qual" -#endif - +//-------------------------------------------------------------------------------------- +// A wrapper for the auto-generated sipmantidqtpythonpart?.cpp files to disable warnings +// that we can't control. The warnings are actually suppressed in qti.sip +// with '#pragma GCC system_header' but that pragma only works if it occurs +// in a file that has been included with '#include' +//------------------------------------------------------------------------------------- #include "sipmantidqtpythonpart0.cpp" diff --git a/Code/Mantid/MantidQt/SliceViewer/inc/MantidQtSliceViewer/PeakOverlayViewFactorySelector.h b/Code/Mantid/MantidQt/SliceViewer/inc/MantidQtSliceViewer/PeakOverlayViewFactorySelector.h index bdd50ce73d42..e4b413e2f8a9 100644 --- a/Code/Mantid/MantidQt/SliceViewer/inc/MantidQtSliceViewer/PeakOverlayViewFactorySelector.h +++ b/Code/Mantid/MantidQt/SliceViewer/inc/MantidQtSliceViewer/PeakOverlayViewFactorySelector.h @@ -21,7 +21,7 @@ namespace MantidQt private: typedef std::set PeakOverlayViewFactorySet; PeakOverlayViewFactorySet m_candidates; - DISABLE_COPY_AND_ASSIGN(PeakOverlayViewFactorySelector); + DISABLE_COPY_AND_ASSIGN(PeakOverlayViewFactorySelector) public: PeakOverlayViewFactorySelector(); ~PeakOverlayViewFactorySelector(); diff --git a/Code/Mantid/Testing/Data/DocTest/PawleySilicon.nxs.md5 b/Code/Mantid/Testing/Data/DocTest/PawleySilicon.nxs.md5 new file mode 100644 index 000000000000..dfb0fc386fc0 --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/PawleySilicon.nxs.md5 @@ -0,0 +1 @@ +f814c587c2dbe2df89b153f1ad95d4f6 diff --git a/Code/Mantid/Testing/Data/DocTest/irs26176_graphite002_cyl_Abs.nxs.md5 b/Code/Mantid/Testing/Data/DocTest/irs26176_graphite002_cyl_Abs.nxs.md5 new file mode 100644 index 000000000000..98a9172ca63d --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/irs26176_graphite002_cyl_Abs.nxs.md5 @@ -0,0 +1 @@ +f4b31e993d1747f22074cd17365cf0eb \ No newline at end of file diff --git a/Code/Mantid/Testing/Data/UnitTest/irs26176_graphite002_cyl_Abs.nxs.md5 b/Code/Mantid/Testing/Data/UnitTest/irs26176_graphite002_cyl_Abs.nxs.md5 new file mode 100644 index 000000000000..98a9172ca63d --- /dev/null +++ b/Code/Mantid/Testing/Data/UnitTest/irs26176_graphite002_cyl_Abs.nxs.md5 @@ -0,0 +1 @@ +f4b31e993d1747f22074cd17365cf0eb \ No newline at end of file diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/CodeConventions.py b/Code/Mantid/Testing/SystemTests/tests/analysis/CodeConventions.py index ceb618874de1..b87cc677be76 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/CodeConventions.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/CodeConventions.py @@ -53,7 +53,9 @@ "f0_Xoffset", "f0_Yoffset", "f0_Zoffset", "f0_Xrot", "f0_Yrot", "f0_Zrot", "l0", "t0"), - "StretchedExpFT":("height", "tau", "beta") + "StretchedExpFT":("height", "tau", "beta"), + "PawleyParameterFunction":("a","b","c"), + "PawleyFunction":("f0.a","f0.b","f0.c", "f0.Alpha", "f0.Beta", "f0.Gamma", "f0.ZeroShift"), } class Algorithms(stresstesting.MantidStressTest): diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_LETReduction.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_LETReduction.py index 0a423dadcdc9..29f0d2b372a0 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_LETReduction.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_LETReduction.py @@ -238,7 +238,7 @@ def custom_name(prop_man): # Uncomment this to use custom filename function # Note: the properties are stored in prop_man class accessed as # below. - #return custom_name(self.reducer.prop_man) + #return lambda : custom_name(self.reducer.prop_man) # use this method to use standard file name generating function return None diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MAPS_DGSReduction.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MAPS_DGSReduction.py index 33f32227f94e..3f93c239ea87 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MAPS_DGSReduction.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MAPS_DGSReduction.py @@ -90,7 +90,7 @@ def custom_name(prop_man): # Uncomment this to use custom filename function # Note: the properties are stored in prop_man class accessed as # below. - #return custom_name(self.reducer.prop_man) + #return lambda : custom_name(self.reducer.prop_man) # use this method to use standard file name generating function return None diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MariReduction.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MariReduction.py index e3611b6e2112..0cd60bad6ddf 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MariReduction.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MariReduction.py @@ -73,13 +73,13 @@ def custom_name(prop_man): # sample run is more then just list of runs, so we use # the formalization below to access its methods run_num = PropertyManager.sample_run.run_number() - name = "RUN{0}atEi{1:<4.1f}meV_One2One".format(run_num ,ei) + name = "RUN{0}atEi{1:<3.2f}meV_One2One".format(run_num ,ei) return name # Uncomment this to use custom filename function # Note: the properties are stored in prop_man class accessed as # below. - #return custom_name(self.reducer.prop_man) + #return lambda : custom_name(self.reducer.prop_man) # use this method to use standard file name generating function return None diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/PeaksFilter/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/PeaksFilter/CMakeLists.txt index c2820075f5b9..a9f5477cb67e 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/PeaksFilter/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/PeaksFilter/CMakeLists.txt @@ -1,5 +1,5 @@ PROJECT(PeaksFilter) - +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) ADD_PARAVIEW_PLUGIN(MantidParaViewPeaksFilterSMPlugin "1.0" SERVER_MANAGER_XML PeaksFilter.xml SERVER_MANAGER_SOURCES vtkPeaksFilter.cxx diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/PeaksFilter/vtkPeaksFilter.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/PeaksFilter/vtkPeaksFilter.cxx index fdf20fa28303..27c35049f11b 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/PeaksFilter/vtkPeaksFilter.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/PeaksFilter/vtkPeaksFilter.cxx @@ -17,7 +17,7 @@ #include #include -vtkStandardNewMacro(vtkPeaksFilter); +vtkStandardNewMacro(vtkPeaksFilter) using namespace Mantid::VATES; diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/CMakeLists.txt index 451c01cae863..056b2b05e3ab 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/CMakeLists.txt @@ -1,5 +1,5 @@ PROJECT(ScaleWorkspace) - +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) ADD_PARAVIEW_PLUGIN(MantidParaViewScaleWorkspaceSMPlugin "1.0" SERVER_MANAGER_XML ScaleWorkspace.xml SERVER_MANAGER_SOURCES vtkScaleWorkspace.cxx diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/vtkScaleWorkspace.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/vtkScaleWorkspace.cxx index a9eef434d14e..e9b15021d609 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/vtkScaleWorkspace.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/vtkScaleWorkspace.cxx @@ -11,7 +11,7 @@ #include #include -vtkStandardNewMacro(vtkScaleWorkspace); +vtkStandardNewMacro(vtkScaleWorkspace) using namespace Mantid::VATES; diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/SplatterPlot/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/SplatterPlot/CMakeLists.txt index d6beddcd88c7..3d3208936b16 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/SplatterPlot/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/SplatterPlot/CMakeLists.txt @@ -1,5 +1,5 @@ PROJECT(SplatterPlot) - +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) ADD_PARAVIEW_PLUGIN(MantidParaViewSplatterPlotSMPlugin "1.0" SERVER_MANAGER_XML SplatterPlot.xml SERVER_MANAGER_SOURCES vtkSplatterPlot.cxx diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/SplatterPlot/vtkSplatterPlot.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/SplatterPlot/vtkSplatterPlot.cxx index b2266585c532..7a60a3852bef 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/SplatterPlot/vtkSplatterPlot.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/SplatterPlot/vtkSplatterPlot.cxx @@ -20,7 +20,7 @@ using namespace Mantid::API; using namespace Mantid::VATES; -vtkStandardNewMacro(vtkSplatterPlot); +vtkStandardNewMacro(vtkSplatterPlot) /// Constructor vtkSplatterPlot::vtkSplatterPlot() : m_numberPoints(0), m_topPercentile(0.0), diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/EventNexusReader/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/EventNexusReader/CMakeLists.txt index 798b29582c9b..5537e38b6206 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/EventNexusReader/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/EventNexusReader/CMakeLists.txt @@ -1,5 +1,5 @@ project( MantidParaViewEventNexusReader ) - +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) add_paraview_plugin( MantidParaViewEventNexusReaderSMPlugin "1.0" SERVER_MANAGER_XML EventNexusReader.xml SERVER_MANAGER_SOURCES vtkEventNexusReader.cxx diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/EventNexusReader/vtkEventNexusReader.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/EventNexusReader/vtkEventNexusReader.cxx index db709eb1240a..6edd4d02dad2 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/EventNexusReader/vtkEventNexusReader.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/EventNexusReader/vtkEventNexusReader.cxx @@ -18,7 +18,7 @@ #include "MantidVatesAPI/FilteringUpdateProgressAction.h" #include "MantidVatesAPI/MDLoadingViewAdapter.h" -vtkStandardNewMacro(vtkEventNexusReader); +vtkStandardNewMacro(vtkEventNexusReader) using namespace Mantid::VATES; using Mantid::Geometry::IMDDimension_sptr; diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDEWNexusReader/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDEWNexusReader/CMakeLists.txt index aa1f3a57ed9c..c7b74fc70f15 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDEWNexusReader/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDEWNexusReader/CMakeLists.txt @@ -1,5 +1,5 @@ project( MantidParaViewMDEWNexusReader ) - +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) add_paraview_plugin( MantidParaViewMDEWNexusReaderSMPlugin "1.0" SERVER_MANAGER_XML MDEWNexusReader.xml SERVER_MANAGER_SOURCES vtkMDEWNexusReader.cxx diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDEWNexusReader/vtkMDEWNexusReader.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDEWNexusReader/vtkMDEWNexusReader.cxx index 6cd9ab74d996..880b277761c1 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDEWNexusReader/vtkMDEWNexusReader.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDEWNexusReader/vtkMDEWNexusReader.cxx @@ -21,7 +21,7 @@ #include -vtkStandardNewMacro(vtkMDEWNexusReader); +vtkStandardNewMacro(vtkMDEWNexusReader) using namespace Mantid::VATES; using Mantid::Geometry::IMDDimension_sptr; diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDHWNexusReader/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDHWNexusReader/CMakeLists.txt index 6ad4b9ff3c82..5607de2b63ea 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDHWNexusReader/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDHWNexusReader/CMakeLists.txt @@ -1,5 +1,5 @@ project( MantidParaViewMDHWNexusReader ) - +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) add_paraview_plugin( MantidParaViewMDHWNexusReaderSMPlugin "1.0" SERVER_MANAGER_XML MDHWNexusReader.xml SERVER_MANAGER_SOURCES vtkMDHWNexusReader.cxx diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDHWNexusReader/vtkMDHWNexusReader.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDHWNexusReader/vtkMDHWNexusReader.cxx index 95f90f535cc8..834965eb2c5c 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDHWNexusReader/vtkMDHWNexusReader.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/MDHWNexusReader/vtkMDHWNexusReader.cxx @@ -19,7 +19,7 @@ #include "MantidVatesAPI/FilteringUpdateProgressAction.h" #include "MantidVatesAPI/MDLoadingViewAdapter.h" -vtkStandardNewMacro(vtkMDHWNexusReader); +vtkStandardNewMacro(vtkMDHWNexusReader) using namespace Mantid::VATES; using Mantid::Geometry::IMDDimension_sptr; diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/NexusPeaksReader/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/NexusPeaksReader/CMakeLists.txt index 685637a59d6a..9a1c7182a763 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/NexusPeaksReader/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/NexusPeaksReader/CMakeLists.txt @@ -1,5 +1,5 @@ project( MantidParaViewNexusPeaksReader ) - +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) add_paraview_plugin( MantidParaViewNexusPeaksReaderSMPlugin "1.0" SERVER_MANAGER_XML NexusPeaksReader.xml SERVER_MANAGER_SOURCES vtkNexusPeaksReader.cxx diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/NexusPeaksReader/vtkNexusPeaksReader.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/NexusPeaksReader/vtkNexusPeaksReader.cxx index d04f458bb6ed..7e228505d086 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/NexusPeaksReader/vtkNexusPeaksReader.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/NexusPeaksReader/vtkNexusPeaksReader.cxx @@ -23,7 +23,7 @@ #include #include -vtkStandardNewMacro(vtkNexusPeaksReader); +vtkStandardNewMacro(vtkNexusPeaksReader) using namespace Mantid::VATES; using Mantid::Geometry::IMDDimension_sptr; diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/CMakeLists.txt index 0944ba066267..3b2407ae8055 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/CMakeLists.txt @@ -1,5 +1,5 @@ project( MantidParaViewPeaksReader ) - +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) add_paraview_plugin( MantidParaViewPeaksReaderSMPlugin "1.0" SERVER_MANAGER_XML PeaksReader.xml SERVER_MANAGER_SOURCES vtkPeaksReader.cxx diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/vtkPeaksReader.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/vtkPeaksReader.cxx index a63fce33d42a..70a227c7af43 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/vtkPeaksReader.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/PeaksReader/vtkPeaksReader.cxx @@ -22,7 +22,7 @@ #include -vtkStandardNewMacro(vtkPeaksReader); +vtkStandardNewMacro(vtkPeaksReader) using namespace Mantid::VATES; using Mantid::Geometry::IMDDimension_sptr; diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/SQWEventReader/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/SQWEventReader/CMakeLists.txt index eace77b7a09b..d8d8525c52cf 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/SQWEventReader/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/SQWEventReader/CMakeLists.txt @@ -1,5 +1,5 @@ project( MantidParaViewSQWEventReader ) - +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) add_paraview_plugin( MantidParaViewSQWEventReaderSMPlugin "1.0" SERVER_MANAGER_XML SQWEventReader.xml SERVER_MANAGER_SOURCES vtkSQWEventReader.cxx diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/SQWEventReader/vtkSQWEventReader.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/SQWEventReader/vtkSQWEventReader.cxx index d964c50c2d61..ef61e72c3cc6 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/SQWEventReader/vtkSQWEventReader.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/SQWEventReader/vtkSQWEventReader.cxx @@ -19,7 +19,7 @@ #include "MantidVatesAPI/FilteringUpdateProgressAction.h" #include "MantidVatesAPI/MDLoadingViewAdapter.h" -vtkStandardNewMacro(vtkSQWEventReader); +vtkStandardNewMacro(vtkSQWEventReader) using namespace Mantid::VATES; using Mantid::Geometry::IMDDimension_sptr; diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/SQWReader/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/SQWReader/CMakeLists.txt index cf5dd9ef299f..f06150575442 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/SQWReader/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewReaders/SQWReader/CMakeLists.txt @@ -1,5 +1,5 @@ project( MantidParaViewSQWReader ) - +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) add_paraview_plugin( MantidParaViewSQWReaderSMPlugin "1.0" SERVER_MANAGER_XML SQWReader.xml SERVER_MANAGER_SOURCES vtkSQWReader.cxx diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDEWSource/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDEWSource/CMakeLists.txt index 1719a68e0bd6..a40f403de2a1 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDEWSource/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDEWSource/CMakeLists.txt @@ -1,5 +1,5 @@ PROJECT(MantidParaViewMDEWSource) - +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) ADD_PARAVIEW_PLUGIN(MantidParaViewMDEWSourceSMPlugin "1.0" SERVER_MANAGER_XML MDEWSource.xml SERVER_MANAGER_SOURCES vtkMDEWSource.cxx) diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDEWSource/vtkMDEWSource.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDEWSource/vtkMDEWSource.cxx index 12fc54a626e1..196dd73e69c8 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDEWSource/vtkMDEWSource.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDEWSource/vtkMDEWSource.cxx @@ -19,7 +19,7 @@ using namespace Mantid::VATES; -vtkStandardNewMacro(vtkMDEWSource); +vtkStandardNewMacro(vtkMDEWSource) /// Constructor vtkMDEWSource::vtkMDEWSource() : m_wsName(""), m_depth(1000), m_time(0), m_presenter(NULL), m_isStartup(true), m_startupTimeValue(0) diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDHWSource/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDHWSource/CMakeLists.txt index d65a9066e679..e3fa0dd9580e 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDHWSource/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDHWSource/CMakeLists.txt @@ -1,5 +1,5 @@ PROJECT(MantidParaViewMDHWSource) - +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) ADD_PARAVIEW_PLUGIN(MantidParaViewMDHWSourceSMPlugin "1.0" SERVER_MANAGER_XML MDHWSource.xml SERVER_MANAGER_SOURCES vtkMDHWSource.cxx) diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDHWSource/vtkMDHWSource.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDHWSource/vtkMDHWSource.cxx index 26ed4e7eba59..e2757e29cacb 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDHWSource/vtkMDHWSource.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/MDHWSource/vtkMDHWSource.cxx @@ -19,7 +19,7 @@ using namespace Mantid::VATES; -vtkStandardNewMacro(vtkMDHWSource); +vtkStandardNewMacro(vtkMDHWSource) /// Constructor vtkMDHWSource::vtkMDHWSource() : m_wsName(""), m_time(0), m_presenter(NULL) diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/CMakeLists.txt index bbf6ca293523..188fe0c7fafd 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/CMakeLists.txt @@ -1,5 +1,5 @@ PROJECT(MantidParaViewPeaksSource) - +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) ADD_PARAVIEW_PLUGIN(MantidParaViewPeaksSourceSMPlugin "1.0" SERVER_MANAGER_XML PeaksSource.xml SERVER_MANAGER_SOURCES vtkPeaksSource.cxx) diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/vtkPeaksSource.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/vtkPeaksSource.cxx index 6709e928e1f7..e3ff1ab962be 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/vtkPeaksSource.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/PeaksSource/vtkPeaksSource.cxx @@ -16,7 +16,7 @@ #include "MantidAPI/AnalysisDataService.h" -vtkStandardNewMacro(vtkPeaksSource); +vtkStandardNewMacro(vtkPeaksSource) using namespace Mantid::VATES; using Mantid::Geometry::IMDDimension_sptr; diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/SinglePeakMarkerSource/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/SinglePeakMarkerSource/CMakeLists.txt index f846a0c12d52..b713178fd46d 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/SinglePeakMarkerSource/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/SinglePeakMarkerSource/CMakeLists.txt @@ -1,5 +1,5 @@ PROJECT(MantidParaViewSinglePeakMarkerSource) - +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) ADD_PARAVIEW_PLUGIN(MantidParaViewSinglePeakMarkerSourceSMPlugin "1.0" SERVER_MANAGER_XML SinglePeakMarkerSource.xml SERVER_MANAGER_SOURCES vtkSinglePeakMarkerSource.cxx) diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/SinglePeakMarkerSource/vtkSinglePeakMarkerSource.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/SinglePeakMarkerSource/vtkSinglePeakMarkerSource.cxx index e8da4f13ecdc..d607310440f8 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/SinglePeakMarkerSource/vtkSinglePeakMarkerSource.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewSources/SinglePeakMarkerSource/vtkSinglePeakMarkerSource.cxx @@ -6,7 +6,7 @@ #include "MantidVatesAPI/vtkSinglePeakMarker.h" -vtkStandardNewMacro(vtkSinglePeakMarkerSource); +vtkStandardNewMacro(vtkSinglePeakMarkerSource) using namespace Mantid::VATES; diff --git a/Code/Mantid/Vates/VatesAPI/src/LoadVTK.cpp b/Code/Mantid/Vates/VatesAPI/src/LoadVTK.cpp index 29c450db97fe..4bc43553b977 100644 --- a/Code/Mantid/Vates/VatesAPI/src/LoadVTK.cpp +++ b/Code/Mantid/Vates/VatesAPI/src/LoadVTK.cpp @@ -66,7 +66,7 @@ namespace Mantid { namespace VATES { - DECLARE_FILELOADER_ALGORITHM(LoadVTK); + DECLARE_FILELOADER_ALGORITHM(LoadVTK) /** * Return the confidence with with this algorithm can load the file diff --git a/Code/Mantid/Vates/VatesSimpleGui/StandAloneExec/CMakeLists.txt b/Code/Mantid/Vates/VatesSimpleGui/StandAloneExec/CMakeLists.txt index f2af04d6f4fd..bcb80bf44f18 100644 --- a/Code/Mantid/Vates/VatesSimpleGui/StandAloneExec/CMakeLists.txt +++ b/Code/Mantid/Vates/VatesSimpleGui/StandAloneExec/CMakeLists.txt @@ -38,6 +38,8 @@ set( TEST_SUITES add_executable( ${PROJECT_NAME} ${INCLUDE_FILES} ${SOURCE_FILES} ${MOC_SRCS} ) +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) + target_link_libraries( ${PROJECT_NAME} pqCore pqComponents pqApplicationComponents ${QT_LIBRARIES} diff --git a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt index 278a8015e40d..98fb3b2fe584 100644 --- a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt +++ b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt @@ -122,11 +122,14 @@ set_target_properties( VatesSimpleGuiViewWidgets PROPERTIES OUTPUT_NAME MantidVa # Add to the 'VatesSimpleGui' group in VS set_property( TARGET VatesSimpleGuiViewWidgets PROPERTY FOLDER MantidVatesSimpleGui ) + +include_directories( SYSTEM ${PARAVIEW_INCLUDE_DIRS} ) + target_link_libraries( VatesSimpleGuiViewWidgets -VatesSimpleGuiQtWidgets pqApplicationComponents pqComponents ${QT_LIBRARIES} +VatesSimpleGuiQtWidgets MantidQtAPI VatesAPI ${MANTID_SUBPROJECT_LIBS} diff --git a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/AutoScaleRangeGenerator.cpp b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/AutoScaleRangeGenerator.cpp index b82e74ce8f4d..8bb04709ace7 100644 --- a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/AutoScaleRangeGenerator.cpp +++ b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/AutoScaleRangeGenerator.cpp @@ -39,7 +39,7 @@ namespace SimpleGui { //Set the initial log scale state due to the mode m_mdSettings.setLastSessionLogScale(getLogScale()); - }; + } /** * Gets the log scale for the mode diff --git a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/BackgroundRgbProvider.cpp b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/BackgroundRgbProvider.cpp index 7cba3778ed2e..59b0757a0176 100644 --- a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/BackgroundRgbProvider.cpp +++ b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/BackgroundRgbProvider.cpp @@ -29,13 +29,13 @@ namespace Mantid BackgroundRgbProvider::BackgroundRgbProvider() { - }; + } BackgroundRgbProvider::~BackgroundRgbProvider() { // Need to record the background color update(); - }; + } std::vector BackgroundRgbProvider::getRgb(bool viewSwitched) { diff --git a/Code/Mantid/docs/source/algorithms/ApplyPaalmanPingsCorrection-v1.rst b/Code/Mantid/docs/source/algorithms/ApplyPaalmanPingsCorrection-v1.rst new file mode 100644 index 000000000000..40af9ecafb8f --- /dev/null +++ b/Code/Mantid/docs/source/algorithms/ApplyPaalmanPingsCorrection-v1.rst @@ -0,0 +1,76 @@ +.. algorithm:: + +.. summary:: + +.. alias:: + +.. properties:: + +Description +----------- + +Applies absorption corrections calculated in the Paalman & Pings absorption +factor format: :math:`A_{s,s}` (correction factor for scattering and absorption +in sample), :math:`A_{s,sc}` (scattering in sample and absorption in sample and +container), :math:`A_{c,sc}` (scattering in container and absorption in sample +and container) and :math:`A_{c,c}` (scattering and absorption in container). + +This algorithm can be used to apply absorption corrections calculated with +either the :ref:`algm-CylinderPaalmanPingsCorrection` and +:ref:`algm-FlatPlatePaalmanPingsCorrection` algorithms as well as the legacy +indirect calculate correcteions routine, providing that the sample and container +are first converted to wavelength and the corrections are interpolated to match +the sample as demonstrated in the example below. + +Usage +----- + +**Example: using with legacy indirect corrections data** + +.. testcode:: exSampleAndCanIRISLegacyCorrections + + # Load the sample and can + sample_ws = Load('irs26176_graphite002_red.nxs') + can_ws = Load('irs26173_graphite002_red.nxs') + + # Convert sample and container workspaces to wavelength + sample_ws = ConvertUnits(InputWorkspace=sample_ws, + Target='Wavelength', + EMode='Indirect', + EFixed=1.845) + can_ws = ConvertUnits(InputWorkspace=can_ws, + Target='Wavelength', + EMode='Indirect', + EFixed=1.845) + + # Load the corrections workspace + corrections_ws = Load('irs26176_graphite002_cyl_Abs.nxs') + + # Interpolate each of the correction factor workspaces to match the + # binning of the smaple + # Required to use corrections from the old indirect calculate + # corrections routines + for factor_ws in corrections_ws: + SplineInterpolation(WorkspaceToMatch=sample_ws, + WorkspaceToInterpolate=factor_ws, + OutputWorkspace=factor_ws, + OutputWorkspaceDeriv='') + + corr = ApplyPaalmanPingsCorrection(SampleWorkspace=sample_ws, + CorrectionsWorkspace=corrections_ws, + CanWorkspace=can_ws) + + print 'Corrected workspace has %d spectra over %d bins' % ( + corr.getNumberHistograms(), corr.blocksize()) + + print 'Type of correction applied: %s' % ( + corr.getRun()['corrections_type'].value) + +Output: + +.. testoutput:: exSampleAndCanIRISLegacyCorrections + + Corrected workspace has 10 spectra over 1905 bins + Type of correction applied: sample_and_can_corrections + +.. categories:: diff --git a/Code/Mantid/docs/source/algorithms/IndirectTransmissionMonitor-v1.rst b/Code/Mantid/docs/source/algorithms/IndirectTransmissionMonitor-v1.rst index cce60aab898a..59f76e941979 100644 --- a/Code/Mantid/docs/source/algorithms/IndirectTransmissionMonitor-v1.rst +++ b/Code/Mantid/docs/source/algorithms/IndirectTransmissionMonitor-v1.rst @@ -26,8 +26,8 @@ Usage .. testcode:: exIRISTransmission - sample_ws = Load('IRS26176.raw') - can_ws = Load('IRS26173.raw') + sample_ws = Load('IRS26176.RAW') + can_ws = Load('IRS26173.RAW') transmission_ws = IndirectTransmissionMonitor(SampleWorkspace=sample_ws, CanWorkspace=can_ws) diff --git a/Code/Mantid/docs/source/algorithms/PawleyFit-v1.rst b/Code/Mantid/docs/source/algorithms/PawleyFit-v1.rst new file mode 100644 index 000000000000..3e59022cd040 --- /dev/null +++ b/Code/Mantid/docs/source/algorithms/PawleyFit-v1.rst @@ -0,0 +1,101 @@ +.. algorithm:: + +.. summary:: + +.. alias:: + +.. properties:: + +Description +----------- + +The algorithm performs a fit of lattice parameters using the principle approach described in a paper by Pawley [Pawley]_. In this approach the reflection positions are calculated from lattice parameters and the reflection's Miller indices (:math:`hkl`), while the other profile parameters for each peak are freely refined. + +PawleyFit requires a MatrixWorkspace with at least one spectrum in terms of either :math:`d` or :math:`Q`, the index of the spectrum can be supplied to the algorithm as a parameter. Furthermore, the range which is used for refinement can be changed by setting the corresponding properties. + +In addition, a TableWorkspace with information about the reflections that are found in the spectrum must be passed as well. There must be four columns with the captions "HKL", "d", "FWHM (rel.)" and "Intensity". The HKL column can be supplied either as V3D or as a string with 3 numbers separated by space, comma or semi-colon and possibly surrounded by square brackets. One way to obtain such a table is to use three algorithms that are used in analysis of POLDI data, which produce tables in a suitable format. Details are given in the usage example section. + +Along with the workspaces containing fit results and parameter values, the algorithm also outputs the reduced :math:`\chi^2`-value, which is also written in the log. + +Usage +----- + +.. include:: ../usagedata-note.txt + +For the usage example there is a calculated, theoretical diffraction pattern (including a bit of noise) for Silicon, which crystallizes in space group :math:`Fd\overline{3}m` and has a cubic cell with lattice parameter :math:`a=5.4311946\,\mathrm{\AA{}}`. + +.. testcode:: ExPawleySilicon + + import numpy as np + + # Load spectrum for Silicon in the d-range down to 0.7 + si_spectrum = Load("PawleySilicon.nxs") + + # In order to index the peaks later on, generate reflection for Si + Si = PoldiCreatePeaksFromCell(SpaceGroup='F d -3 m', + Atoms='Si 0 0 0 1.0 0.05', + a=5.43, LatticeSpacingMin=0.7) + + print "Silicon has", Si.rowCount(), "unique reflections with d > 0.7." + + # Find peaks in the spectrum + si_peaks = PoldiPeakSearch(si_spectrum) + + # Index the peaks, will generate a workspace named 'Indexed_Si' + indexed = PoldiIndexKnownCompounds(si_peaks, CompoundWorkspaces='Si') + + si_peaks_indexed = AnalysisDataService.retrieve('Indexed_Si') + + # 3 peaks have two possibilities for indexing, because their d-values are identical + print "The number of peaks that were indexed:", si_peaks_indexed.rowCount() + + # Run the actual fit with lattice parameters that are slightly off + si_fitted, si_cell, si_params, chi_square = PawleyFit(si_spectrum, + CrystalSystem='Cubic', + InitialCell='5.436 5.436 5.436', + PeakTable=si_peaks_indexed) + + si_cell = AnalysisDataService.retrieve("si_cell") + + a = np.round(si_cell.cell(0, 1), 6) + a_err = np.round(si_cell.cell(0, 2), 6) + a_diff = np.round(np.fabs(a - 5.4311946), 6) + + print "The lattice parameter was refined to a =", a, "+/-", a_err + print "The deviation from the actual parameter (a=5.4311946) is:", a_diff + print "This difference corresponds to", np.round(a_diff / a_err, 2), "standard deviations." + print "The reduced chi square of the fit is:", np.round(chi_square, 3) + +Running this script will generate a bit of output about the results of the different steps. At the end the lattice parameter differs less than one standard deviation from the actual value. + +.. testoutput:: ExPawleySilicon + + Silicon has 18 unique reflections with d > 0.7. + The number of peaks that were indexed: 15 + The lattice parameter was refined to a = 5.431205 +/- 1.6e-05 + The deviation from the actual parameter (a=5.4311946) is: 1e-05 + This difference corresponds to 0.63 standard deviations. + The reduced chi square of the fit is: 1.04 + +.. testcleanup:: ExPawleySilicon + + AnalysisDataService.remove("si_spectrum") + AnalysisDataService.remove("Si") + AnalysisDataService.remove("si_peaks") + AnalysisDataService.remove("indexed") + AnalysisDataService.remove("si_fitted") + AnalysisDataService.remove("si_cell") + AnalysisDataService.remove("si_params") + +It's important to check the output data, which is found in the workspace labeled si_fitted. Plotting it should show that the residuals are just containing background noise and no systematic deviations. Of course, depending on the sample and the measurement this will differ between cases. + +.. figure:: /images/PawleyFitResultTheoreticalSilicon.png + :figwidth: 15 cm + :align: center + :alt: Result of the Pawley fit example with silicon. + + Result of the Pawley fit example with silicon. + +.. [Pawley] Pawley, G. S. “Unit-Cell Refinement from Powder Diffraction Scans.”, J. Appl. Crystallogr. 14, 1981, 357. doi:10.1107/S0021889881009618. + +.. categories:: diff --git a/Code/Mantid/docs/source/fitfunctions/PawleyFunction.rst b/Code/Mantid/docs/source/fitfunctions/PawleyFunction.rst new file mode 100644 index 000000000000..f4b633306023 --- /dev/null +++ b/Code/Mantid/docs/source/fitfunctions/PawleyFunction.rst @@ -0,0 +1,20 @@ +.. _func-PawleyFunction: + +============== +PawleyFunction +============== + +.. index:: PawleyFunction + +Description +----------- + +The basic principle of fitting unit cell parameters to a complete powder diffraction pattern has been described by Pawley. Instead allowing each peak to have a freely selectable position, these positions are calculated as a result from the unit cell parameters. All other parameters of the peaks are refined independently. The implementation of the function differs from the method described in the paper in some points, for example the number of parameters can not change during the refinement (no reflections will be added or removed). + +Since the function requires special setup (assignment of HKLs, selection of crystal system and profile function), there is an algorithm that can perform a Pawley-type fit with different input data. Please see the documentation of :ref:`algm-PawleyFit` for details on how to use it. + +.. attributes:: + +.. properties:: + +.. categories:: diff --git a/Code/Mantid/docs/source/images/PawleyFitResultTheoreticalSilicon.png b/Code/Mantid/docs/source/images/PawleyFitResultTheoreticalSilicon.png new file mode 100644 index 000000000000..ce92ee4e37be Binary files /dev/null and b/Code/Mantid/docs/source/images/PawleyFitResultTheoreticalSilicon.png differ diff --git a/Code/Mantid/docs/source/interfaces/Muon_ALC.rst b/Code/Mantid/docs/source/interfaces/Muon_ALC.rst new file mode 100644 index 000000000000..44496c7921e2 --- /dev/null +++ b/Code/Mantid/docs/source/interfaces/Muon_ALC.rst @@ -0,0 +1,124 @@ +Muon ALC +======== + +.. contents:: Table of Contents + :local: + +Overview +-------- + +The Muon ALC interface, which is short for Avoided Level Crossing, aims at +handling frequent analysis on e.g. HIFI. It uses simple point-and-click to +analyse a sequence of datasets collected with different parameter values, for +instance different magnetic fields, temperature, etc, and study how this +affects asymmetry. There are currently three steps in the analysis. + +Data Loading +------------ + +The Data Loading step, provides an interface for the +:ref:`PlotAsymmetryByLogValue ` algorithm, +in which a sequence of runs are loaded through the fields +*First* and *Last*. All datasets with run number between these limits will be +loaded, and an error message will be shown if any of them is missing. The +user must supply the log data that will be used as X parameter from the list +of available log values. + +.. interface:: ALC + :widget: dataLoadingView + :align: center + :width: 800 + +Options +~~~~~~~ + +First + First run of the sequence of datasets. + +Last + Last run of the sequence of datasets. + +Log + Log value to use as X parameter + +Dead Time Correction + Type of dead time corrections to apply. Options are *None*, in which case no + corrections will be applied, *From Data File*, to load corrections from + the input dataset itself, or *From Custom File*, to load corrections from a + specified nexus file. + +Grouping + Detector grouping to apply. *Auto* will load the grouping information contained + in the run file, while *Custom* allows to specify the list of spectra for both the + forward and backward groups. + +Periods + Period number to use as red data. The *Subtract* option, if checked, allows to + select the green period number that will be subtracted to the red data. + +Calculation + Type of calculation, *Integral* or *Differential*, together with the time limits. + +? + Shows this help page. + +Load + Computes the asymmetry according to selected options and displays it against the + chosen log value. + +Baseline Modelling +------------------ + +In the Baseline Modelling step, the user can fit the baseline by selecting which +sections of the data should be used in the fit, and what the baseline fit +function should be. To select a baseline function, right-click on the *Function* +region, then *Add function* and choose among the different possibilities. Then +pick the desired fitting sections. + +.. interface:: ALC + :widget: baselineModellingView + :align: center + :width: 400 + +Options +~~~~~~~ + +Function + Right-click on the blank area to add a baseline function. + +Sections + Right-click on the blank area to add as many sections as needed to + select the ranges to fit. + +? + Shows this help page. + +Fit + Fits the data. + +Peak Fitting +------------ + +In the Peak Fitting step, data with the baseline subtracted are shown in +the right panel. The user can study the peaks of interest all with the same simple +interface. To add a new peak, right-click on the Peaks region, then select +*Add function* and choose among the different possibilities in the category Peak. + +.. interface:: ALC + :widget: peakFittingView + :align: center + :width: 600 + +Options +~~~~~~~ + +Peaks + Right-click on the blank area to add a peak function. + +? + Shows this help page. + +Fit + Fits the data. + +.. categories:: Interfaces Muon diff --git a/Code/Mantid/instrument/REF_L_Parameters.xml b/Code/Mantid/instrument/REF_L_Parameters.xml index 5330d332c4f8..3cf57dceaa45 100644 --- a/Code/Mantid/instrument/REF_L_Parameters.xml +++ b/Code/Mantid/instrument/REF_L_Parameters.xml @@ -1,17 +1,17 @@ - + - - - - - - - - - - - + + + + + + + + + + + diff --git a/Code/Mantid/instrument/REF_L_Parameters_after_10102014.xml b/Code/Mantid/instrument/REF_L_Parameters_after_10102014.xml new file mode 100644 index 000000000000..b6884401adb4 --- /dev/null +++ b/Code/Mantid/instrument/REF_L_Parameters_after_10102014.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py b/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py index 8d841b685955..6ef761fff556 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py +++ b/Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py @@ -204,8 +204,8 @@ def diagnose(self, white,diag_sample=None,**kwargs): # data file. SNS or 1 to 1 maps may probably avoid this # stuff and can load masks directly white_data = white.get_ws_clone('white_ws_clone') - - diag_mask = LoadMask(Instrument=self.instr_name,InputFile=self.hard_mask_file,\ + idf_file = api.ExperimentInfo.getInstrumentFilename(self.instr_name) + diag_mask = LoadMask(Instrument=idf_file,InputFile=self.hard_mask_file,\ OutputWorkspace='hard_mask_ws') MaskDetectors(Workspace=white_data, MaskedWorkspace=diag_mask) white.add_masked_ws(white_data) @@ -366,7 +366,7 @@ def convert_to_energy(self,wb_run=None,sample_run=None,ei_guess=None,rebin=None, masks_done = False if not prop_man.run_diagnostics: header = "*** Diagnostics including hard masking is skipped " - masks_done = Treu + masks_done = True #if Reducer.save_and_reuse_masks : # SAVE AND REUSE MASKS if self.spectra_masks: @@ -383,7 +383,7 @@ def convert_to_energy(self,wb_run=None,sample_run=None,ei_guess=None,rebin=None, masking = self.spectra_masks # estimate and report the number of failing detectors - nMaskedSpectra = get_failed_spectra_list_from_masks(masking) + nMaskedSpectra = get_failed_spectra_list_from_masks(masking,prop_man) if masking: nSpectra = masking.getNumberHistograms() else: @@ -492,8 +492,6 @@ def convert_to_energy(self,wb_run=None,sample_run=None,ei_guess=None,rebin=None, #prop_man.wb_run = None # clear combined mask self.spectra_masks = None - if 'masking' in mtd: - DeleteWorkspace(masking) return result def _do_abs_corrections(self,deltaE_ws_sample,cashed_mono_int,ei_guess,\ @@ -982,18 +980,37 @@ def prop_man(self,value): ######### @property def spectra_masks(self): - """ The property keeps a workspace with masks, stored for further usage """ + """ The property keeps a workspace with masks workspace name, + stored for further usage""" # check if spectra masks is defined if hasattr(self,'_spectra_masks'): - return self._spectra_masks + if not self._spectra_masks is None and self._spectra_masks in mtd: + return mtd[self._spectra_masks] + else: + self._spectra_masks = None + return None else: return None @spectra_masks.setter def spectra_masks(self,value): """ set up spectra masks """ - self._spectra_masks = value + if value is None: + if hasattr(self,'_spectra_masks') and not self._spectra_masks is None: + if self._spectra_masks in mtd: + DeleteWorkspace(self._spectra_masks) + self._spectra_masks=None + elif isinstance(value,api.Workspace): + self._spectra_masks = value.name() + elif isinstance(value,str): + if value in mtd: + self._spectra_masks = value + else: + self._spectra_masks = None + else: + self._spectra_masks = None + return #------------------------------------------------------------------------------- def apply_absolute_normalization(self,sample_ws,monovan_run=None,ei_guess=None,wb_mono=None,abs_norm_factor_is=None): """ Function applies absolute normalization factor to the target workspace @@ -1515,7 +1532,7 @@ def _build_white_tag(self): white_tag = 'NormBy:{0}_IntergatedIn:{1:0>10.2f}:{2:0>10.2f}'.format(self.normalise_method,low,upp) return white_tag -def get_failed_spectra_list_from_masks(masked_wksp): +def get_failed_spectra_list_from_masks(masked_wksp,prop_man): """Compile a list of spectra numbers that are marked as masked in the masking workspace @@ -1526,6 +1543,11 @@ def get_failed_spectra_list_from_masks(masked_wksp): failed_spectra = [] if masked_wksp is None: return (failed_spectra,0) + try: + name = masked_wksp.name() + except Exeption as ex: + prop_man.log("***WARNING: cached mask workspace invalidated. Incorrect masking reported") + return (failed_spectra,0) masking_wksp,sp_list = ExtractMask(masked_wksp) DeleteWorkspace(masking_wksp) diff --git a/Code/Mantid/scripts/Inelastic/Direct/NonIDF_Properties.py b/Code/Mantid/scripts/Inelastic/Direct/NonIDF_Properties.py index 31916d02a2ab..8dcc95516524 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/NonIDF_Properties.py +++ b/Code/Mantid/scripts/Inelastic/Direct/NonIDF_Properties.py @@ -36,7 +36,6 @@ def __init__(self,Instrument,run_workspace=None): object.__setattr__(self,'_log_to_mantid',False) object.__setattr__(self,'_current_log_level',3) - object.__setattr__(self,'_save_file_name',None) self._set_instrument_and_facility(Instrument,run_workspace) diff --git a/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py b/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py index 6087fdad365d..fbf3397571c7 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py +++ b/Code/Mantid/scripts/Inelastic/Direct/PropertiesDescriptors.py @@ -316,7 +316,7 @@ def __get__(self,instance,owner=None): if instance is None: return self if not self._custom_print is None: - return self._custom_print(instance,owner) + return self._custom_print() if self._file_name: return self._file_name diff --git a/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py b/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py index 0612ae94e297..7e567c8e95e7 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py +++ b/Code/Mantid/scripts/Inelastic/Direct/RunDescriptor.py @@ -1023,19 +1023,31 @@ def copy_spectrum2monitors(data_ws,mon_ws,spectraID): # x_param = mon_ws.readX(0) - bins = [x_param[0],x_param[1] - x_param[0],x_param[-1]] + homo_binning,dx_min=RunDescriptor._is_binning_homogeneous(x_param) + bins = [x_param[0],dx_min,x_param[-1]] ExtractSingleSpectrum(InputWorkspace=data_ws,OutputWorkspace='tmp_mon',WorkspaceIndex=ws_index) Rebin(InputWorkspace='tmp_mon',OutputWorkspace='tmp_mon',Params=bins,PreserveEvents='0') - # should be vice versa but Conjoin invalidate ws pointers and hopefully - # nothing could happen with workspace during conjoining - #AddSampleLog(Workspace=monWS,LogName=done_log_name,LogText=str(ws_index),LogType='Number') mon_ws_name = mon_ws.getName() - ConjoinWorkspaces(InputWorkspace1=mon_ws,InputWorkspace2='tmp_mon') + if not homo_binning: + Rebin(InputWorkspace=mon_ws_name,OutputWorkspace=mon_ws_name,Params=bins,PreserveEvents='0') + ConjoinWorkspaces(InputWorkspace1=mon_ws_name,InputWorkspace2='tmp_mon') mon_ws = mtd[mon_ws_name] if 'tmp_mon' in mtd: DeleteWorkspace(WorkspaceName='tmp_mon') return mon_ws + # + @staticmethod + def _is_binning_homogeneous(x_param): + """Verify if binning in monitor workspace is homogeneous""" + dx=x_param[1:]-x_param[0:-1] + dx_min=min(dx) + dx_max=max(dx) + if dx_max-dx_min>1.e-9: + return False,dx_min + else: + return True,dx_min + #-------------------------------------------------------------------------------------------------------------------- def clear_monitors(self): """ method removes monitor workspace form analysis data service if it is there diff --git a/Code/Mantid/scripts/test/DirectEnergyConversionTest.py b/Code/Mantid/scripts/test/DirectEnergyConversionTest.py index 0b295c6293fb..e5f988c366f5 100644 --- a/Code/Mantid/scripts/test/DirectEnergyConversionTest.py +++ b/Code/Mantid/scripts/test/DirectEnergyConversionTest.py @@ -314,30 +314,35 @@ def test_tof_range(self): red.prop_man.incident_energy = 67 red.prop_man.energy_bins = [-20,0.2,65] - red.prop_man.multirep_tof_specta_list = [5,5] + red.prop_man.multirep_tof_specta_list = [4,5,6] + MoveInstrumentComponent(Workspace='run', ComponentName='Detector', DetectorID=1102, Z=3) + MoveInstrumentComponent(Workspace='run', ComponentName='Detector', DetectorID=1103,Z=6) + tof_range = red.find_tof_range_for_multirep(run) self.assertEqual(len(tof_range),3) run_tof = ConvertUnits(run,Target='TOF',EMode='Direct',EFixed=67.) - x = run_tof.readX(4) + x = run_tof.readX(3) dx=abs(x[1:]-x[:-1]) xMin = min(x) - xMax = max(x) dt = min(dx) + x = run_tof.readX(5) + xMax = max(x) + self.assertAlmostEqual(tof_range[0],xMin) self.assertAlmostEqual(tof_range[1],dt) self.assertAlmostEqual(tof_range[2],xMax) # check another working mode - red.prop_man.multirep_tof_specta_list = 5 + red.prop_man.multirep_tof_specta_list = 4 tof_range1 = red.find_tof_range_for_multirep(run) self.assertAlmostEqual(tof_range[0],tof_range1[0]) self.assertAlmostEqual(tof_range[1],tof_range1[1]) - self.assertAlmostEqual(tof_range[2],tof_range1[2]) + #self.assertAlmostEqual(tof_range[2],tof_range1[2]) def test_multirep_mode(self): # create test workspace @@ -352,6 +357,9 @@ def test_multirep_mode(self): run = CreateSampleWorkspace( Function='Multiple Peaks',WorkspaceType='Event',NumBanks=8, BankPixelWidth=1,\ NumEvents=100000, XUnit='TOF',xMin=tMin,xMax=tMax) LoadInstrument(run,InstrumentName='MARI') + MoveInstrumentComponent(Workspace='run', ComponentName='Detector', DetectorID=1102,Z=1) + # MoveInstrumentComponent(Workspace='run', ComponentName='Detector', DetectorID=1103,Z=4) + # MoveInstrumentComponent(Workspace='run', ComponentName='Detector', DetectorID=1104,Z=5) # do second run2 = CloneWorkspace(run) @@ -365,6 +373,7 @@ def test_multirep_mode(self): tReducer.hard_mask_file=None tReducer.map_file=None tReducer.save_format=None + tReducer.multirep_tof_specta_list = [4,5] result = tReducer.convert_to_energy(wb_ws,run,[67.,122.],[-2,0.02,0.8]) @@ -431,6 +440,7 @@ def test_multirep_abs_units_mode(self): tReducer.prop_man.normalise_method='monitor-1' tReducer.norm_mon_integration_range=[tMin,tMax] + result = tReducer.convert_to_energy(wb_ws,run,[67.,122.],[-2,0.02,0.8],None,mono) self.assertEqual(len(result),2) diff --git a/Code/Mantid/scripts/test/DirectPropertyManagerTest.py b/Code/Mantid/scripts/test/DirectPropertyManagerTest.py index 344df3a9d670..3cde32203d62 100644 --- a/Code/Mantid/scripts/test/DirectPropertyManagerTest.py +++ b/Code/Mantid/scripts/test/DirectPropertyManagerTest.py @@ -1088,14 +1088,14 @@ def test_custom_print(self): propman.sample_run = 1000 propman.incident_energy = 20. - def custom_print(propman,PropertyManager): + def custom_print(propman): ei = propman.incident_energy run_n = PropertyManager.sample_run.run_number() name = "RUN{0}atEi{1:<4.1f}meV_One2One".format(run_n,ei) return name - PropertyManager.save_file_name.set_custom_print(custom_print) + PropertyManager.save_file_name.set_custom_print(lambda : custom_print(self.prop_man)) self.assertEqual(propman.save_file_name,'RUN1000atEi20.0meV_One2One') diff --git a/Code/Mantid/scripts/test/ReductionWrapperTest.py b/Code/Mantid/scripts/test/ReductionWrapperTest.py index 83f558655efa..f037da458dd5 100644 --- a/Code/Mantid/scripts/test/ReductionWrapperTest.py +++ b/Code/Mantid/scripts/test/ReductionWrapperTest.py @@ -4,13 +4,47 @@ from mantid.simpleapi import * from mantid import api,config -from Direct.ReductionWrapper import ReductionWrapper +from Direct.ReductionWrapper import * import MariReduction as mr # import unittest +class test_helper(ReductionWrapper): + def __init__(self,web_var=None): + """ sets properties defaults for the instrument with Name""" + ReductionWrapper.__init__(self,'MAR',web_var) + + def set_custom_output_filename(self): + """define custom name of output files if standard one is not satisfactory + In addition to that, example of accessing reduction properties + Changing them if necessary + """ + def custom_name(prop_man): + """ sample function which builds filename from + incident energy and run number and adds some auxiliary information + to it. + """ + + # Note -- properties have the same names as the list of advanced and + # main properties + ei = PropertyManager.incident_energy.get_current() + # sample run is more then just list of runs, so we use + # the formalization below to access its methods + run_num = prop_man.sample_run + name = "SOMETHING{0}_{1:<3.2f}meV_rings".format(run_num ,ei) + return name + + # Uncomment this to use custom filename function + # Note: the properties are stored in prop_man class accessed as + # below. + return lambda: custom_name(self.reducer.prop_man) + # use this method to use standard file name generating function + #return None + @iliad + def reduce(self, input_file = None, output_directory = None): + return '' #----------------------------------------------------------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------------------------------------------------------- @@ -34,8 +68,6 @@ def test_default_fails(self): self.assertRaises(NotImplementedError,red.def_advanced_properties) self.assertTrue('reduce' in dir(red)) - - def test_export_advanced_values(self): red = mr.ReduceMARI() @@ -126,6 +158,22 @@ def test_validate_settings(self): self.assertEqual(level,1) self.assertEqual(len(errors),1) + def test_custom_print_name(self): + th=test_helper() + th.reducer.prop_man.sample_run = 100 + th.reducer.prop_man.incident_energy=[10.01,20] + + th.reduce() + + save_file = th.reducer.prop_man.save_file_name + self.assertEqual(save_file,'SOMETHING100_10.01meV_rings') + + th.reducer.prop_man.sample_run = 200 + PropertyManager.incident_energy.next() + save_file = th.reducer.prop_man.save_file_name + self.assertEqual(save_file,'SOMETHING200_20.00meV_rings') + + if __name__=="__main__": diff --git a/Code/Mantid/scripts/test/RunDescriptorTest.py b/Code/Mantid/scripts/test/RunDescriptorTest.py index 1515fbf1a040..1a8956188d83 100644 --- a/Code/Mantid/scripts/test/RunDescriptorTest.py +++ b/Code/Mantid/scripts/test/RunDescriptorTest.py @@ -155,6 +155,34 @@ def test_copy_spectra2monitors(self): self.assertEqual(mon_ws.getNumberHistograms(),3) self.assertEqual(mon_ws.getIndexFromSpectrumNumber(3),2) + def test_copy_spectra2monitors_heterogen(self): + propman = self.prop_man + run_ws = CreateSampleWorkspace( Function='Multiple Peaks', WorkspaceType = 'Event',NumBanks=1, BankPixelWidth=5, NumEvents=100) + run_ws_monitors = CreateSampleWorkspace( Function='Multiple Peaks', WorkspaceType = 'Histogram',NumBanks=2, BankPixelWidth=1, NumEvents=100) + + run_ws_monitors = Rebin(run_ws_monitors,Params='1,-0.01,20000') + x=run_ws_monitors.readX(0) + dx = x[1:]-x[:-1] + min_step0 = min(dx) + + propman.monovan_run = run_ws + propman.spectra_to_monitors_list = 3 + + mon_ws = PropertyManager.monovan_run.get_monitors_ws() + self.assertTrue(isinstance(mon_ws, api.Workspace)) + self.assertEqual(mon_ws.getNumberHistograms(),3) + self.assertEqual(mon_ws.getIndexFromSpectrumNumber(3),2) + + x=mon_ws.readX(0) + dx = x[1:]-x[:-1] + min_step1 = min(dx) + max_step1 = max(dx) + + self.assertAlmostEqual(min_step0,min_step1,5) + self.assertAlmostEqual(max_step1,min_step1,5) + + + def test_ws_name(self): run_ws = CreateSampleWorkspace( Function='Multiple Peaks', NumBanks=1, BankPixelWidth=4, NumEvents=100) propman = self.prop_man