diff --git a/Framework/API/inc/MantidAPI/IFunction1D.h b/Framework/API/inc/MantidAPI/IFunction1D.h index 61f9ea1d1b7bc85ad7f934af6978782dfa420740..f40d2b454d6d8e75e3f252fc11caffee8d9a4249 100644 --- a/Framework/API/inc/MantidAPI/IFunction1D.h +++ b/Framework/API/inc/MantidAPI/IFunction1D.h @@ -12,9 +12,10 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { class Fit; } - +} namespace API { //---------------------------------------------------------------------- @@ -88,7 +89,7 @@ protected: static Kernel::Logger g_log; /// Making a friend - friend class CurveFitting::Fit; + friend class CurveFitting::Algorithms::Fit; }; typedef boost::shared_ptr<IFunction1D> IFunction1D_sptr; diff --git a/Framework/API/inc/MantidAPI/ITransformScale.h b/Framework/API/inc/MantidAPI/ITransformScale.h index d13af449f046120f40869cb0f8d2208312c60088..18832392062ceba43c5749aed0ea7201681dfaab 100644 --- a/Framework/API/inc/MantidAPI/ITransformScale.h +++ b/Framework/API/inc/MantidAPI/ITransformScale.h @@ -8,6 +8,7 @@ #include <boost/shared_ptr.hpp> #endif +#include <string> #include <vector> #include "MantidAPI/DllConfig.h" diff --git a/Framework/API/src/AlgorithmFactory.cpp b/Framework/API/src/AlgorithmFactory.cpp index b208e36ca7348261cf51e35b625d0882debb3e21..c21455f254585879e0b78e04fc8916841c370a6a 100644 --- a/Framework/API/src/AlgorithmFactory.cpp +++ b/Framework/API/src/AlgorithmFactory.cpp @@ -1,7 +1,6 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include <iostream> #include <sstream> #include "MantidAPI/AlgorithmFactory.h" #include "MantidAPI/Algorithm.h" diff --git a/Framework/API/src/Axis.cpp b/Framework/API/src/Axis.cpp index 025e8fac19de6807b41c3ba71800e66e229f5275..6f8abc8a5af84d90791a8898728fc123952ebe21 100644 --- a/Framework/API/src/Axis.cpp +++ b/Framework/API/src/Axis.cpp @@ -5,8 +5,6 @@ #include "MantidKernel/Exception.h" #include "MantidKernel/UnitFactory.h" -#include <iostream> - namespace Mantid { namespace API { diff --git a/Framework/API/src/Column.cpp b/Framework/API/src/Column.cpp index 2611772b53561e078740201f67477f571b6de634..1be47194e896a6b7479bdb0d87ff0fdca4feb730 100644 --- a/Framework/API/src/Column.cpp +++ b/Framework/API/src/Column.cpp @@ -1,9 +1,10 @@ -#include "MantidAPI/Column.h" -#include "MantidKernel/Logger.h" #include <algorithm> #include <iostream> #include <stdexcept> +#include "MantidAPI/Column.h" +#include "MantidKernel/Logger.h" + namespace Mantid { namespace API { diff --git a/Framework/API/src/ColumnFactory.cpp b/Framework/API/src/ColumnFactory.cpp index 313dc12290c22ffccf517331d7ef977ee017078e..0ccf9d87644f9eae8158c54502a796b056126038 100644 --- a/Framework/API/src/ColumnFactory.cpp +++ b/Framework/API/src/ColumnFactory.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <sstream> #include "MantidAPI/ColumnFactory.h" #include "MantidAPI/Column.h" diff --git a/Framework/API/src/CompositeFunction.cpp b/Framework/API/src/CompositeFunction.cpp index 1f4481e9a01d8316695b22e86fb998f5bd6fbf79..cc2c652fffb579a8086f05f21de5f029e484dbf5 100644 --- a/Framework/API/src/CompositeFunction.cpp +++ b/Framework/API/src/CompositeFunction.cpp @@ -11,7 +11,6 @@ #include <boost/lexical_cast.hpp> #include <boost/shared_array.hpp> #include <sstream> -#include <iostream> #include <algorithm> namespace Mantid { diff --git a/Framework/API/src/CostFunctionFactory.cpp b/Framework/API/src/CostFunctionFactory.cpp index 4037501fa47806b583a605dc79316dba74ac59df..ea0e131e3a024925ddd078ceea612d507ba7759f 100644 --- a/Framework/API/src/CostFunctionFactory.cpp +++ b/Framework/API/src/CostFunctionFactory.cpp @@ -1,7 +1,6 @@ #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/ICostFunction.h" #include "MantidKernel/LibraryManager.h" -#include <iostream> namespace Mantid { namespace API { diff --git a/Framework/API/src/Expression.cpp b/Framework/API/src/Expression.cpp index 6343c71404475aeece8d891908fe62bacf0089a6..011dd6d1de37fb0187e93af12e4c6bdf8b95edc6 100644 --- a/Framework/API/src/Expression.cpp +++ b/Framework/API/src/Expression.cpp @@ -1,11 +1,11 @@ +#include <iostream> +#include <locale> +#include <sstream> + #include "MantidAPI/Expression.h" #include <Poco/StringTokenizer.h> -#include <sstream> -#include <iostream> -#include <locale> - namespace Mantid { namespace API { diff --git a/Framework/API/src/FileProperty.cpp b/Framework/API/src/FileProperty.cpp index 064edc4553be3c77255fa167f621d6a2ce83321f..c7baf7b1e2c0920184154db3e92d28a60526fe1a 100644 --- a/Framework/API/src/FileProperty.cpp +++ b/Framework/API/src/FileProperty.cpp @@ -13,7 +13,6 @@ #include <Poco/File.h> #include <cctype> #include <algorithm> -#include <iostream> namespace Mantid { diff --git a/Framework/API/src/FunctionDomain1D.cpp b/Framework/API/src/FunctionDomain1D.cpp index 30f8bf1d7d62a1e804ba52781e0bbfefd1f0ccb8..bf466655d6aa17cb8f04bfd4fc5b184b239dcfde 100644 --- a/Framework/API/src/FunctionDomain1D.cpp +++ b/Framework/API/src/FunctionDomain1D.cpp @@ -2,7 +2,6 @@ // Includes //---------------------------------------------------------------------- #include "MantidAPI/FunctionDomain1D.h" -#include <iostream> namespace Mantid { namespace API { diff --git a/Framework/API/src/FunctionValues.cpp b/Framework/API/src/FunctionValues.cpp index 0cc95afbdf7ef211be473d844fa13a78fe766e0d..ac8552df041cb1594354e36b4f3c567b1ef4d501 100644 --- a/Framework/API/src/FunctionValues.cpp +++ b/Framework/API/src/FunctionValues.cpp @@ -2,7 +2,6 @@ // Includes //---------------------------------------------------------------------- #include "MantidAPI/FunctionValues.h" -#include <iostream> #include <algorithm> namespace Mantid { diff --git a/Framework/API/src/GridDomain.cpp b/Framework/API/src/GridDomain.cpp index 05fafaaf9e6a04f27bfba49accdfaa3891c7f8f6..0d8ed05ee4bfc4e91790da93778e2813c2c82d58 100644 --- a/Framework/API/src/GridDomain.cpp +++ b/Framework/API/src/GridDomain.cpp @@ -1,7 +1,6 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include <iostream> #include <numeric> #include <stdexcept> diff --git a/Framework/API/src/GridDomain1D.cpp b/Framework/API/src/GridDomain1D.cpp index 3c9422233f79c4030a38360a040daddb41430bad..a85cf8693256fa8a2462cddaa866d4ede1f44a7c 100644 --- a/Framework/API/src/GridDomain1D.cpp +++ b/Framework/API/src/GridDomain1D.cpp @@ -1,7 +1,6 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include <iostream> #include <numeric> #include "MantidAPI/GridDomain1D.h" diff --git a/Framework/API/src/IFunction.cpp b/Framework/API/src/IFunction.cpp index 539b092f3158b652bdc4b3090d57174d106108d8..379ee94adba1b572e0e2f4da29316a1854c2431b 100644 --- a/Framework/API/src/IFunction.cpp +++ b/Framework/API/src/IFunction.cpp @@ -28,7 +28,6 @@ #include <limits> #include <sstream> -#include <iostream> #include <algorithm> namespace Mantid { diff --git a/Framework/API/src/IFunction1D.cpp b/Framework/API/src/IFunction1D.cpp index bbab2daccede26d7164e3695574b88a2b04a267b..17bf113464a603be78a63c4b8695f9ec361ade43 100644 --- a/Framework/API/src/IFunction1D.cpp +++ b/Framework/API/src/IFunction1D.cpp @@ -23,7 +23,6 @@ #include <boost/lexical_cast.hpp> #include <sstream> -#include <iostream> namespace Mantid { namespace API { diff --git a/Framework/API/src/IFunctionMD.cpp b/Framework/API/src/IFunctionMD.cpp index 83d2d3d433cbad0800754bac801948d0e8127376..6eaacaedfe19bf4119467d3484ee5c61e5c893b1 100644 --- a/Framework/API/src/IFunctionMD.cpp +++ b/Framework/API/src/IFunctionMD.cpp @@ -15,7 +15,6 @@ #include <boost/lambda/lambda.hpp> #include <sstream> -#include <iostream> #include <algorithm> #include <functional> #include <iterator> diff --git a/Framework/API/src/IFunctionMW.cpp b/Framework/API/src/IFunctionMW.cpp index a0c5793f76ac11db357a1182bf87982ed6b343fc..9797475d1d8a0b7a1e60d753a47c4bf2d02dc708 100644 --- a/Framework/API/src/IFunctionMW.cpp +++ b/Framework/API/src/IFunctionMW.cpp @@ -4,8 +4,6 @@ #include "MantidAPI/IFunctionMW.h" #include "MantidAPI/MatrixWorkspace.h" -#include <iostream> - namespace Mantid { namespace API { using namespace Geometry; diff --git a/Framework/API/src/LinearScale.cpp b/Framework/API/src/LinearScale.cpp index 4d11c0fb96276eec88ab36a6ab73b0f90e16cb8f..4c44e30a040b6730956a30d724482503e512dfd6 100644 --- a/Framework/API/src/LinearScale.cpp +++ b/Framework/API/src/LinearScale.cpp @@ -1,7 +1,6 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include <iostream> #include "MantidAPI/LinearScale.h" #include "MantidAPI/TransformScaleFactory.h" diff --git a/Framework/API/src/LogarithmScale.cpp b/Framework/API/src/LogarithmScale.cpp index 1e4abfdd83cf4cd95d0c3f74af6ea6d478c86380..a5eda36399eb32cacca6a4269fc0d435ae948e99 100644 --- a/Framework/API/src/LogarithmScale.cpp +++ b/Framework/API/src/LogarithmScale.cpp @@ -1,7 +1,6 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include <iostream> #include <cmath> #include <stdexcept> diff --git a/Framework/API/src/ParamFunction.cpp b/Framework/API/src/ParamFunction.cpp index 8d58067639d218b408ffc3d5b75e281c1e5d5054..2d43466f5d74e0bdace00ac4b65d87091bca9664 100644 --- a/Framework/API/src/ParamFunction.cpp +++ b/Framework/API/src/ParamFunction.cpp @@ -11,7 +11,6 @@ #include <boost/math/special_functions/fpclassify.hpp> #include <sstream> -#include <iostream> #include <limits> namespace Mantid { diff --git a/Framework/API/src/PeakFunctionIntegrator.cpp b/Framework/API/src/PeakFunctionIntegrator.cpp index b36896423ffc1f0df2c1a70f2e2409e0d0a2737f..c2dc90a12cb3c1c3e17d42997952a70db00505c8 100644 --- a/Framework/API/src/PeakFunctionIntegrator.cpp +++ b/Framework/API/src/PeakFunctionIntegrator.cpp @@ -2,7 +2,6 @@ #include "MantidAPI/FunctionDomain1D.h" #include "gsl/gsl_errno.h" -#include <iostream> #include <iomanip> namespace Mantid { diff --git a/Framework/API/src/SpectraAxis.cpp b/Framework/API/src/SpectraAxis.cpp index ebd17d4b814863a7c485aebd7bcd53028d615b96..43db4d278296bde473f968c07439ed419dac33ca 100644 --- a/Framework/API/src/SpectraAxis.cpp +++ b/Framework/API/src/SpectraAxis.cpp @@ -9,7 +9,6 @@ #include "MantidKernel/Unit.h" #include <boost/lexical_cast.hpp> -#include <iostream> namespace Mantid { namespace API { diff --git a/Framework/API/src/TempFunction.cpp b/Framework/API/src/TempFunction.cpp index 4f95ae8ecadf1d6e4c1bd9f6ac5ed4ca09487abf..2e7e30e8f059ed54c476c3826a4a56e933d63962 100644 --- a/Framework/API/src/TempFunction.cpp +++ b/Framework/API/src/TempFunction.cpp @@ -8,7 +8,6 @@ #include "MantidAPI/ParameterTie.h" #include <sstream> -#include <iostream> namespace Mantid { namespace API { diff --git a/Framework/API/test/AlgorithmPropertyTest.h b/Framework/API/test/AlgorithmPropertyTest.h index e4f151be0b90b3cb651f69ffbc927b4b132b67db..9d60a2b1cf91eac964a79c32e371cd85156dd2f9 100644 --- a/Framework/API/test/AlgorithmPropertyTest.h +++ b/Framework/API/test/AlgorithmPropertyTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAPI/AlgorithmProperty.h" #include "MantidAPI/AlgorithmHasProperty.h" diff --git a/Framework/API/test/AsynchronousTest.h b/Framework/API/test/AsynchronousTest.h index 07d419957def311b17ae628b22ec2ad9a22d7ed2..8fa819cea2aa758d9d33218629f3817e6b526f3c 100644 --- a/Framework/API/test/AsynchronousTest.h +++ b/Framework/API/test/AsynchronousTest.h @@ -7,7 +7,6 @@ #include <Poco/ActiveResult.h> #include <Poco/NObserver.h> #include <Poco/Thread.h> -#include <iostream> using namespace Mantid::Kernel; using namespace Mantid::API; diff --git a/Framework/API/test/CoordTransformTest.h b/Framework/API/test/CoordTransformTest.h index 7ce04f333e9bb5231b87e9a69f89d92b207acd5b..8f8e2fc42a00ae3712d8fcafdfcb4b517a42fb6f 100644 --- a/Framework/API/test/CoordTransformTest.h +++ b/Framework/API/test/CoordTransformTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/Timer.h" #include "MantidAPI/CoordTransform.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; diff --git a/Framework/API/test/DataProcessorAlgorithmTest.h b/Framework/API/test/DataProcessorAlgorithmTest.h index 804ca82f23e26c0b7ef4be0708aaa112229e0bb4..a3c689e8603c6571ba42fca3897c00ee1b8f06c0 100644 --- a/Framework/API/test/DataProcessorAlgorithmTest.h +++ b/Framework/API/test/DataProcessorAlgorithmTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAPI/DataProcessorAlgorithm.h" #include "MantidTestHelpers/FakeObjects.h" diff --git a/Framework/API/test/EnabledWhenWorkspaceIsTypeTest.h b/Framework/API/test/EnabledWhenWorkspaceIsTypeTest.h index 5df2c41eb7718f0b4c700be482d9d024717d71db..790b55da1cd11f1a09fb4686ce73669a113d2c23 100644 --- a/Framework/API/test/EnabledWhenWorkspaceIsTypeTest.h +++ b/Framework/API/test/EnabledWhenWorkspaceIsTypeTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAPI/EnabledWhenWorkspaceIsType.h" #include "MantidKernel/PropertyManagerOwner.h" diff --git a/Framework/API/test/FermiChopperModelTest.h b/Framework/API/test/FermiChopperModelTest.h index 35e1ae34c2f93fb4fb305913f3d5185625f16489..527a4c39080c18287032ac7242f7913378380252 100644 --- a/Framework/API/test/FermiChopperModelTest.h +++ b/Framework/API/test/FermiChopperModelTest.h @@ -7,7 +7,6 @@ #include "MantidTestHelpers/ComponentCreationHelper.h" #include <cxxtest/TestSuite.h> #include <boost/make_shared.hpp> -#include <iomanip> class FermiChopperModelTest : public CxxTest::TestSuite { typedef boost::shared_ptr<Mantid::API::FermiChopperModel> diff --git a/Framework/API/test/FrameworkManagerTest.h b/Framework/API/test/FrameworkManagerTest.h index fedbaf2891fc0ba1610469fcbf937719b6c79439..3f1b01767973cf26e96b0c981b75524d6637a4cd 100644 --- a/Framework/API/test/FrameworkManagerTest.h +++ b/Framework/API/test/FrameworkManagerTest.h @@ -7,7 +7,6 @@ #include "MantidAPI/Algorithm.h" #include "MantidAPI/AlgorithmFactory.h" #include <stdexcept> -#include <iostream> using namespace Mantid::Kernel; using namespace Mantid::API; diff --git a/Framework/API/test/FunctionDomainTest.h b/Framework/API/test/FunctionDomainTest.h index 46c8dbbadf6e28456a3c968385ce00daca2d4ee8..cd9d99bfe53cc630a2ef9e7724eb54661fbb2d50 100644 --- a/Framework/API/test/FunctionDomainTest.h +++ b/Framework/API/test/FunctionDomainTest.h @@ -6,7 +6,6 @@ #include "MantidAPI/WorkspaceFactory.h" #include <cxxtest/TestSuite.h> -#include <iostream> using namespace Mantid; using namespace Mantid::API; diff --git a/Framework/API/test/FunctionValuesTest.h b/Framework/API/test/FunctionValuesTest.h index ece5090d9bd93389cef3a8c2661370baf6b9357e..30cf805f718630b56445ef5023770a961ee242af 100644 --- a/Framework/API/test/FunctionValuesTest.h +++ b/Framework/API/test/FunctionValuesTest.h @@ -5,7 +5,6 @@ #include "MantidAPI/FunctionValues.h" #include <cxxtest/TestSuite.h> -#include <iostream> using namespace Mantid; using namespace Mantid::API; diff --git a/Framework/API/test/IEventListTest.h b/Framework/API/test/IEventListTest.h index ab960042e57a6ba53e51287cc9325f68772665b8..334ed6e3fa4a86071df3fddd7fdcab48e346b52f 100644 --- a/Framework/API/test/IEventListTest.h +++ b/Framework/API/test/IEventListTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAPI/IEventList.h" diff --git a/Framework/API/test/IFunction1DTest.h b/Framework/API/test/IFunction1DTest.h index b2b55489f115efe91733659fbfcc976894144d12..0eabfc571e2426ff5d88daf58194b5b44b483af0 100644 --- a/Framework/API/test/IFunction1DTest.h +++ b/Framework/API/test/IFunction1DTest.h @@ -7,7 +7,6 @@ #include "MantidAPI/FunctionValues.h" #include <cxxtest/TestSuite.h> -#include <iostream> using namespace Mantid; using namespace Mantid::API; diff --git a/Framework/API/test/IFunctionMDTest.h b/Framework/API/test/IFunctionMDTest.h index 7e21a71544b6c00d753d3c84569ff0d39f030718..e3f563fc1b2ae5abf73f25c641ddd945b92231ef 100644 --- a/Framework/API/test/IFunctionMDTest.h +++ b/Framework/API/test/IFunctionMDTest.h @@ -3,7 +3,6 @@ #include "MantidAPI/IFunctionMD.h" #include <cxxtest/TestSuite.h> -#include <iostream> using namespace Mantid; using namespace Mantid::API; diff --git a/Framework/API/test/ISpectrumTest.h b/Framework/API/test/ISpectrumTest.h index fea22024ddb8eb5f10fff49c0b779e37b8847b62..625bb42f14effd62927747b787daf18bc68e7560 100644 --- a/Framework/API/test/ISpectrumTest.h +++ b/Framework/API/test/ISpectrumTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAPI/ISpectrum.h" #include "MantidTestHelpers/FakeObjects.h" diff --git a/Framework/API/test/ImplicitFunctionFactoryTest.h b/Framework/API/test/ImplicitFunctionFactoryTest.h index abcea3ce1f0f072d8cf59902a1c46fd0328a3130..1b1ef4b16c3edec28973ea152eac3c2d655d4662 100644 --- a/Framework/API/test/ImplicitFunctionFactoryTest.h +++ b/Framework/API/test/ImplicitFunctionFactoryTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> #include <vector> -#include <iostream> #include <gmock/gmock.h> #include <gtest/gtest.h> #include "MantidAPI/ImplicitFunctionParameterParserFactory.h" diff --git a/Framework/API/test/ImplicitFunctionParameterParserFactoryTest.h b/Framework/API/test/ImplicitFunctionParameterParserFactoryTest.h index 2362545a857d9eb24b4fe7c6c24a96967247ff16..976ea132f0f0f15ebe5ece1a549f9316f02503c8 100644 --- a/Framework/API/test/ImplicitFunctionParameterParserFactoryTest.h +++ b/Framework/API/test/ImplicitFunctionParameterParserFactoryTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> #include <vector> -#include <iostream> #include "MantidAPI/ImplicitFunctionParameterParserFactory.h" #include "MantidKernel/ConfigService.h" diff --git a/Framework/API/test/ImplicitFunctionParserFactoryTest.h b/Framework/API/test/ImplicitFunctionParserFactoryTest.h index 009e0409d808a776f71167bfeafc787c23144933..4cee2938158750b662185866d43df80864ccaee5 100644 --- a/Framework/API/test/ImplicitFunctionParserFactoryTest.h +++ b/Framework/API/test/ImplicitFunctionParserFactoryTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> #include <vector> -#include <iostream> #include "MantidAPI/ImplicitFunctionParserFactory.h" #include "MantidKernel/ConfigService.h" diff --git a/Framework/API/test/InstrumentDataServiceTest.h b/Framework/API/test/InstrumentDataServiceTest.h index 27b411e76d9f18c3cc391d3e442040255d443177..034b18bd9e3e82e909e45ebd6126a6385e930378 100644 --- a/Framework/API/test/InstrumentDataServiceTest.h +++ b/Framework/API/test/InstrumentDataServiceTest.h @@ -6,7 +6,6 @@ #include "MantidAPI/InstrumentDataService.h" #include "MantidGeometry/Instrument.h" #include "MantidKernel/Exception.h" -#include <iostream> using namespace Mantid::API; using namespace Mantid::Geometry; diff --git a/Framework/API/test/MDGeometryTest.h b/Framework/API/test/MDGeometryTest.h index 126b2e28d6d673775b4ad5c2846bffb305e80b67..a933cffc4b1c7135d5d45caf1c2ad7a91196e7fc 100644 --- a/Framework/API/test/MDGeometryTest.h +++ b/Framework/API/test/MDGeometryTest.h @@ -6,8 +6,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include "MantidKernel/VMD.h" #include "MantidAPI/IMDWorkspace.h" #include "MantidTestHelpers/FakeObjects.h" diff --git a/Framework/API/test/MultiDomainFunctionTest.h b/Framework/API/test/MultiDomainFunctionTest.h index 87109b8220ae6c9f94d091b4f71d324c735d6d8e..933a23c22919bdcc74644e49d0e01380f70e581b 100644 --- a/Framework/API/test/MultiDomainFunctionTest.h +++ b/Framework/API/test/MultiDomainFunctionTest.h @@ -12,7 +12,6 @@ #include <cxxtest/TestSuite.h> #include <boost/make_shared.hpp> #include <algorithm> -#include <iostream> using namespace Mantid; using namespace Mantid::API; diff --git a/Framework/API/test/MultipleExperimentInfosTest.h b/Framework/API/test/MultipleExperimentInfosTest.h index 3fce4df593320f676185a5ae235905f31198423f..8198fa528b1dd7ba8cd6857d51b54146a5853e10 100644 --- a/Framework/API/test/MultipleExperimentInfosTest.h +++ b/Framework/API/test/MultipleExperimentInfosTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAPI/MultipleExperimentInfos.h" #include "MantidAPI/ExperimentInfo.h" diff --git a/Framework/API/test/MultipleFilePropertyTest.h b/Framework/API/test/MultipleFilePropertyTest.h index 2ce77d3b8b50206a702c91cd360d098b2cd8f601..77497dad7d45281d627dca5d0365d68e5122f8b9 100644 --- a/Framework/API/test/MultipleFilePropertyTest.h +++ b/Framework/API/test/MultipleFilePropertyTest.h @@ -8,8 +8,6 @@ #include "MantidKernel/Logger.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <Poco/Path.h> #include <Poco/File.h> diff --git a/Framework/API/test/PropertyManagerDataServiceTest.h b/Framework/API/test/PropertyManagerDataServiceTest.h index 6596e9bb84d4dabe351351fdd5836b0ce35f833f..77063af16abb294dac4c712d26bf36f8a8b730a9 100644 --- a/Framework/API/test/PropertyManagerDataServiceTest.h +++ b/Framework/API/test/PropertyManagerDataServiceTest.h @@ -6,7 +6,6 @@ #include "MantidAPI/PropertyManagerDataService.h" #include "MantidKernel/PropertyManager.h" #include "MantidKernel/Exception.h" -#include <iostream> using namespace Mantid::API; using namespace Mantid::Kernel; diff --git a/Framework/API/test/PropertyNexusTest.h b/Framework/API/test/PropertyNexusTest.h index ce4c2492ec4923855f7644efb63fad97440979d1..7d21f82e8d1e445695fd63d528c71965c92a90a0 100644 --- a/Framework/API/test/PropertyNexusTest.h +++ b/Framework/API/test/PropertyNexusTest.h @@ -6,8 +6,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include "MantidTestHelpers/NexusTestHelper.h" #include "MantidKernel/PropertyWithValue.h" #include "MantidKernel/TimeSeriesProperty.h" diff --git a/Framework/API/test/WorkspaceFactoryTest.h b/Framework/API/test/WorkspaceFactoryTest.h index a3aa58f0d0f8a116a7bdc00c70a7f382550a0b1e..8ec2978f7ba3d5ec9d557c22b7e20cce5a98939d 100644 --- a/Framework/API/test/WorkspaceFactoryTest.h +++ b/Framework/API/test/WorkspaceFactoryTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> #include <vector> -#include <iostream> #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/WorkspaceFactory.h" diff --git a/Framework/API/test/WorkspaceGroupTest.h b/Framework/API/test/WorkspaceGroupTest.h index 1feaa40e635b349a92063823ee8e65be0763c03b..f14a8d18889924d490797a14eac2981f925c289d 100644 --- a/Framework/API/test/WorkspaceGroupTest.h +++ b/Framework/API/test/WorkspaceGroupTest.h @@ -10,8 +10,6 @@ #include <boost/shared_ptr.hpp> #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <gmock/gmock.h> #include <gtest/gtest.h> diff --git a/Framework/Algorithms/inc/MantidAlgorithms/AsymmetryCalc.h b/Framework/Algorithms/inc/MantidAlgorithms/AsymmetryCalc.h index 29fb229b39b2ff403e88c816c812fbc157f6a18f..17d811ee4ac5234a22825455da646f00a6b8c7d0 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/AsymmetryCalc.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/AsymmetryCalc.h @@ -72,6 +72,7 @@ private: // Overridden Algorithm methods void init(); void exec(); + std::map<std::string, std::string> validateInputs(); }; } // namespace Algorithm diff --git a/Framework/Algorithms/src/ApplyDeadTimeCorr.cpp b/Framework/Algorithms/src/ApplyDeadTimeCorr.cpp index 4d17035fc7c661651e267c2b1044b507a937a2ee..e50710997d9036191e5d48c42fd5114e05d33743 100644 --- a/Framework/Algorithms/src/ApplyDeadTimeCorr.cpp +++ b/Framework/Algorithms/src/ApplyDeadTimeCorr.cpp @@ -9,7 +9,6 @@ #include "MantidAPI/ITableWorkspace.h" #include "MantidAPI/TableRow.h" -#include <iostream> #include <cmath> using std::string; diff --git a/Framework/Algorithms/src/ApplyDetailedBalance.cpp b/Framework/Algorithms/src/ApplyDetailedBalance.cpp index a5e200345c02296ad7787a0b9e3a358839cd0fa3..6fd2dc79cbd60860112bb005fc02713ebe7cf145 100644 --- a/Framework/Algorithms/src/ApplyDetailedBalance.cpp +++ b/Framework/Algorithms/src/ApplyDetailedBalance.cpp @@ -6,7 +6,6 @@ #include "MantidKernel/TimeSeriesProperty.h" #include "boost/lexical_cast.hpp" -#include <iostream> #include <cmath> using std::string; diff --git a/Framework/Algorithms/src/AsymmetryCalc.cpp b/Framework/Algorithms/src/AsymmetryCalc.cpp index 95ada02b2c39055948dd4e580ff2c46af00ebf90..c4644592da8072dda046130c13c4c160b969c649 100644 --- a/Framework/Algorithms/src/AsymmetryCalc.cpp +++ b/Framework/Algorithms/src/AsymmetryCalc.cpp @@ -37,6 +37,34 @@ void AsymmetryCalc::init() { Direction::Input); } +//---------------------------------------------------------------------------------------------- +/** Validates the inputs. + */ +std::map<std::string, std::string> AsymmetryCalc::validateInputs() { + + std::map<std::string, std::string> result; + + std::vector<size_t> list; + std::vector<int> forwd = getProperty("ForwardSpectra"); + std::vector<int> backwd = getProperty("BackwardSpectra"); + + API::MatrixWorkspace_sptr inputWS = getProperty("InputWorkspace"); + + inputWS->getIndicesFromSpectra(forwd, list); + if (forwd.size() != list.size()) { + result["ForwardSpectra"] = + "Some of the spectra can not be found in the input workspace"; + } + + inputWS->getIndicesFromSpectra(backwd, list); + if (backwd.size() != list.size()) { + result["BackwardSpectra"] = + "Some of the spectra can not be found in the input workspace"; + } + + return result; +} + /** Executes the algorithm * */ @@ -90,11 +118,6 @@ void AsymmetryCalc::exec() { std::vector<size_t> indices; tmpWS->getIndicesFromSpectra(specIDs, indices); - // If some spectra were not found, can't continue - if (specIDs.size() != indices.size()) - throw std::invalid_argument( - "Could not find two spectra in the input workspace"); - forward = static_cast<int>(indices[0]); backward = static_cast<int>(indices[1]); } diff --git a/Framework/Algorithms/src/ConvertUnits.cpp b/Framework/Algorithms/src/ConvertUnits.cpp index 5c20adeabe3b687863279273e46383bceac2352a..43d213c3a6c8972cf2592e40755b08aa57766444 100644 --- a/Framework/Algorithms/src/ConvertUnits.cpp +++ b/Framework/Algorithms/src/ConvertUnits.cpp @@ -19,7 +19,6 @@ #include <boost/math/special_functions/fpclassify.hpp> #include <cfloat> -#include <iostream> #include <limits> namespace Mantid { diff --git a/Framework/Algorithms/src/CreateCalFileByNames.cpp b/Framework/Algorithms/src/CreateCalFileByNames.cpp index 71cad52468290e3057f12003cf107ecc5ef73c5a..5fce447687eb61314466cdaa481a316473960879 100644 --- a/Framework/Algorithms/src/CreateCalFileByNames.cpp +++ b/Framework/Algorithms/src/CreateCalFileByNames.cpp @@ -12,7 +12,6 @@ #include <boost/algorithm/string/split.hpp> #include <fstream> -#include <iomanip> #include <queue> using namespace Mantid::API; diff --git a/Framework/Algorithms/src/CreateDummyCalFile.cpp b/Framework/Algorithms/src/CreateDummyCalFile.cpp index f64c069ce29a67747a3be06f9851b44958b5ea43..d7c9020aaf9ecfded65339768e765ff11d20f89b 100644 --- a/Framework/Algorithms/src/CreateDummyCalFile.cpp +++ b/Framework/Algorithms/src/CreateDummyCalFile.cpp @@ -10,7 +10,6 @@ #include <queue> #include <fstream> -#include <iomanip> #include <Poco/DOM/DOMParser.h> #include <Poco/DOM/Document.h> #include <Poco/DOM/Element.h> diff --git a/Framework/Algorithms/src/CreateLogTimeCorrection.cpp b/Framework/Algorithms/src/CreateLogTimeCorrection.cpp index dcac5219540acf8b576b7ae6fd274c6df1e20633..4652655b238a0dd0130e7c75e78c0219e19a592f 100644 --- a/Framework/Algorithms/src/CreateLogTimeCorrection.cpp +++ b/Framework/Algorithms/src/CreateLogTimeCorrection.cpp @@ -5,7 +5,6 @@ #include "MantidAPI/InstrumentValidator.h" #include <fstream> -#include <iomanip> using namespace Mantid; using namespace Mantid::API; diff --git a/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp b/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp index d2ca6fb93850b5190c56de061e88517494449d79..d1d9cbaf304cecfe0db193f78e39aa8965d55ff0 100644 --- a/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp +++ b/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp @@ -22,9 +22,8 @@ #include <Poco/File.h> #include <cmath> -#include <fstream> -#include <iomanip> #include <numeric> +#include <fstream> #include <sstream> namespace Mantid { diff --git a/Framework/Algorithms/src/FFTSmooth.cpp b/Framework/Algorithms/src/FFTSmooth.cpp index 9069be1a52b98c0c5a031aaaa63f29c3ab59f907..6f7291d1a208763a3da79b6080807cfb5159a19a 100644 --- a/Framework/Algorithms/src/FFTSmooth.cpp +++ b/Framework/Algorithms/src/FFTSmooth.cpp @@ -4,7 +4,6 @@ #include "MantidAlgorithms/FFTSmooth.h" #include "MantidKernel/Exception.h" -#include <iostream> #include "MantidKernel/BoundedValidator.h" #include "MantidKernel/ListValidator.h" diff --git a/Framework/Algorithms/src/FFTSmooth2.cpp b/Framework/Algorithms/src/FFTSmooth2.cpp index 745441a1a978f70d2bb620b9aef5093fd7987b93..88c68e75e13ed5e324dfa660dd30ee2f716587e9 100644 --- a/Framework/Algorithms/src/FFTSmooth2.cpp +++ b/Framework/Algorithms/src/FFTSmooth2.cpp @@ -6,7 +6,6 @@ #include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/detail/classification.hpp> -#include <iostream> #include "MantidKernel/BoundedValidator.h" #include "MantidKernel/ListValidator.h" diff --git a/Framework/Algorithms/src/FindPeaks.cpp b/Framework/Algorithms/src/FindPeaks.cpp index 2630ef03e0424a382a5c9b3b6200ad308b267dc7..67fd790e406c8bf64bd03f63717d3ab4d602638b 100644 --- a/Framework/Algorithms/src/FindPeaks.cpp +++ b/Framework/Algorithms/src/FindPeaks.cpp @@ -14,7 +14,6 @@ #include "MantidKernel/VectorHelper.h" #include <boost/algorithm/string.hpp> -#include <iostream> #include <numeric> #include "MantidKernel/BoundedValidator.h" #include "MantidKernel/ListValidator.h" diff --git a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp index ebfeabbcab3bfa8979a0ab33eb4fdae5ad84938e..ed6fedd46ee75042c300526e89d281f43395ebad 100644 --- a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp +++ b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp @@ -18,7 +18,6 @@ #include "MantidKernel/VectorHelper.h" #include <boost/math/special_functions/fpclassify.hpp> -#include <iomanip> #include <sstream> namespace Mantid { diff --git a/Framework/Algorithms/src/GetDetectorOffsets.cpp b/Framework/Algorithms/src/GetDetectorOffsets.cpp index 2f03c0cc389284c27b3cfcc8e9ddfe461afc6d65..5af130be47dc42589c73a119d8910ff94ba8dbb3 100644 --- a/Framework/Algorithms/src/GetDetectorOffsets.cpp +++ b/Framework/Algorithms/src/GetDetectorOffsets.cpp @@ -10,7 +10,6 @@ #include "MantidKernel/ListValidator.h" #include <boost/math/special_functions/fpclassify.hpp> -#include <iomanip> #include <sstream> namespace Mantid { diff --git a/Framework/Algorithms/src/MaskDetectorsIf.cpp b/Framework/Algorithms/src/MaskDetectorsIf.cpp index 3e1f81cf91bae45c6bf31f14b2dc091081a514f6..803f1008d76317cb96a3fd17fc3ba4c193cf401d 100644 --- a/Framework/Algorithms/src/MaskDetectorsIf.cpp +++ b/Framework/Algorithms/src/MaskDetectorsIf.cpp @@ -6,7 +6,6 @@ #include "MantidKernel/ListValidator.h" #include <fstream> -#include <iomanip> namespace Mantid { namespace Algorithms { diff --git a/Framework/Algorithms/src/NormaliseToMonitor.cpp b/Framework/Algorithms/src/NormaliseToMonitor.cpp index 072b78e7686a9099afeb7ac50bc3c4f2701c1792..f8592f395175e7cacce6eaa1900828a11475a4dc 100644 --- a/Framework/Algorithms/src/NormaliseToMonitor.cpp +++ b/Framework/Algorithms/src/NormaliseToMonitor.cpp @@ -14,7 +14,6 @@ #include "MantidKernel/VectorHelper.h" #include <cfloat> -#include <iomanip> #include <numeric> using namespace Mantid::DataObjects; diff --git a/Framework/Algorithms/src/Q1DTOF.cpp b/Framework/Algorithms/src/Q1DTOF.cpp index 955a8a9fccf0cf05d4b31a9d545874766024681f..50108eb2adb7980284588e2ae4b304820d968277 100644 --- a/Framework/Algorithms/src/Q1DTOF.cpp +++ b/Framework/Algorithms/src/Q1DTOF.cpp @@ -9,7 +9,6 @@ #include "MantidKernel/VectorHelper.h" #include "MantidAPI/WorkspaceValidators.h" #include "MantidDataObjects/Histogram1D.h" -#include <iostream> #include <vector> namespace Mantid { diff --git a/Framework/Algorithms/src/RealFFT.cpp b/Framework/Algorithms/src/RealFFT.cpp index dd320924de112004568649095472b726f0a27175..db2466098cdddc8f484617e71753980efc541489 100644 --- a/Framework/Algorithms/src/RealFFT.cpp +++ b/Framework/Algorithms/src/RealFFT.cpp @@ -20,7 +20,6 @@ #include <functional> #include <cmath> -#include <iostream> #include "MantidKernel/BoundedValidator.h" #include "MantidKernel/ListValidator.h" diff --git a/Framework/Algorithms/src/SaveGSASInstrumentFile.cpp b/Framework/Algorithms/src/SaveGSASInstrumentFile.cpp index 4416295a73bb03f8bb68cd77b2462f3793be2672..8fc922fe4b86c0cb05f950d0b1c1e4dcb56f8633 100644 --- a/Framework/Algorithms/src/SaveGSASInstrumentFile.cpp +++ b/Framework/Algorithms/src/SaveGSASInstrumentFile.cpp @@ -7,7 +7,6 @@ #include "MantidAPI/TableRow.h" #include <stdio.h> -#include <iomanip> using namespace Mantid; using namespace Mantid::API; diff --git a/Framework/Algorithms/src/SpatialGrouping.cpp b/Framework/Algorithms/src/SpatialGrouping.cpp index 4d53df627419b0f09deb592e119f74a57722f2b5..bfc5744a0057e65726562e3ea35f78cf57fdcaea 100644 --- a/Framework/Algorithms/src/SpatialGrouping.cpp +++ b/Framework/Algorithms/src/SpatialGrouping.cpp @@ -12,7 +12,6 @@ #include <map> #include <fstream> -#include <iostream> #include <algorithm> #include "MantidAPI/ISpectrum.h" diff --git a/Framework/Algorithms/test/AddLogDerivativeTest.h b/Framework/Algorithms/test/AddLogDerivativeTest.h index 696e229ef732202944c3ca59c3ee35e4cf802bab..4d83e735cc5a6c71f92b432f70c620b418e92612 100644 --- a/Framework/Algorithms/test/AddLogDerivativeTest.h +++ b/Framework/Algorithms/test/AddLogDerivativeTest.h @@ -6,8 +6,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidAPI/Run.h" diff --git a/Framework/Algorithms/test/AddPeakTest.h b/Framework/Algorithms/test/AddPeakTest.h index b534469ba4a7dd882a055477a1723d877e767a89..230ff5a306dd0ad8b440eafb01b6a138a7eb6636 100644 --- a/Framework/Algorithms/test/AddPeakTest.h +++ b/Framework/Algorithms/test/AddPeakTest.h @@ -9,8 +9,6 @@ #include "MantidKernel/Timer.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid::Algorithms; using namespace Mantid::API; diff --git a/Framework/Algorithms/test/ApplyDetailedBalanceTest.h b/Framework/Algorithms/test/ApplyDetailedBalanceTest.h index da83e4b77c51d3251aa5d34e9371ce4946ff9528..e3880bcc1be4d6bd7fdb4ecb90d162340e6ef62f 100644 --- a/Framework/Algorithms/test/ApplyDetailedBalanceTest.h +++ b/Framework/Algorithms/test/ApplyDetailedBalanceTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAPI/AlgorithmManager.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidDataObjects/Workspace2D.h" diff --git a/Framework/Algorithms/test/BinaryOperateMasksTest.h b/Framework/Algorithms/test/BinaryOperateMasksTest.h index f60456beac5c99231392d52d9992c7f7a7228317..3218fb7d2004334ffd9924da9dcb0f329759f3be 100644 --- a/Framework/Algorithms/test/BinaryOperateMasksTest.h +++ b/Framework/Algorithms/test/BinaryOperateMasksTest.h @@ -9,8 +9,6 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidGeometry/Instrument.h" #include <cxxtest/TestSuite.h> -#include <iostream> -#include <iomanip> using namespace Mantid; using namespace Mantid::Algorithms; diff --git a/Framework/Algorithms/test/ChangeBinOffsetTest.h b/Framework/Algorithms/test/ChangeBinOffsetTest.h index faa21e602c8c705beaa8618303f3a9614946623a..04c89a554fa00f98635771a6689eede83947a549 100644 --- a/Framework/Algorithms/test/ChangeBinOffsetTest.h +++ b/Framework/Algorithms/test/ChangeBinOffsetTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> -#include <iostream> #include <sstream> #include <string> diff --git a/Framework/Algorithms/test/ChangePulsetimeTest.h b/Framework/Algorithms/test/ChangePulsetimeTest.h index 17f8e42eecfb1a142f4ffadb772318c09f3ba037..b7a80e0d95fd2d025637be98fac7a12db7d7a441 100644 --- a/Framework/Algorithms/test/ChangePulsetimeTest.h +++ b/Framework/Algorithms/test/ChangePulsetimeTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAlgorithms/ChangePulsetime.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" diff --git a/Framework/Algorithms/test/ConvertToEventWorkspaceTest.h b/Framework/Algorithms/test/ConvertToEventWorkspaceTest.h index d37652d9f1e0785210cf4725324aea08bdf5aae1..f32dac5f19a814a9a4a18cd6cffcaf96b7f63aa3 100644 --- a/Framework/Algorithms/test/ConvertToEventWorkspaceTest.h +++ b/Framework/Algorithms/test/ConvertToEventWorkspaceTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAlgorithms/ConvertToEventWorkspace.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" diff --git a/Framework/Algorithms/test/CountEventsInPulsesTest.h b/Framework/Algorithms/test/CountEventsInPulsesTest.h index b3db88e1ac1097e93eed54b00efe117180c76f45..1b49e7ebe0b8ab3575d0a3216ade2182ffcd87f4 100644 --- a/Framework/Algorithms/test/CountEventsInPulsesTest.h +++ b/Framework/Algorithms/test/CountEventsInPulsesTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAlgorithms/CountEventsInPulses.h" #include "MantidKernel/TimeSeriesProperty.h" diff --git a/Framework/Algorithms/test/CreateGroupingWorkspaceTest.h b/Framework/Algorithms/test/CreateGroupingWorkspaceTest.h index 2854070451cbc5344e3a04442d38b0ad323de981..2b4f978934c39683d39cf19fa83376d8392b353e 100644 --- a/Framework/Algorithms/test/CreateGroupingWorkspaceTest.h +++ b/Framework/Algorithms/test/CreateGroupingWorkspaceTest.h @@ -7,8 +7,6 @@ #include "MantidKernel/Timer.h" #include "MantidAPI/FrameworkManager.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid::Algorithms; using namespace Mantid::API; diff --git a/Framework/Algorithms/test/CreatePeaksWorkspaceTest.h b/Framework/Algorithms/test/CreatePeaksWorkspaceTest.h index 7d8e9eebeb17f66a2b2402c349ee3e0a54cdf5bc..fb822c6164ebbbadbabd9a0d2122949994cd6cc2 100644 --- a/Framework/Algorithms/test/CreatePeaksWorkspaceTest.h +++ b/Framework/Algorithms/test/CreatePeaksWorkspaceTest.h @@ -9,8 +9,6 @@ #include "MantidKernel/Timer.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid::Algorithms; using namespace Mantid::API; diff --git a/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h b/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h index d7fee9f63a94238ce292056e2639e3645b26fe0e..182decc0f49d5d126bac8e09d779e1700a1e2b0d 100644 --- a/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h +++ b/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h @@ -14,8 +14,6 @@ #include <boost/lexical_cast.hpp> #include <Poco/Path.h> #include <cmath> -#include <iomanip> -#include <iostream> #include <sstream> #include <fstream> #include <ios> diff --git a/Framework/Algorithms/test/DiffractionEventCalibrateDetectorsTest.h b/Framework/Algorithms/test/DiffractionEventCalibrateDetectorsTest.h index 0823a4f301089d49f318dabca7f530a59011d876..41a0dfbd9d22b7841d0f5f01d9509ae410ba25e5 100644 --- a/Framework/Algorithms/test/DiffractionEventCalibrateDetectorsTest.h +++ b/Framework/Algorithms/test/DiffractionEventCalibrateDetectorsTest.h @@ -6,8 +6,6 @@ #include "MantidKernel/Timer.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <fstream> #include <Poco/File.h> diff --git a/Framework/Algorithms/test/EditInstrumentGeometryTest.h b/Framework/Algorithms/test/EditInstrumentGeometryTest.h index d801edecc2755a6cd031a6cc9c6e3f5692c9f4da..f0ba68a4ee1ab17000994576f0c510f38bb09431 100644 --- a/Framework/Algorithms/test/EditInstrumentGeometryTest.h +++ b/Framework/Algorithms/test/EditInstrumentGeometryTest.h @@ -10,8 +10,6 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> using namespace Mantid; using namespace Mantid::Algorithms; diff --git a/Framework/Algorithms/test/ElasticWindowTest.h b/Framework/Algorithms/test/ElasticWindowTest.h index babe4b95bd131a07883da6bb3c49af63cfb9c7fd..6d9d4c8ecd9a58b3940de945b0cfd37f2a6632bf 100644 --- a/Framework/Algorithms/test/ElasticWindowTest.h +++ b/Framework/Algorithms/test/ElasticWindowTest.h @@ -3,8 +3,6 @@ #include <cxxtest/TestSuite.h> -#include <iostream> -#include <iomanip> #include "MantidAPI/FrameworkManager.h" #include "MantidKernel/System.h" diff --git a/Framework/Algorithms/test/ExportTimeSeriesLogTest.h b/Framework/Algorithms/test/ExportTimeSeriesLogTest.h index 2d2f8e21e48afd6d1f8b2b897271d0245c072f91..95ffd2e77abaebfd73a6528e367e4f30676c2239 100644 --- a/Framework/Algorithms/test/ExportTimeSeriesLogTest.h +++ b/Framework/Algorithms/test/ExportTimeSeriesLogTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" #include <cmath> -#include <iostream> -#include <iomanip> #include <fstream> #include <Poco/File.h> diff --git a/Framework/Algorithms/test/FilterEventsTest.h b/Framework/Algorithms/test/FilterEventsTest.h index 4de2165a833de3082420c1ed531c733531d794ce..ab3c1343d287cc4a5da8bbe0f354604f32d8b52b 100644 --- a/Framework/Algorithms/test/FilterEventsTest.h +++ b/Framework/Algorithms/test/FilterEventsTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAlgorithms/FilterEvents.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" diff --git a/Framework/Algorithms/test/GenerateEventsFilterTest.h b/Framework/Algorithms/test/GenerateEventsFilterTest.h index abdd7afa091f1ed4bec2897bd740b9ccc842012e..c6520fbca5c429f4dacae7cedffd1fd28824c626 100644 --- a/Framework/Algorithms/test/GenerateEventsFilterTest.h +++ b/Framework/Algorithms/test/GenerateEventsFilterTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" #include <cmath> -#include <iostream> -#include <iomanip> #include <fstream> #include <Poco/File.h> diff --git a/Framework/Algorithms/test/GenerateIPythonNotebookTest.h b/Framework/Algorithms/test/GenerateIPythonNotebookTest.h index 0e3d5fbe3ed31a075123e48bc6085c1ccebb0ed1..290f11a2dde2d1022382acc6b9b11c5479a24338 100644 --- a/Framework/Algorithms/test/GenerateIPythonNotebookTest.h +++ b/Framework/Algorithms/test/GenerateIPythonNotebookTest.h @@ -4,9 +4,7 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> #include <fstream> -#include <iomanip> #include <boost/regex.hpp> #include "MantidAlgorithms/GenerateIPythonNotebook.h" diff --git a/Framework/Algorithms/test/GeneratePeaksTest.h b/Framework/Algorithms/test/GeneratePeaksTest.h index b524ac99fbf283cf9d626a279e271cf19f213357..d25985d93b0d30d9da5e043e24d5532b50dc78b4 100644 --- a/Framework/Algorithms/test/GeneratePeaksTest.h +++ b/Framework/Algorithms/test/GeneratePeaksTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAlgorithms/GeneratePeaks.h" #include "MantidDataObjects/TableWorkspace.h" diff --git a/Framework/Algorithms/test/GeneratePythonScriptTest.h b/Framework/Algorithms/test/GeneratePythonScriptTest.h index 9d8c2860adcf9b5e32dcef36837da5169f075c3a..48234f28bf76ae0973f0b87bf6de72455c33a770 100644 --- a/Framework/Algorithms/test/GeneratePythonScriptTest.h +++ b/Framework/Algorithms/test/GeneratePythonScriptTest.h @@ -4,9 +4,7 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> #include <fstream> -#include <iomanip> #include <boost/regex.hpp> #include "MantidAlgorithms/GeneratePythonScript.h" diff --git a/Framework/Algorithms/test/GetTimeSeriesLogInformationTest.h b/Framework/Algorithms/test/GetTimeSeriesLogInformationTest.h index ea6f2cfff30bf446081f1c588035cc29d0baf815..237f5ab7a6d2120a3b044afe31bec41c4b9f5244 100644 --- a/Framework/Algorithms/test/GetTimeSeriesLogInformationTest.h +++ b/Framework/Algorithms/test/GetTimeSeriesLogInformationTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" #include <cmath> -#include <iostream> -#include <iomanip> #include <fstream> #include <Poco/File.h> diff --git a/Framework/Algorithms/test/InvertMaskTest.h b/Framework/Algorithms/test/InvertMaskTest.h index 2ddb4be78ec41d6ac821ad8b1d6162c4e2aa32ba..422422e53fdcd67113f75685e0eab062da2e5194 100644 --- a/Framework/Algorithms/test/InvertMaskTest.h +++ b/Framework/Algorithms/test/InvertMaskTest.h @@ -8,8 +8,6 @@ #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidGeometry/Instrument.h" -#include <iostream> -#include <iomanip> #include "MantidAlgorithms/InvertMask.h" diff --git a/Framework/Algorithms/test/MaskBinsFromTableTest.h b/Framework/Algorithms/test/MaskBinsFromTableTest.h index fbac8eab834ab98d99d81c807c1248b247d67dae..72e265cbfa7753823d58d3d0ef7efeb67295b2f9 100644 --- a/Framework/Algorithms/test/MaskBinsFromTableTest.h +++ b/Framework/Algorithms/test/MaskBinsFromTableTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/MaskBinsFromTable.h" diff --git a/Framework/Algorithms/test/MedianDetectorTestTest.h b/Framework/Algorithms/test/MedianDetectorTestTest.h index bb69f74a2f355cfe7663e2660abb31faaf5b4d79..da4fd49def2968c6cf2742c9571cc59ceaa87625 100644 --- a/Framework/Algorithms/test/MedianDetectorTestTest.h +++ b/Framework/Algorithms/test/MedianDetectorTestTest.h @@ -16,7 +16,6 @@ #include <Poco/File.h> #include <Poco/Path.h> #include <cmath> -#include <iostream> #include <sstream> #include <fstream> #include <ios> diff --git a/Framework/Algorithms/test/NormaliseByDetectorTest.h b/Framework/Algorithms/test/NormaliseByDetectorTest.h index 8f32e4747e6c06e27e88597805d1acae3868273a..f2a3086001076a8dca7a2a65983ec9d8db19a8d0 100644 --- a/Framework/Algorithms/test/NormaliseByDetectorTest.h +++ b/Framework/Algorithms/test/NormaliseByDetectorTest.h @@ -16,7 +16,6 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidTestHelpers/ScopedFileHelper.h" #include "MantidKernel/ConfigService.h" -#include <iomanip> using namespace Mantid; using namespace Mantid::Algorithms; diff --git a/Framework/Algorithms/test/PDFFourierTransformTest.h b/Framework/Algorithms/test/PDFFourierTransformTest.h index 6b72b4f7b4bc04a2a8d48d2510f7214e49288f1d..724358a188011d84ec7c9458369957a1ccd9127e 100644 --- a/Framework/Algorithms/test/PDFFourierTransformTest.h +++ b/Framework/Algorithms/test/PDFFourierTransformTest.h @@ -11,8 +11,6 @@ #include "MantidAPI/WorkspaceFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/IAlgorithm.h" -#include <iostream> -#include <iomanip> #include "MantidAlgorithms/PDFFourierTransform.h" diff --git a/Framework/Algorithms/test/PauseTest.h b/Framework/Algorithms/test/PauseTest.h index 8ab460600349ef0b98e5448294325f6ca1571a16..4caceae6c1f902c4d78c72ef2b68c61640ddec3e 100644 --- a/Framework/Algorithms/test/PauseTest.h +++ b/Framework/Algorithms/test/PauseTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAlgorithms/Pause.h" diff --git a/Framework/Algorithms/test/PlotAsymmetryByLogValueTest.h b/Framework/Algorithms/test/PlotAsymmetryByLogValueTest.h index e7ab84fb34d0e17577abdc42ba07fb9d7120d377..8f7648d74fcc93ee8ff291a8fc0dec5f5eab191f 100644 --- a/Framework/Algorithms/test/PlotAsymmetryByLogValueTest.h +++ b/Framework/Algorithms/test/PlotAsymmetryByLogValueTest.h @@ -13,7 +13,6 @@ #include "MantidDataHandling/LoadInstrument.h" #include "MantidDataHandling/SaveNexus.h" -#include <iostream> #include <Poco/File.h> using namespace Mantid::API; diff --git a/Framework/Algorithms/test/Q1DWeightedTest.h b/Framework/Algorithms/test/Q1DWeightedTest.h index 0555cf4adf2287754dec61f27212f0db4644a0ae..6abd0718970d3084d54eb7a1695b75f939d050f6 100644 --- a/Framework/Algorithms/test/Q1DWeightedTest.h +++ b/Framework/Algorithms/test/Q1DWeightedTest.h @@ -5,7 +5,6 @@ #include "MantidAlgorithms/Q1DWeighted.h" #include "MantidDataHandling/LoadSpice2D.h" #include "MantidDataHandling/MoveInstrumentComponent.h" -#include <iostream> using namespace Mantid::API; using namespace Mantid::Kernel; diff --git a/Framework/Algorithms/test/RayTracerTesterTest.h b/Framework/Algorithms/test/RayTracerTesterTest.h index 5b643f7871c08f35a427b55bacf6a21a9bae3662..9f9e6972af7bfd70bb5d5e1e30f5f10381a34025 100644 --- a/Framework/Algorithms/test/RayTracerTesterTest.h +++ b/Framework/Algorithms/test/RayTracerTesterTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAlgorithms/RayTracerTester.h" diff --git a/Framework/Algorithms/test/RegroupTest.h b/Framework/Algorithms/test/RegroupTest.h index 3c49bc8e7738146b1e260b04f0ff3bb2de8046c9..fd329c37d4f9aa5b7bda8685ced9616a9f72bbfd 100644 --- a/Framework/Algorithms/test/RegroupTest.h +++ b/Framework/Algorithms/test/RegroupTest.h @@ -8,8 +8,6 @@ #include "MantidAlgorithms/Regroup.h" #include "MantidAPI/WorkspaceProperty.h" -#include <iostream> - using namespace Mantid::Kernel; using namespace Mantid::DataObjects; using namespace Mantid::API; diff --git a/Framework/Algorithms/test/RemoveBinsTest.h b/Framework/Algorithms/test/RemoveBinsTest.h index 0eb0444239da3c9b5f3b915f1b6e65b0bf2fc005..e4dd7d4d22f3bff0e8e02d9fbef41d0656ab7c4a 100644 --- a/Framework/Algorithms/test/RemoveBinsTest.h +++ b/Framework/Algorithms/test/RemoveBinsTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> -#include <iostream> #include <sstream> #include <string> #include <stdexcept> diff --git a/Framework/Algorithms/test/RemoveLowResTOFTest.h b/Framework/Algorithms/test/RemoveLowResTOFTest.h index 2c4117254f2a41c4f33f1f8a86d2a032ad0e8fd0..151e8c9694c50d2ec363a9f1f3a743e29edce805 100644 --- a/Framework/Algorithms/test/RemoveLowResTOFTest.h +++ b/Framework/Algorithms/test/RemoveLowResTOFTest.h @@ -9,8 +9,6 @@ #include "MantidKernel/UnitFactory.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidTestHelpers/ComponentCreationHelper.h" -#include <iostream> -#include <iomanip> #include <set> #include <string> diff --git a/Framework/Algorithms/test/RemovePromptPulseTest.h b/Framework/Algorithms/test/RemovePromptPulseTest.h index f4500225d70fac0a2bb46474f99b8d21476e00ba..0675bf25926ce6292f20fc27f6f5628dc8c71c73 100644 --- a/Framework/Algorithms/test/RemovePromptPulseTest.h +++ b/Framework/Algorithms/test/RemovePromptPulseTest.h @@ -2,8 +2,6 @@ #define MANTID_ALGORITHMS_REMOVEPROMPTPULSETEST_H_ #include <cxxtest/TestSuite.h> -#include <iostream> -#include <iomanip> #include "MantidAPI/AnalysisDataService.h" #include "MantidDataObjects/EventWorkspace.h" #include "MantidKernel/System.h" diff --git a/Framework/Algorithms/test/ResetNegativesTest.h b/Framework/Algorithms/test/ResetNegativesTest.h index 7db37fd2283726a289b11cc0b4ccd62dbcac5104..f9bbbec67ed1105b96ec17e832db47687be348b4 100644 --- a/Framework/Algorithms/test/ResetNegativesTest.h +++ b/Framework/Algorithms/test/ResetNegativesTest.h @@ -7,8 +7,6 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include <iostream> -#include <iomanip> #include <string> #include "MantidAlgorithms/ResetNegatives.h" diff --git a/Framework/Algorithms/test/ResizeRectangularDetectorTest.h b/Framework/Algorithms/test/ResizeRectangularDetectorTest.h index 588a827ad4f94710b79f6aa659218e6e4752c8b0..c7fe587a3bfa55887dae0542fa7f95393fd08a16 100644 --- a/Framework/Algorithms/test/ResizeRectangularDetectorTest.h +++ b/Framework/Algorithms/test/ResizeRectangularDetectorTest.h @@ -11,8 +11,6 @@ #include "MantidKernel/V3D.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include "MantidGeometry/Instrument/RectangularDetectorPixel.h" using namespace Mantid; diff --git a/Framework/Algorithms/test/ShiftLogTimeTest.h b/Framework/Algorithms/test/ShiftLogTimeTest.h index 45b0ceee013cf535d849a0d51302e29fbba270bb..fff95c4817c5a2e86af7c5f655a9ff06c96e53f0 100644 --- a/Framework/Algorithms/test/ShiftLogTimeTest.h +++ b/Framework/Algorithms/test/ShiftLogTimeTest.h @@ -7,8 +7,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include "MantidKernel/TimeSeriesProperty.h" -#include <iostream> -#include <iomanip> using namespace Mantid; using namespace Mantid::Algorithms; diff --git a/Framework/Algorithms/test/SignalOverErrorTest.h b/Framework/Algorithms/test/SignalOverErrorTest.h index 7887d9c45237c7c66cdb9a20d0ebf0c77a97b779..be31dec152265817744963a41cde36f70e33be81 100644 --- a/Framework/Algorithms/test/SignalOverErrorTest.h +++ b/Framework/Algorithms/test/SignalOverErrorTest.h @@ -7,8 +7,6 @@ #include "MantidKernel/Timer.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Algorithms; diff --git a/Framework/Algorithms/test/SmoothNeighboursTest.h b/Framework/Algorithms/test/SmoothNeighboursTest.h index 9fc602a9e04a335675c26068e739adec4f19cf58..2dab29faed28f25443c5bb139b8985b5d841c44f 100644 --- a/Framework/Algorithms/test/SmoothNeighboursTest.h +++ b/Framework/Algorithms/test/SmoothNeighboursTest.h @@ -14,8 +14,6 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iostream> -#include <iomanip> using namespace Mantid; using namespace Mantid::Kernel; diff --git a/Framework/Algorithms/test/UnwrapSNSTest.h b/Framework/Algorithms/test/UnwrapSNSTest.h index 68ae1ed6d58a699380332052430270414097e040..7fa34a7772f2b1c1c67b2c3f96d12360c5711b5d 100644 --- a/Framework/Algorithms/test/UnwrapSNSTest.h +++ b/Framework/Algorithms/test/UnwrapSNSTest.h @@ -9,8 +9,6 @@ #include "MantidKernel/UnitFactory.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidTestHelpers/ComponentCreationHelper.h" -#include <iostream> -#include <iomanip> #include <string> #include "MantidAlgorithms/UnwrapSNS.h" diff --git a/Framework/Algorithms/test/WeightingStrategyTest.h b/Framework/Algorithms/test/WeightingStrategyTest.h index 01c8b69bc460004398f4b0727d04e2cc8d83cf96..c3515c98c80ec431cecbe579476037ee5b8a799d 100644 --- a/Framework/Algorithms/test/WeightingStrategyTest.h +++ b/Framework/Algorithms/test/WeightingStrategyTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidAlgorithms/WeightingStrategy.h" diff --git a/Framework/Algorithms/test/WorkspaceCreationHelperTest.h b/Framework/Algorithms/test/WorkspaceCreationHelperTest.h index 3cc5b4bc7968cb9606cb0d5ae3f8611cab17f8fe..a1c3804687da72b281ab281d8f95d8d425f72a42 100644 --- a/Framework/Algorithms/test/WorkspaceCreationHelperTest.h +++ b/Framework/Algorithms/test/WorkspaceCreationHelperTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/Timer.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include "MantidAPI/SpectraDetectorTypes.h" using namespace Mantid; diff --git a/Framework/Crystal/test/AnvredCorrectionTest.h b/Framework/Crystal/test/AnvredCorrectionTest.h index 860322223cd3d9069b2b7ba7157628520ba40927..6b5b5376fbc6c3bb25c93fdb5c1fce93fea15048 100644 --- a/Framework/Crystal/test/AnvredCorrectionTest.h +++ b/Framework/Crystal/test/AnvredCorrectionTest.h @@ -18,8 +18,6 @@ #include <boost/random/variate_generator.hpp> #include <math.h> #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Crystal; diff --git a/Framework/Crystal/test/CalculateUMatrixTest.h b/Framework/Crystal/test/CalculateUMatrixTest.h index bfd583addb80341f5c25371d86ffd9ad75188f17..1541caefccd4b15bb0934c9ec5cbe1c425cc7bb5 100644 --- a/Framework/Crystal/test/CalculateUMatrixTest.h +++ b/Framework/Crystal/test/CalculateUMatrixTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidCrystal/CalculateUMatrix.h" #include "MantidGeometry/Crystal/OrientedLattice.h" diff --git a/Framework/Crystal/test/CentroidPeaksTest.h b/Framework/Crystal/test/CentroidPeaksTest.h index 653179954cc0cb0ea0a7b1fcbd2cdcba15332487..4843512cbdbc6a34455cc9ff7325eae9e53e0db2 100644 --- a/Framework/Crystal/test/CentroidPeaksTest.h +++ b/Framework/Crystal/test/CentroidPeaksTest.h @@ -18,8 +18,6 @@ #include <boost/random/variate_generator.hpp> #include <math.h> #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Crystal; diff --git a/Framework/Crystal/test/FindUBUsingFFTTest.h b/Framework/Crystal/test/FindUBUsingFFTTest.h index 0c9e5c5dc851658279d0a0b2ad6818a45361a9b2..ecc480cb46709c11f98e9c56a7f3309337b6b7dc 100644 --- a/Framework/Crystal/test/FindUBUsingFFTTest.h +++ b/Framework/Crystal/test/FindUBUsingFFTTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidCrystal/FindUBUsingFFT.h" #include "MantidCrystal/LoadIsawPeaks.h" diff --git a/Framework/Crystal/test/FindUBUsingIndexedPeaksTest.h b/Framework/Crystal/test/FindUBUsingIndexedPeaksTest.h index 3c3da2ce273a44cfcaeef89d1b7cef2614c3a0f1..843071413a8854b218c2cc42ae14f0e755c17c85 100644 --- a/Framework/Crystal/test/FindUBUsingIndexedPeaksTest.h +++ b/Framework/Crystal/test/FindUBUsingIndexedPeaksTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidCrystal/FindUBUsingIndexedPeaks.h" #include "MantidCrystal/LoadIsawPeaks.h" diff --git a/Framework/Crystal/test/FindUBUsingLatticeParametersTest.h b/Framework/Crystal/test/FindUBUsingLatticeParametersTest.h index 1cef9de875a70cd6be271b68fa70ec16f8a872f4..4f25945262e0acc68bbcbe1fd00b9e785d40db7a 100644 --- a/Framework/Crystal/test/FindUBUsingLatticeParametersTest.h +++ b/Framework/Crystal/test/FindUBUsingLatticeParametersTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidCrystal/FindUBUsingLatticeParameters.h" #include "MantidCrystal/LoadIsawPeaks.h" diff --git a/Framework/Crystal/test/FindUBUsingMinMaxDTest.h b/Framework/Crystal/test/FindUBUsingMinMaxDTest.h index 63ffb2254a1bf0f45c5fed7d46340ab4cbf23b89..58934d00d7f2ce538c78d234b033e0b0602a673c 100644 --- a/Framework/Crystal/test/FindUBUsingMinMaxDTest.h +++ b/Framework/Crystal/test/FindUBUsingMinMaxDTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidCrystal/FindUBUsingMinMaxD.h" #include "MantidCrystal/LoadIsawPeaks.h" diff --git a/Framework/Crystal/test/IndexPeaksTest.h b/Framework/Crystal/test/IndexPeaksTest.h index 748bc85b78c3dddf16585b10339378d79b3ab042..a9085df9d0e9019931da7e44ce518d0aa235bf81 100644 --- a/Framework/Crystal/test/IndexPeaksTest.h +++ b/Framework/Crystal/test/IndexPeaksTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidCrystal/IndexPeaks.h" #include "MantidCrystal/LoadIsawPeaks.h" diff --git a/Framework/Crystal/test/LoadHKLTest.h b/Framework/Crystal/test/LoadHKLTest.h index b4a255d7e268ccd191ea211e896dfa0270534afe..df8f5eb183b6a486e89612b400f13ec2734ced36 100644 --- a/Framework/Crystal/test/LoadHKLTest.h +++ b/Framework/Crystal/test/LoadHKLTest.h @@ -10,8 +10,6 @@ #include "MantidKernel/Timer.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <fstream> #include <Poco/File.h> diff --git a/Framework/Crystal/test/LoadIsawPeaksTest.h b/Framework/Crystal/test/LoadIsawPeaksTest.h index 8d40b021e447a87c99a6c8af8c9efafc79a2f793..57cde40ffec075c23623f56444c411f44be551db 100644 --- a/Framework/Crystal/test/LoadIsawPeaksTest.h +++ b/Framework/Crystal/test/LoadIsawPeaksTest.h @@ -9,8 +9,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid::API; using namespace Mantid::Crystal; diff --git a/Framework/Crystal/test/LoadIsawSpectrumTest.h b/Framework/Crystal/test/LoadIsawSpectrumTest.h index 1beed81dcc2d6e53ccef1d212425f33b52098954..2754a7760068ff0e86673ed3dcf6a2b43799c0f8 100644 --- a/Framework/Crystal/test/LoadIsawSpectrumTest.h +++ b/Framework/Crystal/test/LoadIsawSpectrumTest.h @@ -10,8 +10,6 @@ #include "MantidGeometry/Crystal/OrientedLattice.h" #include "MantidAPI/FrameworkManager.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid::Crystal; using namespace Mantid::API; diff --git a/Framework/Crystal/test/LoadIsawUBTest.h b/Framework/Crystal/test/LoadIsawUBTest.h index a15fb23b6785e498c4fe034ca3107ea796b19240..8123d2272b27415eb9f57b951e60f41fd30ed14c 100644 --- a/Framework/Crystal/test/LoadIsawUBTest.h +++ b/Framework/Crystal/test/LoadIsawUBTest.h @@ -11,8 +11,6 @@ #include "MantidGeometry/Crystal/OrientedLattice.h" #include "MantidAPI/FrameworkManager.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid::Crystal; using namespace Mantid::API; diff --git a/Framework/Crystal/test/NormaliseVanadiumTest.h b/Framework/Crystal/test/NormaliseVanadiumTest.h index ddda1f89f4852bfe05e6e000a2bbb981fd17e04b..4d52925b22f4b7abfd7d3f2680330949a3af7ac5 100644 --- a/Framework/Crystal/test/NormaliseVanadiumTest.h +++ b/Framework/Crystal/test/NormaliseVanadiumTest.h @@ -16,8 +16,6 @@ #include <boost/random/variate_generator.hpp> #include <math.h> #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Crystal; diff --git a/Framework/Crystal/test/OptimizeLatticeForCellTypeTest.h b/Framework/Crystal/test/OptimizeLatticeForCellTypeTest.h index 52d91d88e90b58e3868ebca7030f0af2fa119802..cfb878810325628d3fbc91d0004c44d8f4653f20 100644 --- a/Framework/Crystal/test/OptimizeLatticeForCellTypeTest.h +++ b/Framework/Crystal/test/OptimizeLatticeForCellTypeTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidCrystal/OptimizeLatticeForCellType.h" #include "MantidCrystal/FindUBUsingFFT.h" diff --git a/Framework/Crystal/test/PeakIntegrationTest.h b/Framework/Crystal/test/PeakIntegrationTest.h index 2801488ecac725c61137663b6dacd2a8aa0fc87b..a34be8927d45e43d347563d18dba877f998dba4d 100644 --- a/Framework/Crystal/test/PeakIntegrationTest.h +++ b/Framework/Crystal/test/PeakIntegrationTest.h @@ -18,8 +18,6 @@ #include <boost/random/variate_generator.hpp> #include <math.h> #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Crystal; diff --git a/Framework/Crystal/test/PeakIntensityVsRadiusTest.h b/Framework/Crystal/test/PeakIntensityVsRadiusTest.h index 5e560b92b22c143754b9d7557b7a489c9194d749..e9b5733569bbc94b772a1aff5d7e1d2a74ff7659 100644 --- a/Framework/Crystal/test/PeakIntensityVsRadiusTest.h +++ b/Framework/Crystal/test/PeakIntensityVsRadiusTest.h @@ -11,8 +11,6 @@ #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidAPI/FrameworkManager.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Crystal; diff --git a/Framework/Crystal/test/PredictPeaksTest.h b/Framework/Crystal/test/PredictPeaksTest.h index 6234ee18989727368dec0b5576f51c237cd0eff3..01401b993b2c54838c5b49dc96a73cb2e3c19fc5 100644 --- a/Framework/Crystal/test/PredictPeaksTest.h +++ b/Framework/Crystal/test/PredictPeaksTest.h @@ -9,8 +9,6 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include "MantidKernel/V3D.h" #include "MantidGeometry/IDTypes.h" diff --git a/Framework/Crystal/test/SaveHKLTest.h b/Framework/Crystal/test/SaveHKLTest.h index a7dba0a6a1328c62c10f5bf97d1213bcfe297a1e..80b747709416c8be4aa158ec3e213bc4d1509530 100644 --- a/Framework/Crystal/test/SaveHKLTest.h +++ b/Framework/Crystal/test/SaveHKLTest.h @@ -9,8 +9,6 @@ #include "MantidKernel/Timer.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <fstream> #include <Poco/File.h> diff --git a/Framework/Crystal/test/SaveIsawPeaksTest.h b/Framework/Crystal/test/SaveIsawPeaksTest.h index 62766e5826a417130ffb9681505de2c2c68858b8..53bd33d0cb1fc07e55af1de26a442cf828a183ec 100644 --- a/Framework/Crystal/test/SaveIsawPeaksTest.h +++ b/Framework/Crystal/test/SaveIsawPeaksTest.h @@ -9,8 +9,6 @@ #include "MantidKernel/Timer.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <Poco/File.h> using namespace Mantid; diff --git a/Framework/Crystal/test/SaveIsawUBTest.h b/Framework/Crystal/test/SaveIsawUBTest.h index 3e781524bb32a81e067402bff791a35dbaac31a9..77b9ce5e690cf6b1e5d5e6a432459dacf592f8b3 100644 --- a/Framework/Crystal/test/SaveIsawUBTest.h +++ b/Framework/Crystal/test/SaveIsawUBTest.h @@ -19,7 +19,6 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iostream> #include <fstream> #include <stdio.h> #include <stdlib.h> diff --git a/Framework/Crystal/test/SaveLauenormTest.h b/Framework/Crystal/test/SaveLauenormTest.h index ffa2ff24f389c393a234867e749cda2cde13c6c3..d5c88b526cd20cd496abfe6b1bdcf71589bdd1de 100644 --- a/Framework/Crystal/test/SaveLauenormTest.h +++ b/Framework/Crystal/test/SaveLauenormTest.h @@ -9,8 +9,6 @@ #include "MantidKernel/Timer.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <fstream> #include <Poco/File.h> diff --git a/Framework/Crystal/test/SavePeaksFileTest.h b/Framework/Crystal/test/SavePeaksFileTest.h index f6fe4353c75cdaec961e6b6f4d600ce80d454bd9..4de6a339657af611b9f3b9d3becdd5ca8d568ff6 100644 --- a/Framework/Crystal/test/SavePeaksFileTest.h +++ b/Framework/Crystal/test/SavePeaksFileTest.h @@ -8,8 +8,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <Poco/File.h> using namespace Mantid::Kernel; diff --git a/Framework/Crystal/test/SelectCellOfTypeTest.h b/Framework/Crystal/test/SelectCellOfTypeTest.h index 918286b3bd1d21e993e630fc72b94e2f4c4d4827..0e67f114ccc4a50c097399ad188f45503fbfdb9d 100644 --- a/Framework/Crystal/test/SelectCellOfTypeTest.h +++ b/Framework/Crystal/test/SelectCellOfTypeTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidCrystal/SelectCellOfType.h" #include "MantidCrystal/LoadIsawPeaks.h" diff --git a/Framework/Crystal/test/SelectCellWithFormTest.h b/Framework/Crystal/test/SelectCellWithFormTest.h index a711dd4f7fd32a9ffb170eb5afd11f5b383850a3..77cc15c40b3f37000f743a6ce37d8dd305a95e3b 100644 --- a/Framework/Crystal/test/SelectCellWithFormTest.h +++ b/Framework/Crystal/test/SelectCellWithFormTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidCrystal/SelectCellWithForm.h" #include "MantidCrystal/LoadIsawPeaks.h" diff --git a/Framework/Crystal/test/SetGoniometerTest.h b/Framework/Crystal/test/SetGoniometerTest.h index dfd07fce6c8c666e7fda9d61ddaf2547f9138679..7380082ff01a431c1cb76887ca0fecbdb95b610f 100644 --- a/Framework/Crystal/test/SetGoniometerTest.h +++ b/Framework/Crystal/test/SetGoniometerTest.h @@ -9,8 +9,6 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAPI/FrameworkManager.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include "MantidKernel/V3D.h" #include "MantidKernel/Matrix.h" diff --git a/Framework/Crystal/test/SetUBTest.h b/Framework/Crystal/test/SetUBTest.h index 801dc6bb3bece6803265013f11a166036ef1be6b..2b86a2180d31de449324674e7dec10710cbb3ef3 100644 --- a/Framework/Crystal/test/SetUBTest.h +++ b/Framework/Crystal/test/SetUBTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidCrystal/SetUB.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" diff --git a/Framework/Crystal/test/ShowPossibleCellsTest.h b/Framework/Crystal/test/ShowPossibleCellsTest.h index 5a623a0cbaf17f5480f968415cff8afc7bd61968..4e731455a5261df21112de0eb0ee34d70c26551a 100644 --- a/Framework/Crystal/test/ShowPossibleCellsTest.h +++ b/Framework/Crystal/test/ShowPossibleCellsTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidCrystal/ShowPossibleCells.h" #include "MantidCrystal/LoadIsawPeaks.h" diff --git a/Framework/Crystal/test/SortHKLTest.h b/Framework/Crystal/test/SortHKLTest.h index 72b6ea2fd61b7309e23e253e3bed34941b2acdb8..656a41076d7319f6bfd9da2db2c6aece29f6839d 100644 --- a/Framework/Crystal/test/SortHKLTest.h +++ b/Framework/Crystal/test/SortHKLTest.h @@ -10,8 +10,6 @@ #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidGeometry/Crystal/OrientedLattice.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <fstream> #include <Poco/File.h> diff --git a/Framework/Crystal/test/StatisticsOfPeaksWorkspaceTest.h b/Framework/Crystal/test/StatisticsOfPeaksWorkspaceTest.h index 0499b1711c84e9da0b538df8e963d2a5121bda9c..ee57d99bb1738c40f9ab25d9c29d932e4665f7e7 100644 --- a/Framework/Crystal/test/StatisticsOfPeaksWorkspaceTest.h +++ b/Framework/Crystal/test/StatisticsOfPeaksWorkspaceTest.h @@ -10,8 +10,6 @@ #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidGeometry/Crystal/OrientedLattice.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <fstream> #include <Poco/File.h> diff --git a/Framework/Crystal/test/TransformHKLTest.h b/Framework/Crystal/test/TransformHKLTest.h index c958842c007a17729ecc54da3d52c7fee8337da6..05acb7732de32b10683693ac24dcfb77255638ee 100644 --- a/Framework/Crystal/test/TransformHKLTest.h +++ b/Framework/Crystal/test/TransformHKLTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidCrystal/TransformHKL.h" #include "MantidCrystal/LoadIsawPeaks.h" diff --git a/Framework/CurveFitting/CMakeLists.txt b/Framework/CurveFitting/CMakeLists.txt index c7be58f1e72176eed23025ebda88c4a7e00aec8a..dfbff31c86c754d00670840aa2275393a8de0276 100644 --- a/Framework/CurveFitting/CMakeLists.txt +++ b/Framework/CurveFitting/CMakeLists.txt @@ -3,118 +3,119 @@ set ( SRC_FILES # src/SCDPanelErrors.cpp # src/ChebyshevPolynomialBackground.cpp #src/RefinePowderInstrumentParameters.cpp - src/Abragam.cpp + src/Algorithms/CalculateChiSquared.cpp + src/Algorithms/CalculateGammaBackground.cpp + src/Algorithms/CalculateMSVesuvio.cpp + src/Algorithms/ConvertToYSpace.cpp + src/Algorithms/ConvolveWorkspaces.cpp + src/Algorithms/EstimatePeakErrors.cpp + src/Algorithms/EvaluateFunction.cpp + src/Algorithms/Fit.cpp + src/Algorithms/Fit1D.cpp + src/Algorithms/FitPowderDiffPeaks.cpp + src/Algorithms/LeBailFit.cpp + src/Algorithms/LeBailFunction.cpp + src/Algorithms/NormaliseByPeakArea.cpp + src/Algorithms/PawleyFit.cpp + src/Algorithms/PlotPeakByLogValue.cpp + src/Algorithms/RefinePowderInstrumentParameters.cpp + src/Algorithms/RefinePowderInstrumentParameters3.cpp + src/Algorithms/SplineBackground.cpp + src/Algorithms/SplineInterpolation.cpp + src/Algorithms/SplineSmoothing.cpp src/AugmentedLagrangianOptimizer.cpp - src/BFGS_Minimizer.cpp - src/BSpline.cpp - src/BackToBackExponential.cpp - src/BackgroundFunction.cpp - src/BivariateNormal.cpp - src/Bk2BkExpConvPV.cpp - src/BoundaryConstraint.cpp - src/CalculateChiSquared.cpp - src/CalculateGammaBackground.cpp - src/CalculateMSVesuvio.cpp - src/ChebfunBase.cpp - src/Chebyshev.cpp - src/ComptonPeakProfile.cpp - src/ComptonProfile.cpp - src/ComptonScatteringCountRate.cpp - src/ConvertToYSpace.cpp - src/Convolution.cpp - src/ConvolveWorkspaces.cpp - src/CostFuncFitting.cpp - src/CostFuncLeastSquares.cpp - src/CostFuncRwp.cpp - src/CostFuncUnweightedLeastSquares.cpp - src/CubicSpline.cpp - src/DampingMinimizer.cpp - src/DeltaFunction.cpp - src/DerivMinimizer.cpp - src/DiffRotDiscreteCircle.cpp - src/DiffSphere.cpp - src/DynamicKuboToyabe.cpp - src/EndErfc.cpp - src/EstimatePeakErrors.cpp - src/EvaluateFunction.cpp - src/ExpDecay.cpp - src/ExpDecayMuon.cpp - src/ExpDecayOsc.cpp - src/FABADAMinimizer.cpp - src/FRConjugateGradientMinimizer.cpp - src/Fit.cpp - src/Fit1D.cpp + src/Constraints/BoundaryConstraint.cpp + src/CostFunctions/CostFuncFitting.cpp + src/CostFunctions/CostFuncLeastSquares.cpp + src/CostFunctions/CostFuncRwp.cpp + src/CostFunctions/CostFuncUnweightedLeastSquares.cpp src/FitMW.cpp - src/FitPowderDiffPeaks.cpp - src/FlatBackground.cpp - src/FullprofPolynomial.cpp + src/FuncMinimizers/BFGS_Minimizer.cpp + src/FuncMinimizers/DampingMinimizer.cpp + src/FuncMinimizers/DerivMinimizer.cpp + src/FuncMinimizers/FABADAMinimizer.cpp + src/FuncMinimizers/FRConjugateGradientMinimizer.cpp + src/FuncMinimizers/LevenbergMarquardtMDMinimizer.cpp + src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp + src/FuncMinimizers/PRConjugateGradientMinimizer.cpp + src/FuncMinimizers/SimplexMinimizer.cpp + src/FuncMinimizers/SteepestDescentMinimizer.cpp src/FunctionDomain1DSpectrumCreator.cpp + src/Functions/Abragam.cpp + src/Functions/BSpline.cpp + src/Functions/BackToBackExponential.cpp + src/Functions/BackgroundFunction.cpp + src/Functions/BivariateNormal.cpp + src/Functions/Bk2BkExpConvPV.cpp + src/Functions/ChebfunBase.cpp + src/Functions/Chebyshev.cpp + src/Functions/ComptonPeakProfile.cpp + src/Functions/ComptonProfile.cpp + src/Functions/ComptonScatteringCountRate.cpp + src/Functions/Convolution.cpp + src/Functions/CubicSpline.cpp + src/Functions/DeltaFunction.cpp + src/Functions/DiffRotDiscreteCircle.cpp + src/Functions/DiffSphere.cpp + src/Functions/DynamicKuboToyabe.cpp + src/Functions/EndErfc.cpp + src/Functions/ExpDecay.cpp + src/Functions/ExpDecayMuon.cpp + src/Functions/ExpDecayOsc.cpp + src/Functions/FlatBackground.cpp + src/Functions/FullprofPolynomial.cpp + src/Functions/GausDecay.cpp + src/Functions/GausOsc.cpp + src/Functions/Gaussian.cpp + src/Functions/GaussianComptonProfile.cpp + src/Functions/GramCharlierComptonProfile.cpp + src/Functions/IkedaCarpenterPV.cpp + src/Functions/LinearBackground.cpp + src/Functions/LogNormal.cpp + src/Functions/Lorentzian.cpp + src/Functions/Lorentzian1D.cpp + src/Functions/MuonFInteraction.cpp + src/Functions/NeutronBk2BkExpConvPVoigt.cpp + src/Functions/PawleyFunction.cpp + src/Functions/PeakParameterFunction.cpp + src/Functions/Polynomial.cpp + src/Functions/ProcessBackground.cpp + src/Functions/ProductFunction.cpp + src/Functions/ProductLinearExp.cpp + src/Functions/ProductQuadraticExp.cpp + src/Functions/PseudoVoigt.cpp + src/Functions/Quadratic.cpp + src/Functions/ReflectivityMulf.cpp + src/Functions/Resolution.cpp + src/Functions/SimpleChebfun.cpp + src/Functions/StaticKuboToyabe.cpp + src/Functions/StaticKuboToyabeTimesExpDecay.cpp + src/Functions/StaticKuboToyabeTimesGausDecay.cpp + src/Functions/StretchExp.cpp + src/Functions/StretchExpMuon.cpp + src/Functions/TabulatedFunction.cpp + src/Functions/ThermalNeutronBk2BkExpAlpha.cpp + src/Functions/ThermalNeutronBk2BkExpBeta.cpp + src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp + src/Functions/ThermalNeutronBk2BkExpSigma.cpp + src/Functions/ThermalNeutronDtoTOFFunction.cpp + src/Functions/UserFunction.cpp + src/Functions/UserFunction1D.cpp + src/Functions/VesuvioResolution.cpp + src/Functions/Voigt.cpp src/GSLFunctions.cpp src/GSLMatrix.cpp src/GSLVector.cpp - src/GausDecay.cpp - src/GausOsc.cpp - src/Gaussian.cpp - src/GaussianComptonProfile.cpp - src/GramCharlierComptonProfile.cpp src/IFittingAlgorithm.cpp - src/IkedaCarpenterPV.cpp src/LatticeDomainCreator.cpp src/LatticeFunction.cpp - src/LeBailFit.cpp - src/LeBailFunction.cpp - src/LevenbergMarquardtMDMinimizer.cpp - src/LevenbergMarquardtMinimizer.cpp - src/LinearBackground.cpp - src/LogNormal.cpp - src/Lorentzian.cpp - src/Lorentzian1D.cpp src/MSVesuvioHelpers.cpp src/MultiDomainCreator.cpp - src/MuonFInteraction.cpp - src/NeutronBk2BkExpConvPVoigt.cpp - src/NormaliseByPeakArea.cpp - src/PRConjugateGradientMinimizer.cpp src/ParDomain.cpp src/ParameterEstimator.cpp - src/PawleyFit.cpp - src/PawleyFunction.cpp - src/PeakParameterFunction.cpp - src/PlotPeakByLogValue.cpp - src/Polynomial.cpp - src/ProcessBackground.cpp - src/ProductFunction.cpp - src/ProductLinearExp.cpp - src/ProductQuadraticExp.cpp - src/PseudoVoigt.cpp - src/Quadratic.cpp - src/RefinePowderInstrumentParameters3.cpp - src/ReflectivityMulf.cpp - src/Resolution.cpp src/SeqDomain.cpp src/SeqDomainSpectrumCreator.cpp - src/SimpleChebfun.cpp - src/SimplexMinimizer.cpp src/SpecialFunctionHelper.cpp - src/SplineBackground.cpp - src/SplineInterpolation.cpp - src/SplineSmoothing.cpp - src/StaticKuboToyabe.cpp - src/StaticKuboToyabeTimesExpDecay.cpp - src/StaticKuboToyabeTimesGausDecay.cpp - src/SteepestDescentMinimizer.cpp - src/StretchExp.cpp - src/StretchExpMuon.cpp - src/TabulatedFunction.cpp - src/ThermalNeutronBk2BkExpAlpha.cpp - src/ThermalNeutronBk2BkExpBeta.cpp - src/ThermalNeutronBk2BkExpConvPVoigt.cpp - src/ThermalNeutronBk2BkExpSigma.cpp - src/ThermalNeutronDtoTOFFunction.cpp - src/UserFunction.cpp - src/UserFunction1D.cpp - src/VesuvioResolution.cpp - src/Voigt.cpp ) set ( SRC_UNITY_IGNORE_FILES src/Fit1D.cpp src/GSLFunctions.cpp ) @@ -124,235 +125,237 @@ set ( INC_FILES # inc/MantidCurveFitting/SCDPanelErrors.h # inc/MantidCurveFitting/ChebyshevPolynomialBackground.h #inc/MantidCurveFitting/RefinePowderInstrumentParameters.h - inc/MantidCurveFitting/Abragam.h + inc/MantidCurveFitting/Algorithms/CalculateChiSquared.h + inc/MantidCurveFitting/Algorithms/CalculateGammaBackground.h + inc/MantidCurveFitting/Algorithms/CalculateMSVesuvio.h + inc/MantidCurveFitting/Algorithms/ConvertToYSpace.h + inc/MantidCurveFitting/Algorithms/ConvolveWorkspaces.h + inc/MantidCurveFitting/Algorithms/EstimatePeakErrors.h + inc/MantidCurveFitting/Algorithms/EvaluateFunction.h + inc/MantidCurveFitting/Algorithms/Fit.h + inc/MantidCurveFitting/Algorithms/Fit1D.h + inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h + inc/MantidCurveFitting/Algorithms/LeBailFit.h + inc/MantidCurveFitting/Algorithms/LeBailFunction.h + inc/MantidCurveFitting/Algorithms/NormaliseByPeakArea.h + inc/MantidCurveFitting/Algorithms/PawleyFit.h + inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h + inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h + inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h + inc/MantidCurveFitting/Algorithms/SplineBackground.h + inc/MantidCurveFitting/Algorithms/SplineInterpolation.h + inc/MantidCurveFitting/Algorithms/SplineSmoothing.h inc/MantidCurveFitting/AugmentedLagrangianOptimizer.h - inc/MantidCurveFitting/BFGS_Minimizer.h - inc/MantidCurveFitting/BSpline.h - inc/MantidCurveFitting/BackToBackExponential.h - inc/MantidCurveFitting/BackgroundFunction.h - inc/MantidCurveFitting/BivariateNormal.h - inc/MantidCurveFitting/Bk2BkExpConvPV.h - inc/MantidCurveFitting/BoundaryConstraint.h - inc/MantidCurveFitting/CalculateChiSquared.h - inc/MantidCurveFitting/CalculateGammaBackground.h - inc/MantidCurveFitting/CalculateMSVesuvio.h - inc/MantidCurveFitting/ChebfunBase.h - inc/MantidCurveFitting/Chebyshev.h - inc/MantidCurveFitting/ComptonPeakProfile.h - inc/MantidCurveFitting/ComptonProfile.h - inc/MantidCurveFitting/ComptonScatteringCountRate.h - inc/MantidCurveFitting/ConvertToYSpace.h - inc/MantidCurveFitting/Convolution.h - inc/MantidCurveFitting/ConvolveWorkspaces.h - inc/MantidCurveFitting/CostFuncFitting.h - inc/MantidCurveFitting/CostFuncLeastSquares.h - inc/MantidCurveFitting/CostFuncRwp.h - inc/MantidCurveFitting/CostFuncUnweightedLeastSquares.h - inc/MantidCurveFitting/CubicSpline.h - inc/MantidCurveFitting/DampingMinimizer.h - inc/MantidCurveFitting/DeltaFunction.h - inc/MantidCurveFitting/DerivMinimizer.h - inc/MantidCurveFitting/DiffRotDiscreteCircle.h - inc/MantidCurveFitting/DiffSphere.h + inc/MantidCurveFitting/Constraints/BoundaryConstraint.h + inc/MantidCurveFitting/CostFunctions/CostFuncFitting.h + inc/MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h + inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h + inc/MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h inc/MantidCurveFitting/DllConfig.h - inc/MantidCurveFitting/DynamicKuboToyabe.h - inc/MantidCurveFitting/EndErfc.h - inc/MantidCurveFitting/EstimatePeakErrors.h - inc/MantidCurveFitting/EvaluateFunction.h - inc/MantidCurveFitting/ExpDecay.h - inc/MantidCurveFitting/ExpDecayMuon.h - inc/MantidCurveFitting/ExpDecayOsc.h - inc/MantidCurveFitting/FABADAMinimizer.h - inc/MantidCurveFitting/FRConjugateGradientMinimizer.h - inc/MantidCurveFitting/Fit.h - inc/MantidCurveFitting/Fit1D.h inc/MantidCurveFitting/FitMW.h - inc/MantidCurveFitting/FitPowderDiffPeaks.h - inc/MantidCurveFitting/FlatBackground.h - inc/MantidCurveFitting/FullprofPolynomial.h + inc/MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h + inc/MantidCurveFitting/FuncMinimizers/DampingMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/DerivMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h + inc/MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h inc/MantidCurveFitting/FunctionDomain1DSpectrumCreator.h + inc/MantidCurveFitting/Functions/Abragam.h + inc/MantidCurveFitting/Functions/BSpline.h + inc/MantidCurveFitting/Functions/BackToBackExponential.h + inc/MantidCurveFitting/Functions/BackgroundFunction.h + inc/MantidCurveFitting/Functions/BivariateNormal.h + inc/MantidCurveFitting/Functions/Bk2BkExpConvPV.h + inc/MantidCurveFitting/Functions/ChebfunBase.h + inc/MantidCurveFitting/Functions/Chebyshev.h + inc/MantidCurveFitting/Functions/ComptonPeakProfile.h + inc/MantidCurveFitting/Functions/ComptonProfile.h + inc/MantidCurveFitting/Functions/ComptonScatteringCountRate.h + inc/MantidCurveFitting/Functions/Convolution.h + inc/MantidCurveFitting/Functions/CubicSpline.h + inc/MantidCurveFitting/Functions/DeltaFunction.h + inc/MantidCurveFitting/Functions/DiffRotDiscreteCircle.h + inc/MantidCurveFitting/Functions/DiffSphere.h + inc/MantidCurveFitting/Functions/DynamicKuboToyabe.h + inc/MantidCurveFitting/Functions/EndErfc.h + inc/MantidCurveFitting/Functions/ExpDecay.h + inc/MantidCurveFitting/Functions/ExpDecayMuon.h + inc/MantidCurveFitting/Functions/ExpDecayOsc.h + inc/MantidCurveFitting/Functions/FlatBackground.h + inc/MantidCurveFitting/Functions/FullprofPolynomial.h + inc/MantidCurveFitting/Functions/GausDecay.h + inc/MantidCurveFitting/Functions/GausOsc.h + inc/MantidCurveFitting/Functions/Gaussian.h + inc/MantidCurveFitting/Functions/GaussianComptonProfile.h + inc/MantidCurveFitting/Functions/GramCharlierComptonProfile.h + inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h + inc/MantidCurveFitting/Functions/LinearBackground.h + inc/MantidCurveFitting/Functions/LogNormal.h + inc/MantidCurveFitting/Functions/Lorentzian.h + inc/MantidCurveFitting/Functions/Lorentzian1D.h + inc/MantidCurveFitting/Functions/MuonFInteraction.h + inc/MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h + inc/MantidCurveFitting/Functions/PawleyFunction.h + inc/MantidCurveFitting/Functions/PeakParameterFunction.h + inc/MantidCurveFitting/Functions/Polynomial.h + inc/MantidCurveFitting/Functions/ProcessBackground.h + inc/MantidCurveFitting/Functions/ProductFunction.h + inc/MantidCurveFitting/Functions/ProductLinearExp.h + inc/MantidCurveFitting/Functions/ProductQuadraticExp.h + inc/MantidCurveFitting/Functions/PseudoVoigt.h + inc/MantidCurveFitting/Functions/Quadratic.h + inc/MantidCurveFitting/Functions/ReflectivityMulf.h + inc/MantidCurveFitting/Functions/Resolution.h + inc/MantidCurveFitting/Functions/SimpleChebfun.h + inc/MantidCurveFitting/Functions/StaticKuboToyabe.h + inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h + inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h + inc/MantidCurveFitting/Functions/StretchExp.h + inc/MantidCurveFitting/Functions/StretchExpMuon.h + inc/MantidCurveFitting/Functions/TabulatedFunction.h + inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h + inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h + inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h + inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h + inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h + inc/MantidCurveFitting/Functions/UserFunction.h + inc/MantidCurveFitting/Functions/UserFunction1D.h + inc/MantidCurveFitting/Functions/VesuvioResolution.h + inc/MantidCurveFitting/Functions/Voigt.h inc/MantidCurveFitting/GSLFunctions.h inc/MantidCurveFitting/GSLJacobian.h inc/MantidCurveFitting/GSLMatrix.h inc/MantidCurveFitting/GSLVector.h - inc/MantidCurveFitting/GausDecay.h - inc/MantidCurveFitting/GausOsc.h - inc/MantidCurveFitting/Gaussian.h - inc/MantidCurveFitting/GaussianComptonProfile.h - inc/MantidCurveFitting/GramCharlierComptonProfile.h inc/MantidCurveFitting/HalfComplex.h inc/MantidCurveFitting/IFittingAlgorithm.h - inc/MantidCurveFitting/IkedaCarpenterPV.h inc/MantidCurveFitting/Jacobian.h inc/MantidCurveFitting/LatticeDomainCreator.h inc/MantidCurveFitting/LatticeFunction.h - inc/MantidCurveFitting/LeBailFit.h - inc/MantidCurveFitting/LeBailFunction.h - inc/MantidCurveFitting/LevenbergMarquardtMDMinimizer.h - inc/MantidCurveFitting/LevenbergMarquardtMinimizer.h - inc/MantidCurveFitting/LinearBackground.h - inc/MantidCurveFitting/LogNormal.h - inc/MantidCurveFitting/Lorentzian.h - inc/MantidCurveFitting/Lorentzian1D.h inc/MantidCurveFitting/MSVesuvioHelpers.h inc/MantidCurveFitting/MultiDomainCreator.h - inc/MantidCurveFitting/MuonFInteraction.h - inc/MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h - inc/MantidCurveFitting/NormaliseByPeakArea.h - inc/MantidCurveFitting/PRConjugateGradientMinimizer.h inc/MantidCurveFitting/ParDomain.h inc/MantidCurveFitting/ParameterEstimator.h - inc/MantidCurveFitting/PawleyFit.h - inc/MantidCurveFitting/PawleyFunction.h - inc/MantidCurveFitting/PeakParameterFunction.h - inc/MantidCurveFitting/PlotPeakByLogValue.h - inc/MantidCurveFitting/Polynomial.h - inc/MantidCurveFitting/ProcessBackground.h - inc/MantidCurveFitting/ProductFunction.h - inc/MantidCurveFitting/ProductLinearExp.h - inc/MantidCurveFitting/ProductQuadraticExp.h - inc/MantidCurveFitting/PseudoVoigt.h - inc/MantidCurveFitting/Quadratic.h - inc/MantidCurveFitting/RefinePowderInstrumentParameters3.h - inc/MantidCurveFitting/ReflectivityMulf.h - inc/MantidCurveFitting/Resolution.h inc/MantidCurveFitting/SeqDomain.h inc/MantidCurveFitting/SeqDomainSpectrumCreator.h - inc/MantidCurveFitting/SimpleChebfun.h - inc/MantidCurveFitting/SimplexMinimizer.h inc/MantidCurveFitting/SpecialFunctionSupport.h - inc/MantidCurveFitting/SplineBackground.h - inc/MantidCurveFitting/SplineInterpolation.h - inc/MantidCurveFitting/SplineSmoothing.h - inc/MantidCurveFitting/StaticKuboToyabe.h - inc/MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h - inc/MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h - inc/MantidCurveFitting/SteepestDescentMinimizer.h - inc/MantidCurveFitting/StretchExp.h - inc/MantidCurveFitting/StretchExpMuon.h - inc/MantidCurveFitting/TabulatedFunction.h - inc/MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h - inc/MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h - inc/MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h - inc/MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h - inc/MantidCurveFitting/ThermalNeutronDtoTOFFunction.h - inc/MantidCurveFitting/UserFunction.h - inc/MantidCurveFitting/UserFunction1D.h - inc/MantidCurveFitting/VesuvioResolution.h - inc/MantidCurveFitting/Voigt.h ) set ( TEST_FILES # ChebyshevPolynomialBackgroundTest.h # RefinePowderInstrumentParametersTest.h #SCDPanelErrorsTest.h - AbragamTest.h + Algorithms/CalculateChiSquaredTest.h + Algorithms/CalculateGammaBackgroundTest.h + Algorithms/CalculateMSVesuvioTest.h + Algorithms/ConvertToYSpaceTest.h + Algorithms/ConvolveWorkspacesTest.h + Algorithms/EstimatePeakErrorsTest.h + Algorithms/EvaluateFunctionTest.h + Algorithms/FitPowderDiffPeaksTest.h + Algorithms/FitTest.h + Algorithms/LeBailFitTest.h + Algorithms/LeBailFunctionTest.h + Algorithms/NormaliseByPeakAreaTest.h + Algorithms/PawleyFitTest.h + Algorithms/PlotPeakByLogValueTest.h + Algorithms/RefinePowderInstrumentParameters3Test.h + Algorithms/RefinePowderInstrumentParametersTest.h + Algorithms/SeqDomainSpectrumCreatorTest.h + Algorithms/SplineBackgroundTest.h + Algorithms/SplineInterpolationTest.h + Algorithms/SplineSmoothingTest.h AugmentedLagrangianOptimizerTest.h - BFGSTest.h - BSplineTest.h - BackToBackExponentialTest.h - BivariateNormalTest.h - Bk2BkExpConvPVTest.h - BoundaryConstraintTest.h - CalculateChiSquaredTest.h - CalculateGammaBackgroundTest.h - CalculateMSVesuvioTest.h - ChebfunBaseTest.h - ChebyshevTest.h CompositeFunctionTest.h - ComptonPeakProfileTest.h - ComptonProfileTest.h - ComptonScatteringCountRateTest.h - ConvertToYSpaceTest.h - ConvolutionTest.h - ConvolveWorkspacesTest.h - CostFuncUnweightedLeastSquaresTest.h - CubicSplineTest.h - DampingMinimizerTest.h - DeltaFunctionTest.h - DiffRotDiscreteCircleTest.h - DiffSphereTest.h - DynamicKuboToyabeTest.h - EndErfcTest.h - EstimatePeakErrorsTest.h - EvaluateFunctionTest.h - ExpDecayMuonTest.h - ExpDecayOscTest.h - ExpDecayTest.h - FABADAMinimizerTest.h - FRConjugateGradientTest.h + Constraints/BoundaryConstraintTest.h + CostFunctions/CostFuncUnweightedLeastSquaresTest.h + CostFunctions/LeastSquaresTest.h FitMWTest.h - FitPowderDiffPeaksTest.h - FitTest.h - FlatBackgroundTest.h - FullprofPolynomialTest.h + FuncMinimizers/BFGSTest.h + FuncMinimizers/DampingMinimizerTest.h + FuncMinimizers/FABADAMinimizerTest.h + FuncMinimizers/FRConjugateGradientTest.h + FuncMinimizers/LevenbergMarquardtMDTest.h + FuncMinimizers/LevenbergMarquardtTest.h + FuncMinimizers/PRConjugateGradientTest.h + FuncMinimizers/SimplexTest.h FunctionDomain1DSpectrumCreatorTest.h FunctionFactoryConstraintTest.h FunctionParameterDecoratorFitTest.h + Functions/AbragamTest.h + Functions/BSplineTest.h + Functions/BackToBackExponentialTest.h + Functions/BivariateNormalTest.h + Functions/Bk2BkExpConvPVTest.h + Functions/ChebfunBaseTest.h + Functions/ChebyshevTest.h + Functions/ComptonPeakProfileTest.h + Functions/ComptonProfileTest.h + Functions/ComptonScatteringCountRateTest.h + Functions/ConvolutionTest.h + Functions/CubicSplineTest.h + Functions/DeltaFunctionTest.h + Functions/DiffRotDiscreteCircleTest.h + Functions/DiffSphereTest.h + Functions/DynamicKuboToyabeTest.h + Functions/EndErfcTest.h + Functions/ExpDecayMuonTest.h + Functions/ExpDecayOscTest.h + Functions/ExpDecayTest.h + Functions/FlatBackgroundTest.h + Functions/FullprofPolynomialTest.h + Functions/GausDecayTest.h + Functions/GausOscTest.h + Functions/GaussianComptonProfileTest.h + Functions/GaussianTest.h + Functions/GramCharlierComptonProfileTest.h + Functions/IkedaCarpenterPVTest.h + Functions/LinearBackgroundTest.h + Functions/LogNormalTest.h + Functions/Lorentzian1DTest.h + Functions/LorentzianTest.h + Functions/MuonFInteractionTest.h + Functions/NeutronBk2BkExpConvPVoigtTest.h + Functions/PawleyFunctionTest.h + Functions/PeakParameterFunctionTest.h + Functions/PolynomialTest.h + Functions/ProcessBackgroundTest.h + Functions/ProductFunctionTest.h + Functions/ProductLinearExpTest.h + Functions/ProductQuadraticExpTest.h + Functions/PseudoVoigtTest.h + Functions/QuadraticTest.h + Functions/ReflectivityMulfTest.h + Functions/ResolutionTest.h + Functions/SimpleChebfunTest.h + Functions/StaticKuboToyabeTest.h + Functions/StaticKuboToyabeTimesExpDecayTest.h + Functions/StaticKuboToyabeTimesGausDecayTest.h + Functions/StretchExpMuonTest.h + Functions/StretchExpTest.h + Functions/TabulatedFunctionTest.h + Functions/ThermalNeutronBk2BkExpAlphaTest.h + Functions/ThermalNeutronBk2BkExpBetaTest.h + Functions/ThermalNeutronBk2BkExpConvPVoigtTest.h + Functions/ThermalNeutronBk2BkExpSigmaTest.h + Functions/ThermalNeutronDtoTOFFunctionTest.h + Functions/UserFunction1DTest.h + Functions/UserFunctionTest.h + Functions/VesuvioResolutionTest.h + Functions/VoigtTest.h GSLMatrixTest.h GSLVectorTest.h - GausDecayTest.h - GausOscTest.h - GaussianComptonProfileTest.h - GaussianTest.h - GramCharlierComptonProfileTest.h IPeakFunctionCentreParameterNameTest.h IPeakFunctionIntensityTest.h - IkedaCarpenterPVTest.h LatticeDomainCreatorTest.h LatticeFunctionTest.h - LeBailFitTest.h - LeBailFunctionTest.h - LeastSquaresTest.h - LevenbergMarquardtMDTest.h - LevenbergMarquardtTest.h - LinearBackgroundTest.h - LogNormalTest.h - Lorentzian1DTest.h - LorentzianTest.h MultiDomainCreatorTest.h MultiDomainFunctionTest.h - MuonFInteractionTest.h - NeutronBk2BkExpConvPVoigtTest.h - NormaliseByPeakAreaTest.h - PRConjugateGradientTest.h ParameterEstimatorTest.h - PawleyFitTest.h - PawleyFunctionTest.h - PeakParameterFunctionTest.h - PlotPeakByLogValueTest.h - PolynomialTest.h - ProcessBackgroundTest.h - ProductFunctionTest.h - ProductLinearExpTest.h - ProductQuadraticExpTest.h - PseudoVoigtTest.h - QuadraticTest.h - RefinePowderInstrumentParameters3Test.h - ReflectivityMulfTest.h - ResolutionTest.h - SeqDomainSpectrumCreatorTest.h - SimpleChebfunTest.h - SimplexTest.h SpecialFunctionSupportTest.h - SplineBackgroundTest.h - SplineInterpolationTest.h - SplineSmoothingTest.h - StaticKuboToyabeTest.h - StaticKuboToyabeTimesExpDecayTest.h - StaticKuboToyabeTimesGausDecayTest.h - StretchExpMuonTest.h - StretchExpTest.h - TabulatedFunctionTest.h - ThermalNeutronBk2BkExpAlphaTest.h - ThermalNeutronBk2BkExpBetaTest.h - ThermalNeutronBk2BkExpConvPVoigtTest.h - ThermalNeutronBk2BkExpSigmaTest.h - ThermalNeutronDtoTOFFunctionTest.h - UserFunction1DTest.h - UserFunctionTest.h - VesuvioResolutionTest.h - VoigtTest.h ) if (COVERALLS) diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateChiSquared.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateChiSquared.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/CalculateChiSquared.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateChiSquared.h index 34d50d67839be92218d2d149aad8272f7c9ce575..867ec832b324d9ad2353e516c3235fc791d48ed4 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateChiSquared.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateChiSquared.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** @@ -51,6 +52,7 @@ private: std::vector<size_t> m_fixedParameters; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateGammaBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateGammaBackground.h similarity index 87% rename from Framework/CurveFitting/inc/MantidCurveFitting/CalculateGammaBackground.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateGammaBackground.h index 4cf7ebc54a20af54e0396148ebdf74ccbca95d21..ac575bb8035a120fd8e0e3cc51739cd693b26f2d 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateGammaBackground.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateGammaBackground.h @@ -7,11 +7,14 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { +struct ResolutionParams; +} +namespace Algorithms { //--------------------------------------------------------------------------- // Forward declarations //--------------------------------------------------------------------------- struct DetectorParams; -struct ResolutionParams; /** @@ -75,17 +78,17 @@ private: void calculateBackgroundFromFoils(const size_t inputIndex, const size_t outputIndex); /// Compute expected background from single foil for spectrum at wsIndex - void calculateBackgroundSingleFoil(std::vector<double> &ctfoil, - const size_t wsIndex, - const FoilInfo &foilInfo, - const Kernel::V3D &detPos, - const DetectorParams &detPar, - const ResolutionParams &detRes); + void calculateBackgroundSingleFoil( + std::vector<double> &ctfoil, const size_t wsIndex, + const FoilInfo &foilInfo, const Kernel::V3D &detPos, + const DetectorParams &detPar, + const CurveFitting::Functions::ResolutionParams &detRes); /// Compute a TOF spectrum for the given inputs & spectrum - void calculateTofSpectrum(std::vector<double> &result, - std::vector<double> &tmpWork, const size_t wsIndex, - const DetectorParams &detpar, - const ResolutionParams &respar); + void + calculateTofSpectrum(std::vector<double> &result, + std::vector<double> &tmpWork, const size_t wsIndex, + const DetectorParams &detpar, + const CurveFitting::Functions::ResolutionParams &respar); /// Check and store appropriate input data void retrieveInputs(); @@ -133,6 +136,7 @@ private: API::Progress *m_progress; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateMSVesuvio.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateMSVesuvio.h similarity index 93% rename from Framework/CurveFitting/inc/MantidCurveFitting/CalculateMSVesuvio.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateMSVesuvio.h index 71b9767435f032f9d4564ec8ef53d4dd5ee160a6..96d84d452dadbbff40e58b32c09184768055420b 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateMSVesuvio.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateMSVesuvio.h @@ -9,16 +9,16 @@ namespace Mantid { namespace CurveFitting { -//----------------------------------------------------------------------------- -// CurveFitting forward declarations -//----------------------------------------------------------------------------- -struct DetectorParams; -struct ResolutionParams; namespace MSVesuvioHelper { class RandomNumberGenerator; struct Simulation; struct SimulationWithErrors; } +namespace Functions { +struct ResolutionParams; +} +namespace Algorithms { +struct DetectorParams; /** Calculates the multiple scattering & total scattering contributions @@ -88,12 +88,13 @@ private: void cacheInputs(); void calculateMS(const size_t wsIndex, API::ISpectrum &totalsc, API::ISpectrum &multsc) const; - void simulate(const DetectorParams &detpar, const ResolutionParams &respar, + void simulate(const DetectorParams &detpar, + const Functions::ResolutionParams &respar, MSVesuvioHelper::Simulation &simulCounts) const; void assignToOutput(const MSVesuvioHelper::SimulationWithErrors &avgCounts, API::ISpectrum &totalsc, API::ISpectrum &multsc) const; double calculateCounts(const DetectorParams &detpar, - const ResolutionParams &respar, + const Functions::ResolutionParams &respar, MSVesuvioHelper::Simulation &simulation) const; // single-event helpers @@ -116,7 +117,8 @@ private: const double e1res) const; // Member Variables - MSVesuvioHelper::RandomNumberGenerator *m_randgen; // random number generator + CurveFitting::MSVesuvioHelper::RandomNumberGenerator * + m_randgen; // random number generator size_t m_acrossIdx, m_upIdx, m_beamIdx; // indices of each direction Kernel::V3D m_beamDir; // Directional vector for beam @@ -136,6 +138,7 @@ private: API::MatrixWorkspace_sptr m_inputWS; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ConvertToYSpace.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvertToYSpace.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ConvertToYSpace.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvertToYSpace.h index c548e60ad362f48487a0dfdb134dc85c73cfccdd..6ed4648408a367518609fab46670ec8d4c4dbe18 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ConvertToYSpace.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvertToYSpace.h @@ -5,6 +5,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /// Simple data structure to store nominal detector values /// It avoids some functions taking a huge number of arguments @@ -101,6 +102,7 @@ private: API::MatrixWorkspace_sptr m_qOutputWS; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ConvolveWorkspaces.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvolveWorkspaces.h similarity index 95% rename from Framework/CurveFitting/inc/MantidCurveFitting/ConvolveWorkspaces.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvolveWorkspaces.h index 30ad9f3f040bf284b2274e08dbd3753b665eff41..19fa08127b0e1a54c8fdd6a0a6594e1faba251ec 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ConvolveWorkspaces.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvolveWorkspaces.h @@ -9,12 +9,13 @@ #include "MantidAPI/MatrixWorkspace_fwd.h" #include "MantidDataObjects/EventWorkspace.h" #include "MantidDataObjects/Workspace2D.h" -#include "MantidCurveFitting/CubicSpline.h" +#include "MantidCurveFitting/Functions/CubicSpline.h" #include "MantidAPI/ParamFunction.h" #include "MantidAPI/IFunction1D.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** Convolution of two workspaces Copyright © 2012 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge @@ -65,6 +66,7 @@ private: API::Progress *prog; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/EstimatePeakErrors.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EstimatePeakErrors.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/EstimatePeakErrors.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EstimatePeakErrors.h index fa886873c50b189aa5aab1cb5bc594f5b5a98c5b..c16a6b037959f973eed6c93204d73d11ed92ac45 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/EstimatePeakErrors.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EstimatePeakErrors.h @@ -5,6 +5,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { //--------------------------------------------------------------------------- /** @@ -44,6 +45,7 @@ private: void exec(); }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/EvaluateFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EvaluateFunction.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/EvaluateFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EvaluateFunction.h index 48bfd7abe57983d68d45b5c817c6361fb06313fa..55be4b63901ced996a404c85b2980f8702f52d29 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/EvaluateFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EvaluateFunction.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** @@ -44,6 +45,7 @@ private: void execConcrete(); }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Fit.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/Fit.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit.h index baaf264d06d012cfa0efda8169d7ae9181d28c68..20c76810d8a5affe143d42be189d9fd0b77ca9d6 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Fit.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit.h @@ -20,6 +20,7 @@ class IFuncMinimizer; } namespace CurveFitting { +namespace Algorithms { /** A generic fitting algorithm. It fits a function to some data in a workspace. @@ -114,6 +115,7 @@ protected: void copyMinimizerOutput(const API::IFuncMinimizer &minimizer); }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Fit1D.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit1D.h similarity index 99% rename from Framework/CurveFitting/inc/MantidCurveFitting/Fit1D.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit1D.h index 132ce49ede9e9ea965ca0537a32b2925355d4b0c..9cfc546a20c3023fc0d609560b8d3eece550cf72 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Fit1D.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit1D.h @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** Deprecation notice: instead of using this algorithm please use the Fit algorithm instead. @@ -140,6 +141,7 @@ protected: friend struct FitData; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FitPowderDiffPeaks.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h similarity index 77% rename from Framework/CurveFitting/inc/MantidCurveFitting/FitPowderDiffPeaks.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h index 1fe1d2551ebe75f32516f0077b138a6c153f8fc3..5436f304f29d3fd7a7076d4dcfca9dab48dd0b03 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/FitPowderDiffPeaks.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h @@ -8,13 +8,14 @@ #include "MantidAPI/ITableWorkspace_fwd.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidDataObjects/Workspace2D.h" -#include "MantidCurveFitting/BackgroundFunction.h" -#include "MantidCurveFitting/Polynomial.h" -#include "MantidCurveFitting/BackToBackExponential.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/Polynomial.h" +#include "MantidCurveFitting/Functions/BackToBackExponential.h" #include "MantidGeometry/Crystal/UnitCell.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** FitPowderDiffPeaks : Fit peaks in powder diffraction pattern. @@ -88,7 +89,7 @@ private: void genPeaksFromTable(DataObjects::TableWorkspace_sptr peakparamws); /// Generate a peak - BackToBackExponential_sptr + Functions::BackToBackExponential_sptr genPeak(std::map<std::string, int> hklmap, std::map<std::string, double> parammap, std::map<std::string, std::string> bk2bk2braggmap, bool &good, @@ -114,62 +115,66 @@ private: void fitPeaksRobust(); /// Fit a single peak - bool fitPeak(BackToBackExponential_sptr peak, - BackgroundFunction_sptr background, double leftdev, + bool fitPeak(Functions::BackToBackExponential_sptr peak, + Functions::BackgroundFunction_sptr background, double leftdev, double rightdev, size_t m_wsIndex, double &chi2); //--------------------------------------------------------------------------- /// Fit single peak in robust mode (no hint) - bool fitSinglePeakRobust(BackToBackExponential_sptr peak, - BackgroundFunction_sptr background, double leftdev, - double rightdev, - std::map<std::string, double> rightpeakparammap, - double &finalchi2); + bool + fitSinglePeakRobust(Functions::BackToBackExponential_sptr peak, + Functions::BackgroundFunction_sptr backgroundfunction, + double leftdev, double rightdev, + std::map<std::string, double> rightpeakparammap, + double &finalchi2); /// Fit signle peak by Monte Carlo/simulated annealing - bool fitSinglePeakSimulatedAnnealing(BackToBackExponential_sptr peak, - std::vector<std::string> paramtodomc); + bool + fitSinglePeakSimulatedAnnealing(Functions::BackToBackExponential_sptr peak, + std::vector<std::string> paramtodomc); /// Fit peak with confidence of the centre - bool fitSinglePeakConfidentX(BackToBackExponential_sptr peak); + bool fitSinglePeakConfidentX(Functions::BackToBackExponential_sptr peak); /// Fit peak with trustful peak parameters - bool fitSinglePeakConfident(BackToBackExponential_sptr peak, - BackgroundFunction_sptr backgroundfunction, - double leftbound, double rightbound, double &chi2, - bool &annhilatedpeak); + bool + fitSinglePeakConfident(Functions::BackToBackExponential_sptr peak, + Functions::BackgroundFunction_sptr backgroundfunction, + double leftbound, double rightbound, double &chi2, + bool &annhilatedpeak); /// Fit peak with confident parameters bool fitSinglePeakConfidentY(DataObjects::Workspace2D_sptr dataws, - BackToBackExponential_sptr peak, + Functions::BackToBackExponential_sptr peak, double dampingfactor); /// Fit peaks with confidence in fwhm and etc. - bool fitOverlappedPeaks(std::vector<BackToBackExponential_sptr> peaks, - BackgroundFunction_sptr backgroundfunction, - double gfwhm); + bool + fitOverlappedPeaks(std::vector<Functions::BackToBackExponential_sptr> peaks, + Functions::BackgroundFunction_sptr backgroundfunction, + double gfwhm); /// Fit multiple (overlapped) peaks - bool doFitMultiplePeaks(DataObjects::Workspace2D_sptr dataws, size_t wsindex, - API::CompositeFunction_sptr peaksfunc, - std::vector<BackToBackExponential_sptr> peakfuncs, - std::vector<bool> &vecfitgood, - std::vector<double> &vecchi2s); + bool doFitMultiplePeaks( + DataObjects::Workspace2D_sptr dataws, size_t wsindex, + API::CompositeFunction_sptr peaksfunc, + std::vector<Functions::BackToBackExponential_sptr> peakfuncs, + std::vector<bool> &vecfitgood, std::vector<double> &vecchi2s); /// Use Le Bail method to estimate and set the peak heights - void estimatePeakHeightsLeBail(DataObjects::Workspace2D_sptr dataws, - size_t wsindex, - std::vector<BackToBackExponential_sptr> peaks); + void estimatePeakHeightsLeBail( + DataObjects::Workspace2D_sptr dataws, size_t wsindex, + std::vector<Functions::BackToBackExponential_sptr> peaks); /// Set constraints on a group of overlapped peaks for fitting - void - setOverlappedPeaksConstraints(std::vector<BackToBackExponential_sptr> peaks); + void setOverlappedPeaksConstraints( + std::vector<Functions::BackToBackExponential_sptr> peaks); /// Fit 1 peak by 1 minimizer of 1 call of minimzer (simple version) bool doFit1PeakSimple(DataObjects::Workspace2D_sptr dataws, size_t workspaceindex, - BackToBackExponential_sptr peakfunction, + Functions::BackToBackExponential_sptr peakfunction, std::string minimzername, size_t maxiteration, double &chi2); @@ -181,25 +186,26 @@ private: // string minimzername, size_t maxiteration, double &chi2); /// Fit single peak with background to raw data - bool doFit1PeakBackground(DataObjects::Workspace2D_sptr dataws, - size_t wsindex, BackToBackExponential_sptr peak, - BackgroundFunction_sptr backgroundfunction, - double &chi2); + bool + doFit1PeakBackground(DataObjects::Workspace2D_sptr dataws, size_t wsindex, + Functions::BackToBackExponential_sptr peak, + Functions::BackgroundFunction_sptr backgroundfunction, + double &chi2); /// Fit 1 peak by using a sequential of minimizer bool doFit1PeakSequential(DataObjects::Workspace2D_sptr dataws, size_t workspaceindex, - BackToBackExponential_sptr peakfunction, + Functions::BackToBackExponential_sptr peakfunction, std::vector<std::string> minimzernames, std::vector<size_t> maxiterations, std::vector<double> dampfactors, double &chi2); /// Fit N overlapped peaks in a simple manner - bool doFitNPeaksSimple(DataObjects::Workspace2D_sptr dataws, size_t wsindex, - API::CompositeFunction_sptr peaksfunc, - std::vector<BackToBackExponential_sptr> peakfuncs, - std::string minimizername, size_t maxiteration, - double &chi2); + bool doFitNPeaksSimple( + DataObjects::Workspace2D_sptr dataws, size_t wsindex, + API::CompositeFunction_sptr peaksfunc, + std::vector<Functions::BackToBackExponential_sptr> peakfuncs, + std::string minimizername, size_t maxiteration, double &chi2); /// Store the function's parameter values to a map void storeFunctionParameters(API::IFunction_sptr function, @@ -241,15 +247,15 @@ private: // double leftbound, double rightbound); /// Estimate the range of a single peak - bool estimateSinglePeakRange(BackToBackExponential_sptr peak, - BackgroundFunction_sptr background, - BackToBackExponential_sptr rightpeak, + bool estimateSinglePeakRange(Functions::BackToBackExponential_sptr peak, + Functions::BackgroundFunction_sptr background, + Functions::BackToBackExponential_sptr rightpeak, double fwhm, bool ismostright, size_t m_wsIndex, double &chi2); /// Observe peak range with hint from right peak's properties - void observePeakRange(BackToBackExponential_sptr thispeak, - BackToBackExponential_sptr rightpeak, + void observePeakRange(Functions::BackToBackExponential_sptr thispeak, + Functions::BackToBackExponential_sptr rightpeak, double refpeakshift, double &peakleftbound, double &peakrightbound); @@ -266,17 +272,19 @@ private: /// Fit background function by removing the peak properly bool doFitBackground(DataObjects::Workspace2D_sptr dataws, - BackgroundFunction_sptr background, double leftpeakbound, - double rightpeakbound); + Functions::BackgroundFunction_sptr background, + double leftpeakbound, double rightpeakbound); /// Fit single peak without background - std::pair<bool, double> doFitPeak_Old(DataObjects::Workspace2D_sptr dataws, - BackToBackExponential_sptr peak, - double guessedfwhm, bool calchi2); + std::pair<bool, double> + doFitPeak_Old(DataObjects::Workspace2D_sptr dataws, + Functions::BackToBackExponential_sptr peak, double guessedfwhm, + bool calchi2); - std::pair<bool, double> doFitPeak(DataObjects::Workspace2D_sptr dataws, - BackToBackExponential_sptr peakfunction, - double guessedfwhm); + std::pair<bool, double> + doFitPeak(DataObjects::Workspace2D_sptr dataws, + Functions::BackToBackExponential_sptr peakfunction, + double guessedfwhm); /// Fit background-removed peak by Gaussian bool doFitGaussianPeak(DataObjects::Workspace2D_sptr dataws, size_t m_wsIndex, @@ -289,7 +297,7 @@ private: /// Calcualte the value of a single peak in a given range. void calculate1PeakGroup(std::vector<size_t> peakindexes, - BackgroundFunction_sptr background); + Functions::BackgroundFunction_sptr background); /// Parse the fitting result std::string parseFitResult(API::IAlgorithm_sptr fitalg, double &chi2, @@ -312,7 +320,7 @@ private: /// Plot a single peak to output vector void plotFunction(API::IFunction_sptr peakfunction, - BackgroundFunction_sptr background, + Functions::BackgroundFunction_sptr background, API::FunctionDomain1DVector domain); //----------------------------------------------------------------------------------------------- @@ -331,8 +339,9 @@ private: // CurveFitting::BackToBackExponential_sptr> m_peaksmap; /// Sorted vector for peaks. double = d_h, vector = (HKL), peak - std::vector<std::pair< - double, std::pair<std::vector<int>, BackToBackExponential_sptr>>> + std::vector< + std::pair<double, std::pair<std::vector<int>, + Functions::BackToBackExponential_sptr>>> m_vecPeakFunctions; /// Peak fitting information @@ -415,7 +424,7 @@ inline double linearInterpolateY(double x0, double xf, double y0, double yf, /// Estimate background for a pattern in a coarse mode void estimateBackgroundCoarse(DataObjects::Workspace2D_sptr dataws, - BackgroundFunction_sptr background, + Functions::BackgroundFunction_sptr background, size_t wsindexraw, size_t wsindexbkgd, size_t wsindexpeak); @@ -434,6 +443,7 @@ size_t findMaxValue(API::MatrixWorkspace_sptr dataws, size_t wsindex, /// Get function parameter name, value and etc information in string std::string getFunctionInfo(API::IFunction_sptr function); +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFit.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFit.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/LeBailFit.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFit.h index cd60219519794d3d0e53e12965233f4402904dfb..dd92a572da7db455acf9c7552bbc80132b9fb799 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFit.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFit.h @@ -3,19 +3,20 @@ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidCurveFitting/LeBailFunction.h" +#include "MantidCurveFitting/Algorithms/LeBailFunction.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidAPI/MatrixWorkspace_fwd.h" -#include "MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include "MantidAPI/ITableWorkspace_fwd.h" #include "MantidAPI/IFunction.h" #include <gsl/gsl_sf_erf.h> namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** LeBailFit : Algorithm to do Le Bail Fit. The workflow and architecture of this algorithm is different from LeBailFit, @@ -136,7 +137,7 @@ private: /// Examine whether the insturment parameter set to a peak can cause a valid /// set of peak profile of that peak bool examinInstrumentParameterValid( - CurveFitting::ThermalNeutronBk2BkExpConvPVoigt_sptr peak, double &d_h, + Functions::ThermalNeutronBk2BkExpConvPVoigt_sptr peak, double &d_h, double &tof_h, std::string &errmsg); /// Set parameters to each peak @@ -161,14 +162,13 @@ private: /// Group peaks together void groupPeaks(std::vector<std::vector< - std::pair<double, CurveFitting::ThermalNeutronBk2BkExpConvPVoigt_sptr>>> & + std::pair<double, Functions::ThermalNeutronBk2BkExpConvPVoigt_sptr>>> & peakgroupvec); /// Calcualate the peak heights of a group of overlapped peaks bool calculateGroupPeakIntensities( std::vector<std::pair< - double, CurveFitting::ThermalNeutronBk2BkExpConvPVoigt_sptr>> - peakgroup, + double, Functions::ThermalNeutronBk2BkExpConvPVoigt_sptr>> peakgroup, API::MatrixWorkspace_sptr dataws, size_t wsindex, bool zerobackground, std::vector<double> &allpeaksvalues); @@ -343,7 +343,7 @@ private: -------------------------------*/ /// Background function - CurveFitting::BackgroundFunction_sptr m_backgroundFunction; + Functions::BackgroundFunction_sptr m_backgroundFunction; /// Function parameters updated by fit std::map<std::string, Parameter> @@ -474,6 +474,7 @@ void convertTableWorkspaceToMaps( std::vector<std::map<std::string, std::string>> strmaps, std::vector<std::map<std::string, double>> dblmaps); +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFunction.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/LeBailFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFunction.h index 3b46dfb4dd6b4312a2783cad39b6ece8344d76e7..656bdc5066bd66ef1a1f9d93a07be215c3e1447c 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFunction.h @@ -5,14 +5,17 @@ #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/MatrixWorkspace_fwd.h" #include "MantidAPI/IPowderDiffPeakFunction.h" -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** LeBailFunction : LeBailFunction is to calculate peak intensities in a composite * function including neutron peak and background functions. + * Note: This is not a Mantid Fit Function, just a helper + * class to the algorithm @date 2013-04-26 : original LeBailFunction is not used by any other functions. And thus @@ -174,7 +177,7 @@ private: /// Composite functions for all peaks and background API::CompositeFunction_sptr m_compsiteFunction; /// Background function - BackgroundFunction_sptr m_background; + Functions::BackgroundFunction_sptr m_background; /// Parameters std::map<std::string, double> m_functionParameters; @@ -212,6 +215,7 @@ private: typedef boost::shared_ptr<LeBailFunction> LeBailFunction_sptr; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/NormaliseByPeakArea.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/NormaliseByPeakArea.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/NormaliseByPeakArea.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/NormaliseByPeakArea.h index 56ae1b98d345e495576ea53cf04931ecaebae29d..4cfac079922ccc7d1b7579199dad4aae0f9fc293 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/NormaliseByPeakArea.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/NormaliseByPeakArea.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** @@ -87,6 +88,7 @@ private: API::Progress *m_progress; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFit.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PawleyFit.h similarity index 87% rename from Framework/CurveFitting/inc/MantidCurveFitting/PawleyFit.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PawleyFit.h index c1c78b1044cd34e7e7a24c9d3277b1ae0b9098ba..7bddf3ec39884df67505bda3e8c5f800eda0ed2e 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFit.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PawleyFit.h @@ -5,11 +5,12 @@ #include "MantidAPI/Algorithm.h" #include "MantidAPI/ITableWorkspace_fwd.h" #include "MantidAPI/TableRow.h" -#include "MantidCurveFitting/PawleyFunction.h" +#include "MantidCurveFitting/Functions/PawleyFunction.h" #include "MantidKernel/Unit.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** @class V3DFromHKLColumnExtractor @@ -76,18 +77,18 @@ public: protected: double getTransformedCenter(double d, const Kernel::Unit_sptr &unit) const; - void addHKLsToFunction(PawleyFunction_sptr &pawleyFn, + void addHKLsToFunction(Functions::PawleyFunction_sptr &pawleyFn, const API::ITableWorkspace_sptr &tableWs, const Kernel::Unit_sptr &unit, double startX, double endX) const; API::ITableWorkspace_sptr - getLatticeFromFunction(const PawleyFunction_sptr &pawleyFn) const; - API::ITableWorkspace_sptr - getPeakParametersFromFunction(const PawleyFunction_sptr &pawleyFn) const; + getLatticeFromFunction(const Functions::PawleyFunction_sptr &pawleyFn) const; + API::ITableWorkspace_sptr getPeakParametersFromFunction( + const Functions::PawleyFunction_sptr &pawleyFn) const; API::IFunction_sptr - getCompositeFunction(const PawleyFunction_sptr &pawleyFn) const; + getCompositeFunction(const Functions::PawleyFunction_sptr &pawleyFn) const; void init(); void exec(); @@ -95,6 +96,7 @@ protected: Kernel::Unit_sptr m_dUnit; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PlotPeakByLogValue.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/PlotPeakByLogValue.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h index 891f455c6e78482bd644cc1a74e8a563730eded7..0c0acc74d34543a09c5202729c92f1c91aebdfaf 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/PlotPeakByLogValue.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** Takes a workspace group and fits the same spectrum in all workspaces with @@ -119,6 +120,7 @@ private: std::map<std::string, std::vector<std::string>> m_minimizerWorkspaces; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h index debe7054a8bbfc3ff26d11c0638cd687034fec87..ae51ee6bc546147d19ee3d365b728512e0bf0641 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h @@ -8,15 +8,16 @@ #include "MantidAPI/ITableWorkspace_fwd.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidDataObjects/Workspace2D.h" -#include "MantidCurveFitting/BackgroundFunction.h" -#include "MantidCurveFitting/Polynomial.h" -#include "MantidCurveFitting/BackToBackExponential.h" -#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/Polynomial.h" +#include "MantidCurveFitting/Functions/BackToBackExponential.h" +#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h" #include "MantidAPI/FunctionDomain.h" #include "MantidAPI/FunctionValues.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** RefinePowderInstrumentParameters : Algorithm to refine instrument geometry parameters only. @@ -154,7 +155,7 @@ private: DataObjects::Workspace2D_sptr dataWS; /// Map for all peaks to fit individually - std::map<std::vector<int>, CurveFitting::BackToBackExponential_sptr> mPeaks; + std::map<std::vector<int>, Functions::BackToBackExponential_sptr> mPeaks; /// Map for all peaks' error (fitted vs. experimental): [HKL]: Chi^2 std::map<std::vector<int>, double> mPeakErrors; @@ -187,7 +188,7 @@ private: size_t mMaxNumberStoredParameters; /// Modelling function - CurveFitting::ThermalNeutronDtoTOFFunction_sptr mFunction; + Functions::ThermalNeutronDtoTOFFunction_sptr mFunction; }; /** Formular for linear iterpolation: X = [(xf-x0)*Y - (xf*y0-x0*yf)]/(yf-y0) @@ -206,6 +207,7 @@ inline double linearInterpolateY(double x0, double xf, double y0, double yf, return y; } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters3.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters3.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h index 3af13a083e66cdfd186c9115c029b3ade0b6a252..56875c6c88568c1c49d67c13d29018a34627fb3b 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters3.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h @@ -8,12 +8,13 @@ #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" -#include "MantidCurveFitting/LeBailFit.h" -#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/LeBailFit.h" +#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** RefinePowderInstrumentParameters3 : @@ -183,7 +184,7 @@ private: std::map<std::string, Parameter> m_profileParameters; /// My function for peak positions - ThermalNeutronDtoTOFFunction_sptr m_positionFunc; + Functions::ThermalNeutronDtoTOFFunction_sptr m_positionFunc; /// Damping factor double m_dampingFactor; @@ -226,6 +227,7 @@ double calculateFunctionChiSquare(const std::vector<double> &modelY, const std::vector<double> &dataY, const std::vector<double> &dataE); +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SplineBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineBackground.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/SplineBackground.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineBackground.h index 53d877e613b3670c049e7683fa8f5c8c83114ca1..9aa91c96228c809036a56bac61cf5da9e9e01a36 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SplineBackground.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineBackground.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** SplineBackground @@ -61,6 +62,7 @@ private: void exec(); }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SplineInterpolation.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineInterpolation.h similarity index 95% rename from Framework/CurveFitting/inc/MantidCurveFitting/SplineInterpolation.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineInterpolation.h index b75259124c0cd45b1a657154a0b15d23a784cbe2..fbb797729d6c07784b7d6fa7efed53a4bfec8d2f 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SplineInterpolation.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineInterpolation.h @@ -3,10 +3,11 @@ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidCurveFitting/CubicSpline.h" +#include "MantidCurveFitting/Functions/CubicSpline.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** Takes two workspaces as input. One contain a set of points which define a spline, @@ -62,7 +63,7 @@ private: void exec(); /// CubicSpline member used to perform interpolation - boost::shared_ptr<CubicSpline> m_cspline; + boost::shared_ptr<Functions::CubicSpline> m_cspline; /// setup an output workspace using meta data from inws and taking a number of /// spectra @@ -91,6 +92,7 @@ private: int order) const; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SplineSmoothing.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineSmoothing.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/SplineSmoothing.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineSmoothing.h index 3c95fe4d0f927d458811de8854ffba1ab3ea2b70..ee17aa3dca0fb55f9ece30aee9b9fb5fc0cc8503 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SplineSmoothing.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineSmoothing.h @@ -4,10 +4,11 @@ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" #include "MantidAPI/WorkspaceFactory.h" -#include "MantidCurveFitting/BSpline.h" +#include "MantidCurveFitting/Functions/BSpline.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { /** Takes a 2D workspace and produces an output workspace containing a smoothed version of the data by selecting @@ -106,7 +107,7 @@ private: void performAdditionalFitting(API::MatrixWorkspace_sptr ws, const int row); /// CubicSpline member used to perform smoothing - boost::shared_ptr<BSpline> m_cspline; + boost::shared_ptr<Functions::BSpline> m_cspline; /// pointer to the input workspace API::MatrixWorkspace_sptr m_inputWorkspace; /// pointer to the input workspace converted to point data @@ -117,6 +118,7 @@ private: API::MatrixWorkspace_sptr m_outputWorkspace; }; +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BoundaryConstraint.h b/Framework/CurveFitting/inc/MantidCurveFitting/Constraints/BoundaryConstraint.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/BoundaryConstraint.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Constraints/BoundaryConstraint.h index 2b3301fa8ea844eea8951a2583b47df936d45c83..ef798c50e1afbe87ad21d94ee77fdd088c0bfa47 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/BoundaryConstraint.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Constraints/BoundaryConstraint.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Constraints { //---------------------------------------------------------------------- // Forward Declaration //---------------------------------------------------------------------- @@ -142,6 +143,7 @@ private: double m_upperBound; }; +} // namespace Constraints } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncFitting.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncFitting.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncFitting.h rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncFitting.h index 7bbc76c8bb8e07885624d8244efddb334a28d9d0..41cc8170906b0b63a589a46c417aa0fb4442a974 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncFitting.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncFitting.h @@ -12,6 +12,7 @@ namespace Mantid { namespace CurveFitting { +namespace CostFunctions { /** A semi-abstract class for a cost function for fitting functions. Implement val(), deriv(), and valAndDeriv() methods in a concrete class. @@ -100,6 +101,7 @@ protected: mutable bool m_dirtyHessian; /// dirty hessian flag }; +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncIgnorePosPeaks.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncIgnorePosPeaks.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncIgnorePosPeaks.h rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncIgnorePosPeaks.h index ffef9d6666730776e3cc435975acfafa650cf799..2a38310ecf35d42be1781cc744f35b342ffdfbb6 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncIgnorePosPeaks.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncIgnorePosPeaks.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace CostFunctions { /** Cost function which allows positive peaks to be ignored and is suitable for e.g. fitting the background @@ -61,6 +62,7 @@ private: const std::string m_name; }; +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncLeastSquares.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncLeastSquares.h rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h index be05dae8779b0db76f5cd7ba9060ae7850cb4e99..9478d2ab3be0dd7fc4ee4b47e5d147f139741c96 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncLeastSquares.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h @@ -4,7 +4,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/CostFuncFitting.h" +#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h" #include "MantidCurveFitting/GSLMatrix.h" #include "MantidCurveFitting/GSLVector.h" @@ -13,6 +13,7 @@ namespace CurveFitting { class SeqDomain; class ParDomain; +namespace CostFunctions { /** Cost function for least squares @author Anders Markvardsen, ISIS, RAL @@ -101,12 +102,13 @@ protected: mutable double m_pushedValue; mutable GSLVector m_pushedParams; - friend class SeqDomain; - friend class ParDomain; + friend class CurveFitting::SeqDomain; + friend class CurveFitting::ParDomain; double m_factor; }; +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncRwp.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncRwp.h rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h index a58da7c674ccf477b2ff508921c8a133308e392d..4c5b04e99c27543c1150e0f06421ed9d57d418fb 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncRwp.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h @@ -4,7 +4,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidCurveFitting/GSLMatrix.h" #include "MantidCurveFitting/GSLVector.h" @@ -16,6 +16,8 @@ namespace CurveFitting { class SeqDomain; class ParDomain; +namespace CostFunctions { + /** Cost function for Rwp = (sum_i (( obs_i - cal_i )/sigma_i)**2 ) / (sum_i (obs_i/sigma_i)**2) @@ -68,6 +70,7 @@ private: double calSqrtW(API::FunctionValues_sptr values) const; }; +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncUnweightedLeastSquares.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncUnweightedLeastSquares.h rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h index 17fc016bb426d6e2c37c534c89f796124d3bb7a5..85f979e8876e3206414b27f2a3173d1c7f0f20bf 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncUnweightedLeastSquares.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h @@ -2,10 +2,11 @@ #define MANTID_CURVEFITTING_COSTFUNCUNWEIGHTEDLEASTSQUARES_H_ #include "MantidKernel/System.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" namespace Mantid { namespace CurveFitting { +namespace CostFunctions { /** @class CostFuncUnweightedLeastSquares * @@ -53,6 +54,7 @@ protected: double getResidualVariance() const; }; +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BFGS_Minimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/BFGS_Minimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h index dbafd43e1a5452b7c3d9efdf9a74de52dbb6a3aa..137e3f2f08b1f4fd5f36f13a801eda26cb229bf1 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/BFGS_Minimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h @@ -5,10 +5,11 @@ // Includes //---------------------------------------------------------------------- #include "MantidCurveFitting/DllConfig.h" -#include "MantidCurveFitting/DerivMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h" namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** Implementing Broyden-Fletcher-Goldfarb-Shanno (BFGS) algorithm by wrapping the IFuncMinimizer interface around the GSL implementation of this algorithm. @@ -52,6 +53,7 @@ protected: static Kernel::Logger &g_log; }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DampingMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DampingMinimizer.h similarity index 92% rename from Framework/CurveFitting/inc/MantidCurveFitting/DampingMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DampingMinimizer.h index 4c8be89a8f28e194246585da2ad52351ad28abb4..a09325d17a0556d65ff8fe3c8f925ccfd394c18d 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/DampingMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DampingMinimizer.h @@ -10,8 +10,10 @@ namespace Mantid { namespace CurveFitting { - +namespace CostFunctions { class CostFuncLeastSquares; +} // namespace CostFunctions +namespace FuncMinimisers { /** Implements a least squares minimization algorithm with damping. @@ -56,13 +58,13 @@ public: private: /// Pointer to the cost function. Must be the least squares. - boost::shared_ptr<CostFuncLeastSquares> m_leastSquares; + boost::shared_ptr<CostFunctions::CostFuncLeastSquares> m_leastSquares; /// Relative tolerance. double m_relTol; /// The damping mu parameter in the Levenberg-Marquardt method. // double m_damping; }; - +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DerivMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DerivMinimizer.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/DerivMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DerivMinimizer.h index f894626253e6974c47a3a924af6c6d0923f3c67a..2da8b40ba41cf1e55c5a3a9fe27ba0822cc7e428 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/DerivMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DerivMinimizer.h @@ -12,6 +12,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** A wrapper around the GSL functions implementing a minimizer using derivatives. Concrete classes must implement the getGSLMinimizerType() method. @@ -94,6 +95,7 @@ private: void initGSLMMin(); }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FABADAMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h similarity index 93% rename from Framework/CurveFitting/inc/MantidCurveFitting/FABADAMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h index 751e195e233676fd8a9f8be9af86c8a123189af1..c2c5b5ebfb75a997919a933003aff9b3beee60ea 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/FABADAMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h @@ -10,7 +10,16 @@ namespace Mantid { namespace CurveFitting { +namespace CostFunctions { +/// Forward Declaration class CostFuncLeastSquares; +} +} +} + +namespace Mantid { +namespace CurveFitting { +namespace FuncMinimisers { /** FABADA : TODO: DESCRIPTION @@ -56,7 +65,7 @@ private: /// Pointer to the cost function. Must be the least squares. /// Intentar encontrar una manera de sacar aqui el numero de parametros que /// no sea necesaria la cost function - boost::shared_ptr<CostFuncLeastSquares> m_leastSquares; + boost::shared_ptr<CostFunctions::CostFuncLeastSquares> m_leastSquares; /// The number of iterations done. size_t m_counter; /// @@ -88,6 +97,8 @@ private: /// Maximum number of iterations size_t m_max_iter; }; + +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FRConjugateGradientMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/FRConjugateGradientMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h index cbe9ac8d9d7f1af2789f5a2aa0a1377a517d15ed..683b3a8c3b0521ab38b2be2e29d0831b84f844a3 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/FRConjugateGradientMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h @@ -5,10 +5,11 @@ // Includes //---------------------------------------------------------------------- #include "MantidCurveFitting/DllConfig.h" -#include "MantidCurveFitting/DerivMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h" namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** Implementing Fletcher-Reeves flavour of the conjugate gradient algorithm by wrapping the IFuncMinimizer interface around the GSL implementation of this algorithm. @@ -51,6 +52,7 @@ protected: virtual const gsl_multimin_fdfminimizer_type *getGSLMinimizerType(); }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMDMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h similarity index 93% rename from Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMDMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h index 5d39606ed1f013a8041f9abb79ea943fe2c3f2c1..139b82aff0229675b5193519173860073e388008 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMDMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h @@ -10,9 +10,11 @@ namespace Mantid { namespace CurveFitting { - +namespace CostFunctions { class CostFuncLeastSquares; +} // namespace CostFunctions +namespace FuncMinimisers { /** Implementing Levenberg-Marquardt algorithm. Uses the normal system calculate the corrections to the parameters. Expects a cost function that can evaluate the value, the derivatives and the hessian matrix. @@ -57,7 +59,7 @@ public: private: /// Pointer to the cost function. Must be the least squares. - boost::shared_ptr<CostFuncLeastSquares> m_leastSquares; + boost::shared_ptr<CostFunctions::CostFuncLeastSquares> m_leastSquares; /// The tau parameter in the Levenberg-Marquardt method. double m_tau; /// The damping mu parameter in the Levenberg-Marquardt method. @@ -71,6 +73,7 @@ private: std::vector<double> m_D; }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h index a5af8ed98820db924555df0d58ef32974ad5c18c..e2c786adb32c18a7f1b32bb90f7d2813405df4c3 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h @@ -11,6 +11,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** Implementing Levenberg-Marquardt by wrapping the IFuncMinimizer interface around the GSL implementation of this algorithm. @@ -79,6 +80,7 @@ private: double m_relError; }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PRConjugateGradientMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/PRConjugateGradientMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h index 80d5feaf207f6260087c35404fed96b97c6de952..99f37e47c2b7f46d35eb3fb2e36c7b0b9040e846 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/PRConjugateGradientMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h @@ -5,10 +5,11 @@ // Includes //---------------------------------------------------------------------- #include "MantidCurveFitting/DllConfig.h" -#include "MantidCurveFitting/DerivMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h" namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** Implementing Polak-Ribiere flavour of the conjugate gradient algorithm by wrapping the IFuncMinimizer interface around the GSL implementation of this algorithm. @@ -49,6 +50,7 @@ protected: virtual const gsl_multimin_fdfminimizer_type *getGSLMinimizerType(); }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SimplexMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/SimplexMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h index 5ca099ae2b281a22b1d70aecade9fea5fb4a732f..14e637fd956804ea8580a0ebd7a6cc656b9c1942 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SimplexMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** Implementing Simplex by wrapping the IFuncMinimizer interface around the GSL implementation of this algorithm. @@ -87,6 +88,7 @@ private: gsl_multimin_function gslContainer; }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SteepestDescentMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/SteepestDescentMinimizer.h rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h index 7e319e65c8427794ee1d1ee9eefac848983f0e82..a251a9eae3b7ec077233b9ce66b96812aead1e81 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SteepestDescentMinimizer.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h @@ -5,10 +5,11 @@ // Includes //---------------------------------------------------------------------- #include "MantidCurveFitting/DllConfig.h" -#include "MantidCurveFitting/DerivMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h" namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** Implementing the steepest descent algorithm by wrapping the IFuncMinimizer interface around the GSL implementation of this algorithm. @@ -51,6 +52,7 @@ protected: static Kernel::Logger &g_log; }; +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Abragam.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Abragam.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/Abragam.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Abragam.h index 426c69d337e2ee0bc9964f7d04a401f4aca6fcaf..0bfcade021dcda28e4a3e875a4fcb048d8bc1c48 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Abragam.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Abragam.h @@ -12,6 +12,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide Abragam fitting function for muon scientists @@ -64,6 +65,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BSpline.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BSpline.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/BSpline.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/BSpline.h index a2a59dad6354494d31ddefa4cb73735db5244192..b45302749aaad9b49e7ca5082d9f4dbe64c7afc5 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/BSpline.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BSpline.h @@ -4,7 +4,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include <boost/shared_ptr.hpp> #include <gsl/gsl_errno.h> @@ -12,6 +12,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** A wrapper around GSL functions implementing a B-spline. @@ -75,6 +76,7 @@ private: m_bsplineDerivWorkspace; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BackToBackExponential.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackToBackExponential.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/BackToBackExponential.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackToBackExponential.h index 103d8679b413e23627156e4151a577b52331b48b..83910c281dbe962f7dcfabaad1d381c90f90ffcf 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/BackToBackExponential.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackToBackExponential.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide BackToBackExponential peak shape function interface to IPeakFunction. That is the function: @@ -87,6 +88,7 @@ protected: typedef boost::shared_ptr<BackToBackExponential> BackToBackExponential_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BackgroundFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackgroundFunction.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/BackgroundFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackgroundFunction.h index 46f9f2f25c32946dd9b517e80a2f24b58f67ecff..fc373fc1331bff0219d8f2d477db154ef6c9c97b 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/BackgroundFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackgroundFunction.h @@ -13,6 +13,7 @@ class Parser; namespace Mantid { namespace CurveFitting { +namespace Functions { /** A background function. Functions that are intended to be used as backgrounds should inherit from this class to enable certain features. E.g. querying @@ -74,6 +75,7 @@ public: typedef boost::shared_ptr<BackgroundFunction> BackgroundFunction_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BivariateNormal.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/BivariateNormal.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h index 5404e669d06fa3f1f9909bf8350dfd6d46f01481..59fd0db97239581ebaa53d4a3a430e70b2536390 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/BivariateNormal.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h @@ -4,15 +4,16 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidAPI/IFunctionMW.h" #include "MantidAPI/IFunction1D.h" #include "MantidAPI/ParamFunction.h" #include "MantidKernel/cow_ptr.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** * Provide peak shape function interface a Peak shape on one time slice of a @@ -176,6 +177,7 @@ protected: expCoeffxy; //<Other common values used in calculating values and //<derivatives }; +} // namespace Functions } } diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Bk2BkExpConvPV.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Bk2BkExpConvPV.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/Bk2BkExpConvPV.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Bk2BkExpConvPV.h index f7511c3810a8eda9e2cdd4fda957c04f9d581253..be7ed03f4ad95d00407a788af69241ca74bbe386 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Bk2BkExpConvPV.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Bk2BkExpConvPV.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Bk2BkExpConvPV : Peak profile as tback-to-back exponential convoluted with pseudo-Voigt. @@ -92,6 +93,7 @@ private: typedef boost::shared_ptr<Bk2BkExpConvPV> Bk2BkExpConvPV_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ChebfunBase.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ChebfunBase.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h index 37eafa709eb65aa33d783d805ca48f5ed320a53d..92dd84b3ddf1deda279dc2435e33092d12c71afa 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ChebfunBase.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h @@ -1,8 +1,8 @@ #ifndef MANTID_CURVEFITTING_CHEBFUNBASE_H #define MANTID_CURVEFITTING_CHEBFUNBASE_H -#include "DllConfig.h" -#include "GSLMatrix.h" +#include "MantidCurveFitting/DllConfig.h" +#include "MantidCurveFitting/GSLMatrix.h" #include <boost/shared_ptr.hpp> #include <vector> @@ -15,6 +15,7 @@ class IFunction; } namespace CurveFitting { +namespace Functions { /// Type of the approximated function typedef std::function<double(double)> ChebfunFunctionType; @@ -213,6 +214,7 @@ boost::shared_ptr<ChebfunBase> ChebfunBase::bestFitAnyTolerance( return ChebfunBase_sptr(); } +} // namespace Functions } // CurveFitting } // Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Chebyshev.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Chebyshev.h similarity index 95% rename from Framework/CurveFitting/inc/MantidCurveFitting/Chebyshev.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Chebyshev.h index 100a00197e1a218cf4d7016a7c45d16e38430f72..0b4209636d5883ea7112815e5e7d0e2369da0144 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Chebyshev.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Chebyshev.h @@ -4,11 +4,12 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include <valarray> namespace Mantid { namespace CurveFitting { +namespace Functions { /** Implements Chebyshev polynomial expansion. @@ -72,6 +73,7 @@ private: typedef boost::shared_ptr<Chebyshev> Chebyshev_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonPeakProfile.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonPeakProfile.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ComptonPeakProfile.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonPeakProfile.h index 22d9514f8f6749ea7e5a5d9d6153613673be7005..a3a8d2dfb1853fa9ef4fa58a698c0702fc809f7d 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonPeakProfile.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonPeakProfile.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** This implements a resolution function for fitting a single mass in a compton scattering spectrum. The @@ -81,6 +82,7 @@ private: double m_hwhmLorentz; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonProfile.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonProfile.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/ComptonProfile.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonProfile.h index c533219940a0172149577792504bae5ea9c88330..58f9e65ab1ff2aaad49b01da28636e012b8158dd 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonProfile.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonProfile.h @@ -2,18 +2,21 @@ #define MANTID_CURVEFITTING_COMPTONPROFILE_H_ #include "MantidCurveFitting/DllConfig.h" -#include "MantidCurveFitting/VesuvioResolution.h" +#include "MantidCurveFitting/Functions/VesuvioResolution.h" #include "MantidAPI/IPeakFunction.h" #include "MantidAPI/MatrixWorkspace_fwd.h" #include "MantidAPI/ParamFunction.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { //--------------------------------------------------------------------------- // Forward declarations //--------------------------------------------------------------------------- struct DetectorParams; +} +namespace Functions { /** This class serves as a base-class for ComptonProfile type functions. @see GaussianComptonProfile, GramCharlierComptonProfile @@ -59,13 +62,14 @@ public: /// Pre-calculate the Y-space values with specified resolution parameters void cacheYSpaceValues(const std::vector<double> &tseconds, - const bool isHistogram, const DetectorParams &detpar, + const bool isHistogram, + const Algorithms::DetectorParams &detpar, const ResolutionParams &respar); /// Pre-calculate the Y-space values virtual void cacheYSpaceValues(const std::vector<double> &tseconds, const bool isHistogram, - const DetectorParams &detpar); + const Algorithms::DetectorParams &detpar); /// Turn off logger void disableLogging() { m_log.setEnabled(false); } ///@} @@ -133,6 +137,7 @@ protected: ///@} }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonScatteringCountRate.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonScatteringCountRate.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/ComptonScatteringCountRate.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonScatteringCountRate.h index 1b3c42cfd9cf84997e60c8a747676fe23bfe542f..a34ee169656166cbcd099378c4ca6a7214c248cc 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonScatteringCountRate.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonScatteringCountRate.h @@ -2,12 +2,13 @@ #define MANTID_CURVEFITTING_COMPTONSCATTERINGCOUNTRATE_H_ #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/ComptonProfile.h" +#include "MantidCurveFitting/Functions/ComptonProfile.h" #include "MantidKernel/ClassMacros.h" #include "MantidKernel/Matrix.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Implements a specialized function that encapsulates the combination of @@ -92,6 +93,7 @@ private: std::vector<double> m_dataErrorRatio; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Convolution.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Convolution.h similarity index 99% rename from Framework/CurveFitting/inc/MantidCurveFitting/Convolution.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Convolution.h index 499d426d8bbcccc70ac5f21e8e8c68a572c651b9..b1e5791269a82fcdc5fbef17b757ab8b22b24a85 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Convolution.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Convolution.h @@ -11,6 +11,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Performes convolution of two functions. @@ -151,6 +152,7 @@ private: mutable std::vector<double> m_resolution; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CubicSpline.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/CubicSpline.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/CubicSpline.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/CubicSpline.h index 0ad0f34ccc00de17b46e5f28653f5e07a34d4ccc..3dbaa2c4dc2cbae2236fac99393de0856a271c1d 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CubicSpline.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/CubicSpline.h @@ -4,7 +4,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include <boost/scoped_array.hpp> #include <gsl/gsl_errno.h> @@ -13,6 +13,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** A wrapper around GSL functions implementing cubic spline interpolation. @@ -117,6 +118,7 @@ private: typedef boost::shared_ptr<CubicSpline> CubicSpline_sptr; typedef const boost::shared_ptr<CubicSpline> CubicSpline_const_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DeltaFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DeltaFunction.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/DeltaFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/DeltaFunction.h index 1f0b682f088492ab13765438ac147bfd7f53aecb..9f98b9cafbcffd02ce3fa9281323ae05918054c5 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/DeltaFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DeltaFunction.h @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Delta function. Makes sence in Convolution only. @@ -78,6 +79,7 @@ protected: } }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DiffRotDiscreteCircle.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffRotDiscreteCircle.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/DiffRotDiscreteCircle.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffRotDiscreteCircle.h index 8b1c38f194acfe816aa5e15788132eb720c86413..0157a963217c46f6cc209ebef4c09d2e9e195b5d 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/DiffRotDiscreteCircle.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffRotDiscreteCircle.h @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** @author Jose Borreguero, NScD @date December 02 2013 @@ -125,6 +126,7 @@ private: boost::shared_ptr<InelasticDiffRotDiscreteCircle> m_inelastic; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DiffSphere.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffSphere.h similarity index 99% rename from Framework/CurveFitting/inc/MantidCurveFitting/DiffSphere.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffSphere.h index 7db3b4e805332c1280f709fc4f2da9b277e82a66..b7eeb4b57e017333dd7ac416b11752691c7693f2 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/DiffSphere.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffSphere.h @@ -14,6 +14,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** @author Jose Borreguero, NScD @date 11/14/2011 @@ -172,6 +173,7 @@ private: m_inelastic; // inelastic intensity of the DiffSphere structure factor }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DynamicKuboToyabe.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DynamicKuboToyabe.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/DynamicKuboToyabe.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/DynamicKuboToyabe.h index 7b24a53770f71e84d18c280f07f50843b2764987..9865dd6b967b0f8104c7d4c385ac8fe4a9265fb9 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/DynamicKuboToyabe.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DynamicKuboToyabe.h @@ -11,6 +11,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide Dynamic Kubo Toyabe function interface to IFunction1D for muon scientists. @@ -87,6 +88,7 @@ private: double m_minEps, m_maxEps; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/EndErfc.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/EndErfc.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/EndErfc.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/EndErfc.h index 490ab7dba3c2a0c120b0f083e356e2437ebca4f7..1519739ca40c79dbaa5616264e928a7407fed088 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/EndErfc.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/EndErfc.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide Errore function erfc()for calibrating the end of a tube. @@ -57,6 +58,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecay.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecay.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/ExpDecay.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecay.h index 60ccb117530cc9b2da7b49617b9eb27e012aa7e6..45732a7d1124801438877998d3b7e6b93e8df03a 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecay.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecay.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide exponential decay function: h*exp(-(x-c)/t) @@ -56,6 +57,7 @@ protected: const size_t nData); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayMuon.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayMuon.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayMuon.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayMuon.h index b12e4e30a1224464520fb86898ae1df7dda76562..7a42e6a9aaf3058eda3bf8a9ab9877feb10150c4 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayMuon.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayMuon.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide exponential decay function: h*exp(-lambda.x) @@ -59,6 +60,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayOsc.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayOsc.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayOsc.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayOsc.h index 9f896924044cb2578fda36b0e6a93e150e60d760..07d3ad4d03a47a66ed337c142a60e9cf21012683 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayOsc.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayOsc.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide oscillating exponential decay function: h*exp(-lambda.x)*(cos(2pi*f*x+phi)) @@ -61,6 +62,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FlatBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/FlatBackground.h similarity index 93% rename from Framework/CurveFitting/inc/MantidCurveFitting/FlatBackground.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/FlatBackground.h index 1de1aba3bd9ee7a9c61ee04dd1151e4e9381fa3b..cb1add3374562c945fe024946ec3079fdb382742 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/FlatBackground.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/FlatBackground.h @@ -1,11 +1,12 @@ #ifndef MANTID_CURVEFITTING_FLATBACKGROUND_H_ #define MANTID_CURVEFITTING_FLATBACKGROUND_H_ -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include "MantidKernel/System.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** FlatBackground : TODO: DESCRIPTION @@ -47,6 +48,7 @@ private: void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FullprofPolynomial.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/FullprofPolynomial.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/FullprofPolynomial.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/FullprofPolynomial.h index 114437e08a4a6e6aee0465c1d92866fd9822b91e..8a5f52c3953d950f5b62cf7a0b981b4f84c2e7ad 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/FullprofPolynomial.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/FullprofPolynomial.h @@ -2,10 +2,11 @@ #define MANTID_CURVEFITTING_FULLPROFPOLYNOMIAL_H_ #include "MantidKernel/System.h" -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** FullprofPolynomial : Polynomial background defined in Fullprof @@ -75,6 +76,7 @@ private: typedef boost::shared_ptr<FullprofPolynomial> FullprofPolynomial_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GausDecay.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausDecay.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/GausDecay.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausDecay.h index ac17d7122184a9f52292a9c78d746ff4437fde4f..053d65163a9f60a0e561be628579b227d1035913 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/GausDecay.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausDecay.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide gaussian decay function: A*exp(-(sigma.x)^2)) @@ -59,6 +60,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GausOsc.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausOsc.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/GausOsc.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausOsc.h index a80e5df087e7bc3e06fb5704268eab30bfc6731d..b54279a77ada4db8cfb55bbf53a1d1fe9b482049 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/GausOsc.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausOsc.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide gaussian decay function: A*exp(-(sigma.x)^2)) @@ -59,6 +60,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Gaussian.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Gaussian.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/Gaussian.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Gaussian.h index da8d2b4914c7e01e33c5ef83cd1e7e2944a40f29..c56f8618d54c3feca5e7bbc3937ae6456b771c58 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Gaussian.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Gaussian.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide gaussian peak shape function interface to IPeakFunction. I.e. the function: Height*exp(-0.5*((x-PeakCentre)/Sigma)^2). @@ -79,6 +80,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GaussianComptonProfile.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GaussianComptonProfile.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/GaussianComptonProfile.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/GaussianComptonProfile.h index 4030a64cac4039f4307b3b07fd9ed045985d06dc..60c6ffe5f6266ade00fef84d9785ab66e12588ea 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/GaussianComptonProfile.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GaussianComptonProfile.h @@ -2,10 +2,11 @@ #define MANTID_CURVEFITTING_GAUSSIANCOMPTONPROFILE_H_ #include "MantidCurveFitting/DllConfig.h" -#include "MantidCurveFitting/ComptonProfile.h" +#include "MantidCurveFitting/Functions/ComptonProfile.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Implements a function to calculate the Compton profile of a nucleus using a @@ -64,6 +65,7 @@ private: const double amplitude) const; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GramCharlierComptonProfile.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GramCharlierComptonProfile.h similarity index 94% rename from Framework/CurveFitting/inc/MantidCurveFitting/GramCharlierComptonProfile.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/GramCharlierComptonProfile.h index bc8e1b4fd01d4ac647b5c2afd8812084adbd850b..14cbb33b841dfca79fb96e8da8705c1d25da2012 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/GramCharlierComptonProfile.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GramCharlierComptonProfile.h @@ -2,10 +2,11 @@ #define MANTID_CURVEFITTING_GRAMCHARLIERCOMPTONPROFILE_H_ #include "MantidCurveFitting/DllConfig.h" -#include "MantidCurveFitting/ComptonProfile.h" +#include "MantidCurveFitting/Functions/ComptonProfile.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Implements a function to calculate the Compton profile of a nucleus using a @@ -75,7 +76,8 @@ private: size_t wi, double startX, double endX); /// Pre-calculate the Y-space values void cacheYSpaceValues(const std::vector<double> &tseconds, - const bool isHistogram, const DetectorParams &detpar); + const bool isHistogram, + const Algorithms::DetectorParams &detpar); /// The active hermite coefficents std::vector<short> m_hermite; @@ -95,6 +97,7 @@ private: bool m_userFixedFSE; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/IkedaCarpenterPV.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/IkedaCarpenterPV.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h index ecb2f57bc9166e4d8232bfdd9bc90ef2208496eb..bc8cc43f3e66a697a9e61977a4b8c037736306bb 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/IkedaCarpenterPV.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide Ikeda-Carpenter-pseudo-Voigt peak shape function interface to IPeakFunction. See wiki @@ -96,6 +97,7 @@ private: double &eta) const; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LinearBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/LinearBackground.h similarity index 95% rename from Framework/CurveFitting/inc/MantidCurveFitting/LinearBackground.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/LinearBackground.h index 3919c08b16233c0625e92ec5e7496e8280a9ce86..e8ba0edd4443cd9bf9277159cf528a001dd62fb9 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LinearBackground.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/LinearBackground.h @@ -4,10 +4,11 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide linear function interface to IFunction. I.e. the function: A0+A1*x. @@ -61,6 +62,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LogNormal.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/LogNormal.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/LogNormal.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/LogNormal.h index 6816b53db955c049ce4ae2e8d83230f99e43eb47..90273384e73961fbff8ab34e0fea5f01e0bb5adf 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LogNormal.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/LogNormal.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide Log Normal function: h*exp(-(log(x)-t)^2 / (2*b^2) )/x @@ -54,6 +55,7 @@ protected: const size_t nData); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian.h index b6b816d9d1fbd762e8d01d271bfa37ed305b06e3..132408dee74bf59f15c532d86ac917d00b2d32da 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide lorentzian peak shape function interface to IPeakFunction. I.e. the function: \f$ \frac{A}{\pi}( \Gamma/2((x-PeakCentre)^2+(\Gamma/2)^2) @@ -69,6 +70,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian1D.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian1D.h similarity index 95% rename from Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian1D.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian1D.h index 66fb65e18476ca6e7ad6bb53eb9cd19e8b8b7bc0..6211f2d053b617abcf03f5084cc31ee7966ec979 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian1D.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian1D.h @@ -4,10 +4,11 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Fit1D.h" +#include "MantidCurveFitting/Algorithms/Fit1D.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Deprecation notice: instead of using this algorithm please use the Fit algorithm where the Function parameter of this algorithm is used @@ -50,7 +51,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. File change history is stored at: <https://github.com/mantidproject/mantid> Code Documentation is available at: <http://doxygen.mantidproject.org> */ -class DLLExport Lorentzian1D : public Fit1D { +class DLLExport Lorentzian1D : public Algorithms::Fit1D { public: /// Destructor virtual ~Lorentzian1D(){}; @@ -80,6 +81,7 @@ private: const double *xValues, const size_t nData); }; +} // namespace Functions } // namespace Algorithm } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/MuonFInteraction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/MuonFInteraction.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/MuonFInteraction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/MuonFInteraction.h index 508ea9d2279cf4635302d25f6a90425c4bb7a156..f474266b5605ce12a87c96a79e392d5410ac75dc 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/MuonFInteraction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/MuonFInteraction.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide Muon F Interaction fitting function @@ -57,6 +58,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h index 93933ea8871a7327b1b0ceee740fc07591c25cc5..7ddc907fdabb05231397f386d2bff50dab3e7d54 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** NeutronBk2BkExpConvPVoigt : Back-to-back exponential function convoluted with pseudo-voigt @@ -128,6 +129,7 @@ private: mutable double m_N; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h similarity index 99% rename from Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h index a9e3214fd494c581db6725e82b1b4c62cd5ca66d..a56373b31075af5abccf29966b2c68b123f557a1 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h @@ -13,6 +13,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** @class PawleyParameterFunction @@ -173,6 +174,7 @@ protected: typedef boost::shared_ptr<PawleyFunction> PawleyFunction_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PeakParameterFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PeakParameterFunction.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/PeakParameterFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/PeakParameterFunction.h index 22621031ef1242d457f5d30003eb08aeec097836..e0d34610fbf5f7bd3b948b584c0691614dc68058 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/PeakParameterFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PeakParameterFunction.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** PeakParameterFunction : @@ -62,6 +63,7 @@ protected: API::IPeakFunction_sptr m_peakFunction; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Polynomial.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Polynomial.h similarity index 95% rename from Framework/CurveFitting/inc/MantidCurveFitting/Polynomial.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Polynomial.h index 94cfa29b53e326a109883a9d444bfd66183698fc..fcb944652788d7d91509eb50452853cf582f13ea 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Polynomial.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Polynomial.h @@ -2,11 +2,12 @@ #define MANTID_CURVEFITTING_POLYNOMIAL_H_ #include "MantidKernel/System.h" -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { /** Polynomial : N-th polynomial background function. @@ -73,6 +74,7 @@ private: typedef boost::shared_ptr<Polynomial> Polynomial_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ProcessBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProcessBackground.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/ProcessBackground.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProcessBackground.h index 3b9c09886fefe4018ceac089427213d4f95f24a2..e5b8e1dd27201ed2404d63fb88e4992e592dcea6 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ProcessBackground.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProcessBackground.h @@ -3,7 +3,7 @@ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidKernel/ArrayProperty.h" @@ -13,6 +13,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { class RemovePeaks { public: @@ -141,6 +142,7 @@ private: void fitBackgroundFunction(std::string bkgdfunctiontype); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ProductFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductFunction.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ProductFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductFunction.h index 83ca1c3239d57117d8822d75ee2ed884e5f1adc7..cef21a282322ecfe74c8250d2db5ac344b69a72f 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ProductFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductFunction.h @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Allow user to create a fit function which is the product of two or more other fit functions. @@ -62,6 +63,7 @@ protected: virtual void init(){}; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ProductLinearExp.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductLinearExp.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/ProductLinearExp.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductLinearExp.h index b49be7f9b1dfbc992b354277ca51ef82959c2d33..2e54ad0d69c2253c092fe8008ab60508fb24dd51 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ProductLinearExp.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductLinearExp.h @@ -7,6 +7,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ProductLinearExp : Function that evauates the product of an exponential and linear function. @@ -49,6 +50,7 @@ protected: const size_t nData) const; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ProductQuadraticExp.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductQuadraticExp.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/ProductQuadraticExp.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductQuadraticExp.h index 257482ed18ecc744075382591895133bad6913d8..ac047a16d192d738949c4ad1af2bc1485e970f4f 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ProductQuadraticExp.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductQuadraticExp.h @@ -7,6 +7,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ProductQuadraticExp : Function that evauates the product of an exponential and quadratic function. @@ -49,6 +50,7 @@ protected: const size_t nData) const; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PseudoVoigt.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PseudoVoigt.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/PseudoVoigt.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/PseudoVoigt.h index 6c970c4b17c2b18b4f6ae5c6e8780428e36b3164..53a3f331d2bd26ced8e7eca0260cb55ed230009f 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/PseudoVoigt.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PseudoVoigt.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** PseudoVoigt @@ -71,6 +72,7 @@ protected: void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Quadratic.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Quadratic.h similarity index 95% rename from Framework/CurveFitting/inc/MantidCurveFitting/Quadratic.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Quadratic.h index 0e1e6f08553667bcb36cc7f9f922da615d2d5cbd..41eb1812f44767733cd18005bc0c6b2a9147a8c1 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Quadratic.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Quadratic.h @@ -4,10 +4,11 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide quadratic function interface to IFunction. I.e. the function: A0+A1*x+A2*x^2 @@ -60,6 +61,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ReflectivityMulf.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ReflectivityMulf.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/ReflectivityMulf.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ReflectivityMulf.h index 0ccf77e23f6d2639013ba29334afbcaa7794d71c..b1c6fb99b986b55055e602d648be001b8ab03b76 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ReflectivityMulf.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ReflectivityMulf.h @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ReflectivityMulf : Calculate the ReflectivityMulf from a simple layer model. @@ -59,6 +60,7 @@ private: typedef boost::shared_ptr<ReflectivityMulf> ReflectivityMulf_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Resolution.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Resolution.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/Resolution.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Resolution.h index fd7237629dd03edb73858578fc5fa931afc2ab55..bfb2f49bc06f0f68c352223eca731199f136b809 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Resolution.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Resolution.h @@ -4,10 +4,11 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/TabulatedFunction.h" +#include "MantidCurveFitting/Functions/TabulatedFunction.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Resolution function. It is implemented in terms of TabulatedFunction but doesn't inherit form it. @@ -67,6 +68,7 @@ private: TabulatedFunction m_fun; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SimpleChebfun.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/SimpleChebfun.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/SimpleChebfun.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/SimpleChebfun.h index 5da29131ea0bbc5f41d67d8e7ef924dde747f6a2..e05bfbcd112c0541933de0e440b03217a2e6d67c 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SimpleChebfun.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/SimpleChebfun.h @@ -2,10 +2,11 @@ #define MANTID_CURVEFITTING_SIMPLECHEBFUN_H_ #include "MantidKernel/System.h" -#include "MantidCurveFitting/ChebfunBase.h" +#include "MantidCurveFitting/Functions/ChebfunBase.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** SimpleChebfun : approximates smooth 1d functions and provides methods to manipulate them. @@ -94,6 +95,7 @@ private: bool m_badFit; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabe.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabe.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabe.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabe.h index b959aa5ecf47e81356d1188da75598381b6fe764..b6beff8a18a795ef96eb64ab6cc427a7f5336910 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabe.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabe.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide static Kubo Toyabe fitting function @@ -57,6 +58,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h index 143973e3c742846f82b86e3963db8aa2314f8173..0ceebf0aa2ecec4259996780b29d09d45a8dc251 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** StaticKuboToyabeTimesExpDecay fitting function @@ -51,6 +52,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h index 0b4d63300dcb6c717fbc06db0986a5ace4c70838..6f9370af94cadbeff4d3fa1b48fd050e2d6901d3 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** StaticKuboToyabeTimesGausDecay fitting function. @@ -51,6 +52,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StretchExp.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExp.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/StretchExp.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExp.h index 7f61f545b008744c2e7a173de94ea3ad86e473cc..43677513e130aeb2df4d37dcc7753d5f06b417f3 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/StretchExp.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExp.h @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide Streteched Exponential fitting function: h*exp(-(x/t)^b ) @@ -55,6 +56,7 @@ protected: const size_t nData); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StretchExpMuon.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExpMuon.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/StretchExpMuon.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExpMuon.h index 433965a34874a6ce489df33ee7a2d1317bd2711b..4816212d1a4a8840e2538c9e249c829f96f39e43 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/StretchExpMuon.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExpMuon.h @@ -8,6 +8,7 @@ #include "MantidAPI/IFunction1D.h" namespace Mantid { namespace CurveFitting { +namespace Functions { /** Provide stetch exponential function for Muon scientists @@ -52,6 +53,7 @@ protected: virtual void init(); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/TabulatedFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/TabulatedFunction.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/TabulatedFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/TabulatedFunction.h index 2fe8d9ae5d15127e1e7f3e2687d4dfe2a3b0fcc9..a4e4812efbeb5b7ca51bc888c8f604f1af4503da 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/TabulatedFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/TabulatedFunction.h @@ -19,6 +19,7 @@ class MatrixWorkspace; } namespace CurveFitting { +namespace Functions { /** A function which takes its values from a file or a workspace. The values atr @@ -124,6 +125,7 @@ private: mutable bool m_setupFinished; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h index a8b2aee386cb1ee75b40be77b19b5085fd089919..5ee5b6e50b500c5dfa5e7a0c9b76294195214587 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h @@ -7,6 +7,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ThermalNeutronBk2BkExpAlpha : Function to calculate Alpha of Bk2Bk Exponential function from @@ -71,6 +72,7 @@ private: typedef boost::shared_ptr<ThermalNeutronBk2BkExpAlpha> ThermalNeutronBk2BkExpAlpha_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h index f88f29f5001131df88a7b0030389647467642562..31e1d7efd7975e0257a0fab7d6865f37a9225fa5 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h @@ -7,6 +7,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ThermalNeutronBk2BkExpBETA : Function to calculate Beta of Bk2Bk Exponential function from @@ -71,6 +72,7 @@ private: typedef boost::shared_ptr<ThermalNeutronBk2BkExpBeta> ThermalNeutronBk2BkExpBeta_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h similarity index 99% rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h index e36a938cb9b8f0b12cad3306ff2d0a6112d73ba2..267f3ab7819f647cbdf717fe422fcc9a1315e0a1 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ThermalNeutronBk2BkExpConvPVoigt : Back-to-back exponential convoluted with pseudo Voigt for thermal neutron @@ -196,6 +197,7 @@ inline double calCubicDSpace(double a, int h, int k, int l) /// Integral for Gamma // std::complex<double> E1X(std::complex<double> z); +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h index c4534681d1b727069a4d88299628dae824655d1e..412ea0d44021b1cacac2edfdc884cf7a9b61e604 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h @@ -7,6 +7,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ThermalNeutronBk2BkExpSIGMA : Function to calculate Sigma of Bk2Bk Exponential function from @@ -70,6 +71,7 @@ private: typedef boost::shared_ptr<ThermalNeutronBk2BkExpSigma> ThermalNeutronBk2BkExpSigma_sptr; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronDtoTOFFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronDtoTOFFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h index 0fef3abbf8c1175838de6a4166e51d3bc25ea1f2..8d0c4a2ed846b5bcd0b3636a287ceb33606ef2a5 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronDtoTOFFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h @@ -14,6 +14,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** ThermalNeutronDtoTOFFunction : TODO: DESCRIPTION @@ -98,6 +99,7 @@ inline double calThermalNeutronTOF(double dh, double dtt1, double dtt1t, return tof_h; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/UserFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/UserFunction.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction.h index ca9c41550d92e490dab933ad1a5f55767af82f58..cd6e468fee151c7a2463f3e30729b01f0a54bcb3 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/UserFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction.h @@ -14,6 +14,7 @@ class Parser; namespace Mantid { namespace CurveFitting { +namespace Functions { /** A user defined function. @@ -95,6 +96,7 @@ private: static double *AddVariable(const char *varName, void *pufun); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/UserFunction1D.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction1D.h similarity index 97% rename from Framework/CurveFitting/inc/MantidCurveFitting/UserFunction1D.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction1D.h index 1c27d36a0a15df1a6b5f40eae0db12c9faefbef0..fefde7f6549aa277abcce768ea6d1d2a5f6d7a43 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/UserFunction1D.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction1D.h @@ -4,12 +4,13 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Fit1D.h" +#include "MantidCurveFitting/Algorithms/Fit1D.h" #include "MantidGeometry/muParser_Silent.h" #include <boost/shared_array.hpp> namespace Mantid { namespace CurveFitting { +namespace Functions { /** Deprecation notice: instead of using this algorithm please use the Fit algorithm where the Function parameter of this algorithm is used @@ -70,7 +71,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. File change history is stored at: <https://github.com/mantidproject/mantid> Code Documentation is available at: <http://doxygen.mantidproject.org> */ -class UserFunction1D : public Fit1D { +class UserFunction1D : public Algorithms::Fit1D { public: /// Constructor UserFunction1D() @@ -121,6 +122,7 @@ private: boost::shared_array<double> m_tmp1; }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/VesuvioResolution.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/VesuvioResolution.h similarity index 96% rename from Framework/CurveFitting/inc/MantidCurveFitting/VesuvioResolution.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/VesuvioResolution.h index 02f62fb838f4303c62d893c1d86b769f6dedb560..18576a11ca4f5a8cbb79c07d2bd034470e901cd3 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/VesuvioResolution.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/VesuvioResolution.h @@ -8,10 +8,13 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { //--------------------------------------------------------------------------- // Forward declarations //--------------------------------------------------------------------------- struct DetectorParams; +} +namespace Functions { //--------------------------------------------------------------------------- /// Simple data structure to store resolution parameter values @@ -81,7 +84,7 @@ public: setMatrixWorkspace(boost::shared_ptr<const API::MatrixWorkspace> workspace, size_t wi, double startX, double endX); /// Pre-calculate the resolution components values - void cacheResolutionComponents(const DetectorParams &detpar, + void cacheResolutionComponents(const Algorithms::DetectorParams &detpar, const ResolutionParams &respar); /// Turn off logger void disableLogging() { m_log.setEnabled(false); } @@ -118,6 +121,7 @@ private: ///@} }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Voigt.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Voigt.h similarity index 98% rename from Framework/CurveFitting/inc/MantidCurveFitting/Voigt.h rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Voigt.h index 192bcb12d02833b47a6b2e1defb1d34e1f80c41f..780771239cdf771d7854ff0918fab2af18cf2ab4 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Voigt.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Voigt.h @@ -6,6 +6,7 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { /** Implements an analytical approximation to the Voigt function. @@ -66,6 +67,7 @@ private: void setFwhm(const double value); }; +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h b/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h index 259599a19010f6dc76c6e803aef871e5763c01d4..bde389d04c861786ba31393bf215c6d456523b21 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h @@ -7,7 +7,7 @@ #include <gsl/gsl_blas.h> #include "MantidAPI/IFunction.h" #include "MantidAPI/ICostFunction.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" namespace Mantid { namespace CurveFitting { @@ -85,7 +85,7 @@ public: /// Structure to contain least squares data and used by GSL struct GSL_FitData { /// Constructor - GSL_FitData(boost::shared_ptr<CostFuncLeastSquares> cf); + GSL_FitData(boost::shared_ptr<CostFunctions::CostFuncLeastSquares> cf); /// Destructor ~GSL_FitData(); /// number of points to be fitted (size of X, Y and sqrtWeightData arrays) @@ -94,14 +94,14 @@ struct GSL_FitData { size_t p; /// Pointer to the function API::IFunction_sptr function; - boost::shared_ptr<CostFuncLeastSquares> costFunction; + boost::shared_ptr<CostFunctions::CostFuncLeastSquares> costFunction; /// Initial function parameters gsl_vector *initFuncParams; /// Jacobi matrix interface JacobianImpl1 J; // this is presently commented out in the implementation - // gsl_matrix *holdCalculatedJacobian; ///< cache of the claculated jacobian + // gsl_matrix *holdCalculatedJacobian; ///< cache of the calculated jacobian }; int gsl_f(const gsl_vector *x, void *params, gsl_vector *f); diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h index dda2fcf1d8358f0e60023c855a4eb5080a758447..3c8886b0b648fe6475b0312904f2987fe694581e 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h @@ -4,7 +4,7 @@ #include "MantidKernel/System.h" #include "MantidAPI/ILatticeFunction.h" -#include "MantidCurveFitting/PawleyFunction.h" +#include "MantidCurveFitting/Functions/PawleyFunction.h" namespace Mantid { namespace CurveFitting { @@ -61,7 +61,7 @@ protected: void beforeDecoratedFunctionSet(const API::IFunction_sptr &fn); private: - PawleyParameterFunction_sptr m_cellParameters; + Functions::PawleyParameterFunction_sptr m_cellParameters; }; typedef boost::shared_ptr<LatticeFunction> LatticeFunction_sptr; diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/MultiBG.h b/Framework/CurveFitting/inc/MantidCurveFitting/MultiBG.h deleted file mode 100644 index 506d7e7f047a3cc6dccba054d32ed6ec93e21e94..0000000000000000000000000000000000000000 --- a/Framework/CurveFitting/inc/MantidCurveFitting/MultiBG.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef MANTID_CURVEFITTING_MULTIBG_H_ -#define MANTID_CURVEFITTING_MULTIBG_H_ - -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- -#include "MantidAPI/CompositeFunction.h" -#include "MantidAPI/IFunctionMW.h" -#include "MantidAPI/MatrixWorkspace_fwd.h" - -#ifdef _WIN32 -#pragma warning(disable : 4250) -#endif - -namespace Mantid { - -namespace API { -class WorkspaceGroup; -} - -namespace CurveFitting { -/** A composite function. - - @author Roman Tolchenov, Tessella Support Services plc - @date 19/08/2011 - - Copyright © 2009 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 <http://www.gnu.org/licenses/>. - - File change history is stored at: <https://github.com/mantidproject/mantid>. - Code Documentation is available at: <http://doxygen.mantidproject.org> -*/ -class DLLExport MultiBG : public API::CompositeFunction { -public: - /// Default constructor - MultiBG() : API::CompositeFunction() {} - /// Destructor - virtual ~MultiBG(); - - /* Overriden methods */ - - using CompositeFunction::setWorkspace; - virtual void setWorkspace(boost::shared_ptr<const API::Workspace>) {} - /// Set the workspace - void setWorkspace(boost::shared_ptr<const API::Workspace> ws, bool copyData); - void setSlicing(const std::string &slicing); - virtual boost::shared_ptr<const API::Workspace> getWorkspace() const { - return m_spectra[0].first; - } - /// Returns the function's name - std::string name() const { return "MultiBG"; } - /// Returns the function's category - virtual const std::string category() const { return "Background"; } - - virtual void function(API::FunctionDomain &) const {} - - /// Returns the size of the fitted data (number of double values returned by - /// the function) - virtual size_t dataSize() const { return m_data.size(); } - /// Returns a reference to the fitted data. These data are taken from the - /// workspace set by setWorkspace() method. - virtual const double *getData() const { return &m_data[0]; } - virtual const double *getWeights() const { return &m_weights[0]; } - /// Function you want to fit to. - void function(double *out) const; - /// Derivatives of function with respect to active parameters - void functionDeriv(API::Jacobian *out); - void functionDeriv(API::FunctionDomain &domain, API::Jacobian &jacobian) { - API::IFunction::functionDeriv(domain, jacobian); - } - -protected: - boost::shared_ptr<API::WorkspaceGroup> createCalculatedWorkspaceGroup( - const std::vector<double> &sd = std::vector<double>()); - - boost::shared_ptr<const API::MatrixWorkspace> m_workspace; - - /// to collect different workspaces found in child functions - std::vector<std::pair<boost::shared_ptr<const API::MatrixWorkspace>, size_t>> - m_spectra; - /// to store function indices to workspaces: m_funIndex[i] gives vector of - /// indexes of m_spectra for function i - std::vector<std::vector<size_t>> m_funIndex; - /// the data vector which is a composition of all fitted spectra - std::vector<double> m_data; - /// the vector of fitting weights, one for each value in m_data - std::vector<double> m_weights; - /// offsets of particular workspaces in the m_data and m_weights arrays - std::vector<size_t> m_offset; -}; - -} // namespace CurveFitting -} // namespace Mantid - -#endif /*MANTID_CURVEFITTING_MULTIBG_H_*/ diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ParDomain.h b/Framework/CurveFitting/inc/MantidCurveFitting/ParDomain.h index bda5ec1da7cc7a89ee1a20eeb634b7eca1a483a7..c695e7c06bdb07dae06f7888c0898215e8318819 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/ParDomain.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/ParDomain.h @@ -43,12 +43,13 @@ public: virtual void getDomainAndValues(size_t i, API::FunctionDomain_sptr &domain, API::FunctionValues_sptr &values) const; /// Calculate the value of a least squares cost function - virtual void leastSquaresVal(const CostFuncLeastSquares &leastSquares); + virtual void + leastSquaresVal(const CostFunctions::CostFuncLeastSquares &leastSquares); /// Calculate the value, first and second derivatives of a least squares cost /// function - virtual void - leastSquaresValDerivHessian(const CostFuncLeastSquares &leastSquares, - bool evalDeriv, bool evalHessian); + virtual void leastSquaresValDerivHessian( + const CostFunctions::CostFuncLeastSquares &leastSquares, bool evalDeriv, + bool evalHessian); }; } // namespace CurveFitting diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h b/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h index 5e451efdf3324c3b6d47fd4e9a35f32f9550336f..7066b276f113f0883a8e7dc08376f473dfead9ec 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h @@ -8,8 +8,8 @@ #include "MantidAPI/FunctionDomain.h" #include "MantidAPI/FunctionValues.h" #include "MantidAPI/IDomainCreator.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" -#include "MantidCurveFitting/CostFuncRwp.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncRwp.h" #include <stdexcept> #include <vector> @@ -57,16 +57,17 @@ public: /// Add new domain creator void addCreator(API::IDomainCreator_sptr creator); /// Calculate the value of a least squares cost function - virtual void leastSquaresVal(const CostFuncLeastSquares &leastSquares); + virtual void + leastSquaresVal(const CostFunctions::CostFuncLeastSquares &leastSquares); /// Calculate the value, first and second derivatives of a least squares cost /// function - virtual void - leastSquaresValDerivHessian(const CostFuncLeastSquares &leastSquares, - bool evalDeriv, bool evalHessian); + virtual void leastSquaresValDerivHessian( + const CostFunctions::CostFuncLeastSquares &leastSquares, bool evalDeriv, + bool evalHessian); /// Calculate the value of a Rwp cost function - void rwpVal(const CostFuncRwp &rwp); + void rwpVal(const CostFunctions::CostFuncRwp &rwp); /// Calculate the value, first and second derivatives of a RWP cost function - void rwpValDerivHessian(const CostFuncRwp &rwp, bool evalDeriv, + void rwpValDerivHessian(const CostFunctions::CostFuncRwp &rwp, bool evalDeriv, bool evalHessian); /// Create an instance of SeqDomain in one of two forms: either SeqDomain for diff --git a/Framework/CurveFitting/src/CalculateChiSquared.cpp b/Framework/CurveFitting/src/Algorithms/CalculateChiSquared.cpp similarity index 98% rename from Framework/CurveFitting/src/CalculateChiSquared.cpp rename to Framework/CurveFitting/src/Algorithms/CalculateChiSquared.cpp index 0f65e00127775c1c352363f77ef26f0476887d81..17104a9e4b23dd8223a42f8cc5647bc397ee9d10 100644 --- a/Framework/CurveFitting/src/CalculateChiSquared.cpp +++ b/Framework/CurveFitting/src/Algorithms/CalculateChiSquared.cpp @@ -1,16 +1,18 @@ -#include "MantidCurveFitting/CalculateChiSquared.h" +#include "MantidCurveFitting/Algorithms/CalculateChiSquared.h" #include "MantidAPI/ITableWorkspace.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidAPI/Column.h" #include "MantidAPI/TableRow.h" -#include "MantidCurveFitting/ChebfunBase.h" +#include "MantidCurveFitting/Functions/ChebfunBase.h" #include "MantidCurveFitting/GSLJacobian.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { -using namespace Mantid::Kernel; -using namespace Mantid::API; +using namespace Kernel; +using namespace API; +using namespace Functions; // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(CalculateChiSquared) @@ -651,5 +653,6 @@ void CalculateChiSquared::refixParameters() { } } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CalculateGammaBackground.cpp b/Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp similarity index 95% rename from Framework/CurveFitting/src/CalculateGammaBackground.cpp rename to Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp index d4dfeb2503d74d64dcf47b5655128fc95fc281c3..a6281e12576ea6a561de2189adf28c38e98ac59f 100644 --- a/Framework/CurveFitting/src/CalculateGammaBackground.cpp +++ b/Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp @@ -1,7 +1,7 @@ -#include "MantidCurveFitting/CalculateGammaBackground.h" -#include "MantidCurveFitting/ComptonProfile.h" -#include "MantidCurveFitting/ConvertToYSpace.h" -#include "MantidCurveFitting/VesuvioResolution.h" +#include "MantidCurveFitting/Algorithms/CalculateGammaBackground.h" +#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h" +#include "MantidCurveFitting/Functions/ComptonProfile.h" +#include "MantidCurveFitting/Functions/VesuvioResolution.h" #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/FunctionProperty.h" @@ -16,8 +16,12 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { using namespace API; using namespace Kernel; +using namespace CurveFitting; +using namespace CurveFitting::Functions; +using namespace BOOST_FUNCTION_STD_NS; using namespace std; // Subscription @@ -227,8 +231,9 @@ void CalculateGammaBackground::calculateSpectrumFromDetector( // -- Setup detector & resolution parameters -- DetectorParams detPar = ConvertToYSpace::getDetectorParameters(m_inputWS, inputIndex); - ResolutionParams detRes = - VesuvioResolution::getResolutionParameters(m_inputWS, inputIndex); + CurveFitting::Functions::ResolutionParams detRes = + CurveFitting::Functions::VesuvioResolution::getResolutionParameters( + m_inputWS, inputIndex); // Compute a time of flight spectrum convolved with a Voigt resolution // function for each mass @@ -254,8 +259,9 @@ void CalculateGammaBackground::calculateBackgroundFromFoils( // -- Setup detector & resolution parameters -- DetectorParams detPar = ConvertToYSpace::getDetectorParameters(m_inputWS, inputIndex); - ResolutionParams detRes = - VesuvioResolution::getResolutionParameters(m_inputWS, inputIndex); + CurveFitting::Functions::ResolutionParams detRes = + CurveFitting::Functions::VesuvioResolution::getResolutionParameters( + m_inputWS, inputIndex); const size_t nxvalues = m_backgroundWS->blocksize(); std::vector<double> foilSpectrum(nxvalues); @@ -320,7 +326,7 @@ void CalculateGammaBackground::calculateBackgroundSingleFoil( // Structs to hold geometry & resolution information DetectorParams foilPar = detPar; // copy foilPar.t0 = 0.0; - ResolutionParams foilRes = detRes; // copy + CurveFitting::Functions::ResolutionParams foilRes = detRes; // copy foilRes.dEnGauss = foilInfo.gaussWidth; foilRes.dEnLorentz = foilInfo.lorentzWidth; @@ -388,8 +394,9 @@ void CalculateGammaBackground::calculateTofSpectrum( FunctionFactory::Instance().createInitialized(m_profileFunction)); for (size_t i = 0; i < m_npeaks; ++i) { - auto profile = boost::dynamic_pointer_cast<ComptonProfile>( - profileFunction->getFunction(i)); + auto profile = + boost::dynamic_pointer_cast<CurveFitting::Functions::ComptonProfile>( + profileFunction->getFunction(i)); profile->disableLogging(); profile->setUpForFit(); profile->cacheYSpaceValues(tseconds, false, detpar, respar); @@ -422,8 +429,9 @@ void CalculateGammaBackground::retrieveInputs() { boost::dynamic_pointer_cast<CompositeFunction>(profileFunction)) { m_npeaks = composite->nFunctions(); for (size_t i = 0; i < m_npeaks; ++i) { - auto single = boost::dynamic_pointer_cast<ComptonProfile>( - composite->getFunction(i)); + auto single = + boost::dynamic_pointer_cast<CurveFitting::Functions::ComptonProfile>( + composite->getFunction(i)); if (!single) { throw std::invalid_argument("Invalid function. Composite must contain " "only ComptonProfile functions"); @@ -595,5 +603,6 @@ std::pair<double, double> CalculateGammaBackground::calculateThetaRange( return std::make_pair(theta - dtheta, theta + dtheta); } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CalculateMSVesuvio.cpp b/Framework/CurveFitting/src/Algorithms/CalculateMSVesuvio.cpp similarity index 96% rename from Framework/CurveFitting/src/CalculateMSVesuvio.cpp rename to Framework/CurveFitting/src/Algorithms/CalculateMSVesuvio.cpp index 1b9aea72dde7c708db9ec294cd7861830a9b50c6..c34d6b66b7caf69f416a7fb04af6a6f341c9a881 100644 --- a/Framework/CurveFitting/src/CalculateMSVesuvio.cpp +++ b/Framework/CurveFitting/src/Algorithms/CalculateMSVesuvio.cpp @@ -1,11 +1,11 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- -#include "MantidCurveFitting/CalculateMSVesuvio.h" +#include "MantidCurveFitting/Algorithms/CalculateMSVesuvio.h" // Use helpers for storing detector/resolution parameters -#include "MantidCurveFitting/ConvertToYSpace.h" +#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h" #include "MantidCurveFitting/MSVesuvioHelpers.h" -#include "MantidCurveFitting/VesuvioResolution.h" +#include "MantidCurveFitting/Functions/VesuvioResolution.h" #include "MantidAPI/SampleShapeValidator.h" #include "MantidAPI/WorkspaceValidators.h" @@ -25,8 +25,11 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { using namespace API; using namespace Kernel; +using namespace CurveFitting; +using namespace CurveFitting::Functions; using Geometry::Link; using Geometry::ParameterMap; using Geometry::Track; @@ -137,7 +140,8 @@ void CalculateMSVesuvio::exec() { MatrixWorkspace_sptr multsc = WorkspaceFactory::Instance().create(m_inputWS); // Initialize random number generator - m_randgen = new MSVesuvioHelper::RandomNumberGenerator(getProperty("Seed")); + m_randgen = new CurveFitting::MSVesuvioHelper::RandomNumberGenerator( + getProperty("Seed")); // Setup progress const size_t nhist = m_inputWS->getNumberHistograms(); @@ -319,11 +323,11 @@ void CalculateMSVesuvio::calculateMS(const size_t wsIndex, DetectorParams detpar = ConvertToYSpace::getDetectorParameters(m_inputWS, wsIndex); detpar.t0 *= 1e6; // t0 in microseconds here - ResolutionParams respar = - VesuvioResolution::getResolutionParameters(m_inputWS, wsIndex); + Functions::ResolutionParams respar = + Functions::VesuvioResolution::getResolutionParameters(m_inputWS, wsIndex); // Final counts averaged over all simulations - MSVesuvioHelper::SimulationAggregator accumulator(m_nruns); + CurveFitting::MSVesuvioHelper::SimulationAggregator accumulator(m_nruns); for (size_t i = 0; i < m_nruns; ++i) { m_progress->report("MS calculation: idx=" + boost::lexical_cast<std::string>(wsIndex) + ", run=" + @@ -338,7 +342,8 @@ void CalculateMSVesuvio::calculateMS(const size_t wsIndex, } // Average over all runs and assign to output workspaces - MSVesuvioHelper::SimulationWithErrors avgCounts = accumulator.average(); + CurveFitting::MSVesuvioHelper::SimulationWithErrors avgCounts = + accumulator.average(); avgCounts.normalise(); assignToOutput(avgCounts, totalsc, multsc); } @@ -354,7 +359,7 @@ void CalculateMSVesuvio::calculateMS(const size_t wsIndex, */ void CalculateMSVesuvio::simulate( const DetectorParams &detpar, const ResolutionParams &respar, - MSVesuvioHelper::Simulation &simulCounts) const { + CurveFitting::MSVesuvioHelper::Simulation &simulCounts) const { for (size_t i = 0; i < m_nevents; ++i) { calculateCounts(detpar, respar, simulCounts); } @@ -369,7 +374,7 @@ void CalculateMSVesuvio::simulate( * scattering contribution */ void CalculateMSVesuvio::assignToOutput( - const MSVesuvioHelper::SimulationWithErrors &avgCounts, + const CurveFitting::MSVesuvioHelper::SimulationWithErrors &avgCounts, API::ISpectrum &totalsc, API::ISpectrum &multsc) const { // Sum up all multiple scatter events auto &msscatY = multsc.dataY(); @@ -404,7 +409,7 @@ void CalculateMSVesuvio::assignToOutput( */ double CalculateMSVesuvio::calculateCounts( const DetectorParams &detpar, const ResolutionParams &respar, - MSVesuvioHelper::Simulation &simulation) const { + CurveFitting::MSVesuvioHelper::Simulation &simulation) const { double weightSum(0.0); // moderator coord in lab frame @@ -785,13 +790,14 @@ double CalculateMSVesuvio::generateE1(const double angle, const double e1nom, const double randv = m_randgen->flat(); if (e1nom < 5000.0) { if (angle > 90.0) - return MSVesuvioHelper::finalEnergyAuDD(randv); + return CurveFitting::MSVesuvioHelper::finalEnergyAuDD(randv); else - return MSVesuvioHelper::finalEnergyAuYap(randv); + return CurveFitting::MSVesuvioHelper::finalEnergyAuYap(randv); } else { - return MSVesuvioHelper::finalEnergyUranium(randv); + return CurveFitting::MSVesuvioHelper::finalEnergyUranium(randv); } } } // namespace Algorithms +} // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ConvertToYSpace.cpp b/Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp similarity index 98% rename from Framework/CurveFitting/src/ConvertToYSpace.cpp rename to Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp index e7c099c6f5d44cb04c4c958dc3115f5c79776928..1124ff0504e39bf341dc6e2d45f958ec507eeda8 100644 --- a/Framework/CurveFitting/src/ConvertToYSpace.cpp +++ b/Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ConvertToYSpace.h" +#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h" #include "MantidAPI/WorkspaceValidators.h" #include "MantidGeometry/Instrument/DetectorGroup.h" @@ -8,6 +8,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(ConvertToYSpace) @@ -299,5 +300,6 @@ void ConvertToYSpace::cacheInstrumentGeometry() { m_samplePos = sample->getPos(); } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ConvolveWorkspaces.cpp b/Framework/CurveFitting/src/Algorithms/ConvolveWorkspaces.cpp similarity index 92% rename from Framework/CurveFitting/src/ConvolveWorkspaces.cpp rename to Framework/CurveFitting/src/Algorithms/ConvolveWorkspaces.cpp index c8bc4034617b52b04c993398b9051a33012d4ca1..860d527201a1ef0c1501070ca0fb35f7b680b631 100644 --- a/Framework/CurveFitting/src/ConvolveWorkspaces.cpp +++ b/Framework/CurveFitting/src/Algorithms/ConvolveWorkspaces.cpp @@ -1,9 +1,9 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/ConvolveWorkspaces.h" -#include "MantidCurveFitting/Convolution.h" -#include "MantidCurveFitting/TabulatedFunction.h" +#include "MantidCurveFitting/Algorithms/ConvolveWorkspaces.h" +#include "MantidCurveFitting/Functions/Convolution.h" +#include "MantidCurveFitting/Functions/TabulatedFunction.h" #include <sstream> #include <gsl/gsl_errno.h> #include <gsl/gsl_fft_real.h> @@ -11,6 +11,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(ConvolveWorkspaces) @@ -25,6 +26,7 @@ using namespace Kernel; using namespace API; using namespace DataObjects; using namespace Geometry; +using namespace Functions; void ConvolveWorkspaces::init() { declareProperty( @@ -96,4 +98,5 @@ void ConvolveWorkspaces::exec() { } } // namespace Algorithms +} // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/EstimatePeakErrors.cpp b/Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp similarity index 97% rename from Framework/CurveFitting/src/EstimatePeakErrors.cpp rename to Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp index f9f0903ea3654a519c2d13286627ca44b6275f50..3990ef3fbabf9c2d809877eac4c9ca43622d12b0 100644 --- a/Framework/CurveFitting/src/EstimatePeakErrors.cpp +++ b/Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp @@ -1,6 +1,6 @@ -#include "MantidCurveFitting/EstimatePeakErrors.h" +#include "MantidCurveFitting/Algorithms/EstimatePeakErrors.h" #include "MantidCurveFitting/GSLMatrix.h" -#include "MantidCurveFitting/PeakParameterFunction.h" +#include "MantidCurveFitting/Functions/PeakParameterFunction.h" #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/FunctionProperty.h" @@ -12,6 +12,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { using namespace API; using namespace Kernel; using namespace std; @@ -164,5 +165,6 @@ void EstimatePeakErrors::exec() { setProperty("OutputWorkspace", results); } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/EvaluateFunction.cpp b/Framework/CurveFitting/src/Algorithms/EvaluateFunction.cpp similarity index 94% rename from Framework/CurveFitting/src/EvaluateFunction.cpp rename to Framework/CurveFitting/src/Algorithms/EvaluateFunction.cpp index d5c5e9e7099de52de4bcca1fd6203f2ed22cc061..9e072bd88875299e3e259ac3f7b024717c91d27e 100644 --- a/Framework/CurveFitting/src/EvaluateFunction.cpp +++ b/Framework/CurveFitting/src/Algorithms/EvaluateFunction.cpp @@ -1,7 +1,8 @@ -#include "MantidCurveFitting/EvaluateFunction.h" +#include "MantidCurveFitting/Algorithms/EvaluateFunction.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { using namespace Mantid::Kernel; using namespace Mantid::API; @@ -55,5 +56,6 @@ void EvaluateFunction::execConcrete() { setProperty("OutputWorkspace", outputWS); } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Fit.cpp b/Framework/CurveFitting/src/Algorithms/Fit.cpp similarity index 97% rename from Framework/CurveFitting/src/Fit.cpp rename to Framework/CurveFitting/src/Algorithms/Fit.cpp index c37debe935c3074b8cce0224b27cff1c2ae5a4a2..b10b66a8a918dca32327fc32d80a04a0136e399e 100644 --- a/Framework/CurveFitting/src/Fit.cpp +++ b/Framework/CurveFitting/src/Algorithms/Fit.cpp @@ -1,8 +1,8 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Fit.h" -#include "MantidCurveFitting/CostFuncFitting.h" +#include "MantidCurveFitting/Algorithms/Fit.h" +#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -18,6 +18,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { // Register the class into the algorithm factory DECLARE_ALGORITHM(Fit) @@ -63,7 +64,7 @@ void Fit::initConcrete() { API::CostFunctionFactory::Instance().getKeys(); // select only CostFuncFitting variety for (auto it = costFuncOptions.begin(); it != costFuncOptions.end(); ++it) { - auto costFunc = boost::dynamic_pointer_cast<CostFuncFitting>( + auto costFunc = boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>( API::CostFunctionFactory::Instance().create(*it)); if (!costFunc) { *it = ""; @@ -152,8 +153,8 @@ void Fit::execConcrete() { const size_t maxIterations = static_cast<size_t>(intMaxIterations); // get the cost function which must be a CostFuncFitting - boost::shared_ptr<CostFuncFitting> costFunc = - boost::dynamic_pointer_cast<CostFuncFitting>( + boost::shared_ptr<CostFunctions::CostFuncFitting> costFunc = + boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>( API::CostFunctionFactory::Instance().create( getPropertyValue("CostFunction"))); @@ -362,5 +363,6 @@ void Fit::execConcrete() { progress(1.0); } -} // namespace Algorithm +} // namespace Algorithms +} // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Fit1D.cpp b/Framework/CurveFitting/src/Algorithms/Fit1D.cpp similarity index 99% rename from Framework/CurveFitting/src/Fit1D.cpp rename to Framework/CurveFitting/src/Algorithms/Fit1D.cpp index f4c054ddc095e1976d0812b46d7c2373ed6bc562..3f3db8ff573c4ba24d9da29b069138b950125401 100644 --- a/Framework/CurveFitting/src/Fit1D.cpp +++ b/Framework/CurveFitting/src/Algorithms/Fit1D.cpp @@ -1,11 +1,10 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Fit1D.h" +#include "MantidCurveFitting/Algorithms/Fit1D.h" #include <sstream> #include <numeric> #include <cmath> -#include <iomanip> #include "MantidKernel/Exception.h" #include "MantidAPI/ITableWorkspace.h" #include "MantidAPI/TableRow.h" @@ -21,6 +20,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { using namespace Kernel; using API::WorkspaceProperty; @@ -777,5 +777,6 @@ FitData::FitData(Fit1D *fit, const std::string &fixed) J.m_map[i] = -1; } -} // namespace Algorithm +} // namespace Algorithms +} // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/FitPowderDiffPeaks.cpp b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp similarity index 99% rename from Framework/CurveFitting/src/FitPowderDiffPeaks.cpp rename to Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp index b5ad39301ddcb5b6156ab72e7ec20a3482d7e7c8..b69b92fdba2ae6bc11c07eaadbd5e5c46d75924d 100644 --- a/Framework/CurveFitting/src/FitPowderDiffPeaks.cpp +++ b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/FitPowderDiffPeaks.h" +#include "MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h" #include "MantidKernel/ListValidator.h" #include "MantidKernel/ArrayProperty.h" @@ -16,22 +16,21 @@ #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/TextAxis.h" -#include "MantidCurveFitting/Fit.h" -#include "MantidCurveFitting/BackgroundFunction.h" -#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h" -#include "MantidCurveFitting/Polynomial.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/BackToBackExponential.h" -#include "MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h" -#include "MantidCurveFitting/DampingMinimizer.h" -#include "MantidCurveFitting/CostFuncFitting.h" +#include "MantidCurveFitting/Algorithms/Fit.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h" +#include "MantidCurveFitting/Functions/Polynomial.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Functions/BackToBackExponential.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h" +#include "MantidCurveFitting/FuncMinimizers/DampingMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h" #include <boost/algorithm/string.hpp> #include <boost/algorithm/string/split.hpp> #include <fstream> -#include <iomanip> #include <gsl/gsl_sf_erf.h> #include <cmath> @@ -51,11 +50,14 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::Kernel; using namespace Mantid::DataObjects; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Constraints; using namespace std; namespace Mantid { namespace CurveFitting { +namespace Algorithms { DECLARE_ALGORITHM(FitPowderDiffPeaks) @@ -591,7 +593,7 @@ void FitPowderDiffPeaks::observePeakRange(BackToBackExponential_sptr thispeak, * Assumption: * 1. peak must be in the range of [input peak center - leftdev, + rightdev] * - * Prerequisit: + * Prerequisites: * ---- NONE! * * Algorithms: @@ -1854,10 +1856,9 @@ bool FitPowderDiffPeaks::doFitGaussianPeak(DataObjects::Workspace2D_sptr dataws, // b) Constraint double centerleftend = in_center - leftfwhm * 0.5; double centerrightend = in_center + rightfwhm * 0.5; - CurveFitting::BoundaryConstraint *centerbound = - new CurveFitting::BoundaryConstraint(gaussianpeak.get(), "PeakCentre", - centerleftend, centerrightend, - false); + Constraints::BoundaryConstraint *centerbound = + new Constraints::BoundaryConstraint(gaussianpeak.get(), "PeakCentre", + centerleftend, centerrightend, false); gaussianpeak->addConstraint(centerbound); // 3. Fit @@ -2812,7 +2813,7 @@ FitPowderDiffPeaks::genPeak(map<string, int> hklmap, map<string, string> bk2bk2braggmap, bool &good, vector<int> &hkl, double &d_h) { // Generate a peak function - CurveFitting::BackToBackExponential newpeak; + BackToBackExponential newpeak; newpeak.initialize(); BackToBackExponential_sptr newpeakptr = boost::make_shared<BackToBackExponential>(newpeak); @@ -3448,5 +3449,6 @@ size_t findMaxValue(MatrixWorkspace_sptr dataws, size_t wsindex, return imax; } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp similarity index 99% rename from Framework/CurveFitting/src/LeBailFit.cpp rename to Framework/CurveFitting/src/Algorithms/LeBailFit.cpp index 0ea5ae09288890fe5860669c91f206aa621a0f9d..60e3d731b21978a1bb9b3ed92ab4deb36575ab06 100644 --- a/Framework/CurveFitting/src/LeBailFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp @@ -4,20 +4,19 @@ * COMMIT NOTES */ -#include "MantidCurveFitting/LeBailFit.h" +#include "MantidCurveFitting/Algorithms/LeBailFit.h" #include "MantidKernel/ListValidator.h" #include "MantidAPI/TableRow.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/ArrayProperty.h" #include "MantidKernel/VisibleWhenProperty.h" -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" #include "MantidAPI/TextAxis.h" #include <boost/algorithm/string.hpp> #include <boost/algorithm/string/split.hpp> -#include <iomanip> #include <fstream> @@ -44,6 +43,7 @@ using namespace std; namespace Mantid { namespace CurveFitting { +namespace Algorithms { const Rfactor badR(DBL_MAX, DBL_MAX); @@ -2692,5 +2692,6 @@ void writeRfactorsToFile(vector<double> vecX, vector<Rfactor> vecR, return; } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/LeBailFunction.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp similarity index 99% rename from Framework/CurveFitting/src/LeBailFunction.cpp rename to Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp index bed2bfd968fe5c19504ed0b82621c91502ef595e..0d9ee16925a41aaa4efb24ce3524080ca49365b9 100644 --- a/Framework/CurveFitting/src/LeBailFunction.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp @@ -1,9 +1,9 @@ #include "MantidAPI/Algorithm.h" -#include "MantidCurveFitting/LeBailFunction.h" +#include "MantidCurveFitting/Algorithms/LeBailFunction.h" #include "MantidKernel/System.h" #include "MantidAPI/FunctionFactory.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include <sstream> @@ -18,6 +18,7 @@ const double NEG_DBL_MAX(-1. * DBL_MAX); namespace Mantid { namespace CurveFitting { +namespace Algorithms { namespace { const double PEAKRANGECONSTANT = 5.0; @@ -894,7 +895,8 @@ void LeBailFunction::addBackgroundFunction( // Create background function from factory auto background = FunctionFactory::Instance().createFunction(backgroundtype); - m_background = boost::dynamic_pointer_cast<BackgroundFunction>(background); + m_background = + boost::dynamic_pointer_cast<Functions::BackgroundFunction>(background); // Set order and initialize m_background->setAttributeValue("n", static_cast<int>(order)); @@ -946,7 +948,7 @@ void LeBailFunction::setFitProfileParameter(string paramname, double minvalue, std::stringstream parss; parss << "f0." << paramname; string parnamef0 = parss.str(); - CurveFitting::BoundaryConstraint *bc = new BoundaryConstraint( + Constraints::BoundaryConstraint *bc = new Constraints::BoundaryConstraint( m_compsiteFunction.get(), parnamef0, minvalue, maxvalue); m_compsiteFunction->addConstraint(bc); @@ -1153,4 +1155,5 @@ double LeBailFunction::getPeakMaximumValue(std::vector<int> hkl, } } // namespace Mantid +} // namespace Algorithms } // namespace CurveFitting diff --git a/Framework/CurveFitting/src/NormaliseByPeakArea.cpp b/Framework/CurveFitting/src/Algorithms/NormaliseByPeakArea.cpp similarity index 99% rename from Framework/CurveFitting/src/NormaliseByPeakArea.cpp rename to Framework/CurveFitting/src/Algorithms/NormaliseByPeakArea.cpp index f3a7522bbfac8b7f93e12d9980b70f9c502b4814..780f0feb4261bf251d0c137fae577124e818ec44 100644 --- a/Framework/CurveFitting/src/NormaliseByPeakArea.cpp +++ b/Framework/CurveFitting/src/Algorithms/NormaliseByPeakArea.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/NormaliseByPeakArea.h" +#include "MantidCurveFitting/Algorithms/NormaliseByPeakArea.h" #include "MantidAPI/IFunction.h" #include "MantidAPI/FunctionFactory.h" @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { /// Starting value of peak position in y-space for fit double PEAK_POS_GUESS = -0.1; @@ -381,5 +382,6 @@ void NormaliseByPeakArea::symmetriseYSpace() { } } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/PawleyFit.cpp b/Framework/CurveFitting/src/Algorithms/PawleyFit.cpp similarity index 94% rename from Framework/CurveFitting/src/PawleyFit.cpp rename to Framework/CurveFitting/src/Algorithms/PawleyFit.cpp index 19cfd18fd2cbb7d9e1c079d6d2aa2c33ddde2979..22b87ff3efafd815630d8527b13152414abfe9cc 100644 --- a/Framework/CurveFitting/src/PawleyFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/PawleyFit.cpp @@ -1,7 +1,7 @@ -#include "MantidCurveFitting/PawleyFit.h" +#include "MantidCurveFitting/Algorithms/PawleyFit.h" #include "MantidAPI/FunctionFactory.h" -#include "MantidCurveFitting/PawleyFunction.h" +#include "MantidCurveFitting/Functions/PawleyFunction.h" #include "MantidAPI/ITableWorkspace.h" #include "MantidAPI/TableRow.h" @@ -14,6 +14,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { using namespace API; using namespace Kernel; @@ -62,7 +63,7 @@ double PawleyFit::getTransformedCenter(double d, const Unit_sptr &unit) const { * @param startX :: Lowest allowed x-value for reflection position. * @param endX :: Highest allowed x-value for reflection position. */ -void PawleyFit::addHKLsToFunction(PawleyFunction_sptr &pawleyFn, +void PawleyFit::addHKLsToFunction(Functions::PawleyFunction_sptr &pawleyFn, const ITableWorkspace_sptr &tableWs, const Unit_sptr &unit, double startX, double endX) const { @@ -105,8 +106,8 @@ void PawleyFit::addHKLsToFunction(PawleyFunction_sptr &pawleyFn, /// Creates a table containing the cell parameters stored in the supplied /// function. -ITableWorkspace_sptr -PawleyFit::getLatticeFromFunction(const PawleyFunction_sptr &pawleyFn) const { +ITableWorkspace_sptr PawleyFit::getLatticeFromFunction( + const Functions::PawleyFunction_sptr &pawleyFn) const { if (!pawleyFn) { throw std::invalid_argument( "Cannot extract lattice parameters from null function."); @@ -119,7 +120,7 @@ PawleyFit::getLatticeFromFunction(const PawleyFunction_sptr &pawleyFn) const { latticeParameterTable->addColumn("double", "Value"); latticeParameterTable->addColumn("double", "Error"); - PawleyParameterFunction_sptr parameters = + Functions::PawleyParameterFunction_sptr parameters = pawleyFn->getPawleyParameterFunction(); for (size_t i = 0; i < parameters->nParams(); ++i) { @@ -133,7 +134,7 @@ PawleyFit::getLatticeFromFunction(const PawleyFunction_sptr &pawleyFn) const { /// Extracts all profile parameters from the supplied function. ITableWorkspace_sptr PawleyFit::getPeakParametersFromFunction( - const PawleyFunction_sptr &pawleyFn) const { + const Functions::PawleyFunction_sptr &pawleyFn) const { if (!pawleyFn) { throw std::invalid_argument( "Cannot extract peak parameters from null function."); @@ -167,8 +168,8 @@ ITableWorkspace_sptr PawleyFit::getPeakParametersFromFunction( /// 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 { +IFunction_sptr PawleyFit::getCompositeFunction( + const Functions::PawleyFunction_sptr &pawleyFn) const { CompositeFunction_sptr composite = boost::make_shared<CompositeFunction>(); composite->addFunction(pawleyFn); @@ -271,8 +272,9 @@ void PawleyFit::init() { /// Execution of algorithm. void PawleyFit::exec() { // Setup PawleyFunction with cell from input parameters - PawleyFunction_sptr pawleyFn = boost::dynamic_pointer_cast<PawleyFunction>( - FunctionFactory::Instance().createFunction("PawleyFunction")); + Functions::PawleyFunction_sptr pawleyFn = + boost::dynamic_pointer_cast<Functions::PawleyFunction>( + FunctionFactory::Instance().createFunction("PawleyFunction")); g_log.information() << "Setting up Pawley function..." << std::endl; std::string profileFunction = getProperty("PeakProfileFunction"); @@ -286,7 +288,7 @@ void PawleyFit::exec() { << std::endl; pawleyFn->setUnitCell(getProperty("InitialCell")); - PawleyParameterFunction_sptr pawleyParameterFunction = + Functions::PawleyParameterFunction_sptr pawleyParameterFunction = pawleyFn->getPawleyParameterFunction(); g_log.information() << " Initial unit cell: " @@ -416,5 +418,6 @@ V3D V3DFromHKLColumnExtractor::getHKLFromString( return hkl; } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/PlotPeakByLogValue.cpp b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp similarity index 99% rename from Framework/CurveFitting/src/PlotPeakByLogValue.cpp rename to Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp index f380f15c43c792e136b2fa2f5451103819fb68b2..1478d845126c02fd1f1acc413dd612f3e9d521e8 100644 --- a/Framework/CurveFitting/src/PlotPeakByLogValue.cpp +++ b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp @@ -3,7 +3,6 @@ //---------------------------------------------------------------------- #include <cmath> #include <vector> -#include <iostream> #include <fstream> #include <sstream> #include <algorithm> @@ -11,7 +10,7 @@ #include <boost/lexical_cast.hpp> #include <boost/algorithm/string/replace.hpp> -#include "MantidCurveFitting/PlotPeakByLogValue.h" +#include "MantidCurveFitting/Algorithms/PlotPeakByLogValue.h" #include "MantidAPI/IFuncMinimizer.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -36,6 +35,7 @@ Mantid::Kernel::Logger g_log("PlotPeakByLogValue"); namespace Mantid { namespace CurveFitting { +namespace Algorithms { using namespace Kernel; using namespace API; @@ -619,5 +619,6 @@ PlotPeakByLogValue::getMinimizerString(const std::string &wsName, return format; } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/RefinePowderInstrumentParameters.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp similarity index 97% rename from Framework/CurveFitting/src/RefinePowderInstrumentParameters.cpp rename to Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp index 56a400e3b11d329ebde5463760d0e7e9b4c5e117..98a64f0b76769673b79f16fcf1fab4ce31aea6d1 100644 --- a/Framework/CurveFitting/src/RefinePowderInstrumentParameters.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/RefinePowderInstrumentParameters.h" +#include "MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h" #include "MantidKernel/ListValidator.h" #include "MantidKernel/ArrayProperty.h" @@ -14,11 +14,11 @@ #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/TextAxis.h" -#include "MantidCurveFitting/Fit.h" -#include "MantidCurveFitting/BackgroundFunction.h" -#include "MantidCurveFitting/Polynomial.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Gaussian.h" +#include "MantidCurveFitting/Algorithms/Fit.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/Polynomial.h" +#include "MantidCurveFitting/Functions/Gaussian.h" #include "MantidGeometry/Crystal/UnitCell.h" @@ -26,7 +26,6 @@ #include <boost/algorithm/string/split.hpp> #include <fstream> -#include <iomanip> #include <gsl/gsl_sf_erf.h> @@ -34,11 +33,15 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::Kernel; using namespace Mantid::DataObjects; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Constraints; using namespace std; namespace Mantid { namespace CurveFitting { +namespace Algorithms { DECLARE_ALGORITHM(RefinePowderInstrumentParameters) @@ -224,9 +227,8 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() { << endl; // 1. Initialize the fitting function - CurveFitting::ThermalNeutronDtoTOFFunction rawfunc; - mFunction = - boost::make_shared<CurveFitting::ThermalNeutronDtoTOFFunction>(rawfunc); + ThermalNeutronDtoTOFFunction rawfunc; + mFunction = boost::make_shared<ThermalNeutronDtoTOFFunction>(rawfunc); mFunction->initialize(); API::FunctionDomain1DVector domain(dataWS->readX(1)); @@ -803,7 +805,7 @@ void RefinePowderInstrumentParameters::getD2TOFFuncParamNames( parnames.clear(); // 2. Get the parameter names from function - CurveFitting::ThermalNeutronDtoTOFFunction d2toffunc; + ThermalNeutronDtoTOFFunction d2toffunc; d2toffunc.initialize(); std::vector<std::string> funparamnames = d2toffunc.getParameterNames(); @@ -879,7 +881,7 @@ void RefinePowderInstrumentParameters::genPeaksFromTable( for (size_t ir = 0; ir < numrows; ++ir) { // a) Generate peak - CurveFitting::BackToBackExponential newpeak; + BackToBackExponential newpeak; newpeak.initialize(); // b) Parse parameters @@ -930,8 +932,8 @@ void RefinePowderInstrumentParameters::genPeaksFromTable( newpeak.setParameter("I", height); // d) Make to share pointer and set to instance data structure (map) - CurveFitting::BackToBackExponential_sptr newpeakptr = - boost::make_shared<CurveFitting::BackToBackExponential>(newpeak); + BackToBackExponential_sptr newpeakptr = + boost::make_shared<BackToBackExponential>(newpeak); std::vector<int> hkl; hkl.push_back(h); @@ -1168,8 +1170,7 @@ void RefinePowderInstrumentParameters::genPeakCentersWorkspace( throw runtime_error(errss.str()); } - std::map<std::vector<int>, CurveFitting::BackToBackExponential_sptr>::iterator - peakiter; + std::map<std::vector<int>, BackToBackExponential_sptr>::iterator peakiter; std::vector<std::pair<double, std::pair<double, double>>> peakcenters; // d_h [TOF_h, CHI2] @@ -1300,5 +1301,6 @@ RefinePowderInstrumentParameters::genOutputInstrumentParameterTable() { return newtablews; } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/RefinePowderInstrumentParameters3.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp similarity index 99% rename from Framework/CurveFitting/src/RefinePowderInstrumentParameters3.cpp rename to Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp index b2f339bc14ef4a88622e1565a4df50765cee08ee..a5c35c1f331d71bca31643d8fc85b77d7bf7b2fd 100644 --- a/Framework/CurveFitting/src/RefinePowderInstrumentParameters3.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/RefinePowderInstrumentParameters3.h" +#include "MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h" #include "MantidAPI/Axis.h" #include "MantidAPI/TextAxis.h" @@ -7,12 +7,14 @@ using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::DataObjects; using namespace Mantid::Kernel; using namespace std; namespace Mantid { namespace CurveFitting { +namespace Algorithms { DECLARE_ALGORITHM(RefinePowderInstrumentParameters3) @@ -1266,8 +1268,9 @@ void RefinePowderInstrumentParameters3::setFunctionParameterFitSetups( double upperbound = param.maxvalue; if (lowerbound >= -DBL_MAX * 0.1 || upperbound <= DBL_MAX * 0.1) { // If there is a boundary - BoundaryConstraint *bc = new BoundaryConstraint( - function.get(), parname, lowerbound, upperbound, false); + Constraints::BoundaryConstraint *bc = + new Constraints::BoundaryConstraint( + function.get(), parname, lowerbound, upperbound, false); function->addConstraint(bc); } } else { @@ -1428,5 +1431,6 @@ void restoreFunctionParameterValue( return; } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/SplineBackground.cpp b/Framework/CurveFitting/src/Algorithms/SplineBackground.cpp similarity index 97% rename from Framework/CurveFitting/src/SplineBackground.cpp rename to Framework/CurveFitting/src/Algorithms/SplineBackground.cpp index d3eddbab62067a8297f96e73f2911bfccfe6eab8..93b2e86016a7320e17d3ae657789ec49ad86da6f 100644 --- a/Framework/CurveFitting/src/SplineBackground.cpp +++ b/Framework/CurveFitting/src/Algorithms/SplineBackground.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/SplineBackground.h" +#include "MantidCurveFitting/Algorithms/SplineBackground.h" #include <gsl/gsl_bspline.h> #include <gsl/gsl_multifit.h> #include <gsl/gsl_statistics.h> @@ -9,6 +9,7 @@ namespace Mantid { namespace CurveFitting { +namespace Algorithms { DECLARE_ALGORITHM(SplineBackground) @@ -170,5 +171,6 @@ void SplineBackground::exec() { setProperty("OutputWorkspace", outWS); } -} // namespace Algorithm +} // namespace Algorithms +} // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/SplineInterpolation.cpp b/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp similarity index 98% rename from Framework/CurveFitting/src/SplineInterpolation.cpp rename to Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp index 63731d8bd084bc41f9eda55f90669c0b41b494d1..9d1a1bc531c9d0dc3c765ddf3a904e1bf1955a7c 100644 --- a/Framework/CurveFitting/src/SplineInterpolation.cpp +++ b/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp @@ -2,16 +2,18 @@ #include "MantidAPI/NumericAxis.h" #include "MantidAPI/Progress.h" #include "MantidKernel/BoundedValidator.h" -#include "MantidCurveFitting/SplineInterpolation.h" +#include "MantidCurveFitting/Algorithms/SplineInterpolation.h" namespace Mantid { namespace CurveFitting { +namespace Algorithms { // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(SplineInterpolation) using namespace API; using namespace Kernel; +using Functions::CubicSpline; //---------------------------------------------------------------------------------------------- /** Constructor @@ -253,5 +255,6 @@ void SplineInterpolation::calculateSpline( m_cspline->function1D(yValues, xValues, nData); } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/SplineSmoothing.cpp b/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp similarity index 99% rename from Framework/CurveFitting/src/SplineSmoothing.cpp rename to Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp index 9cac9523f02913279baf3857de8585df1cf1611f..87fcfb16e36bfd4af6e18a84ed51b9c459f27e3c 100644 --- a/Framework/CurveFitting/src/SplineSmoothing.cpp +++ b/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp @@ -4,19 +4,20 @@ #include "MantidAPI/TextAxis.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidKernel/BoundedValidator.h" -#include "MantidCurveFitting/SplineSmoothing.h" +#include "MantidCurveFitting/Algorithms/SplineSmoothing.h" #include <algorithm> namespace Mantid { namespace CurveFitting { +namespace Algorithms { // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(SplineSmoothing) using namespace API; using namespace Kernel; - +using Functions::BSpline; //---------------------------------------------------------------------------------------------- /** Constructor */ @@ -370,5 +371,6 @@ void SplineSmoothing::selectSmoothingPoints( } } +} // namespace Algorithms } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/BoundaryConstraint.cpp b/Framework/CurveFitting/src/Constraints/BoundaryConstraint.cpp similarity index 98% rename from Framework/CurveFitting/src/BoundaryConstraint.cpp rename to Framework/CurveFitting/src/Constraints/BoundaryConstraint.cpp index 6ecbe020e781f48f2adbc63862c2ddb45fd067e5..86f3f52be2a7fe4549198c0a4926b5a0c3d1074a 100644 --- a/Framework/CurveFitting/src/BoundaryConstraint.cpp +++ b/Framework/CurveFitting/src/Constraints/BoundaryConstraint.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidAPI/Expression.h" #include "MantidAPI/ConstraintFactory.h" #include "MantidKernel/Logger.h" @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace Constraints { namespace { /// static logger Kernel::Logger g_log("BoundaryConstraint"); @@ -247,5 +248,6 @@ std::string BoundaryConstraint::asString() const { return ostr.str(); } +} // namespace Constraints } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CostFuncFitting.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp similarity index 98% rename from Framework/CurveFitting/src/CostFuncFitting.cpp rename to Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp index 425bdcce324e7fcf858aa95d24c5aa0bd21f2b8f..021e2ed4db9b86a3b5f85a87cd5350288186c49d 100644 --- a/Framework/CurveFitting/src/CostFuncFitting.cpp +++ b/Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/CostFuncFitting.h" +#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h" #include "MantidCurveFitting/GSLJacobian.h" #include "MantidAPI/IConstraint.h" @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace CostFunctions { /** * Constructor. @@ -202,5 +203,6 @@ void CostFuncFitting::calTransformationMatrixNumerically(GSLMatrix &tm) { } } +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CostFuncIgnorePosPeaks.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncIgnorePosPeaks.cpp similarity index 95% rename from Framework/CurveFitting/src/CostFuncIgnorePosPeaks.cpp rename to Framework/CurveFitting/src/CostFunctions/CostFuncIgnorePosPeaks.cpp index 6e6b404b1b2fd4fb680e0cf6c92e0babd2f2617f..8f5d5ecbb2e835d9b04494c915715a60ba097158 100644 --- a/Framework/CurveFitting/src/CostFuncIgnorePosPeaks.cpp +++ b/Framework/CurveFitting/src/CostFunctions/CostFuncIgnorePosPeaks.cpp @@ -1,13 +1,14 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/CostFuncIgnorePosPeaks.h" +#include "MantidCurveFitting/CostFunctions/CostFuncIgnorePosPeaks.h" #include "MantidKernel/PhysicalConstants.h" #include <cmath> #include <gsl/gsl_sf_erf.h> namespace Mantid { namespace CurveFitting { +namespace CostFunctions { DECLARE_COSTFUNCTION(CostFuncIgnorePosPeaks, Ignore positive peaks) @@ -73,5 +74,6 @@ void CostFuncIgnorePosPeaks::deriv(const double *yData, } } +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CostFuncLeastSquares.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncLeastSquares.cpp similarity index 98% rename from Framework/CurveFitting/src/CostFuncLeastSquares.cpp rename to Framework/CurveFitting/src/CostFunctions/CostFuncLeastSquares.cpp index e1fa52338bf531753909c036c1de96881be22f2f..025968c21b954c5bac4f0754a974669bcc9f462e 100644 --- a/Framework/CurveFitting/src/CostFuncLeastSquares.cpp +++ b/Framework/CurveFitting/src/CostFunctions/CostFuncLeastSquares.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidCurveFitting/Jacobian.h" #include "MantidCurveFitting/SeqDomain.h" #include "MantidAPI/IConstraint.h" @@ -10,10 +10,9 @@ #include "MantidKernel/Logger.h" #include "MantidKernel/MultiThreaded.h" -#include <iomanip> - namespace Mantid { namespace CurveFitting { +namespace CostFunctions { namespace { /// static logger Kernel::Logger g_log("CostFuncLeastSquares"); @@ -438,5 +437,6 @@ void CostFuncLeastSquares::calActiveCovarianceMatrix(GSLMatrix &covar, } } +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CostFuncRwp.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncRwp.cpp similarity index 94% rename from Framework/CurveFitting/src/CostFuncRwp.cpp rename to Framework/CurveFitting/src/CostFunctions/CostFuncRwp.cpp index c72d9d3d4a1487df71590914057100a46c4c9eab..17e783d9f7e438c9366c6d3fc3ffe700703e3872 100644 --- a/Framework/CurveFitting/src/CostFuncRwp.cpp +++ b/Framework/CurveFitting/src/CostFunctions/CostFuncRwp.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/CostFuncRwp.h" +#include "MantidCurveFitting/CostFunctions/CostFuncRwp.h" #include "MantidCurveFitting/Jacobian.h" #include "MantidCurveFitting/SeqDomain.h" #include "MantidAPI/IConstraint.h" @@ -9,10 +9,10 @@ #include "MantidAPI/FunctionValues.h" #include <cmath> -#include <iomanip> namespace Mantid { namespace CurveFitting { +namespace CostFunctions { DECLARE_COSTFUNCTION(CostFuncRwp, Rwp) @@ -64,5 +64,6 @@ double CostFuncRwp::calSqrtW(API::FunctionValues_sptr values) const { return sqrt(weight); } +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CostFuncUnweightedLeastSquares.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncUnweightedLeastSquares.cpp similarity index 95% rename from Framework/CurveFitting/src/CostFuncUnweightedLeastSquares.cpp rename to Framework/CurveFitting/src/CostFunctions/CostFuncUnweightedLeastSquares.cpp index da4e2bd1170ff07e4dba224179e1d2a8e33d58b8..c7eadd62b70a84e434abd1ab4eacc719f584a558 100644 --- a/Framework/CurveFitting/src/CostFuncUnweightedLeastSquares.cpp +++ b/Framework/CurveFitting/src/CostFunctions/CostFuncUnweightedLeastSquares.cpp @@ -1,11 +1,11 @@ -#include "MantidCurveFitting/CostFuncUnweightedLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h" #include "MantidKernel/Logger.h" -#include <iomanip> #include <cmath> namespace Mantid { namespace CurveFitting { +namespace CostFunctions { namespace { /// static logger @@ -80,5 +80,6 @@ double CostFuncUnweightedLeastSquares::getResidualVariance() const { return residualVariance; } +} // namespace CostFunctions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/FitMW.cpp b/Framework/CurveFitting/src/FitMW.cpp index d98e9dc7f3719d3111503175281cd3cd0d12242a..730110936f4ad63ae1821bdd9fe2d7c4e1cd6d15 100644 --- a/Framework/CurveFitting/src/FitMW.cpp +++ b/Framework/CurveFitting/src/FitMW.cpp @@ -2,7 +2,7 @@ //---------------------------------------------------------------------- #include "MantidCurveFitting/FitMW.h" #include "MantidCurveFitting/SeqDomain.h" -#include "MantidCurveFitting/Convolution.h" +#include "MantidCurveFitting/Functions/Convolution.h" #include "MantidCurveFitting/ParameterEstimator.h" #include "MantidAPI/CompositeFunction.h" @@ -449,7 +449,7 @@ void FitMW::appendCompositeFunctionMembers( // if function is a Convolution then output of convolved model's mebers may be // required if (m_convolutionCompositeMembers && - boost::dynamic_pointer_cast<CurveFitting::Convolution>(function)) { + boost::dynamic_pointer_cast<Functions::Convolution>(function)) { appendConvolvedCompositeFunctionMembers(functionList, function); } else { const auto compositeFn = @@ -486,8 +486,8 @@ void FitMW::appendCompositeFunctionMembers( void FitMW::appendConvolvedCompositeFunctionMembers( std::list<API::IFunction_sptr> &functionList, const API::IFunction_sptr &function) const { - boost::shared_ptr<CurveFitting::Convolution> convolution = - boost::dynamic_pointer_cast<CurveFitting::Convolution>(function); + boost::shared_ptr<Functions::Convolution> convolution = + boost::dynamic_pointer_cast<Functions::Convolution>(function); const auto compositeFn = boost::dynamic_pointer_cast<API::CompositeFunction>( convolution->getFunction(1)); @@ -498,8 +498,8 @@ void FitMW::appendConvolvedCompositeFunctionMembers( const size_t nlocals = compositeFn->nFunctions(); for (size_t i = 0; i < nlocals; ++i) { auto localFunction = compositeFn->getFunction(i); - boost::shared_ptr<CurveFitting::Convolution> localConvolution = - boost::make_shared<CurveFitting::Convolution>(); + boost::shared_ptr<Functions::Convolution> localConvolution = + boost::make_shared<Functions::Convolution>(); localConvolution->addFunction(resolution); localConvolution->addFunction(localFunction); functionList.insert(functionList.end(), localConvolution); diff --git a/Framework/CurveFitting/src/BFGS_Minimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/BFGS_Minimizer.cpp similarity index 85% rename from Framework/CurveFitting/src/BFGS_Minimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/BFGS_Minimizer.cpp index 8feb486fce889ac7784d01cbfe6a74a1032e0499..40b817c1028cc4f3d818e529859f37a7352fd00d 100644 --- a/Framework/CurveFitting/src/BFGS_Minimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/BFGS_Minimizer.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BFGS_Minimizer.h" +#include "MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { namespace { /// static logger object Kernel::Logger g_log("BFGS_Minimizer"); @@ -23,5 +24,6 @@ const gsl_multimin_fdfminimizer_type *BFGS_Minimizer::getGSLMinimizerType() { return gsl_multimin_fdfminimizer_vector_bfgs2; } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/DampingMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/DampingMinimizer.cpp similarity index 91% rename from Framework/CurveFitting/src/DampingMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/DampingMinimizer.cpp index 01e3169ebba8d9a0d3587a6d30143796d1de82f0..08114e04a546b699b4f359ba826924cf850a1917 100644 --- a/Framework/CurveFitting/src/DampingMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/DampingMinimizer.cpp @@ -1,8 +1,8 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/DampingMinimizer.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/DampingMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -17,6 +17,8 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { + namespace { /// static logger Kernel::Logger g_log("DampingMinimizer"); @@ -32,7 +34,9 @@ DampingMinimizer::DampingMinimizer(double relTol) /// Initialize minimizer, i.e. pass a function to minimize. void DampingMinimizer::initialize(API::ICostFunction_sptr function, size_t) { - m_leastSquares = boost::dynamic_pointer_cast<CostFuncLeastSquares>(function); + m_leastSquares = + boost::dynamic_pointer_cast<CostFunctions::CostFuncLeastSquares>( + function); if (!m_leastSquares) { throw std::invalid_argument("Damping minimizer works only with least " "squares. Different function was given."); @@ -121,5 +125,6 @@ double DampingMinimizer::costFunctionVal() { return m_leastSquares->val(); } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/DerivMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/DerivMinimizer.cpp similarity index 88% rename from Framework/CurveFitting/src/DerivMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/DerivMinimizer.cpp index 57cbc5a122fcbce37b30629977b8cc9c6dcc0dc0..5f54e75d6d7bea7407b1156cb3d8d035f05e59e1 100644 --- a/Framework/CurveFitting/src/DerivMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/DerivMinimizer.cpp @@ -1,11 +1,12 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/DerivMinimizer.h" -#include "MantidCurveFitting/CostFuncFitting.h" +#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h" namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { /** Used by the GSL to calculate the cost function. * @param x :: Vector with parameters @@ -17,8 +18,9 @@ double DerivMinimizer::fun(const gsl_vector *x, void *params) { for (size_t i = 0; i < n; ++i) { minimizer.m_costFunction->setParameter(i, gsl_vector_get(x, i)); } - boost::shared_ptr<CostFuncFitting> fitting = - boost::dynamic_pointer_cast<CostFuncFitting>(minimizer.m_costFunction); + boost::shared_ptr<CostFunctions::CostFuncFitting> fitting = + boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>( + minimizer.m_costFunction); if (fitting) { fitting->getFittingFunction()->applyTies(); } @@ -36,8 +38,9 @@ void DerivMinimizer::dfun(const gsl_vector *x, void *params, gsl_vector *g) { for (size_t i = 0; i < n; ++i) { minimizer.m_costFunction->setParameter(i, gsl_vector_get(x, i)); } - boost::shared_ptr<CostFuncFitting> fitting = - boost::dynamic_pointer_cast<CostFuncFitting>(minimizer.m_costFunction); + boost::shared_ptr<CostFunctions::CostFuncFitting> fitting = + boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>( + minimizer.m_costFunction); if (fitting) { fitting->getFittingFunction()->applyTies(); } @@ -61,8 +64,9 @@ void DerivMinimizer::fundfun(const gsl_vector *x, void *params, double *f, for (size_t i = 0; i < n; ++i) { minimizer.m_costFunction->setParameter(i, gsl_vector_get(x, i)); } - boost::shared_ptr<CostFuncFitting> fitting = - boost::dynamic_pointer_cast<CostFuncFitting>(minimizer.m_costFunction); + boost::shared_ptr<CostFunctions::CostFuncFitting> fitting = + boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>( + minimizer.m_costFunction); if (fitting) { fitting->getFittingFunction()->applyTies(); } @@ -173,5 +177,6 @@ void DerivMinimizer::setStopGradient(const double value) { double DerivMinimizer::costFunctionVal() { return m_gslSolver->f; } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/FABADAMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp similarity index 97% rename from Framework/CurveFitting/src/FABADAMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp index 8e8f7e3d70838d4d8dfaa06d2010a61b5954d7bc..fcdedf14c5017e8603999ccc7f97b1b8076febef 100644 --- a/Framework/CurveFitting/src/FABADAMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp @@ -1,6 +1,6 @@ -#include "MantidCurveFitting/FABADAMinimizer.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" +#include "MantidCurveFitting//Constraints/BoundaryConstraint.h" #include <stdio.h> #include <stdlib.h> @@ -26,11 +26,11 @@ #include <boost/version.hpp> #include <boost/math/special_functions/fpclassify.hpp> -#include <iostream> #include <ctime> namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { namespace { // static logger object @@ -92,7 +92,9 @@ FABADAMinimizer::~FABADAMinimizer() {} void FABADAMinimizer::initialize(API::ICostFunction_sptr function, size_t maxIterations) { - m_leastSquares = boost::dynamic_pointer_cast<CostFuncLeastSquares>(function); + m_leastSquares = + boost::dynamic_pointer_cast<CostFunctions::CostFuncLeastSquares>( + function); if (!m_leastSquares) { throw std::invalid_argument( "FABADA works only with least squares. Different function was given."); @@ -121,7 +123,8 @@ void FABADAMinimizer::initialize(API::ICostFunction_sptr function, m_bound.push_back(false); API::IConstraint *iconstr = fun->getConstraint(i); if (iconstr) { - BoundaryConstraint *bcon = dynamic_cast<BoundaryConstraint *>(iconstr); + Constraints::BoundaryConstraint *bcon = + dynamic_cast<Constraints::BoundaryConstraint *>(iconstr); if (bcon) { m_bound[i] = true; if (bcon->hasLower()) { @@ -641,5 +644,6 @@ void FABADAMinimizer::finalize() { } } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/FRConjugateGradientMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/FRConjugateGradientMinimizer.cpp similarity index 86% rename from Framework/CurveFitting/src/FRConjugateGradientMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/FRConjugateGradientMinimizer.cpp index a06a974c52ff6db48b0532bf76cab1c32bb2fd2e..d609f35a7cf2132a0a4c5b2aa81388d8cefb17d5 100644 --- a/Framework/CurveFitting/src/FRConjugateGradientMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/FRConjugateGradientMinimizer.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/FRConjugateGradientMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { namespace { /// static logger Kernel::Logger g_log("FRConjugateGradientMinimizer"); @@ -28,5 +29,6 @@ FRConjugateGradientMinimizer::getGSLMinimizerType() { return gsl_multimin_fdfminimizer_conjugate_fr; } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/LevenbergMarquardtMDMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMDMinimizer.cpp similarity index 96% rename from Framework/CurveFitting/src/LevenbergMarquardtMDMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMDMinimizer.cpp index 11793321b58aa4f52d8d51db2238f6f28ab41022..74fe28e69cdf447d7ba99f833fca8083f359adb5 100644 --- a/Framework/CurveFitting/src/LevenbergMarquardtMDMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMDMinimizer.cpp @@ -1,8 +1,8 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -12,11 +12,11 @@ #include <boost/lexical_cast.hpp> #include <gsl/gsl_blas.h> -#include <iostream> #include <cmath> namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { namespace { /// static logger object Kernel::Logger g_log("LevenbergMarquardMD"); @@ -40,7 +40,9 @@ LevenbergMarquardtMDMinimizer::LevenbergMarquardtMDMinimizer() /// Initialize minimizer, i.e. pass a function to minimize. void LevenbergMarquardtMDMinimizer::initialize(API::ICostFunction_sptr function, size_t) { - m_leastSquares = boost::dynamic_pointer_cast<CostFuncLeastSquares>(function); + m_leastSquares = + boost::dynamic_pointer_cast<CostFunctions::CostFuncLeastSquares>( + function); if (!m_leastSquares) { throw std::invalid_argument("Levenberg-Marquardt minimizer works only with " "least squares. Different function was given."); @@ -287,5 +289,6 @@ double LevenbergMarquardtMDMinimizer::costFunctionVal() { return m_leastSquares->val(); } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/LevenbergMarquardtMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp similarity index 93% rename from Framework/CurveFitting/src/LevenbergMarquardtMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp index 7e5614689298bb76705e4f6fed28472a1eab3ff5..df84cfc9f62124e1817e6b462e96fb64a59a7842 100644 --- a/Framework/CurveFitting/src/LevenbergMarquardtMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp @@ -1,8 +1,8 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/LevenbergMarquardtMinimizer.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -13,10 +13,10 @@ #include <boost/lexical_cast.hpp> #include <gsl/gsl_blas.h> -#include <iostream> namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { namespace { // Get a reference to the logger Kernel::Logger g_log("LevenbergMarquardtMinimizer"); @@ -41,7 +41,8 @@ void LevenbergMarquardtMinimizer::initialize( API::ICostFunction_sptr costFunction, size_t) { // set-up GSL container to be used with GSL simplex algorithm auto leastSquares = - boost::dynamic_pointer_cast<CostFuncLeastSquares>(costFunction); + boost::dynamic_pointer_cast<CostFunctions::CostFuncLeastSquares>( + costFunction); if (leastSquares) { m_data = new GSL_FitData(leastSquares); } else { @@ -141,5 +142,6 @@ void LevenbergMarquardtMinimizer::calCovarianceMatrix(double epsrel, gsl_multifit_covar(m_gslSolver->J, epsrel, covar); } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/PRConjugateGradientMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/PRConjugateGradientMinimizer.cpp similarity index 85% rename from Framework/CurveFitting/src/PRConjugateGradientMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/PRConjugateGradientMinimizer.cpp index ae9d3adaa6fb0e7841e23f563c88b6027a88685a..e208d427551e7e3ce76b176607ea017300396127 100644 --- a/Framework/CurveFitting/src/PRConjugateGradientMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/PRConjugateGradientMinimizer.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/PRConjugateGradientMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -10,6 +10,7 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { // clang-format off ///@cond nodoc @@ -24,5 +25,6 @@ PRConjugateGradientMinimizer::getGSLMinimizerType() { return gsl_multimin_fdfminimizer_conjugate_pr; } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/FuncMinimizers/SimplexMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/SimplexMinimizer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e9399ae13f134ee944285d188a5e406dc5698645 --- /dev/null +++ b/Framework/CurveFitting/src/FuncMinimizers/SimplexMinimizer.cpp @@ -0,0 +1,124 @@ +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#include "MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h" + +#include "MantidAPI/FuncMinimizerFactory.h" + +#include "MantidKernel/Logger.h" + +namespace Mantid { +namespace CurveFitting { +namespace FuncMinimisers { +namespace { +/// static logger +Kernel::Logger g_log("SimplexMinimizer"); +} + +DECLARE_FUNCMINIMIZER(SimplexMinimizer, Simplex) + +/** Calculating cost function +* +* @param x :: Input function arguments +* @param params :: Pointer to a SimplexMinimizer +* @return Value of the cost function +*/ +double SimplexMinimizer::fun(const gsl_vector *x, void *params) { + SimplexMinimizer &minimizer = *static_cast<SimplexMinimizer *>(params); + // update function parameters + if (x->data) { + for (size_t i = 0; i < minimizer.m_costFunction->nParams(); ++i) { + minimizer.m_costFunction->setParameter(i, gsl_vector_get(x, i)); + } + } + boost::shared_ptr<CostFunctions::CostFuncFitting> fitting = + boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>( + minimizer.m_costFunction); + if (fitting) { + fitting->getFittingFunction()->applyTies(); + } + return minimizer.m_costFunction->val(); +} + +SimplexMinimizer::SimplexMinimizer(const double epsabs) + : m_epsabs(epsabs), m_costFunction(), m_size(1.0), m_simplexStepSize(NULL), + m_startGuess(NULL), m_gslSolver(NULL) { + gslContainer.f = NULL; + gslContainer.n = -1; + gslContainer.params = NULL; +} + +void SimplexMinimizer::initialize(API::ICostFunction_sptr function, size_t) { + m_costFunction = function; + + const gsl_multimin_fminimizer_type *T = gsl_multimin_fminimizer_nmsimplex; + + size_t np = function->nParams(); + // step size for simplex + m_simplexStepSize = gsl_vector_alloc(np); + gsl_vector_set_all(m_simplexStepSize, m_size); + + // setup simplex container + gslContainer.n = np; + gslContainer.f = &fun; + gslContainer.params = this; + + // fill in parameter values + m_startGuess = gsl_vector_alloc(np); + for (size_t i = 0; i < np; ++i) { + gsl_vector_set(m_startGuess, i, function->getParameter(i)); + } + + // setup minimizer + m_gslSolver = gsl_multimin_fminimizer_alloc(T, np); + gsl_multimin_fminimizer_set(m_gslSolver, &gslContainer, m_startGuess, + m_simplexStepSize); +} + +/** + * Do one iteration. + * @return :: true if iterations to be continued, false if they can stop + */ +bool SimplexMinimizer::iterate(size_t) { + int status = gsl_multimin_fminimizer_iterate(m_gslSolver); + if (status) { + m_errorString = gsl_strerror(status); + return false; + } + double size = gsl_multimin_fminimizer_size(m_gslSolver); + status = gsl_multimin_test_size(size, m_epsabs); + if (status != GSL_CONTINUE) { + m_errorString = gsl_strerror(status); + return false; + } + return true; +} + +/// resets the size +void SimplexMinimizer::resetSize(const double &size) { + m_size = size; + clearMemory(); + initialize(m_costFunction); +} + +SimplexMinimizer::~SimplexMinimizer() { clearMemory(); } + +/// clear memory +void SimplexMinimizer::clearMemory() { + if (m_simplexStepSize) { + gsl_vector_free(m_simplexStepSize); + } + if (m_startGuess) { + gsl_vector_free(m_startGuess); + } + if (m_gslSolver) { + gsl_multimin_fminimizer_free(m_gslSolver); + } +} + +double SimplexMinimizer::costFunctionVal() { return m_gslSolver->fval; } + +} // namespace FuncMinimisers +} // namespace CurveFitting +} // namespace Mantid diff --git a/Framework/CurveFitting/src/SteepestDescentMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/SteepestDescentMinimizer.cpp similarity index 85% rename from Framework/CurveFitting/src/SteepestDescentMinimizer.cpp rename to Framework/CurveFitting/src/FuncMinimizers/SteepestDescentMinimizer.cpp index be4c4380ab191ba7a3db2150ca0a14c39a179e1b..810d63841a68ab2b02ff4f0630cbcc574bfb259d 100644 --- a/Framework/CurveFitting/src/SteepestDescentMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/SteepestDescentMinimizer.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/SteepestDescentMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -10,6 +10,8 @@ namespace Mantid { namespace CurveFitting { +namespace FuncMinimisers { + namespace { // Get a reference to the logger Kernel::Logger g_log("SteepestDescentMinimizer"); @@ -24,5 +26,6 @@ SteepestDescentMinimizer::getGSLMinimizerType() { return gsl_multimin_fdfminimizer_steepest_descent; } +} // namespace FuncMinimisers } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Abragam.cpp b/Framework/CurveFitting/src/Functions/Abragam.cpp similarity index 93% rename from Framework/CurveFitting/src/Abragam.cpp rename to Framework/CurveFitting/src/Functions/Abragam.cpp index cd24227e3143a73979c2fca010074c8d4ea831dc..40ff74e9b61da1d1896de518896c4d6c8f5cf25a 100644 --- a/Framework/CurveFitting/src/Abragam.cpp +++ b/Framework/CurveFitting/src/Functions/Abragam.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Abragam.h" +#include "MantidCurveFitting/Functions/Abragam.h" #include "MantidAPI//FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(Abragam) @@ -61,5 +65,6 @@ void Abragam::setActiveParameter(size_t i, double value) { setParameter(j, value, false); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/BSpline.cpp b/Framework/CurveFitting/src/Functions/BSpline.cpp similarity index 98% rename from Framework/CurveFitting/src/BSpline.cpp rename to Framework/CurveFitting/src/Functions/BSpline.cpp index b174fdc184dedc64f68525912eddf8103fde4e81..670a7c8614abc0934bf5e909fe48b46bdcc26b4e 100644 --- a/Framework/CurveFitting/src/BSpline.cpp +++ b/Framework/CurveFitting/src/Functions/BSpline.cpp @@ -1,17 +1,21 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BSpline.h" +#include "MantidCurveFitting/Functions/BSpline.h" #include "MantidCurveFitting/GSLVector.h" #include "MantidCurveFitting/GSLMatrix.h" #include "MantidAPI/FunctionFactory.h" #include <boost/lexical_cast.hpp> -#include <iostream> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; + using namespace Kernel; + using namespace API; DECLARE_FUNCTION(BSpline) @@ -251,5 +255,6 @@ void BSpline::getGSLBreakPoints(std::vector<double> &bp) const { } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/BackToBackExponential.cpp b/Framework/CurveFitting/src/Functions/BackToBackExponential.cpp similarity index 96% rename from Framework/CurveFitting/src/BackToBackExponential.cpp rename to Framework/CurveFitting/src/Functions/BackToBackExponential.cpp index 0c623c678de5444a75316e156d2abd584412dbf5..64a5d5aae6a6237bd4a293c78107fc7e4e7c5363 100644 --- a/Framework/CurveFitting/src/BackToBackExponential.cpp +++ b/Framework/CurveFitting/src/Functions/BackToBackExponential.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BackToBackExponential.h" +#include "MantidCurveFitting/Functions/BackToBackExponential.h" #include "MantidAPI/FunctionFactory.h" #include <gsl/gsl_sf_erf.h> @@ -12,8 +12,12 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(BackToBackExponential) @@ -144,5 +148,6 @@ double BackToBackExponential::expWidth() const { return M_LN2 * (a + b) / (a * b); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/BackgroundFunction.cpp b/Framework/CurveFitting/src/Functions/BackgroundFunction.cpp similarity index 78% rename from Framework/CurveFitting/src/BackgroundFunction.cpp rename to Framework/CurveFitting/src/Functions/BackgroundFunction.cpp index a7d79bd6fe4109e9f58967b399e725ff16f25302..1b243cda6edc5f52619fe15152aab68edb443053 100644 --- a/Framework/CurveFitting/src/BackgroundFunction.cpp +++ b/Framework/CurveFitting/src/Functions/BackgroundFunction.cpp @@ -1,12 +1,16 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/BackgroundFunction.h" +#include "MantidCurveFitting/Functions/BackgroundFunction.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; void BackgroundFunction::fit(const std::vector<double> &X, @@ -15,5 +19,6 @@ void BackgroundFunction::fit(const std::vector<double> &X, (void)Y; // Avoid compiler warning } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/BivariateNormal.cpp b/Framework/CurveFitting/src/Functions/BivariateNormal.cpp similarity index 98% rename from Framework/CurveFitting/src/BivariateNormal.cpp rename to Framework/CurveFitting/src/Functions/BivariateNormal.cpp index f9cae2a8038f071c747db3f76be879e2778e15d7..59918f5e1e5e65171378450762c01892f3c9d5f4 100644 --- a/Framework/CurveFitting/src/BivariateNormal.cpp +++ b/Framework/CurveFitting/src/Functions/BivariateNormal.cpp @@ -1,5 +1,5 @@ -#include "MantidCurveFitting/BivariateNormal.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Functions/BivariateNormal.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidKernel/PhysicalConstants.h" #include "MantidAPI/ParameterTie.h" @@ -9,7 +9,6 @@ #include <fstream> #include <algorithm> #include <math.h> -#include <iostream> #include <sstream> #include <string> #include <cstdio> @@ -18,6 +17,10 @@ using namespace Mantid::API; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; +using namespace Constraints; namespace { /// static logger @@ -680,5 +683,6 @@ double BivariateNormal::initCoeff(const MantidVec &D, const MantidVec &X, return penalty; } +} // namespace Functions } // namespace curveFitting } // namespaceMantid diff --git a/Framework/CurveFitting/src/Bk2BkExpConvPV.cpp b/Framework/CurveFitting/src/Functions/Bk2BkExpConvPV.cpp similarity index 98% rename from Framework/CurveFitting/src/Bk2BkExpConvPV.cpp rename to Framework/CurveFitting/src/Functions/Bk2BkExpConvPV.cpp index 7052c100cf82ebd824ef254c3b1495f466d269af..d3f4fcb35aae249b2971879a6f362d0066251462 100644 --- a/Framework/CurveFitting/src/Bk2BkExpConvPV.cpp +++ b/Framework/CurveFitting/src/Functions/Bk2BkExpConvPV.cpp @@ -1,18 +1,22 @@ #include <cmath> -#include "MantidCurveFitting/Bk2BkExpConvPV.h" +#include "MantidCurveFitting/Functions/Bk2BkExpConvPV.h" #include "MantidKernel/System.h" #include "MantidAPI/FunctionFactory.h" #include <gsl/gsl_sf_erf.h> using namespace Mantid::Kernel; + using namespace Mantid::API; using namespace std; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; namespace { /// static logger Kernel::Logger g_log("Bk2BkExpConvPV"); @@ -250,4 +254,5 @@ void Bk2BkExpConvPV::calHandEta(double sigma2, double gamma, double &H, } } // namespace Mantid +} // namespace Functions } // namespace CurveFitting diff --git a/Framework/CurveFitting/src/ChebfunBase.cpp b/Framework/CurveFitting/src/Functions/ChebfunBase.cpp similarity index 99% rename from Framework/CurveFitting/src/ChebfunBase.cpp rename to Framework/CurveFitting/src/Functions/ChebfunBase.cpp index 3a1844b95636baf0adf96fa6b8e88bec092e97a4..4f25c57ba462bd4071272fba1c2ba8f17684dc99 100644 --- a/Framework/CurveFitting/src/ChebfunBase.cpp +++ b/Framework/CurveFitting/src/Functions/ChebfunBase.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ChebfunBase.h" +#include "MantidCurveFitting/Functions/ChebfunBase.h" #include "MantidAPI/IFunction1D.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" @@ -19,6 +19,9 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; // Set the comparison tolerance. const double ChebfunBase::g_tolerance = 1e-15; @@ -297,6 +300,7 @@ ChebfunBase::evalVector(const std::vector<double> &x, */ void ChebfunBase::derivative(const std::vector<double> &a, std::vector<double> &aout) const { + using namespace std::placeholders; if (a.size() != m_x.size()) { throw std::invalid_argument( @@ -331,6 +335,7 @@ void ChebfunBase::derivative(const std::vector<double> &a, */ ChebfunBase_sptr ChebfunBase::integral(const std::vector<double> &a, std::vector<double> &aout) const { + using namespace std::placeholders; if (a.size() != m_x.size()) { throw std::invalid_argument( @@ -926,5 +931,6 @@ ChebfunBase::smooth(const std::vector<double> &xvalues, return y; } +} // Functions } // CurveFitting } // Mantid diff --git a/Framework/CurveFitting/src/Chebyshev.cpp b/Framework/CurveFitting/src/Functions/Chebyshev.cpp similarity index 95% rename from Framework/CurveFitting/src/Chebyshev.cpp rename to Framework/CurveFitting/src/Functions/Chebyshev.cpp index 7da4e1d0b8837453722a2f6952a7becc1c442e98..9395ced590de45f8a22db3d0d092e5b816334a0f 100644 --- a/Framework/CurveFitting/src/Chebyshev.cpp +++ b/Framework/CurveFitting/src/Functions/Chebyshev.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Chebyshev.h" +#include "MantidCurveFitting/Functions/Chebyshev.h" #include "MantidAPI/FunctionFactory.h" #include <boost/lexical_cast.hpp> @@ -9,8 +9,12 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(Chebyshev) @@ -99,5 +103,6 @@ void Chebyshev::setAttribute(const std::string &attName, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ComptonPeakProfile.cpp b/Framework/CurveFitting/src/Functions/ComptonPeakProfile.cpp similarity index 96% rename from Framework/CurveFitting/src/ComptonPeakProfile.cpp rename to Framework/CurveFitting/src/Functions/ComptonPeakProfile.cpp index 89aaaab815f4d755a8cf390ded7d15b7c16083cd..c10c9bf5a8906fc1f6c2e66630ab2079cee8bb44 100644 --- a/Framework/CurveFitting/src/ComptonPeakProfile.cpp +++ b/Framework/CurveFitting/src/Functions/ComptonPeakProfile.cpp @@ -1,14 +1,17 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- -#include "MantidCurveFitting/ComptonPeakProfile.h" -#include "MantidCurveFitting/ConvertToYSpace.h" +#include "MantidCurveFitting/Functions/ComptonPeakProfile.h" +#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting::Algorithms; DECLARE_FUNCTION(ComptonPeakProfile) @@ -82,6 +85,7 @@ void ComptonPeakProfile::function1D(double *out, const double *xValues, */ void ComptonPeakProfile::setUpForFit() { // Voigt & Gaussian + using namespace Mantid::API; m_gauss = boost::dynamic_pointer_cast<IPeakFunction>( FunctionFactory::Instance().createFunction("Gaussian")); @@ -165,5 +169,6 @@ void ComptonPeakProfile::setAttribute(const std::string &name, m_voigtCutOff = value.asDouble(); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ComptonProfile.cpp b/Framework/CurveFitting/src/Functions/ComptonProfile.cpp similarity index 94% rename from Framework/CurveFitting/src/ComptonProfile.cpp rename to Framework/CurveFitting/src/Functions/ComptonProfile.cpp index b7d2ede6cb7e7a10737f3f58823e84be996deceb..f93325fcd70707d6667bbe5d1e0bfab7c89e5a2c 100644 --- a/Framework/CurveFitting/src/ComptonProfile.cpp +++ b/Framework/CurveFitting/src/Functions/ComptonProfile.cpp @@ -1,13 +1,17 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- -#include "MantidCurveFitting/ComptonProfile.h" -#include "MantidCurveFitting/ConvertToYSpace.h" +#include "MantidCurveFitting/Functions/ComptonProfile.h" +#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h" #include "MantidAPI/FunctionFactory.h" #include <gsl/gsl_poly.h> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; +using namespace CurveFitting::Algorithms; namespace { ///@cond @@ -24,6 +28,7 @@ ComptonProfile::ComptonProfile() : API::ParamFunction(), API::IFunction1D(), m_log("ComptonProfile"), m_wsIndex(0), m_mass(0.0), m_voigt(), m_resolutionFunction(), m_yspace(), m_modQ(), m_e0() { + using namespace Mantid::API; m_resolutionFunction = boost::dynamic_pointer_cast<VesuvioResolution>( FunctionFactory::Instance().createFunction("VesuvioResolution")); @@ -53,6 +58,7 @@ void ComptonProfile::function1D(double *out, const double *xValues, * Creates the internal caches */ void ComptonProfile::setUpForFit() { + using namespace Mantid::API; m_voigt = boost::dynamic_pointer_cast<IPeakFunction>( FunctionFactory::Instance().createFunction("Voigt")); @@ -92,7 +98,7 @@ void ComptonProfile::setMatrixWorkspace( m_resolutionFunction->setAttributeValue("Mass", m_mass); m_resolutionFunction->setMatrixWorkspace(workspace, wsIndex, startX, endX); - DetectorParams detpar = + Algorithms::DetectorParams detpar = ConvertToYSpace::getDetectorParameters(workspace, m_wsIndex); this->cacheYSpaceValues(workspace->readX(m_wsIndex), workspace->isHistogramData(), detpar); @@ -100,7 +106,7 @@ void ComptonProfile::setMatrixWorkspace( void ComptonProfile::cacheYSpaceValues(const std::vector<double> &tseconds, const bool isHistogram, - const DetectorParams &detpar, + const Algorithms::DetectorParams &detpar, const ResolutionParams &respar) { m_resolutionFunction->cacheResolutionComponents(detpar, respar); this->cacheYSpaceValues(tseconds, isHistogram, detpar); @@ -111,9 +117,9 @@ void ComptonProfile::cacheYSpaceValues(const std::vector<double> &tseconds, * @param isHistogram True if histogram tof values have been passed in * @param detpar Structure containing detector parameters */ -void ComptonProfile::cacheYSpaceValues(const std::vector<double> &tseconds, - const bool isHistogram, - const DetectorParams &detpar) { +void ComptonProfile::cacheYSpaceValues( + const std::vector<double> &tseconds, const bool isHistogram, + const Algorithms::DetectorParams &detpar) { // ------ Fixed coefficients related to resolution & Y-space transforms // ------------------ const double mevToK = PhysicalConstants::E_mev_toNeutronWavenumberSq; @@ -235,5 +241,6 @@ void ComptonProfile::voigtApproxDiff(std::vector<double> &voigtDiff, 2.0 * std::pow(epsilon, 3))); // divided by (2eps^3) } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ComptonScatteringCountRate.cpp b/Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp similarity index 99% rename from Framework/CurveFitting/src/ComptonScatteringCountRate.cpp rename to Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp index 67051c8d3166b3db68469c9919495d4f958e1e87..fa9ed893cb00c3a6785ce0b2285aafa9fe457461 100644 --- a/Framework/CurveFitting/src/ComptonScatteringCountRate.cpp +++ b/Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ComptonScatteringCountRate.h" +#include "MantidCurveFitting/Functions/ComptonScatteringCountRate.h" #include "MantidCurveFitting/AugmentedLagrangianOptimizer.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/MatrixWorkspace.h" @@ -10,6 +10,9 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using Kernel::Logger; namespace { @@ -445,5 +448,6 @@ void ComptonScatteringCountRate::createEqualityCM(const size_t nmasses) { } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Convolution.cpp b/Framework/CurveFitting/src/Functions/Convolution.cpp similarity index 98% rename from Framework/CurveFitting/src/Convolution.cpp rename to Framework/CurveFitting/src/Functions/Convolution.cpp index db1f62ad49f2d0a9f2f960e59b4b507e5f3e0472..00ed29d4c139058504875f9b573db92e8002d028 100644 --- a/Framework/CurveFitting/src/Convolution.cpp +++ b/Framework/CurveFitting/src/Functions/Convolution.cpp @@ -1,8 +1,8 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Convolution.h" -#include "MantidCurveFitting/DeltaFunction.h" +#include "MantidCurveFitting/Functions/Convolution.h" +#include "MantidCurveFitting/Functions/DeltaFunction.h" #include "MantidAPI/IFunction1D.h" #include "MantidAPI/FunctionFactory.h" @@ -20,8 +20,12 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(Convolution) @@ -297,5 +301,6 @@ void Convolution::refreshResolution() const { m_resolution.clear(); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/CubicSpline.cpp b/Framework/CurveFitting/src/Functions/CubicSpline.cpp similarity index 98% rename from Framework/CurveFitting/src/CubicSpline.cpp rename to Framework/CurveFitting/src/Functions/CubicSpline.cpp index 6b0d2815989e52ae26cf5f7be2a1fe47f8df31e9..d13cb126fdd0971edc5a8a2b9f08aa8b925b32c5 100644 --- a/Framework/CurveFitting/src/CubicSpline.cpp +++ b/Framework/CurveFitting/src/Functions/CubicSpline.cpp @@ -1,24 +1,27 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/CubicSpline.h" +#include "MantidCurveFitting/Functions/CubicSpline.h" #include "MantidAPI/FunctionFactory.h" #include "MantidKernel/Logger.h" #include <algorithm> #include <boost/lexical_cast.hpp> -#include <iostream> #include <stdexcept> #include <vector> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; namespace { /// static logger Kernel::Logger g_log("CubicSpline"); } using namespace Kernel; + using namespace API; DECLARE_FUNCTION(CubicSpline) @@ -359,5 +362,6 @@ void CubicSpline::reallocGSLObjects(const int n) { * */ CubicSpline::~CubicSpline() {} +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/DeltaFunction.cpp b/Framework/CurveFitting/src/Functions/DeltaFunction.cpp similarity index 87% rename from Framework/CurveFitting/src/DeltaFunction.cpp rename to Framework/CurveFitting/src/Functions/DeltaFunction.cpp index 883e0ed542810809d9c777fe98c4c5b15392dcf1..aa26ab1c786ff2f8747568353edd6f4078923b67 100644 --- a/Framework/CurveFitting/src/DeltaFunction.cpp +++ b/Framework/CurveFitting/src/Functions/DeltaFunction.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/DeltaFunction.h" +#include "MantidCurveFitting/Functions/DeltaFunction.h" #include "MantidAPI/FunctionFactory.h" #include <algorithm> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(DeltaFunction) @@ -32,5 +36,6 @@ void DeltaFunction::functionDeriv1D(Jacobian *out, const double *xValues, std::runtime_error("Cannot compute derivative of a delta function"); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/DiffRotDiscreteCircle.cpp b/Framework/CurveFitting/src/Functions/DiffRotDiscreteCircle.cpp similarity index 97% rename from Framework/CurveFitting/src/DiffRotDiscreteCircle.cpp rename to Framework/CurveFitting/src/Functions/DiffRotDiscreteCircle.cpp index ceb07007e2621508b37ecb0b0dcc4e22bce68a79..f295573909e3ba7653a4aad0a806f57f97d95496 100644 --- a/Framework/CurveFitting/src/DiffRotDiscreteCircle.cpp +++ b/Framework/CurveFitting/src/Functions/DiffRotDiscreteCircle.cpp @@ -1,12 +1,12 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/DiffRotDiscreteCircle.h" +#include "MantidCurveFitting/Functions/DiffRotDiscreteCircle.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/ParameterTie.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidGeometry/IDetector.h" #include "MantidKernel/Exception.h" #include "MantidKernel/UnitConversion.h" @@ -20,8 +20,13 @@ Mantid::Kernel::Logger g_log("DiffSphere"); namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; +using namespace Constraints; using namespace API; + using namespace Geometry; DECLARE_FUNCTION(ElasticDiffRotDiscreteCircle) @@ -247,5 +252,6 @@ void DiffRotDiscreteCircle::init() { applyTies(); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/DiffSphere.cpp b/Framework/CurveFitting/src/Functions/DiffSphere.cpp similarity index 98% rename from Framework/CurveFitting/src/DiffSphere.cpp rename to Framework/CurveFitting/src/Functions/DiffSphere.cpp index bf7d4a803090902fc2df9b2c8675326f61196db4..19519493021e0af64a1816b461d1d68332fdbaa8 100644 --- a/Framework/CurveFitting/src/DiffSphere.cpp +++ b/Framework/CurveFitting/src/Functions/DiffSphere.cpp @@ -1,12 +1,12 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/DiffSphere.h" +#include "MantidCurveFitting/Functions/DiffSphere.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/ParameterTie.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidGeometry/IDetector.h" #include "MantidKernel/Exception.h" #include "MantidKernel/UnitConversion.h" @@ -22,9 +22,15 @@ Mantid::Kernel::Logger g_log("DiffSphere"); namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; +using namespace Constraints; using namespace API; + using namespace Geometry; + using namespace Kernel; DECLARE_FUNCTION(ElasticDiffSphere) @@ -351,5 +357,6 @@ void DiffSphere::init() { applyTies(); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/DynamicKuboToyabe.cpp b/Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp similarity index 98% rename from Framework/CurveFitting/src/DynamicKuboToyabe.cpp rename to Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp index e62d0ba82c49eb9694c16d02874baf371cb0b1c5..e90d834562d8ce0768ab38f196a97d142b2686e8 100644 --- a/Framework/CurveFitting/src/DynamicKuboToyabe.cpp +++ b/Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/DynamicKuboToyabe.h" +#include "MantidCurveFitting/Functions/DynamicKuboToyabe.h" #include "MantidAPI/Jacobian.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/MatrixWorkspace.h" @@ -9,8 +9,12 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(DynamicKuboToyabe) @@ -375,5 +379,6 @@ bool DynamicKuboToyabe::hasAttribute(const std::string &attName) const { return attName == "BinWidth"; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/EndErfc.cpp b/Framework/CurveFitting/src/Functions/EndErfc.cpp similarity index 91% rename from Framework/CurveFitting/src/EndErfc.cpp rename to Framework/CurveFitting/src/Functions/EndErfc.cpp index 7d5de37a67dd28340214068459843a2f09d31b99..ed8101f7d9a15b3a8c392225b17af219009fcc88 100644 --- a/Framework/CurveFitting/src/EndErfc.cpp +++ b/Framework/CurveFitting/src/Functions/EndErfc.cpp @@ -1,15 +1,19 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/EndErfc.h" +#include "MantidCurveFitting/Functions/EndErfc.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> #include <gsl/gsl_sf_erf.h> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(EndErfc) @@ -51,5 +55,6 @@ void EndErfc::setActiveParameter(size_t i, double value) { setParameter(j, value, false); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ExpDecay.cpp b/Framework/CurveFitting/src/Functions/ExpDecay.cpp similarity index 90% rename from Framework/CurveFitting/src/ExpDecay.cpp rename to Framework/CurveFitting/src/Functions/ExpDecay.cpp index c5d92311a04e1c729ccb877ec42cf047f9a2d070..3f26962c469291157c260c23e1c1c15ea63bf4c9 100644 --- a/Framework/CurveFitting/src/ExpDecay.cpp +++ b/Framework/CurveFitting/src/Functions/ExpDecay.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/ExpDecay.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(ExpDecay) @@ -41,5 +45,6 @@ void ExpDecay::functionDeriv1D(Jacobian *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ExpDecayMuon.cpp b/Framework/CurveFitting/src/Functions/ExpDecayMuon.cpp similarity index 90% rename from Framework/CurveFitting/src/ExpDecayMuon.cpp rename to Framework/CurveFitting/src/Functions/ExpDecayMuon.cpp index 2f0867e8c10b8111da7e4de914c9bcc43a18d802..748b7ed6bae725f0eeb5eb5127f2fa88c28986da 100644 --- a/Framework/CurveFitting/src/ExpDecayMuon.cpp +++ b/Framework/CurveFitting/src/Functions/ExpDecayMuon.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/ExpDecayMuon.h" +#include "MantidCurveFitting/Functions/ExpDecayMuon.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(ExpDecayMuon) @@ -41,5 +45,6 @@ void ExpDecayMuon::functionDeriv1D(Jacobian *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ExpDecayOsc.cpp b/Framework/CurveFitting/src/Functions/ExpDecayOsc.cpp similarity index 94% rename from Framework/CurveFitting/src/ExpDecayOsc.cpp rename to Framework/CurveFitting/src/Functions/ExpDecayOsc.cpp index f3d677feee5204237636b8284c4446584b5164e0..53713374e6a8df68779401578a7d827b97810047 100644 --- a/Framework/CurveFitting/src/ExpDecayOsc.cpp +++ b/Framework/CurveFitting/src/Functions/ExpDecayOsc.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/ExpDecayOsc.h" +#include "MantidCurveFitting/Functions/ExpDecayOsc.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(ExpDecayOsc) @@ -68,5 +72,6 @@ void ExpDecayOsc::setActiveParameter(size_t i, double value) { setParameter(j, value, false); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/FlatBackground.cpp b/Framework/CurveFitting/src/Functions/FlatBackground.cpp similarity index 92% rename from Framework/CurveFitting/src/FlatBackground.cpp rename to Framework/CurveFitting/src/Functions/FlatBackground.cpp index d1fc5c08ad6a7e1051cf4124ec6cf58256f21a3b..e73d11ecb56b9cefc4505bb0ebcafdd6689f3f31 100644 --- a/Framework/CurveFitting/src/FlatBackground.cpp +++ b/Framework/CurveFitting/src/Functions/FlatBackground.cpp @@ -1,12 +1,16 @@ -#include "MantidCurveFitting/FlatBackground.h" +#include "MantidCurveFitting/Functions/FlatBackground.h" #include "MantidAPI/FunctionFactory.h" #include "MantidKernel/System.h" using namespace Mantid::Kernel; + using namespace Mantid::API; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(FlatBackground) //---------------------------------------------------------------------------------------------- @@ -60,4 +64,5 @@ void FlatBackground::functionDeriv1D(API::Jacobian *out, const double *xValues, } } // namespace Mantid +} // namespace Functions } // namespace CurveFitting diff --git a/Framework/CurveFitting/src/FullprofPolynomial.cpp b/Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp similarity index 97% rename from Framework/CurveFitting/src/FullprofPolynomial.cpp rename to Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp index c11007ea6c0ff153321d028c68eee5b9edd990b4..0c694afb8b925a73e6614f2758d64f771725237f 100644 --- a/Framework/CurveFitting/src/FullprofPolynomial.cpp +++ b/Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp @@ -1,9 +1,12 @@ -#include "MantidCurveFitting/FullprofPolynomial.h" +#include "MantidCurveFitting/Functions/FullprofPolynomial.h" #include "MantidAPI/FunctionFactory.h" #include <boost/lexical_cast.hpp> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(FullprofPolynomial) @@ -161,5 +164,6 @@ bool FullprofPolynomial::hasAttribute(const std::string &attName) const { return has; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/GausDecay.cpp b/Framework/CurveFitting/src/Functions/GausDecay.cpp similarity index 91% rename from Framework/CurveFitting/src/GausDecay.cpp rename to Framework/CurveFitting/src/Functions/GausDecay.cpp index 1497dbd6af7153865b61fb19ed45d4b0fc69f204..62e7fa7b723c6c9d88c9175bdd8a271d0a88c962 100644 --- a/Framework/CurveFitting/src/GausDecay.cpp +++ b/Framework/CurveFitting/src/Functions/GausDecay.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/GausDecay.h" +#include "MantidCurveFitting/Functions/GausDecay.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(GausDecay) @@ -51,5 +55,6 @@ void GausDecay::setActiveParameter(size_t i, double value) { setParameter(j, value, false); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/GausOsc.cpp b/Framework/CurveFitting/src/Functions/GausOsc.cpp similarity index 94% rename from Framework/CurveFitting/src/GausOsc.cpp rename to Framework/CurveFitting/src/Functions/GausOsc.cpp index fbf341f190a4665c037e4d8cdc935aed2ffbdac1..54b17aec67d9e64e675c0d28e4054c6f908aebb9 100644 --- a/Framework/CurveFitting/src/GausOsc.cpp +++ b/Framework/CurveFitting/src/Functions/GausOsc.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/GausOsc.h" +#include "MantidCurveFitting/Functions/GausOsc.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(GausOsc) @@ -69,5 +73,6 @@ void GausOsc::setActiveParameter(size_t i, double value) { setParameter(j, value, false); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Gaussian.cpp b/Framework/CurveFitting/src/Functions/Gaussian.cpp similarity index 94% rename from Framework/CurveFitting/src/Gaussian.cpp rename to Framework/CurveFitting/src/Functions/Gaussian.cpp index 886d31e3f3ef9c0abe4a87030d2e5f2621668f2e..eeacee84e14d13cca2f551c7fb8dd0a864134e12 100644 --- a/Framework/CurveFitting/src/Gaussian.cpp +++ b/Framework/CurveFitting/src/Functions/Gaussian.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Gaussian.h" +#include "MantidCurveFitting/Functions/Gaussian.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> @@ -9,8 +9,12 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(Gaussian) @@ -69,5 +73,6 @@ double Gaussian::activeParameter(size_t i) const { return getParameter(i); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/GaussianComptonProfile.cpp b/Framework/CurveFitting/src/Functions/GaussianComptonProfile.cpp similarity index 96% rename from Framework/CurveFitting/src/GaussianComptonProfile.cpp rename to Framework/CurveFitting/src/Functions/GaussianComptonProfile.cpp index 3cc941c99647c2c51097a6c5f2f81326a2611cc0..23af0e475ee0caf438272c175d588066b1cb2111 100644 --- a/Framework/CurveFitting/src/GaussianComptonProfile.cpp +++ b/Framework/CurveFitting/src/Functions/GaussianComptonProfile.cpp @@ -1,13 +1,16 @@ //------------------------------------------------------------------------------------------------ // Includes //------------------------------------------------------------------------------------------------ -#include "MantidCurveFitting/GaussianComptonProfile.h" +#include "MantidCurveFitting/Functions/GaussianComptonProfile.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(GaussianComptonProfile) const char *WIDTH_PARAM = "Width"; @@ -112,5 +115,6 @@ void GaussianComptonProfile::massProfile(double *result, const size_t nData, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/GramCharlierComptonProfile.cpp b/Framework/CurveFitting/src/Functions/GramCharlierComptonProfile.cpp similarity index 98% rename from Framework/CurveFitting/src/GramCharlierComptonProfile.cpp rename to Framework/CurveFitting/src/Functions/GramCharlierComptonProfile.cpp index 7003021e27ecf3f23f1e331fb07d307eb1c9db38..dcefc759c3041571c04728526393f096af35dbae 100644 --- a/Framework/CurveFitting/src/GramCharlierComptonProfile.cpp +++ b/Framework/CurveFitting/src/Functions/GramCharlierComptonProfile.cpp @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------------------------ // Includes //------------------------------------------------------------------------------------------------ -#include "MantidCurveFitting/GramCharlierComptonProfile.h" +#include "MantidCurveFitting/Functions/GramCharlierComptonProfile.h" #include "MantidAPI/FunctionFactory.h" #include "MantidKernel/Math/Distributions/HermitePolynomials.h" @@ -14,6 +14,9 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; // Register into factory DECLARE_FUNCTION(GramCharlierComptonProfile) @@ -247,6 +250,7 @@ size_t GramCharlierComptonProfile::fillConstraintMatrix( void GramCharlierComptonProfile::massProfile(double *result, const size_t nData) const { UNUSED_ARG(nData); + using namespace Mantid::Kernel; // Hermite expansion (only even terms) + FSE term @@ -275,6 +279,7 @@ void GramCharlierComptonProfile::massProfile(double *result, */ void GramCharlierComptonProfile::addMassProfile( double *result, const unsigned int npoly) const { + using namespace Mantid::Kernel; const double amp(1.0), wg(getParameter(WIDTH_PARAM)); @@ -300,6 +305,7 @@ void GramCharlierComptonProfile::addMassProfile( */ void GramCharlierComptonProfile::addFSETerm(std::vector<double> &lhs) const { assert(static_cast<size_t>(NFINE_Y) == lhs.size()); + using namespace Mantid::Kernel; const double amp(1.0), wg(getParameter(WIDTH_PARAM)); @@ -362,7 +368,7 @@ void GramCharlierComptonProfile::setMatrixWorkspace( */ void GramCharlierComptonProfile::cacheYSpaceValues( const std::vector<double> &tseconds, const bool isHistogram, - const DetectorParams &detpar) { + const Algorithms::DetectorParams &detpar) { ComptonProfile::cacheYSpaceValues(tseconds, isHistogram, detpar); // base-class calculations @@ -438,5 +444,6 @@ void GramCharlierComptonProfile::cacheYSpaceValues( // vector } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/IkedaCarpenterPV.cpp b/Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp similarity index 97% rename from Framework/CurveFitting/src/IkedaCarpenterPV.cpp rename to Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp index 527a9c39698081e58d8acc3d322ee20b35585697..519f78976bd762d60dcdab2afc56eedbceba0123 100644 --- a/Framework/CurveFitting/src/IkedaCarpenterPV.cpp +++ b/Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp @@ -1,8 +1,8 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/IkedaCarpenterPV.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Functions/IkedaCarpenterPV.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidCurveFitting/SpecialFunctionSupport.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/FunctionFactory.h" @@ -21,6 +21,9 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; namespace { /// static logger @@ -28,8 +31,11 @@ Kernel::Logger g_log("IkedaCarpenterPV"); } using namespace Kernel; -using namespace SpecialFunctionSupport; + +using namespace CurveFitting::SpecialFunctionSupport; + using namespace Geometry; +using namespace Constraints; DECLARE_FUNCTION(IkedaCarpenterPV) @@ -366,5 +372,6 @@ void IkedaCarpenterPV::functionDeriv(const API::FunctionDomain &domain, calNumericalDeriv(domain, jacobian); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/LinearBackground.cpp b/Framework/CurveFitting/src/Functions/LinearBackground.cpp similarity index 94% rename from Framework/CurveFitting/src/LinearBackground.cpp rename to Framework/CurveFitting/src/Functions/LinearBackground.cpp index 5961d95a20ed370a835d6464e891ba1d56d27db1..de365f0d88caddcebecc73905b980b9156f64983 100644 --- a/Framework/CurveFitting/src/LinearBackground.cpp +++ b/Framework/CurveFitting/src/Functions/LinearBackground.cpp @@ -1,13 +1,17 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/LinearBackground.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" #include "MantidAPI/FunctionFactory.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(LinearBackground) @@ -79,5 +83,6 @@ void LinearBackground::fit(const std::vector<double> &X, setParameter("A1", a1); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/LogNormal.cpp b/Framework/CurveFitting/src/Functions/LogNormal.cpp similarity index 95% rename from Framework/CurveFitting/src/LogNormal.cpp rename to Framework/CurveFitting/src/Functions/LogNormal.cpp index e7cba5f58ea4f41da6946e3452617b53bfd48fbf..85e24ebfcf8ecd2a6705f68c61793754a6851b91 100644 --- a/Framework/CurveFitting/src/LogNormal.cpp +++ b/Framework/CurveFitting/src/Functions/LogNormal.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/LogNormal.h" +#include "MantidCurveFitting/Functions/LogNormal.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(LogNormal) @@ -78,5 +82,6 @@ void LogNormal::functionDeriv1D(API::Jacobian *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Lorentzian.cpp b/Framework/CurveFitting/src/Functions/Lorentzian.cpp similarity index 94% rename from Framework/CurveFitting/src/Lorentzian.cpp rename to Framework/CurveFitting/src/Functions/Lorentzian.cpp index 8d58c9a3915b9d7bd87d8d9da9be2a6f5ae70be0..0b5d4b534624e37d6e81d22b099809d16d1ac346 100644 --- a/Framework/CurveFitting/src/Lorentzian.cpp +++ b/Framework/CurveFitting/src/Functions/Lorentzian.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Lorentzian.h" +#include "MantidCurveFitting/Functions/Lorentzian.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(Lorentzian) @@ -75,5 +79,6 @@ void Lorentzian::functionDerivLocal(Jacobian *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Lorentzian1D.cpp b/Framework/CurveFitting/src/Functions/Lorentzian1D.cpp similarity index 95% rename from Framework/CurveFitting/src/Lorentzian1D.cpp rename to Framework/CurveFitting/src/Functions/Lorentzian1D.cpp index 763d9a92ed152d2f081d9dfb6ae8bdfe627b537f..1c19669665cef0be1ff816dc5d58c0074c2a8465 100644 --- a/Framework/CurveFitting/src/Lorentzian1D.cpp +++ b/Framework/CurveFitting/src/Functions/Lorentzian1D.cpp @@ -1,13 +1,16 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Lorentzian1D.h" +#include "MantidCurveFitting/Functions/Lorentzian1D.h" #include <gsl/gsl_sf_erf.h> #include <gsl/gsl_multifit_nlin.h> #include "MantidKernel/BoundedValidator.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using API::Jacobian; // Register the class into the algorithm factory @@ -69,5 +72,6 @@ void Lorentzian1D::functionDeriv(const double *in, Jacobian *out, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/MuonFInteraction.cpp b/Framework/CurveFitting/src/Functions/MuonFInteraction.cpp similarity index 90% rename from Framework/CurveFitting/src/MuonFInteraction.cpp rename to Framework/CurveFitting/src/Functions/MuonFInteraction.cpp index a11f82c92ae02a68df3adeb7030eeeed61e72b4b..4fcb0672c65bf56ee6691a3b0880d4d2f23fcba0 100644 --- a/Framework/CurveFitting/src/MuonFInteraction.cpp +++ b/Framework/CurveFitting/src/Functions/MuonFInteraction.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/MuonFInteraction.h" +#include "MantidCurveFitting/Functions/MuonFInteraction.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(MuonFInteraction) @@ -40,5 +44,6 @@ void MuonFInteraction::function1D(double *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp b/Framework/CurveFitting/src/Functions/NeutronBk2BkExpConvPVoigt.cpp similarity index 99% rename from Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp rename to Framework/CurveFitting/src/Functions/NeutronBk2BkExpConvPVoigt.cpp index 9f4d315690da912d41a074727fa5cb012015d8a3..c451d8d528adedf27626917dd0b574be8fffcbda 100644 --- a/Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp +++ b/Framework/CurveFitting/src/Functions/NeutronBk2BkExpConvPVoigt.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h" +#include "MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/ParamFunction.h" #include "MantidKernel/EmptyValues.h" @@ -17,6 +17,9 @@ using namespace std; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; namespace { /// static logger Kernel::Logger g_log("NeutronBk2BkExpConvPV"); @@ -504,5 +507,6 @@ double NeutronBk2BkExpConvPVoigt::calOmega(const double x, const double eta, return omega; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/PawleyFunction.cpp b/Framework/CurveFitting/src/Functions/PawleyFunction.cpp similarity index 98% rename from Framework/CurveFitting/src/PawleyFunction.cpp rename to Framework/CurveFitting/src/Functions/PawleyFunction.cpp index ab4c06fb473da7c04457368a46baeed882992d86..2f4231d00f45460479cb798489372750eca5f56c 100644 --- a/Framework/CurveFitting/src/PawleyFunction.cpp +++ b/Framework/CurveFitting/src/Functions/PawleyFunction.cpp @@ -1,9 +1,9 @@ -#include "MantidCurveFitting/PawleyFunction.h" +#include "MantidCurveFitting/Functions/PawleyFunction.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/MatrixWorkspace.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidKernel/UnitConversion.h" #include "MantidKernel/UnitFactory.h" @@ -13,11 +13,17 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; +using namespace Constraints; DECLARE_FUNCTION(PawleyParameterFunction) using namespace API; + using namespace Geometry; + using namespace Kernel; /// Constructor @@ -572,5 +578,6 @@ void PawleyFunction::beforeDecoratedFunctionSet(const API::IFunction_sptr &fn) { } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/PeakParameterFunction.cpp b/Framework/CurveFitting/src/Functions/PeakParameterFunction.cpp similarity index 93% rename from Framework/CurveFitting/src/PeakParameterFunction.cpp rename to Framework/CurveFitting/src/Functions/PeakParameterFunction.cpp index 068e7d5440dcf0f2e3dae8b5ff1cc009a4d61274..5991f2ad484d034df9434b38cb1a7a29329fc232 100644 --- a/Framework/CurveFitting/src/PeakParameterFunction.cpp +++ b/Framework/CurveFitting/src/Functions/PeakParameterFunction.cpp @@ -1,9 +1,12 @@ -#include "MantidCurveFitting/PeakParameterFunction.h" +#include "MantidCurveFitting/Functions/PeakParameterFunction.h" #include "MantidAPI/IPeakFunction.h" #include "MantidAPI/FunctionFactory.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace API; @@ -59,5 +62,6 @@ void PeakParameterFunction::beforeDecoratedFunctionSet( m_peakFunction = peakFunction; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Polynomial.cpp b/Framework/CurveFitting/src/Functions/Polynomial.cpp similarity index 97% rename from Framework/CurveFitting/src/Polynomial.cpp rename to Framework/CurveFitting/src/Functions/Polynomial.cpp index d6b20c93df577952f06af3527ebccffd30c9a685..800902e4ffabba0586b272a7f9cf0ef3145609f5 100644 --- a/Framework/CurveFitting/src/Polynomial.cpp +++ b/Framework/CurveFitting/src/Functions/Polynomial.cpp @@ -1,14 +1,18 @@ -#include "MantidCurveFitting/Polynomial.h" +#include "MantidCurveFitting/Functions/Polynomial.h" #include "MantidAPI/FunctionFactory.h" #include <boost/lexical_cast.hpp> using namespace Mantid::Kernel; + using namespace Mantid::API; using namespace std; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(Polynomial) @@ -154,5 +158,6 @@ bool Polynomial::hasAttribute(const std::string &attName) const { return attName == "n"; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ProcessBackground.cpp b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp similarity index 98% rename from Framework/CurveFitting/src/ProcessBackground.cpp rename to Framework/CurveFitting/src/Functions/ProcessBackground.cpp index d6bd7e43f1a3cf57dab73270076e1b83b6994019..3df0c026c17f7f09df892405a48b89137f95b329 100644 --- a/Framework/CurveFitting/src/ProcessBackground.cpp +++ b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ProcessBackground.h" +#include "MantidCurveFitting/Functions/ProcessBackground.h" #include "MantidAPI/WorkspaceProperty.h" #include "MantidKernel/Property.h" #include "MantidKernel/ListValidator.h" @@ -6,8 +6,8 @@ #include "MantidKernel/VisibleWhenProperty.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidAPI/MatrixWorkspace.h" -#include "MantidCurveFitting/Polynomial.h" -#include "MantidCurveFitting/Chebyshev.h" +#include "MantidCurveFitting/Functions/Polynomial.h" +#include "MantidCurveFitting/Functions/Chebyshev.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidGeometry/Crystal/IPeak.h" #include "MantidAPI/TableRow.h" @@ -17,15 +17,22 @@ #include <boost/algorithm/string/split.hpp> using namespace Mantid; + using namespace Mantid::API; + using namespace Mantid::Kernel; + using namespace Mantid::DataObjects; + using namespace Mantid::CurveFitting; using namespace std; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_ALGORITHM(ProcessBackground) @@ -677,17 +684,16 @@ ProcessBackground::autoBackgroundSelection(Workspace2D_sptr bkgdWS) { */ BackgroundFunction_sptr ProcessBackground::createBackgroundFunction(const string backgroundtype) { - CurveFitting::BackgroundFunction_sptr bkgdfunction; + Functions::BackgroundFunction_sptr bkgdfunction; if (backgroundtype.compare("Polynomial") == 0) { - bkgdfunction = - boost::dynamic_pointer_cast<CurveFitting::BackgroundFunction>( - boost::make_shared<CurveFitting::Polynomial>()); + bkgdfunction = boost::dynamic_pointer_cast<Functions::BackgroundFunction>( + boost::make_shared<Functions::Polynomial>()); bkgdfunction->initialize(); } else if (backgroundtype.compare("Chebyshev") == 0) { - Chebyshev_sptr cheby = boost::make_shared<CurveFitting::Chebyshev>(); + Chebyshev_sptr cheby = boost::make_shared<Functions::Chebyshev>(); bkgdfunction = - boost::dynamic_pointer_cast<CurveFitting::BackgroundFunction>(cheby); + boost::dynamic_pointer_cast<Functions::BackgroundFunction>(cheby); bkgdfunction->initialize(); g_log.debug() << "[D] Chebyshev is set to range " << m_lowerBound << ", " @@ -1099,5 +1105,6 @@ size_t RemovePeaks::excludePeaks(vector<double> v_inX, vector<bool> &v_useX, return count; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ProductFunction.cpp b/Framework/CurveFitting/src/Functions/ProductFunction.cpp similarity index 89% rename from Framework/CurveFitting/src/ProductFunction.cpp rename to Framework/CurveFitting/src/Functions/ProductFunction.cpp index 91152ccf885dd482e7f781cf3cbcec49e4986bcc..777e29e20fc2a09b9f1d455a5bb99d526e919aea 100644 --- a/Framework/CurveFitting/src/ProductFunction.cpp +++ b/Framework/CurveFitting/src/Functions/ProductFunction.cpp @@ -1,11 +1,14 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/ProductFunction.h" +#include "MantidCurveFitting/Functions/ProductFunction.h" #include "MantidAPI/FunctionFactory.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(ProductFunction) @@ -34,5 +37,6 @@ void ProductFunction::functionDeriv(const API::FunctionDomain &domain, calNumericalDeriv(domain, jacobian); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ProductLinearExp.cpp b/Framework/CurveFitting/src/Functions/ProductLinearExp.cpp similarity index 87% rename from Framework/CurveFitting/src/ProductLinearExp.cpp rename to Framework/CurveFitting/src/Functions/ProductLinearExp.cpp index 58079f6a9cdb9d39ad19d0ba3fd67d8c58684e75..c4d3758b8240479f579389db207affbd0c0f8e6b 100644 --- a/Framework/CurveFitting/src/ProductLinearExp.cpp +++ b/Framework/CurveFitting/src/Functions/ProductLinearExp.cpp @@ -1,13 +1,17 @@ -#include "MantidCurveFitting/ProductLinearExp.h" -#include "MantidCurveFitting/ExpDecay.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/ProductFunction.h" +#include "MantidCurveFitting/Functions/ProductLinearExp.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Functions/ProductFunction.h" #include "MantidAPI/FunctionFactory.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(ProductLinearExp) @@ -72,5 +76,6 @@ void ProductLinearExp::function1D(double *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ProductQuadraticExp.cpp b/Framework/CurveFitting/src/Functions/ProductQuadraticExp.cpp similarity index 88% rename from Framework/CurveFitting/src/ProductQuadraticExp.cpp rename to Framework/CurveFitting/src/Functions/ProductQuadraticExp.cpp index 0d6dc24cd0997d06bbf9c44605ec95e1da170f69..5bd2458173bcdc84d300630334c6142f09eb4f04 100644 --- a/Framework/CurveFitting/src/ProductQuadraticExp.cpp +++ b/Framework/CurveFitting/src/Functions/ProductQuadraticExp.cpp @@ -1,11 +1,14 @@ -#include "MantidCurveFitting/ProductQuadraticExp.h" -#include "MantidCurveFitting/ExpDecay.h" -#include "MantidCurveFitting/Quadratic.h" -#include "MantidCurveFitting/ProductFunction.h" +#include "MantidCurveFitting/Functions/ProductQuadraticExp.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" +#include "MantidCurveFitting/Functions/Quadratic.h" +#include "MantidCurveFitting/Functions/ProductFunction.h" #include "MantidAPI/FunctionFactory.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(ProductQuadraticExp) @@ -73,5 +76,6 @@ void ProductQuadraticExp::function1D(double *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/PseudoVoigt.cpp b/Framework/CurveFitting/src/Functions/PseudoVoigt.cpp similarity index 92% rename from Framework/CurveFitting/src/PseudoVoigt.cpp rename to Framework/CurveFitting/src/Functions/PseudoVoigt.cpp index a492df6add6514a4888fc8eb88b80719fd5c99dd..a0ce2def8134e7420663297cd75c8fb529bc7b94 100644 --- a/Framework/CurveFitting/src/PseudoVoigt.cpp +++ b/Framework/CurveFitting/src/Functions/PseudoVoigt.cpp @@ -1,11 +1,15 @@ -#include "MantidCurveFitting/PseudoVoigt.h" +#include "MantidCurveFitting/Functions/PseudoVoigt.h" #include "MantidAPI/FunctionFactory.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; +using namespace Constraints; using namespace API; @@ -83,5 +87,6 @@ void PseudoVoigt::init() { addConstraint(mixingConstraint); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Quadratic.cpp b/Framework/CurveFitting/src/Functions/Quadratic.cpp similarity index 92% rename from Framework/CurveFitting/src/Quadratic.cpp rename to Framework/CurveFitting/src/Functions/Quadratic.cpp index 0b364ce4a2319cdc0d2b4ef5feb11aad2f1e9963..cb6a2b6f6613a13494efed79a674bedcd94fe056 100644 --- a/Framework/CurveFitting/src/Quadratic.cpp +++ b/Framework/CurveFitting/src/Functions/Quadratic.cpp @@ -1,13 +1,17 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Quadratic.h" +#include "MantidCurveFitting/Functions/Quadratic.h" #include "MantidAPI/FunctionFactory.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(Quadratic) @@ -53,5 +57,6 @@ void Quadratic::functionDeriv1D(API::Jacobian *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ReflectivityMulf.cpp b/Framework/CurveFitting/src/Functions/ReflectivityMulf.cpp similarity index 98% rename from Framework/CurveFitting/src/ReflectivityMulf.cpp rename to Framework/CurveFitting/src/Functions/ReflectivityMulf.cpp index 17ab832f7de39c76e1e7bc4e17654844dbce9667..4d84564dd5a0ab38d2ccec35b20b363cbc60dcda 100644 --- a/Framework/CurveFitting/src/ReflectivityMulf.cpp +++ b/Framework/CurveFitting/src/Functions/ReflectivityMulf.cpp @@ -1,15 +1,19 @@ -#include "MantidCurveFitting/ReflectivityMulf.h" +#include "MantidCurveFitting/Functions/ReflectivityMulf.h" #include "MantidAPI/FunctionFactory.h" #include <boost/lexical_cast.hpp> #include <cmath> using namespace Mantid::Kernel; + using namespace Mantid::API; using namespace std; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(ReflectivityMulf) @@ -292,5 +296,6 @@ void ReflectivityMulf::setAttribute(const std::string &attName, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Resolution.cpp b/Framework/CurveFitting/src/Functions/Resolution.cpp similarity index 90% rename from Framework/CurveFitting/src/Resolution.cpp rename to Framework/CurveFitting/src/Functions/Resolution.cpp index 75319dbcb07e8d3e5c43e859a30e364208b6798e..fad3353dbfd1de98e2d4d5f84bfd156a5ab1a35f 100644 --- a/Framework/CurveFitting/src/Resolution.cpp +++ b/Framework/CurveFitting/src/Functions/Resolution.cpp @@ -1,13 +1,17 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/Resolution.h" +#include "MantidCurveFitting/Functions/Resolution.h" #include "MantidAPI/FunctionFactory.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(Resolution) @@ -43,5 +47,6 @@ bool Resolution::hasAttribute(const std::string &attName) const { return m_fun.hasAttribute(attName); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/SimpleChebfun.cpp b/Framework/CurveFitting/src/Functions/SimpleChebfun.cpp similarity index 97% rename from Framework/CurveFitting/src/SimpleChebfun.cpp rename to Framework/CurveFitting/src/Functions/SimpleChebfun.cpp index 9416aaaae314a59def2b0c4b00c2ae95d413ad59..1cc4ce08e3f2f9ed010d08128465edda590161cc 100644 --- a/Framework/CurveFitting/src/SimpleChebfun.cpp +++ b/Framework/CurveFitting/src/Functions/SimpleChebfun.cpp @@ -1,10 +1,13 @@ -#include "MantidCurveFitting/SimpleChebfun.h" +#include "MantidCurveFitting/Functions/SimpleChebfun.h" #include "MantidAPI/IFunction.h" #include <boost/make_shared.hpp> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; //---------------------------------------------------------------------------------------------- /// Constructs a SimpleChebfun that approximates a function with a polynomial of @@ -163,5 +166,6 @@ SimpleChebfun &SimpleChebfun::operator+=(ChebfunFunctionType fun) { return *this; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/StaticKuboToyabe.cpp b/Framework/CurveFitting/src/Functions/StaticKuboToyabe.cpp similarity index 87% rename from Framework/CurveFitting/src/StaticKuboToyabe.cpp rename to Framework/CurveFitting/src/Functions/StaticKuboToyabe.cpp index 6d96804846ab9f92aa37aa5a8261ced40e400b91..9875e375005a0643d38d89ebbdf44a2fc5a286dc 100644 --- a/Framework/CurveFitting/src/StaticKuboToyabe.cpp +++ b/Framework/CurveFitting/src/Functions/StaticKuboToyabe.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/StaticKuboToyabe.h" +#include "MantidCurveFitting/Functions/StaticKuboToyabe.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(StaticKuboToyabe) @@ -30,5 +34,6 @@ void StaticKuboToyabe::function1D(double *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/StaticKuboToyabeTimesExpDecay.cpp b/Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesExpDecay.cpp similarity index 87% rename from Framework/CurveFitting/src/StaticKuboToyabeTimesExpDecay.cpp rename to Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesExpDecay.cpp index 8ee826d6dbc1de68b6903e508f3db0124516c15b..33e328757063e52ecbc75829779ec16f6e1dd310 100644 --- a/Framework/CurveFitting/src/StaticKuboToyabeTimesExpDecay.cpp +++ b/Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesExpDecay.cpp @@ -1,11 +1,15 @@ -#include "MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h" +#include "MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(StaticKuboToyabeTimesExpDecay) @@ -34,5 +38,6 @@ void StaticKuboToyabeTimesExpDecay::function1D(double *out, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/StaticKuboToyabeTimesGausDecay.cpp b/Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesGausDecay.cpp similarity index 88% rename from Framework/CurveFitting/src/StaticKuboToyabeTimesGausDecay.cpp rename to Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesGausDecay.cpp index 50a84ee40c92b50a38917037d2c481a1a111b102..3fd2c5394f95286b21697564df093db0039f9d92 100644 --- a/Framework/CurveFitting/src/StaticKuboToyabeTimesGausDecay.cpp +++ b/Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesGausDecay.cpp @@ -1,10 +1,15 @@ -#include "MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h" +#include "MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; + using namespace Kernel; + using namespace API; DECLARE_FUNCTION(StaticKuboToyabeTimesGausDecay) @@ -36,5 +41,6 @@ void StaticKuboToyabeTimesGausDecay::function1D(double *out, A * (exp(-(x2 * D2) / 2) * (1 - x2 * D2) * C1 + C2) * exp(-S2 * x2); } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/StretchExp.cpp b/Framework/CurveFitting/src/Functions/StretchExp.cpp similarity index 94% rename from Framework/CurveFitting/src/StretchExp.cpp rename to Framework/CurveFitting/src/Functions/StretchExp.cpp index 51064e2b85c9a6d5b9071afb15bdcb9a8fce9822..41a8cf8b7ff734787fbe4260de9cf4400ed4d1e5 100644 --- a/Framework/CurveFitting/src/StretchExp.cpp +++ b/Framework/CurveFitting/src/Functions/StretchExp.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/StretchExp.h" +#include "MantidCurveFitting/Functions/StretchExp.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(StretchExp) @@ -71,5 +75,6 @@ void StretchExp::functionDeriv1D(API::Jacobian *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/StretchExpMuon.cpp b/Framework/CurveFitting/src/Functions/StretchExpMuon.cpp similarity index 88% rename from Framework/CurveFitting/src/StretchExpMuon.cpp rename to Framework/CurveFitting/src/Functions/StretchExpMuon.cpp index 3c14c8fead5e209b6a6de41a690dfa819079e125..c88d045de580b32c08f6eb0341d26784da9fdf76 100644 --- a/Framework/CurveFitting/src/StretchExpMuon.cpp +++ b/Framework/CurveFitting/src/Functions/StretchExpMuon.cpp @@ -1,14 +1,18 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/StretchExpMuon.h" +#include "MantidCurveFitting/Functions/StretchExpMuon.h" #include "MantidAPI/FunctionFactory.h" #include <cmath> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; using namespace Kernel; + using namespace API; DECLARE_FUNCTION(StretchExpMuon) @@ -31,5 +35,6 @@ void StretchExpMuon::function1D(double *out, const double *xValues, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/TabulatedFunction.cpp b/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp similarity index 98% rename from Framework/CurveFitting/src/TabulatedFunction.cpp rename to Framework/CurveFitting/src/Functions/TabulatedFunction.cpp index 10f9e8168a8779989e05a736b8c56b3b8108c6e1..d0efc13940ae2ce8c316fbd2d6445b2839293b20 100644 --- a/Framework/CurveFitting/src/TabulatedFunction.cpp +++ b/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/TabulatedFunction.h" +#include "MantidCurveFitting/Functions/TabulatedFunction.h" #include "MantidKernel/FileValidator.h" #include "MantidAPI/Algorithm.h" #include "MantidAPI/FunctionFactory.h" @@ -14,7 +14,12 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; + using namespace Kernel; + using namespace API; namespace { @@ -276,5 +281,6 @@ void TabulatedFunction::setupData() const { m_setupFinished = true; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpAlpha.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpAlpha.cpp similarity index 94% rename from Framework/CurveFitting/src/ThermalNeutronBk2BkExpAlpha.cpp rename to Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpAlpha.cpp index 9eff40af37195f5aa5a285dbcbedf0709fbc9d90..464c73e7fb34fa7da4c8d0724e10434e2a6cb249 100644 --- a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpAlpha.cpp +++ b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpAlpha.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h" #include "MantidKernel/System.h" #include "MantidAPI/FunctionFactory.h" @@ -6,12 +6,18 @@ #include <cmath> using namespace std; + using namespace Mantid; + using namespace Mantid::API; + using namespace Mantid::CurveFitting; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(ThermalNeutronBk2BkExpAlpha) @@ -80,5 +86,6 @@ double ThermalNeutronBk2BkExpAlpha::corefunction(double dh, double width, return alpha; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpBeta.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpBeta.cpp similarity index 94% rename from Framework/CurveFitting/src/ThermalNeutronBk2BkExpBeta.cpp rename to Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpBeta.cpp index ae1170803594d1666b7d81497f488802e5e5c85f..92901743be4ceca7e440dbd811db471ffd153962 100644 --- a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpBeta.cpp +++ b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpBeta.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h" #include "MantidKernel/System.h" #include "MantidAPI/FunctionFactory.h" @@ -6,12 +6,18 @@ #include <cmath> using namespace std; + using namespace Mantid; + using namespace Mantid::CurveFitting; + using namespace Mantid::API; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(ThermalNeutronBk2BkExpBeta) @@ -79,5 +85,6 @@ double ThermalNeutronBk2BkExpBeta::corefunction(double dh, double width, return beta; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpConvPVoigt.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp similarity index 99% rename from Framework/CurveFitting/src/ThermalNeutronBk2BkExpConvPVoigt.cpp rename to Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp index 521becfcc478059efe73a2c0aca2a8c645108d6c..8ee59b58177ad3525a2615c6ef4ec8fcd8b8703a 100644 --- a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpConvPVoigt.cpp +++ b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/ParamFunction.h" #include "MantidKernel/EmptyValues.h" @@ -14,11 +14,16 @@ const double PEAKRANGE = 5.0; const double NEG_DBL_MAX = -1. * DBL_MAX; using namespace std; + using namespace Mantid; + using namespace Mantid::API; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; namespace { /// static reference to the logger Kernel::Logger g_log("ThermalNeutronBk2BkExpConvPV"); @@ -774,5 +779,6 @@ void ThermalNeutronBk2BkExpConvPVoigt::setPeakRadius(const int& r) } */ +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpSigma.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpSigma.cpp similarity index 94% rename from Framework/CurveFitting/src/ThermalNeutronBk2BkExpSigma.cpp rename to Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpSigma.cpp index ed8f0af7b195223ea9093587e5bdbf6a29fbca31..51c0370b5cffa8752f75d08b2e7ac51f259e3f71 100644 --- a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpSigma.cpp +++ b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpSigma.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h" #include "MantidKernel/System.h" #include "MantidAPI/FunctionFactory.h" @@ -6,12 +6,18 @@ #include <cmath> using namespace std; + using namespace Mantid; + using namespace Mantid::API; + using namespace Mantid::CurveFitting; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(ThermalNeutronBk2BkExpSigma) @@ -77,5 +83,6 @@ double ThermalNeutronBk2BkExpSigma::corefunction(double dh, double sig0sq, return sigma; } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/ThermalNeutronDtoTOFFunction.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronDtoTOFFunction.cpp similarity index 96% rename from Framework/CurveFitting/src/ThermalNeutronDtoTOFFunction.cpp rename to Framework/CurveFitting/src/Functions/ThermalNeutronDtoTOFFunction.cpp index 8566384197fe62b9422f94a5b9fd39defa2090fc..4d3bb672a2df48ce85ad78f6c9e1cdaa5100d454 100644 --- a/Framework/CurveFitting/src/ThermalNeutronDtoTOFFunction.cpp +++ b/Framework/CurveFitting/src/Functions/ThermalNeutronDtoTOFFunction.cpp @@ -1,4 +1,4 @@ -#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h" +#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h" #include "MantidKernel/System.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/FunctionDomain1D.h" @@ -6,10 +6,14 @@ #include <cmath> using namespace Mantid::API; + using namespace std; namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; //---------------------------------------------------------------------------------------------- DECLARE_FUNCTION(ThermalNeutronDtoTOFFunction) @@ -140,5 +144,6 @@ void ThermalNeutronDtoTOFFunction::functionDerivLocal(API::Jacobian *, "ThermalNeutronDtoTOFFunction."); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/UserFunction.cpp b/Framework/CurveFitting/src/Functions/UserFunction.cpp similarity index 95% rename from Framework/CurveFitting/src/UserFunction.cpp rename to Framework/CurveFitting/src/Functions/UserFunction.cpp index b367c452958f8775f7e667120a214977ed01357e..45ec9fc62f46b77425f2af1f312576146f0c507d 100644 --- a/Framework/CurveFitting/src/UserFunction.cpp +++ b/Framework/CurveFitting/src/Functions/UserFunction.cpp @@ -1,18 +1,22 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidAPI/FunctionFactory.h" #include <boost/tokenizer.hpp> #include "MantidGeometry/muParser_Silent.h" namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; // Register the class into the function factory DECLARE_FUNCTION(UserFunction) using namespace Kernel; + using namespace API; /// Constructor @@ -113,5 +117,6 @@ void UserFunction::functionDeriv(const API::FunctionDomain &domain, calNumericalDeriv(domain, jacobian); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/UserFunction1D.cpp b/Framework/CurveFitting/src/Functions/UserFunction1D.cpp similarity index 97% rename from Framework/CurveFitting/src/UserFunction1D.cpp rename to Framework/CurveFitting/src/Functions/UserFunction1D.cpp index 5164c2322bb93304a9703a2856c7d883296f1697..0c0ee89a9d0c1c6e2befac956b6146109db7825b 100644 --- a/Framework/CurveFitting/src/UserFunction1D.cpp +++ b/Framework/CurveFitting/src/Functions/UserFunction1D.cpp @@ -1,18 +1,22 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidCurveFitting/UserFunction1D.h" +#include "MantidCurveFitting/Functions/UserFunction1D.h" #include "MantidKernel/UnitFactory.h" #include "MantidKernel/MandatoryValidator.h" #include <boost/tokenizer.hpp> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; // Register the class into the algorithm factory DECLARE_ALGORITHM(UserFunction1D) using namespace Kernel; + using namespace API; /** Static callback function used by MuParser to initialize variables implicitly @@ -155,5 +159,6 @@ void UserFunction1D::functionDeriv(const double *in, Jacobian *out, } } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/VesuvioResolution.cpp b/Framework/CurveFitting/src/Functions/VesuvioResolution.cpp similarity index 96% rename from Framework/CurveFitting/src/VesuvioResolution.cpp rename to Framework/CurveFitting/src/Functions/VesuvioResolution.cpp index d850ed0f223861674134ac23aa1fa84bb5a6bd82..44c6b1e458ef1142f49b68f0f61080fca750fe4e 100644 --- a/Framework/CurveFitting/src/VesuvioResolution.cpp +++ b/Framework/CurveFitting/src/Functions/VesuvioResolution.cpp @@ -1,13 +1,18 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- -#include "MantidCurveFitting/VesuvioResolution.h" -#include "MantidCurveFitting/ConvertToYSpace.h" +#include "MantidCurveFitting/Functions/VesuvioResolution.h" +#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h" #include "MantidAPI/FunctionFactory.h" #include <gsl/gsl_poly.h> namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace Mantid; +using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; namespace { ///@cond const char *MASS_NAME = "Mass"; @@ -78,6 +83,7 @@ std::string VesuvioResolution::name() const { return "VesuvioResolution"; } */ void VesuvioResolution::setUpForFit() { // Voigt + using namespace Mantid::API; m_voigt = boost::dynamic_pointer_cast<IPeakFunction>( FunctionFactory::Instance().createFunction("Voigt")); @@ -108,7 +114,7 @@ void VesuvioResolution::setMatrixWorkspace( * @param respar Structure containing resolution parameters */ void VesuvioResolution::cacheResolutionComponents( - const DetectorParams &detpar, const ResolutionParams &respar) { + const Algorithms::DetectorParams &detpar, const ResolutionParams &respar) { // geometry double theta = detpar.theta; // cache for frequent access double hwhmLorentzE = respar.dEnLorentz; @@ -253,5 +259,6 @@ void VesuvioResolution::voigtApprox(std::vector<double> &voigt, std::bind2nd(std::multiplies<double>(), norm)); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/Voigt.cpp b/Framework/CurveFitting/src/Functions/Voigt.cpp similarity index 97% rename from Framework/CurveFitting/src/Voigt.cpp rename to Framework/CurveFitting/src/Functions/Voigt.cpp index 9e006da4d314d97a44efe6c8f7f5bcc3b4b0a90a..73ce3f49f9979c516ecceedd0af016ee7b69eaf5 100644 --- a/Framework/CurveFitting/src/Voigt.cpp +++ b/Framework/CurveFitting/src/Functions/Voigt.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------------------------- // Includes //---------------------------------------------------------------------------------------------- -#include "MantidCurveFitting/Voigt.h" +#include "MantidCurveFitting/Functions/Voigt.h" #include "MantidAPI/FunctionFactory.h" @@ -9,6 +9,9 @@ namespace Mantid { namespace CurveFitting { +namespace Functions { + +using namespace CurveFitting; DECLARE_FUNCTION(Voigt) namespace { @@ -165,5 +168,6 @@ void Voigt::setFwhm(const double value) { this->setParameter(GAUSSIAN_FWHM, 0.5 * value); } +} // namespace Functions } // namespace CurveFitting } // namespace Mantid diff --git a/Framework/CurveFitting/src/GSLFunctions.cpp b/Framework/CurveFitting/src/GSLFunctions.cpp index d5c4445dcc00a0821742647014922c1ea3c7c16d..2ebd26b9ec65f05f028b43dc61b5a802e7a51600 100644 --- a/Framework/CurveFitting/src/GSLFunctions.cpp +++ b/Framework/CurveFitting/src/GSLFunctions.cpp @@ -126,7 +126,7 @@ int gsl_df(const gsl_vector *x, void *params, gsl_matrix *J) { // functionDeriv() return derivatives of calculated data values. Need to // convert this values into - // derivatives of calculated-observed devided by error values used by GSL + // derivatives of calculated-observed divided by error values used by GSL auto values = boost::dynamic_pointer_cast<API::FunctionValues>( p->costFunction->getValues()); if (!values) { @@ -159,7 +159,8 @@ int gsl_fdf(const gsl_vector *x, void *params, gsl_vector *f, gsl_matrix *J) { * Constructor. Creates declared -> active index map * @param cf :: ICostFunction */ -GSL_FitData::GSL_FitData(boost::shared_ptr<CostFuncLeastSquares> cf) +GSL_FitData::GSL_FitData( + boost::shared_ptr<CostFunctions::CostFuncLeastSquares> cf) : function(cf->getFittingFunction()), costFunction(cf) { gsl_set_error_handler_off(); // number of active parameters diff --git a/Framework/CurveFitting/src/LatticeDomainCreator.cpp b/Framework/CurveFitting/src/LatticeDomainCreator.cpp index 69901d090985206b121217ff3a25cc940bff389d..db2ebe4bde9fca3df9b46c7a12805e94876df8e1 100644 --- a/Framework/CurveFitting/src/LatticeDomainCreator.cpp +++ b/Framework/CurveFitting/src/LatticeDomainCreator.cpp @@ -9,7 +9,7 @@ #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Peak.h" -#include "MantidCurveFitting/PawleyFit.h" +#include "MantidCurveFitting/Algorithms/PawleyFit.h" namespace Mantid { namespace CurveFitting { @@ -17,6 +17,7 @@ namespace CurveFitting { using namespace API; using namespace Kernel; using namespace DataObjects; +using namespace CurveFitting::Algorithms; /// Constructor LatticeDomainCreator::LatticeDomainCreator( diff --git a/Framework/CurveFitting/src/LatticeFunction.cpp b/Framework/CurveFitting/src/LatticeFunction.cpp index 895327b1d97f18dcb4252531b56b780828c0a84b..0fd29c73d2762d3ef7ee2772847997eee024d4b3 100644 --- a/Framework/CurveFitting/src/LatticeFunction.cpp +++ b/Framework/CurveFitting/src/LatticeFunction.cpp @@ -62,8 +62,8 @@ void LatticeFunction::init() { /// Checks that the decorated function is a PawleyParameterFunction. void LatticeFunction::beforeDecoratedFunctionSet(const IFunction_sptr &fn) { - PawleyParameterFunction_sptr paramFn = - boost::dynamic_pointer_cast<PawleyParameterFunction>(fn); + Functions::PawleyParameterFunction_sptr paramFn = + boost::dynamic_pointer_cast<Functions::PawleyParameterFunction>(fn); if (!paramFn) { throw std::invalid_argument( diff --git a/Framework/CurveFitting/src/MultiBG.cpp b/Framework/CurveFitting/src/MultiBG.cpp deleted file mode 100644 index 284b6ce33908b4cf7b664d8e0af7f513123eac64..0000000000000000000000000000000000000000 --- a/Framework/CurveFitting/src/MultiBG.cpp +++ /dev/null @@ -1,307 +0,0 @@ -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- -#include "MantidCurveFitting/MultiBG.h" -#include "MantidAPI/IFunctionMW.h" -#include "MantidAPI/Expression.h" -#include "MantidAPI/AnalysisDataService.h" -#include "MantidAPI/WorkspaceGroup.h" -#include "MantidAPI/FunctionFactory.h" - -#include <boost/lambda/lambda.hpp> -#include <boost/lexical_cast.hpp> - -#include <sstream> -#include <iostream> -#include <algorithm> -#include <iterator> -#include <float.h> - -using namespace boost::lambda; - -namespace Mantid { -namespace CurveFitting { - -DECLARE_FUNCTION(MultiBG) - -/** A Jacobian for individual functions - */ -class PartialJacobian : public API::Jacobian { - API::Jacobian *m_J; ///< pointer to the overall Jacobian - size_t m_iY0; ///< data array offset in the overall Jacobian for a particular - /// function - size_t m_iP0; ///< parameter offset in the overall Jacobian for a particular - /// function - size_t m_iaP0; ///< offset in the active Jacobian for a particular function -public: - /** Constructor - * @param J :: A pointer to the overall Jacobian - * @param iY0 :: Data array offset index (declared) for a particular function - * @param iP0 :: The parameter index (declared) offset for a particular - * function - * @param iap0 :: The active parameter index (declared) offset for a - * particular function - */ - PartialJacobian(API::Jacobian *J, size_t iY0, size_t iP0, size_t iap0) - : m_J(J), m_iY0(iY0), m_iP0(iP0), m_iaP0(iap0) {} - /** - * Overridden Jacobian::set(...). - * @param iY :: The index of the data point - * @param iP :: The parameter index of an individual function. - * @param value :: The derivative value - */ - void set(size_t iY, size_t iP, double value) { - m_J->set(m_iY0 + iY, m_iP0 + iP, value); - } - /** - * Overridden Jacobian::get(...). - * @param iY :: The index of the data point - * @param iP :: The parameter index of an individual function. - */ - double get(size_t iY, size_t iP) { return m_J->get(m_iY0 + iY, m_iP0 + iP); } - /** Add number to all iY (data) Jacobian elements for a given iP (parameter) - * @param value :: Value to add - * @param iActiveP :: The index of an active parameter. - */ - virtual void addNumberToColumn(const double &value, const size_t &iActiveP) { - m_J->addNumberToColumn(value, m_iaP0 + iActiveP); - } -}; - -/// Destructor -MultiBG::~MultiBG() {} - -/** - * Function you want to fit to. - */ -void MultiBG::function(double *out) const { - std::vector<double> tmpOut(dataSize()); - std::fill_n(out, dataSize(), 0); - for (size_t i = 0; i < nFunctions(); i++) { - IFitFunction *fun = dynamic_cast<IFitFunction *>(getFunction(i)); - if (!fun) { - throw std::runtime_error( - "IFitFunction expected but function of another type found"); - } - size_t nWS = m_funIndex[i].size(); - for (size_t k = 0; k < nWS; ++k) { - size_t j = m_funIndex[i][k]; - fun->setWorkspace(m_spectra[k].first, - "WorkspaceIndex=" + boost::lexical_cast<std::string>( - m_spectra[j].second), - false); - // std::cerr << i << ' ' << k << " Function " << fun->name() << " ws " << - // fun->getWorkspace()->getName() << " wi " - // << dynamic_cast<Mantid::API::IFunctionMW*>(fun)->getWorkspaceIndex() - // << std::endl; - double *out1 = out + m_offset[j]; - double *tmp1 = &tmpOut[0] + m_offset[j]; - size_t nData = 0; - if (j < m_offset.size() - 1) - nData = m_offset[j + 1] - m_offset[j]; - else - nData = dataSize() - m_offset[j]; - if (i == 0) { - fun->function(out1); - } else { - fun->function(tmp1); - std::transform(out1, out1 + nData, tmp1, out1, std::plus<double>()); - } - } - } - // std::cerr << "Function:\n"; - // for(size_t i = 0; i<nParams();++i) - //{ - // std::cerr << getParameter(i) << ' ' ; - //} - // std::cerr << std::endl; - // std::for_each(out,out+m_dataSize,std::cerr << _1 << '\n'); - // std::cerr << std::endl; -} - -void MultiBG::functionDeriv(API::Jacobian *out) { - // it is possible that out is NULL - if (!out) - return; - for (size_t i = 0; i < nFunctions(); i++) { - IFitFunction *fun = dynamic_cast<IFitFunction *>(getFunction(i)); - if (!fun) { - throw std::runtime_error( - "IFitFunction expected but function of another type found"); - } - size_t nWS = m_funIndex[i].size(); - for (size_t k = 0; k < nWS; ++k) { - size_t j = m_funIndex[i][k]; - fun->setWorkspace(m_spectra[k].first, - "WorkspaceIndex=" + boost::lexical_cast<std::string>( - m_spectra[j].second), - false); - PartialJacobian J(out, m_offset[j], paramOffset(i), activeOffset(i)); - fun->functionDeriv(&J); - } - } -} - -void MultiBG::setWorkspace(boost::shared_ptr<const API::Workspace> ws, bool) { - boost::shared_ptr<const API::MatrixWorkspace> mws = - boost::dynamic_pointer_cast<const API::MatrixWorkspace>(ws); - if (ws && !mws) { - throw std::invalid_argument( - "Workspace in MultiBG has a wrong type (not a MatrixWorkspace)"); - } - m_workspace = mws; -} -/** - * Sets workspaces to member functions. Constructs the data set for fitting. - * @param slicing :: A map between member functions and workspaces or empty - * string. Format: - * "f0,Workspace0,i0;f1,Workspace1,i1;f2,Workspace2,i2;..." - */ -void MultiBG::setSlicing(const std::string &slicing) { - boost::shared_ptr<const API::MatrixWorkspace> mws = m_workspace; - - m_funIndex.resize(nFunctions()); - - if (!slicing.empty()) { - Mantid::API::Expression expr; - expr.parse(slicing); - // expr can be treated as a list even if it has only 1 term - expr.toList(";"); - for (size_t i = 0; i < expr.size(); ++i) { - const Mantid::API::Expression &e = expr[i]; - if (e.name() != "," || e.size() != 3) { - // slicing has a wrong format - ignore it - break; - } - try { - std::string wsName = e[1].name(); - Mantid::API::MatrixWorkspace_sptr ws = - boost::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>( - Mantid::API::AnalysisDataService::Instance().retrieve(wsName)); - - size_t iFun = boost::lexical_cast<size_t>(e[0].name().substr(1)); - size_t wi = boost::lexical_cast<size_t>(e[2].name()); - if (iFun >= nFunctions()) { - throw std::invalid_argument("MultiBG::setWorkspace: function " + - e[0].name() + " not found"); - } - std::pair<boost::shared_ptr<const API::MatrixWorkspace>, size_t> - spectrum = std::make_pair(ws, wi); - m_funIndex[iFun].push_back(m_spectra.size()); - m_spectra.push_back(spectrum); - IFitFunction *fun = dynamic_cast<IFitFunction *>(getFunction(iFun)); - if (!fun) { - throw std::runtime_error( - "IFitFunction expected but function of another type found"); - } - fun->setWorkspace(ws, "WorkspaceIndex=" + e[2].name(), false); - } catch (...) { - break; - } - } - } - - // examine the member functions and fill in the m_funIndex array - for (size_t iFun = 0; iFun < nFunctions(); iFun++) { - API::IFunctionMW *fun = dynamic_cast<API::IFunctionMW *>(getFunction(iFun)); - if (!fun) { - throw std::runtime_error("MultiBG works with IFunctionMW only"); - } - if (fun->getWorkspace()) { - boost::shared_ptr<const API::MatrixWorkspace> iws = - fun->getMatrixWorkspace(); - std::pair<boost::shared_ptr<const API::MatrixWorkspace>, size_t> - spectrum = std::make_pair(iws, fun->getWorkspaceIndex()); - std::vector<std::pair<boost::shared_ptr<const API::MatrixWorkspace>, - size_t>>::iterator it = - std::find(m_spectra.begin(), m_spectra.end(), spectrum); - size_t i; - if (it == m_spectra.end()) { - i = m_spectra.size(); - m_spectra.push_back(spectrum); - } else { - i = size_t(std::distance(it, m_spectra.begin())); - } - m_funIndex[iFun].push_back(i); - // fun->setWorkspace(boost::static_pointer_cast<const - // API::Workspace>(iws),slicing,false); - } - } - - // setWorkspace can be called by GUI when the function had not been properly - // initialized - if (m_spectra.empty()) { - return; - } - - // make functions without set workspace fit to all workspaces - for (size_t iFun = 0; iFun < nFunctions(); iFun++) { - std::vector<size_t> &index = m_funIndex[iFun]; - if (index.empty()) { - index.resize(m_spectra.size()); - int i = 0; - std::for_each(index.begin(), index.end(), _1 = var(i)++); - IFitFunction *fun = dynamic_cast<IFitFunction *>(getFunction(iFun)); - if (!fun) { - throw std::runtime_error( - "IFitFunction expected but function of another type found"); - } - fun->setWorkspace(m_spectra[0].first, - "WorkspaceIndex=" + boost::lexical_cast<std::string>( - m_spectra[0].second), - false); - } - } - - // set dimensions and calculate ws's contribution to m_dataSize - // IFunctionMW::setWorkspace(ws,slicing,false); - // add other workspaces - m_offset.resize(m_spectra.size(), 0); - size_t nData = 0; - for (size_t i = 0; i < m_spectra.size(); ++i) { - mws = m_spectra[i].first; - size_t n = mws->blocksize(); - m_offset[i] = nData; - nData += static_cast<int>(n); - } - - m_data.resize(nData); - m_weights.resize(nData); - - //... fill in the data and the weights ... - - for (size_t i = 0; i < m_spectra.size(); ++i) { - mws = m_spectra[i].first; - size_t wi = m_spectra[i].second; - const Mantid::MantidVec &Y = mws->readY(wi); - const Mantid::MantidVec &E = mws->readE(wi); - size_t j0 = m_offset[i]; - for (size_t j = 0; j < Y.size(); ++j) { - m_data[j0 + j] = Y[j]; - double err = E[j]; - m_weights[j0 + j] = err != 0.0 ? 1. / err : 1.0; - } - } - - // std::cerr << "Workspace:\n"; - // std::for_each(&m_data[0],&m_data[0]+m_dataSize,std::cerr << _1 << '\n'); -} - -/** - * Creates a workspace containing values calculated with this function. It takes - * a workspace and ws index - * of a spectrum which this function may have been fitted to. The output - * contains the original spectrum - * (wi = 0), the calculated values (ws = 1), and the difference between them (ws - * = 2). - * @param sd :: optional standard deviations of the parameters for calculating - * the error bars - * @return created workspase - */ -boost::shared_ptr<API::WorkspaceGroup> -MultiBG::createCalculatedWorkspaceGroup(const std::vector<double> &sd) { - UNUSED_ARG(sd) - return boost::shared_ptr<API::WorkspaceGroup>(); -} -} // namespace API -} // namespace Mantid diff --git a/Framework/CurveFitting/src/ParDomain.cpp b/Framework/CurveFitting/src/ParDomain.cpp index 7cd4fdfe9e2f07b684cc16b4edcb6b9df9145177..01a76765f051c38b7e694348961519a5dc7639d4 100644 --- a/Framework/CurveFitting/src/ParDomain.cpp +++ b/Framework/CurveFitting/src/ParDomain.cpp @@ -28,7 +28,8 @@ void ParDomain::getDomainAndValues(size_t i, API::FunctionDomain_sptr &domain, * Calculate the value of a least squares cost function * @param leastSquares :: The least squares cost func to calculate the value for */ -void ParDomain::leastSquaresVal(const CostFuncLeastSquares &leastSquares) { +void ParDomain::leastSquaresVal( + const CostFunctions::CostFuncLeastSquares &leastSquares) { const int n = static_cast<int>(getNDomains()); PARALLEL_FOR_NO_WSP_CHECK() for (int i = 0; i < n; ++i) { @@ -54,7 +55,7 @@ void ParDomain::leastSquaresVal(const CostFuncLeastSquares &leastSquares) { * @param evalHessian :: Flag to evaluate the Hessian (second derivatives) */ void ParDomain::leastSquaresValDerivHessian( - const CostFuncLeastSquares &leastSquares, bool evalDeriv, + const CostFunctions::CostFuncLeastSquares &leastSquares, bool evalDeriv, bool evalHessian) { const int n = static_cast<int>(getNDomains()); PARALLEL_SET_DYNAMIC(0); diff --git a/Framework/CurveFitting/src/ParameterEstimator.cpp b/Framework/CurveFitting/src/ParameterEstimator.cpp index b06ef9bf59e96e5ecb51b54e67e221a14b95be9a..93c46fd68fbb9ae0690fbf296458a5f3bb20b7c4 100644 --- a/Framework/CurveFitting/src/ParameterEstimator.cpp +++ b/Framework/CurveFitting/src/ParameterEstimator.cpp @@ -1,5 +1,5 @@ #include "MantidCurveFitting/ParameterEstimator.h" -#include "MantidCurveFitting/SimpleChebfun.h" +#include "MantidCurveFitting/Functions/SimpleChebfun.h" #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/FunctionDomain1D.h" @@ -13,6 +13,8 @@ namespace Mantid { namespace CurveFitting { namespace ParameterEstimator { +using namespace Functions; + /// The logger. Kernel::Logger g_log("ParameterEstimator"); diff --git a/Framework/CurveFitting/src/SeqDomain.cpp b/Framework/CurveFitting/src/SeqDomain.cpp index a36e808948d556a6e366f88551bcdf8fffe2d645..8a704c1745664d0961b48088642ba0fdffc410e6 100644 --- a/Framework/CurveFitting/src/SeqDomain.cpp +++ b/Framework/CurveFitting/src/SeqDomain.cpp @@ -68,7 +68,8 @@ SeqDomain *SeqDomain::create(API::IDomainCreator::DomainType type) { * Calculate the value of a least squares cost function * @param leastSquares :: The least squares cost func to calculate the value for */ -void SeqDomain::leastSquaresVal(const CostFuncLeastSquares &leastSquares) { +void SeqDomain::leastSquaresVal( + const CostFunctions::CostFuncLeastSquares &leastSquares) { API::FunctionDomain_sptr domain; API::FunctionValues_sptr values; const size_t n = getNDomains(); @@ -87,7 +88,7 @@ void SeqDomain::leastSquaresVal(const CostFuncLeastSquares &leastSquares) { * Calculate the value of a least squares cost function * @param rwp :: The RWP cost func to calculate the value for */ -void SeqDomain::rwpVal(const CostFuncRwp &rwp) { +void SeqDomain::rwpVal(const CostFunctions::CostFuncRwp &rwp) { API::FunctionDomain_sptr domain; API::FunctionValues_sptr values; const size_t n = getNDomains(); @@ -109,7 +110,7 @@ void SeqDomain::rwpVal(const CostFuncRwp &rwp) { * @param evalHessian :: Flag to evaluate the Hessian (second derivatives) */ void SeqDomain::leastSquaresValDerivHessian( - const CostFuncLeastSquares &leastSquares, bool evalDeriv, + const CostFunctions::CostFuncLeastSquares &leastSquares, bool evalDeriv, bool evalHessian) { API::FunctionDomain_sptr domain; API::FunctionValues_sptr values; @@ -131,8 +132,8 @@ void SeqDomain::leastSquaresValDerivHessian( * @param evalDeriv :: Flag to evaluate the first derivatives * @param evalHessian :: Flag to evaluate the Hessian (second derivatives) */ -void SeqDomain::rwpValDerivHessian(const CostFuncRwp &rwp, bool evalDeriv, - bool evalHessian) { +void SeqDomain::rwpValDerivHessian(const CostFunctions::CostFuncRwp &rwp, + bool evalDeriv, bool evalHessian) { API::FunctionDomain_sptr domain; API::FunctionValues_sptr values; const size_t n = getNDomains(); diff --git a/Framework/CurveFitting/test/CalculateChiSquaredTest.h b/Framework/CurveFitting/test/Algorithms/CalculateChiSquaredTest.h similarity index 99% rename from Framework/CurveFitting/test/CalculateChiSquaredTest.h rename to Framework/CurveFitting/test/Algorithms/CalculateChiSquaredTest.h index 39fb96307a24056335df98216d80fd5641bf899b..fb29bda4b80738fd99f9a2d89838ab547850f606 100644 --- a/Framework/CurveFitting/test/CalculateChiSquaredTest.h +++ b/Framework/CurveFitting/test/Algorithms/CalculateChiSquaredTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/CalculateChiSquared.h" +#include "MantidCurveFitting/Algorithms/CalculateChiSquared.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/FunctionValues.h" @@ -16,7 +16,7 @@ #include <boost/math/special_functions/fpclassify.hpp> #include <limits> -using Mantid::CurveFitting::CalculateChiSquared; +using Mantid::CurveFitting::Algorithms::CalculateChiSquared; using namespace Mantid; using namespace Mantid::API; diff --git a/Framework/CurveFitting/test/CalculateGammaBackgroundTest.h b/Framework/CurveFitting/test/Algorithms/CalculateGammaBackgroundTest.h similarity index 98% rename from Framework/CurveFitting/test/CalculateGammaBackgroundTest.h rename to Framework/CurveFitting/test/Algorithms/CalculateGammaBackgroundTest.h index d5d7dbf487ae5e8493ce8aba1bb577456be3b310..502479b5f363c09a4312cdab88c88b92e233be80 100644 --- a/Framework/CurveFitting/test/CalculateGammaBackgroundTest.h +++ b/Framework/CurveFitting/test/Algorithms/CalculateGammaBackgroundTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/CalculateGammaBackground.h" -#include "ComptonProfileTestHelpers.h" +#include "MantidCurveFitting/Algorithms/CalculateGammaBackground.h" +#include "../Functions/ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::CalculateGammaBackground; +using Mantid::CurveFitting::Algorithms::CalculateGammaBackground; class CalculateGammaBackgroundTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/CalculateMSVesuvioTest.h b/Framework/CurveFitting/test/Algorithms/CalculateMSVesuvioTest.h similarity index 98% rename from Framework/CurveFitting/test/CalculateMSVesuvioTest.h rename to Framework/CurveFitting/test/Algorithms/CalculateMSVesuvioTest.h index 33f7f30b77a0252c38d2c692e8a529ea52de9d9f..f6eefbb0e35fd18579c0e7b04b0cc30398b88512 100644 --- a/Framework/CurveFitting/test/CalculateMSVesuvioTest.h +++ b/Framework/CurveFitting/test/Algorithms/CalculateMSVesuvioTest.h @@ -5,7 +5,7 @@ #include "boost/version.hpp" -#include "MantidCurveFitting/CalculateMSVesuvio.h" +#include "MantidCurveFitting/Algorithms/CalculateMSVesuvio.h" #include "MantidGeometry/Instrument/Goniometer.h" #include "MantidGeometry/Instrument/Detector.h" #include "MantidGeometry/Objects/ShapeFactory.h" @@ -13,9 +13,9 @@ #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "ComptonProfileTestHelpers.h" +#include "../Functions/ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::CalculateMSVesuvio; +using Mantid::CurveFitting::Algorithms::CalculateMSVesuvio; class CalculateMSVesuvioTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/ConvertToYSpaceTest.h b/Framework/CurveFitting/test/Algorithms/ConvertToYSpaceTest.h similarity index 96% rename from Framework/CurveFitting/test/ConvertToYSpaceTest.h rename to Framework/CurveFitting/test/Algorithms/ConvertToYSpaceTest.h index a3fed78b8baaa7c85c3ea0b918de70b4c4cc7fa3..839a9202dcdaa6ca483a5d439f97522d1dba0471 100644 --- a/Framework/CurveFitting/test/ConvertToYSpaceTest.h +++ b/Framework/CurveFitting/test/Algorithms/ConvertToYSpaceTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ConvertToYSpace.h" -#include "ComptonProfileTestHelpers.h" +#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h" +#include "../Functions/ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::ConvertToYSpace; +using Mantid::CurveFitting::Algorithms::ConvertToYSpace; class ConvertToYSpaceTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/ConvolveWorkspacesTest.h b/Framework/CurveFitting/test/Algorithms/ConvolveWorkspacesTest.h similarity index 92% rename from Framework/CurveFitting/test/ConvolveWorkspacesTest.h rename to Framework/CurveFitting/test/Algorithms/ConvolveWorkspacesTest.h index 0e748fa7ad2ea2d13e197185366269ced7bc6c73..fe9dc90f597485b84dc5257466b1ec3f8a180aed 100644 --- a/Framework/CurveFitting/test/ConvolveWorkspacesTest.h +++ b/Framework/CurveFitting/test/Algorithms/ConvolveWorkspacesTest.h @@ -5,8 +5,8 @@ #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/AnalysisDataService.h" -#include "MantidCurveFitting/ConvolveWorkspaces.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/ConvolveWorkspaces.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidAPI/IPeakFunction.h" #include "MantidAPI/TableRow.h" @@ -15,12 +15,13 @@ #include "MantidAPI/FunctionFactory.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidTestHelpers/FakeObjects.h" -#include "MantidCurveFitting/Gaussian.h" +#include "MantidCurveFitting/Functions/Gaussian.h" using namespace Mantid; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; class ConvolveWorkspacesTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/EstimatePeakErrorsTest.h b/Framework/CurveFitting/test/Algorithms/EstimatePeakErrorsTest.h similarity index 98% rename from Framework/CurveFitting/test/EstimatePeakErrorsTest.h rename to Framework/CurveFitting/test/Algorithms/EstimatePeakErrorsTest.h index 3ea8b1328cfa5098cdffdc2af7219645d00b2a4f..04baa92e562d387740477077d681853d54945792 100644 --- a/Framework/CurveFitting/test/EstimatePeakErrorsTest.h +++ b/Framework/CurveFitting/test/Algorithms/EstimatePeakErrorsTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/EstimatePeakErrors.h" +#include "MantidCurveFitting/Algorithms/EstimatePeakErrors.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/AnalysisDataService.h" @@ -19,6 +19,7 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; using namespace WorkspaceCreationHelper; class EstimatePeakErrorsTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/EvaluateFunctionTest.h b/Framework/CurveFitting/test/Algorithms/EvaluateFunctionTest.h similarity index 98% rename from Framework/CurveFitting/test/EvaluateFunctionTest.h rename to Framework/CurveFitting/test/Algorithms/EvaluateFunctionTest.h index 22e8a5aac0777d3003c7215b26ff7a1eb1f1f18f..cf8b80f4d991cbd76fe4a197c039c5eea0e15e6f 100644 --- a/Framework/CurveFitting/test/EvaluateFunctionTest.h +++ b/Framework/CurveFitting/test/Algorithms/EvaluateFunctionTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/EvaluateFunction.h" +#include "MantidCurveFitting/Algorithms/EvaluateFunction.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/FunctionFactory.h" @@ -15,7 +15,7 @@ #include "MantidAPI/MatrixWorkspace.h" #include "MantidKernel/EmptyValues.h" -using Mantid::CurveFitting::EvaluateFunction; +using Mantid::CurveFitting::Algorithms::EvaluateFunction; using namespace Mantid; using namespace Mantid::API; diff --git a/Framework/CurveFitting/test/FitPowderDiffPeaksTest.h b/Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h similarity index 99% rename from Framework/CurveFitting/test/FitPowderDiffPeaksTest.h rename to Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h index ffc3aa2b5be75b21602fda724cfd7ee954fd182e..2eea28afa5bc7c29710dadd82f362ece62d132fb 100644 --- a/Framework/CurveFitting/test/FitPowderDiffPeaksTest.h +++ b/Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/FitPowderDiffPeaks.h" +#include "MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h" #include "MantidDataHandling/LoadAscii.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidDataObjects/Workspace2D.h" @@ -11,7 +11,7 @@ #include "MantidAPI/TableRow.h" #include <fstream> -using Mantid::CurveFitting::FitPowderDiffPeaks; +using Mantid::CurveFitting::Algorithms::FitPowderDiffPeaks; using namespace std; using namespace Mantid; @@ -32,7 +32,7 @@ public: /** Test init */ void test_Init() { - CurveFitting::FitPowderDiffPeaks alg; + Algorithms::FitPowderDiffPeaks alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT(alg.isInitialized()); diff --git a/Framework/CurveFitting/test/FitTest.h b/Framework/CurveFitting/test/Algorithms/FitTest.h similarity index 98% rename from Framework/CurveFitting/test/FitTest.h rename to Framework/CurveFitting/test/Algorithms/FitTest.h index d4ce164b49008fd56dfc082016524bab1e9a7743..94b27088b284b5188b077158fe2d7ab871c110f7 100644 --- a/Framework/CurveFitting/test/FitTest.h +++ b/Framework/CurveFitting/test/Algorithms/FitTest.h @@ -7,11 +7,12 @@ #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/IFuncMinimizer.h" #include "MantidAPI/FuncMinimizerFactory.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "FitTestHelpers.h" using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::API; namespace { diff --git a/Framework/CurveFitting/test/FitTestHelpers.h b/Framework/CurveFitting/test/Algorithms/FitTestHelpers.h similarity index 100% rename from Framework/CurveFitting/test/FitTestHelpers.h rename to Framework/CurveFitting/test/Algorithms/FitTestHelpers.h diff --git a/Framework/CurveFitting/test/LeBailFitTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h similarity index 99% rename from Framework/CurveFitting/test/LeBailFitTest.h rename to Framework/CurveFitting/test/Algorithms/LeBailFitTest.h index 367da9173d58de7fbc930245072ebf27239bca6a..363ef9c91010ca6812518c889f784cbca4f3f335 100644 --- a/Framework/CurveFitting/test/LeBailFitTest.h +++ b/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h @@ -5,11 +5,9 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include "MantidCurveFitting/LeBailFit.h" +#include "MantidCurveFitting/Algorithms/LeBailFit.h" #include "MantidDataHandling/LoadAscii.h" -#include <iostream> -#include <iomanip> #include <fstream> #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -30,7 +28,7 @@ using namespace WorkspaceCreationHelper; using namespace std; -using Mantid::CurveFitting::LeBailFit; +using Mantid::CurveFitting::Algorithms::LeBailFit; class LeBailFitTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/LeBailFunctionTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h similarity index 99% rename from Framework/CurveFitting/test/LeBailFunctionTest.h rename to Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h index af5ecb5b30b30784720c1e4c0ce9945d0f35f34e..3c0fbdc897d010019117c62fe14533fb34c997a9 100644 --- a/Framework/CurveFitting/test/LeBailFunctionTest.h +++ b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h @@ -5,14 +5,13 @@ #include "MantidAPI/WorkspaceFactory.h" #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include <fstream> -#include "MantidCurveFitting/LeBailFunction.h" +#include "MantidCurveFitting/Algorithms/LeBailFunction.h" using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::API; using namespace std; diff --git a/Framework/CurveFitting/test/NormaliseByPeakAreaTest.h b/Framework/CurveFitting/test/Algorithms/NormaliseByPeakAreaTest.h similarity index 98% rename from Framework/CurveFitting/test/NormaliseByPeakAreaTest.h rename to Framework/CurveFitting/test/Algorithms/NormaliseByPeakAreaTest.h index 42e26ed2efc5fbadba4d4a247a2dcb7b48351e0d..30d27a5a9b32834fae81aba7fc65f4d3fd6e56a3 100644 --- a/Framework/CurveFitting/test/NormaliseByPeakAreaTest.h +++ b/Framework/CurveFitting/test/Algorithms/NormaliseByPeakAreaTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/NormaliseByPeakArea.h" -#include "ComptonProfileTestHelpers.h" +#include "MantidCurveFitting/Algorithms/NormaliseByPeakArea.h" +#include "../Functions/ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::NormaliseByPeakArea; +using Mantid::CurveFitting::Algorithms::NormaliseByPeakArea; class NormaliseByPeakAreaTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/PawleyFitTest.h b/Framework/CurveFitting/test/Algorithms/PawleyFitTest.h similarity index 98% rename from Framework/CurveFitting/test/PawleyFitTest.h rename to Framework/CurveFitting/test/Algorithms/PawleyFitTest.h index 3c99605f3d889689ca20cd3a8f375a4c09f0a93f..1766df896cd2ddba7d2486f7210f2496a25dd0fd 100644 --- a/Framework/CurveFitting/test/PawleyFitTest.h +++ b/Framework/CurveFitting/test/Algorithms/PawleyFitTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/PawleyFit.h" +#include "MantidCurveFitting/Algorithms/PawleyFit.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/TableRow.h" @@ -11,8 +11,8 @@ #include "MantidKernel/V3D.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -using Mantid::CurveFitting::PawleyFit; -using Mantid::CurveFitting::V3DFromHKLColumnExtractor; +using Mantid::CurveFitting::Algorithms::PawleyFit; +using Mantid::CurveFitting::Algorithms::V3DFromHKLColumnExtractor; using namespace Mantid::API; using namespace Mantid::Kernel; diff --git a/Framework/CurveFitting/test/PlotPeakByLogValueTest.h b/Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h similarity index 99% rename from Framework/CurveFitting/test/PlotPeakByLogValueTest.h rename to Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h index 03947a4ae12f68f9ef830eeab19346b35e5fa4f7..9fb02f3eff1711f19136fd8add1b58a3658e50b4 100644 --- a/Framework/CurveFitting/test/PlotPeakByLogValueTest.h +++ b/Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/PlotPeakByLogValue.h" +#include "MantidCurveFitting/Algorithms/PlotPeakByLogValue.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidAPI/TableRow.h" @@ -26,6 +26,7 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; typedef Mantid::DataObjects::Workspace2D_sptr WS_type; typedef Mantid::DataObjects::TableWorkspace_sptr TWS_type; diff --git a/Framework/CurveFitting/test/RefinePowderInstrumentParameters3Test.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h similarity index 99% rename from Framework/CurveFitting/test/RefinePowderInstrumentParameters3Test.h rename to Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h index a77678e9ebccb2dae4462d4d8d0611b4fc1c4f26..dedf1a1c02d6251cc27152f26dde9d4820c39563 100644 --- a/Framework/CurveFitting/test/RefinePowderInstrumentParameters3Test.h +++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/RefinePowderInstrumentParameters3.h" +#include "MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Workspace2D.h" @@ -12,7 +12,7 @@ #include <fstream> -using Mantid::CurveFitting::RefinePowderInstrumentParameters3; +using Mantid::CurveFitting::Algorithms::RefinePowderInstrumentParameters3; using namespace Mantid; using namespace Mantid::DataObjects; diff --git a/Framework/CurveFitting/test/RefinePowderInstrumentParametersTest.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h similarity index 98% rename from Framework/CurveFitting/test/RefinePowderInstrumentParametersTest.h rename to Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h index 421e4728d18724aff5a18509d3079997d7af5c81..fccdacb20db30175b3a3fa7c457b9ca9d9cbff43 100644 --- a/Framework/CurveFitting/test/RefinePowderInstrumentParametersTest.h +++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h @@ -3,14 +3,14 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/RefinePowderInstrumentParameters.h" +#include "MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidAPI/TableRow.h" #include <fstream> -using Mantid::CurveFitting::RefinePowderInstrumentParameters; +using Mantid::CurveFitting::Algorithms::RefinePowderInstrumentParameters; using namespace Mantid; using namespace Mantid::Kernel; using namespace Mantid::API; @@ -153,7 +153,7 @@ public: geomparamws); // 2. Set up algorithm parameters - CurveFitting::RefinePowderInstrumentParameters alg; + RefinePowderInstrumentParameters alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT(alg.isInitialized()); @@ -236,7 +236,7 @@ public: geomparamws); // 2. Set up algorithm parameters - CurveFitting::RefinePowderInstrumentParameters alg; + RefinePowderInstrumentParameters alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT(alg.isInitialized()); diff --git a/Framework/CurveFitting/test/SeqDomainSpectrumCreatorTest.h b/Framework/CurveFitting/test/Algorithms/SeqDomainSpectrumCreatorTest.h similarity index 99% rename from Framework/CurveFitting/test/SeqDomainSpectrumCreatorTest.h rename to Framework/CurveFitting/test/Algorithms/SeqDomainSpectrumCreatorTest.h index 4cf5c605467e89f40040a1d00da1b3cea7d9b196..077ca4fd6b7d0e7eaf1743731055c1fa0de27f03 100644 --- a/Framework/CurveFitting/test/SeqDomainSpectrumCreatorTest.h +++ b/Framework/CurveFitting/test/Algorithms/SeqDomainSpectrumCreatorTest.h @@ -10,7 +10,7 @@ #include "MantidAPI/IFunction1DSpectrum.h" #include "MantidAPI/ParamFunction.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidAPI/TableRow.h" #include "MantidAPI/FunctionFactory.h" @@ -20,6 +20,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; class SeqDomainSpectrumCreatorTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/SplineBackgroundTest.h b/Framework/CurveFitting/test/Algorithms/SplineBackgroundTest.h similarity index 96% rename from Framework/CurveFitting/test/SplineBackgroundTest.h rename to Framework/CurveFitting/test/Algorithms/SplineBackgroundTest.h index 935ed917426390465f5b952deb4f385aba20c967..4608bff0880d02351a3143f238691427d8a7896f 100644 --- a/Framework/CurveFitting/test/SplineBackgroundTest.h +++ b/Framework/CurveFitting/test/Algorithms/SplineBackgroundTest.h @@ -2,7 +2,7 @@ #define SPLINEBACKGROUNDTEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/SplineBackground.h" +#include "MantidCurveFitting/Algorithms/SplineBackground.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/MatrixWorkspace.h" diff --git a/Framework/CurveFitting/test/SplineInterpolationTest.h b/Framework/CurveFitting/test/Algorithms/SplineInterpolationTest.h similarity index 97% rename from Framework/CurveFitting/test/SplineInterpolationTest.h rename to Framework/CurveFitting/test/Algorithms/SplineInterpolationTest.h index 43b5adc90e74c081932edbe431ce6a50dcd11081..e55dc97c987ca523d7b8ac445a20e1c9ea1e0f2e 100644 --- a/Framework/CurveFitting/test/SplineInterpolationTest.h +++ b/Framework/CurveFitting/test/Algorithms/SplineInterpolationTest.h @@ -3,12 +3,12 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/SplineInterpolation.h" +#include "MantidCurveFitting/Algorithms/SplineInterpolation.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAPI/NumericAxis.h" #include "MantidAPI/TextAxis.h" -using Mantid::CurveFitting::SplineInterpolation; +using Mantid::CurveFitting::Algorithms::SplineInterpolation; using namespace Mantid::API; class SplineInterpolationTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/SplineSmoothingTest.h b/Framework/CurveFitting/test/Algorithms/SplineSmoothingTest.h similarity index 96% rename from Framework/CurveFitting/test/SplineSmoothingTest.h rename to Framework/CurveFitting/test/Algorithms/SplineSmoothingTest.h index cc28ba8c4361c88f6d91c53231d3120d033fdc9b..bc88af1750e9c0de3be3a6940fd5c9667859b100 100644 --- a/Framework/CurveFitting/test/SplineSmoothingTest.h +++ b/Framework/CurveFitting/test/Algorithms/SplineSmoothingTest.h @@ -4,9 +4,9 @@ #include <cxxtest/TestSuite.h> #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidCurveFitting/SplineSmoothing.h" +#include "MantidCurveFitting/Algorithms/SplineSmoothing.h" -using Mantid::CurveFitting::SplineSmoothing; +using Mantid::CurveFitting::Algorithms::SplineSmoothing; class SplineSmoothingTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/CompositeFunctionTest.h b/Framework/CurveFitting/test/CompositeFunctionTest.h index 9ee2946430933592a048a59e1f179eee728fcb8a..62a5cc3a1e5a15205b4504fafbb040b3f1543b75 100644 --- a/Framework/CurveFitting/test/CompositeFunctionTest.h +++ b/Framework/CurveFitting/test/CompositeFunctionTest.h @@ -5,7 +5,7 @@ #include "MantidAPI/IPeakFunction.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidAPI/TableRow.h" @@ -13,12 +13,12 @@ #include "MantidKernel/ConfigService.h" #include "MantidAPI/FrameworkManager.h" -#include "MantidCurveFitting/SimplexMinimizer.h" -#include "MantidCurveFitting/BFGS_Minimizer.h" -#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h" -#include "MantidCurveFitting/UserFunction.h" -#include "MantidCurveFitting/ExpDecay.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h" +#include "MantidCurveFitting/Functions/UserFunction.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidCurveFitting/GSLJacobian.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" @@ -28,6 +28,10 @@ using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::FuncMinimisers; +using namespace Mantid::CurveFitting::CostFunctions; typedef Mantid::DataObjects::Workspace2D_sptr WS_type; typedef Mantid::DataObjects::TableWorkspace_sptr TWS_type; diff --git a/Framework/CurveFitting/test/BoundaryConstraintTest.h b/Framework/CurveFitting/test/Constraints/BoundaryConstraintTest.h similarity index 95% rename from Framework/CurveFitting/test/BoundaryConstraintTest.h rename to Framework/CurveFitting/test/Constraints/BoundaryConstraintTest.h index e23d1847af1eadd572844b8ece762178eb6588c5..6e340def5735e36eb437735f2ef22b333dbe501e 100644 --- a/Framework/CurveFitting/test/BoundaryConstraintTest.h +++ b/Framework/CurveFitting/test/Constraints/BoundaryConstraintTest.h @@ -3,9 +3,9 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/Lorentzian.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Functions/Lorentzian.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -15,6 +15,8 @@ using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Constraints; class BoundaryConstraintTest : public CxxTest::TestSuite { public: @@ -39,7 +41,7 @@ public: TS_ASSERT(bc.hasUpper()); BoundaryConstraint bc2; - ; + bc2.reset(&gaus, 2); bc2.setBounds(10, 20); diff --git a/Framework/CurveFitting/test/CostFuncUnweightedLeastSquaresTest.h b/Framework/CurveFitting/test/CostFunctions/CostFuncUnweightedLeastSquaresTest.h similarity index 95% rename from Framework/CurveFitting/test/CostFuncUnweightedLeastSquaresTest.h rename to Framework/CurveFitting/test/CostFunctions/CostFuncUnweightedLeastSquaresTest.h index 7604eac76910549eb1946377693e565aed930d03..6b79954f49eac2fdc6c250fb04dec93e158ad58b 100644 --- a/Framework/CurveFitting/test/CostFuncUnweightedLeastSquaresTest.h +++ b/Framework/CurveFitting/test/CostFunctions/CostFuncUnweightedLeastSquaresTest.h @@ -5,11 +5,11 @@ #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionFactory.h" -#include "MantidCurveFitting/CostFuncUnweightedLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h" #include <boost/make_shared.hpp> -using Mantid::CurveFitting::CostFuncUnweightedLeastSquares; +using Mantid::CurveFitting::CostFunctions::CostFuncUnweightedLeastSquares; using namespace Mantid::API; class CostFuncUnweightedLeastSquaresTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/LeastSquaresTest.h b/Framework/CurveFitting/test/CostFunctions/LeastSquaresTest.h similarity index 94% rename from Framework/CurveFitting/test/LeastSquaresTest.h rename to Framework/CurveFitting/test/CostFunctions/LeastSquaresTest.h index 3f49a8cb1103c33ff00f0a512d4b4bd3f1a26417..425d34058f918ca2c14b4cd84a90a9fe86ded20b 100644 --- a/Framework/CurveFitting/test/LeastSquaresTest.h +++ b/Framework/CurveFitting/test/CostFunctions/LeastSquaresTest.h @@ -3,24 +3,27 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/CostFuncLeastSquares.h" -#include "MantidCurveFitting/CostFuncRwp.h" -#include "MantidCurveFitting/SimplexMinimizer.h" -#include "MantidCurveFitting/BFGS_Minimizer.h" -#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h" -#include "MantidCurveFitting/UserFunction.h" -#include "MantidCurveFitting/ExpDecay.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" +#include "MantidCurveFitting/CostFunctions/CostFuncRwp.h" +#include "MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/Gaussian.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Functions/UserFunction.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" #include <gsl/gsl_blas.h> #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; +using namespace Mantid::CurveFitting::CostFunctions; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class LeastSquaresTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/FitMWTest.h b/Framework/CurveFitting/test/FitMWTest.h index 78782f80d0678cdc1fd95ae41b4ca82ae54c3d68..00f938a976097564634c962ab59e1d74bf45e6a0 100644 --- a/Framework/CurveFitting/test/FitMWTest.h +++ b/Framework/CurveFitting/test/FitMWTest.h @@ -5,13 +5,13 @@ #include "MantidTestHelpers/FakeObjects.h" #include "MantidCurveFitting/FitMW.h" -#include "MantidCurveFitting/Fit.h" -#include "MantidCurveFitting/UserFunction.h" -#include "MantidCurveFitting/ExpDecay.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidCurveFitting/SeqDomain.h" -#include "MantidCurveFitting/Convolution.h" -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/Polynomial.h" +#include "MantidCurveFitting/Functions/UserFunction.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" +#include "MantidCurveFitting/Functions/Convolution.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Functions/Polynomial.h" #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/FrameworkManager.h" @@ -29,6 +29,8 @@ using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class FitMWTest : public CxxTest::TestSuite { @@ -51,7 +53,7 @@ public: fun->setParameter("Height", 1.); fun->setParameter("Lifetime", 1.0); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setProperty("Function", fun); @@ -159,7 +161,7 @@ public: fun->setParameter("Height", 1.); fun->setParameter("Lifetime", 1.); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setProperty("Function", fun); diff --git a/Framework/CurveFitting/test/BFGSTest.h b/Framework/CurveFitting/test/FuncMinimizers/BFGSTest.h similarity index 94% rename from Framework/CurveFitting/test/BFGSTest.h rename to Framework/CurveFitting/test/FuncMinimizers/BFGSTest.h index f0c03cb3e3792a1e600f9eaacdb761c0d10fcacf..0343e6677710560c70b4180980c6f01dfda4cbb2 100644 --- a/Framework/CurveFitting/test/BFGSTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/BFGSTest.h @@ -3,13 +3,14 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/BFGS_Minimizer.h" +#include "MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h" #include "MantidAPI/ICostFunction.h" #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; using namespace Mantid::API; class BFGSTestCostFunction : public ICostFunction { diff --git a/Framework/CurveFitting/test/DampingMinimizerTest.h b/Framework/CurveFitting/test/FuncMinimizers/DampingMinimizerTest.h similarity index 95% rename from Framework/CurveFitting/test/DampingMinimizerTest.h rename to Framework/CurveFitting/test/FuncMinimizers/DampingMinimizerTest.h index 61ce4aa560fc51076541d6c0ea00f39367759c01..1e8d08c13f590156ab50f463a09e6ea4e3714271 100644 --- a/Framework/CurveFitting/test/DampingMinimizerTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/DampingMinimizerTest.h @@ -3,17 +3,21 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/CostFuncLeastSquares.h" -#include "MantidCurveFitting/DampingMinimizer.h" -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/DampingMinimizer.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; +using namespace Mantid::CurveFitting::CostFunctions; +using namespace Mantid::CurveFitting::Constraints; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class DampingMinimizerTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/FABADAMinimizerTest.h b/Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h similarity index 94% rename from Framework/CurveFitting/test/FABADAMinimizerTest.h rename to Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h index 29b304014ebc1c720151f74adc0cfdae6d961be1..73f6508f42790dfc83079c5dcf4796ff14c0bf6b 100644 --- a/Framework/CurveFitting/test/FABADAMinimizerTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h @@ -3,20 +3,22 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/FABADAMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidAPI/AlgorithmManager.h" -#include "MantidCurveFitting/ExpDecay.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" #include "MantidKernel/PropertyManager.h" #include "MantidTestHelpers/FakeObjects.h" #include "MantidKernel/Exception.h" -using Mantid::CurveFitting::FABADAMinimizer; +using Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer; using namespace Mantid::API; using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; class FABADAMinimizerTest : public CxxTest::TestSuite { public: @@ -34,7 +36,7 @@ public: fun->setParameter("Height", 8.); fun->setParameter("Lifetime", 1.0); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setRethrows(true); @@ -143,7 +145,7 @@ public: fun->setParameter("Height", 1.); fun->setParameter("Lifetime", 1.0); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setRethrows(true); diff --git a/Framework/CurveFitting/test/FRConjugateGradientTest.h b/Framework/CurveFitting/test/FuncMinimizers/FRConjugateGradientTest.h similarity index 94% rename from Framework/CurveFitting/test/FRConjugateGradientTest.h rename to Framework/CurveFitting/test/FuncMinimizers/FRConjugateGradientTest.h index 34028a02dd1213cb225a4deb8173f35f9de845e1..12629afb2dbd101ef72e3d9cbea61a74c1c13698 100644 --- a/Framework/CurveFitting/test/FRConjugateGradientTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/FRConjugateGradientTest.h @@ -3,13 +3,14 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/FRConjugateGradientMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h" #include "MantidAPI/ICostFunction.h" #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; using namespace Mantid::API; class FRConjugateGradientTestCostFunction : public ICostFunction { diff --git a/Framework/CurveFitting/test/LevenbergMarquardtMDTest.h b/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtMDTest.h similarity index 95% rename from Framework/CurveFitting/test/LevenbergMarquardtMDTest.h rename to Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtMDTest.h index 93ae0e5dd0a8c4fbe019e61fd35211a07ad5aadd..edaeec639e087ddf475094d1d23c41b66cccb0ea 100644 --- a/Framework/CurveFitting/test/LevenbergMarquardtMDTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtMDTest.h @@ -3,17 +3,21 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/CostFuncLeastSquares.h" -#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h" -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; +using namespace Mantid::CurveFitting::CostFunctions; +using namespace Mantid::CurveFitting::Constraints; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class LevenbergMarquardtMDTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/LevenbergMarquardtTest.h b/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtTest.h similarity index 95% rename from Framework/CurveFitting/test/LevenbergMarquardtTest.h rename to Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtTest.h index 30a690d98b9fd530976cf180cb1616a2461c7a0b..359712feb5f798bacd3398eb7e15d1193dac7f58 100644 --- a/Framework/CurveFitting/test/LevenbergMarquardtTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtTest.h @@ -3,17 +3,21 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/CostFuncLeastSquares.h" -#include "MantidCurveFitting/LevenbergMarquardtMinimizer.h" -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; +using namespace Mantid::CurveFitting::CostFunctions; +using namespace Mantid::CurveFitting::Constraints; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class LevenbergMarquardtTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/PRConjugateGradientTest.h b/Framework/CurveFitting/test/FuncMinimizers/PRConjugateGradientTest.h similarity index 94% rename from Framework/CurveFitting/test/PRConjugateGradientTest.h rename to Framework/CurveFitting/test/FuncMinimizers/PRConjugateGradientTest.h index b5a8a910e1492319ec72a65f5f6d2d8a0e7d2cdd..6f250d93aa4a3ff039555979831aac6ca411556b 100644 --- a/Framework/CurveFitting/test/PRConjugateGradientTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/PRConjugateGradientTest.h @@ -3,13 +3,14 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/PRConjugateGradientMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h" #include "MantidAPI/ICostFunction.h" #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; using namespace Mantid::API; class PRConjugateGradientTestCostFunction : public ICostFunction { diff --git a/Framework/CurveFitting/test/SimplexTest.h b/Framework/CurveFitting/test/FuncMinimizers/SimplexTest.h similarity index 93% rename from Framework/CurveFitting/test/SimplexTest.h rename to Framework/CurveFitting/test/FuncMinimizers/SimplexTest.h index 95811e161315ccb4ef59c832762cc5b792392a31..6edf55ccb183f24d904837fcf25fcd9021132fc0 100644 --- a/Framework/CurveFitting/test/SimplexTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/SimplexTest.h @@ -3,13 +3,14 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/SimplexMinimizer.h" +#include "MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h" #include "MantidAPI/ICostFunction.h" #include <sstream> using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::FuncMinimisers; using namespace Mantid::API; class SimplexTestCostFunction : public ICostFunction { diff --git a/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h b/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h index c7f60ebf936da427adc02bfe5a1b4a01c6b27288..699b840af67808e1503a8155ce93469c96282a33 100644 --- a/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h +++ b/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h @@ -9,13 +9,14 @@ #include "MantidAPI/FunctionParameterDecorator.h" #include "MantidDataObjects/Workspace2D.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include <boost/make_shared.hpp> using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; class FunctionParameterDecoratorFitTest; diff --git a/Framework/CurveFitting/test/AbragamTest.h b/Framework/CurveFitting/test/Functions/AbragamTest.h similarity index 91% rename from Framework/CurveFitting/test/AbragamTest.h rename to Framework/CurveFitting/test/Functions/AbragamTest.h index 342eb7360e7b6942a94cd021848e1f6d4e67c333..387926477b7d2f73b443265d2ce80dfafbcd571c 100644 --- a/Framework/CurveFitting/test/AbragamTest.h +++ b/Framework/CurveFitting/test/Functions/AbragamTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Abragam.h" +#include "MantidCurveFitting/Functions/Abragam.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -19,6 +19,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::DataObjects; class AbragamTest : public CxxTest::TestSuite { @@ -54,7 +56,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/BSplineTest.h b/Framework/CurveFitting/test/Functions/BSplineTest.h similarity index 96% rename from Framework/CurveFitting/test/BSplineTest.h rename to Framework/CurveFitting/test/Functions/BSplineTest.h index 0b5e362ab4cca0afec2ef9c0a487f5ff97dbcdd2..a504230e745db1cdc97040a74e634ad084a9351a 100644 --- a/Framework/CurveFitting/test/BSplineTest.h +++ b/Framework/CurveFitting/test/Functions/BSplineTest.h @@ -1,21 +1,22 @@ #ifndef BSPLINETEST_H_ #define BSPLINETEST_H_ -#include "MantidCurveFitting/BSpline.h" -#include "MantidCurveFitting/UserFunction.h" -#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/Functions/BSpline.h" +#include "MantidCurveFitting/Functions/UserFunction.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" #include "MantidAPI/FunctionFactory.h" #include <cxxtest/TestSuite.h> #include <boost/lexical_cast.hpp> -#include <iostream> using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::CostFunctions; class BSplineTest : public CxxTest::TestSuite { public: @@ -345,7 +346,7 @@ private: boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares); costFun->setFittingFunction(bsp, domain, values); - LevenbergMarquardtMDMinimizer s; + FuncMinimisers::LevenbergMarquardtMDMinimizer s; s.initialize(costFun); TS_ASSERT(s.minimize()); return costFun->val(); diff --git a/Framework/CurveFitting/test/BackToBackExponentialTest.h b/Framework/CurveFitting/test/Functions/BackToBackExponentialTest.h similarity index 97% rename from Framework/CurveFitting/test/BackToBackExponentialTest.h rename to Framework/CurveFitting/test/Functions/BackToBackExponentialTest.h index bd30cef1e0906c2d5374fcd99603e57df1b73c4e..764131715ec7f1abb6e84a8ea97b90920846d6a7 100644 --- a/Framework/CurveFitting/test/BackToBackExponentialTest.h +++ b/Framework/CurveFitting/test/Functions/BackToBackExponentialTest.h @@ -3,13 +3,13 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/BackToBackExponential.h" +#include "MantidCurveFitting/Functions/BackToBackExponential.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" #include <cmath> -using Mantid::CurveFitting::BackToBackExponential; +using Mantid::CurveFitting::Functions::BackToBackExponential; namespace { /** diff --git a/Framework/CurveFitting/test/BivariateNormalTest.h b/Framework/CurveFitting/test/Functions/BivariateNormalTest.h similarity index 98% rename from Framework/CurveFitting/test/BivariateNormalTest.h rename to Framework/CurveFitting/test/Functions/BivariateNormalTest.h index d3f8c5bd6c010c21a801f7cd55f12defb17f37d9..c169d9787aa554cdd55bc0a05c1333a376ec90a9 100644 --- a/Framework/CurveFitting/test/BivariateNormalTest.h +++ b/Framework/CurveFitting/test/Functions/BivariateNormalTest.h @@ -9,7 +9,7 @@ #define BIVARIATENORMALTEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/BivariateNormal.h" +#include "MantidCurveFitting/Functions/BivariateNormal.h" #include "MantidKernel/Matrix.h" #include "MantidAPI/Jacobian.h" #include "MantidAPI/WorkspaceFactory.h" @@ -21,7 +21,6 @@ #include "MantidCurveFitting/GSLFunctions.h" #include "MantidKernel/UnitFactory.h" */ -#include <iostream> #include <cmath> #include <stdio.h> #include <stdlib.h> @@ -32,6 +31,7 @@ using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid::DataObjects; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; /** * Used for testing only */ diff --git a/Framework/CurveFitting/test/Bk2BkExpConvPVTest.h b/Framework/CurveFitting/test/Functions/Bk2BkExpConvPVTest.h similarity index 96% rename from Framework/CurveFitting/test/Bk2BkExpConvPVTest.h rename to Framework/CurveFitting/test/Functions/Bk2BkExpConvPVTest.h index 9897818fbc4b5e631475ca687260b7cca4cb135d..95fe716309da8ae2f705171fdcb9efde9d0f810e 100644 --- a/Framework/CurveFitting/test/Bk2BkExpConvPVTest.h +++ b/Framework/CurveFitting/test/Functions/Bk2BkExpConvPVTest.h @@ -4,17 +4,17 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include <fstream> -#include "MantidCurveFitting/Bk2BkExpConvPV.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/Bk2BkExpConvPV.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Workspace2D.h" using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class Bk2BkExpConvPVTest : public CxxTest::TestSuite { @@ -158,7 +158,7 @@ public: << std::endl; // 3. Set fit - Fit fitalg; + Algorithms::Fit fitalg; fitalg.initialize(); TS_ASSERT(fitalg.isInitialized()); diff --git a/Framework/CurveFitting/test/ChebfunBaseTest.h b/Framework/CurveFitting/test/Functions/ChebfunBaseTest.h similarity index 98% rename from Framework/CurveFitting/test/ChebfunBaseTest.h rename to Framework/CurveFitting/test/Functions/ChebfunBaseTest.h index 0d2a8fb5fefc059bcf34a1f666c8419caaaba3ed..175fa53033dff71443d3260d7d825f4f89c94d51 100644 --- a/Framework/CurveFitting/test/ChebfunBaseTest.h +++ b/Framework/CurveFitting/test/Functions/ChebfunBaseTest.h @@ -3,12 +3,13 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ChebfunBase.h" +#include "MantidCurveFitting/Functions/ChebfunBase.h" #include <cmath> using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; double Sin(double x) { return sin(x); } double MinusSin(double x) { return -sin(x); } diff --git a/Framework/CurveFitting/test/ChebyshevTest.h b/Framework/CurveFitting/test/Functions/ChebyshevTest.h similarity index 94% rename from Framework/CurveFitting/test/ChebyshevTest.h rename to Framework/CurveFitting/test/Functions/ChebyshevTest.h index 7cad35f6467b458528ae24878517dd66a89ad8c8..2602cc30011f506b35969d80ec4fbc5d25a0265a 100644 --- a/Framework/CurveFitting/test/ChebyshevTest.h +++ b/Framework/CurveFitting/test/Functions/ChebyshevTest.h @@ -3,8 +3,8 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Chebyshev.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/Chebyshev.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/AnalysisDataService.h" @@ -14,6 +14,8 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; class ChebyshevTest : public CxxTest::TestSuite { public: @@ -59,7 +61,7 @@ public: Chebyshev cheb; cheb.setAttributeValue("n", 3); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setPropertyValue("Function", cheb.asString()); @@ -116,7 +118,7 @@ public: cheb.setAttributeValue("StartX", -10.0); cheb.setAttributeValue("EndX", 10.0); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setPropertyValue("Function", cheb.asString()); diff --git a/Framework/CurveFitting/test/ComptonPeakProfileTest.h b/Framework/CurveFitting/test/Functions/ComptonPeakProfileTest.h similarity index 95% rename from Framework/CurveFitting/test/ComptonPeakProfileTest.h rename to Framework/CurveFitting/test/Functions/ComptonPeakProfileTest.h index b66b087aa802c527caca4a6d8e1fd330d5e621b6..1d5a8488d99c3a143fd1ed5df9d99c4d97e3a7e6 100644 --- a/Framework/CurveFitting/test/ComptonPeakProfileTest.h +++ b/Framework/CurveFitting/test/Functions/ComptonPeakProfileTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ComptonPeakProfile.h" +#include "MantidCurveFitting/Functions/ComptonPeakProfile.h" #include "ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::ComptonPeakProfile; +using Mantid::CurveFitting::Functions::ComptonPeakProfile; class ComptonPeakProfileTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/ComptonProfileTest.h b/Framework/CurveFitting/test/Functions/ComptonProfileTest.h similarity index 95% rename from Framework/CurveFitting/test/ComptonProfileTest.h rename to Framework/CurveFitting/test/Functions/ComptonProfileTest.h index f1a33b8d848929d5101ef39af333cc2e05d9e482..2d21d6981cac2ea1c2bdd06f2e744938371e4cf7 100644 --- a/Framework/CurveFitting/test/ComptonProfileTest.h +++ b/Framework/CurveFitting/test/Functions/ComptonProfileTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ComptonProfile.h" +#include "MantidCurveFitting/Functions/ComptonProfile.h" #include <boost/make_shared.hpp> -using Mantid::CurveFitting::ComptonProfile; +using Mantid::CurveFitting::Functions::ComptonProfile; class ComptonProfileTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/ComptonProfileTestHelpers.h b/Framework/CurveFitting/test/Functions/ComptonProfileTestHelpers.h similarity index 100% rename from Framework/CurveFitting/test/ComptonProfileTestHelpers.h rename to Framework/CurveFitting/test/Functions/ComptonProfileTestHelpers.h diff --git a/Framework/CurveFitting/test/ComptonScatteringCountRateTest.h b/Framework/CurveFitting/test/Functions/ComptonScatteringCountRateTest.h similarity index 97% rename from Framework/CurveFitting/test/ComptonScatteringCountRateTest.h rename to Framework/CurveFitting/test/Functions/ComptonScatteringCountRateTest.h index 714776b1bef083fc29139c04106ce15933024a16..a9fe90bd3babc3a60a9d8cf51350bd93db538fe3 100644 --- a/Framework/CurveFitting/test/ComptonScatteringCountRateTest.h +++ b/Framework/CurveFitting/test/Functions/ComptonScatteringCountRateTest.h @@ -2,9 +2,12 @@ #define MANTID_CURVEFITTING_COMPTONSCATTERINGCOUNTRATETEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ComptonScatteringCountRate.h" +#include "MantidCurveFitting/Functions/ComptonScatteringCountRate.h" #include "ComptonProfileTestHelpers.h" +using Mantid::CurveFitting::Functions::ComptonScatteringCountRate; +using Mantid::CurveFitting::Functions::ComptonProfile; + class ComptonScatteringCountRateTest : public CxxTest::TestSuite { public: // This pair of boilerplate methods prevent the suite being created statically @@ -209,7 +212,7 @@ public: private: /// A simple working object to use for the testing /// Provides a canned answer of 1 for the massProfile - class ComptonProfileStub : public Mantid::CurveFitting::ComptonProfile { + class ComptonProfileStub : public ComptonProfile { public: ComptonProfileStub() : ComptonProfile() { declareParameter("Width", 1.0); @@ -289,7 +292,7 @@ private: return func; } - boost::shared_ptr<Mantid::CurveFitting::ComptonScatteringCountRate> + boost::shared_ptr<ComptonScatteringCountRate> createFunctionNoBackground(const bool useTwoIntensityFuncAsFirst = false) { boost::shared_ptr<ComptonProfileStub> func1; if (useTwoIntensityFuncAsFirst) { @@ -310,7 +313,6 @@ private: func2->setParameter("Width", 10.0); func2->setParameter("Intensity", 3.0); - using Mantid::CurveFitting::ComptonScatteringCountRate; auto profile = boost::make_shared<ComptonScatteringCountRate>(); profile->initialize(); profile->addFunction(func1); @@ -321,7 +323,6 @@ private: } Mantid::API::IFunction_sptr createFunction() { - using Mantid::CurveFitting::ComptonScatteringCountRate; auto profile = boost::make_shared<ComptonScatteringCountRate>(); profile->initialize(); diff --git a/Framework/CurveFitting/test/ConvolutionTest.h b/Framework/CurveFitting/test/Functions/ConvolutionTest.h similarity index 98% rename from Framework/CurveFitting/test/ConvolutionTest.h rename to Framework/CurveFitting/test/Functions/ConvolutionTest.h index 222e87689568f9c6e3885b24b2b446fcb3c727d6..21c97b9b390e28361bbb123333158d45c82abf6d 100644 --- a/Framework/CurveFitting/test/ConvolutionTest.h +++ b/Framework/CurveFitting/test/Functions/ConvolutionTest.h @@ -5,8 +5,8 @@ #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/AnalysisDataService.h" -#include "MantidCurveFitting/Convolution.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/Convolution.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidAPI/IPeakFunction.h" @@ -21,6 +21,8 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; typedef Mantid::DataObjects::Workspace2D_sptr WS_type; typedef Mantid::DataObjects::TableWorkspace_sptr TWS_type; @@ -406,7 +408,7 @@ public: conv->setParameter("f1.h", 1); conv->setParameter("f1.w", 1); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setPropertyValue("Function", conv->asString()); @@ -424,7 +426,7 @@ public: 0.1, fabs(out->getParameter("f1.w") - conv->getParameter("f1.w"))); conv->setAttributeValue("FixResolution", false); - Fit fit1; + Algorithms::Fit fit1; fit1.initialize(); fit1.setProperty("Function", boost::dynamic_pointer_cast<IFunction>(conv)); fit1.setProperty("InputWorkspace", data); diff --git a/Framework/CurveFitting/test/CubicSplineTest.h b/Framework/CurveFitting/test/Functions/CubicSplineTest.h similarity index 97% rename from Framework/CurveFitting/test/CubicSplineTest.h rename to Framework/CurveFitting/test/Functions/CubicSplineTest.h index 4412cd13f5e308158cf79a9eeb48732ddae05bc0..f90d200345fe5ffece9b81c38ba57583f84135e9 100644 --- a/Framework/CurveFitting/test/CubicSplineTest.h +++ b/Framework/CurveFitting/test/Functions/CubicSplineTest.h @@ -4,10 +4,9 @@ #include <boost/scoped_array.hpp> #include <cmath> #include <cxxtest/TestSuite.h> -#include <iostream> -#include "MantidCurveFitting/CubicSpline.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/CubicSpline.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/AnalysisDataService.h" @@ -17,6 +16,8 @@ using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; class CubicSplineTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/DeltaFunctionTest.h b/Framework/CurveFitting/test/Functions/DeltaFunctionTest.h similarity index 93% rename from Framework/CurveFitting/test/DeltaFunctionTest.h rename to Framework/CurveFitting/test/Functions/DeltaFunctionTest.h index d6ff22def118eb83ee4bd09828903e1cc5e7ebf6..b7fabe94be69f939f9593a29ee64bf745353847f 100644 --- a/Framework/CurveFitting/test/DeltaFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/DeltaFunctionTest.h @@ -2,10 +2,10 @@ #define DELTAFUNCTIONTEST_H #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" -#include "MantidCurveFitting/DeltaFunction.h" -#include "MantidCurveFitting/Convolution.h" +#include "MantidCurveFitting/Functions/DeltaFunction.h" +#include "MantidCurveFitting/Functions/Convolution.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" @@ -13,6 +13,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; // same class as ConvolutionTest_Gauss in ConvolutionTest.h class DeltaFunctionTest_Gauss : public IPeakFunction { diff --git a/Framework/CurveFitting/test/DiffRotDiscreteCircleTest.h b/Framework/CurveFitting/test/Functions/DiffRotDiscreteCircleTest.h similarity index 94% rename from Framework/CurveFitting/test/DiffRotDiscreteCircleTest.h rename to Framework/CurveFitting/test/Functions/DiffRotDiscreteCircleTest.h index b6ffb6e4c0ff751c700ef445c3a6cb72a15f52d6..4b8df7d7a42592fafb9a381ecd27f535e01e3fdb 100644 --- a/Framework/CurveFitting/test/DiffRotDiscreteCircleTest.h +++ b/Framework/CurveFitting/test/Functions/DiffRotDiscreteCircleTest.h @@ -3,10 +3,10 @@ #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/AlgorithmFactory.h" -#include "MantidCurveFitting/Convolution.h" -#include "MantidCurveFitting/DiffRotDiscreteCircle.h" -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/Convolution.h" +#include "MantidCurveFitting/Functions/DiffRotDiscreteCircle.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidGeometry/Instrument/ReferenceFrame.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -18,6 +18,10 @@ #include <boost/random/uniform_real.hpp> #include <boost/shared_ptr.hpp> +using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; + class DiffRotDiscreteCircleTest : public CxxTest::TestSuite { public: @@ -34,8 +38,7 @@ public: const double w0 = random_value(-1.0, 1.0); const double h = random_value(1.0, 1000.0); const double fwhm = random_value(1.0, 100.0); - boost::shared_ptr<Mantid::CurveFitting::Gaussian> resolution( - new Mantid::CurveFitting::Gaussian()); + boost::shared_ptr<Gaussian> resolution(new Gaussian()); resolution->initialize(); // declare parameters resolution->setCentre(w0); resolution->setHeight(h); @@ -47,16 +50,15 @@ public: const double r = random_value(0.3, 9.8); const double Q = 0.9; const int N = 6; - boost::shared_ptr<Mantid::CurveFitting::ElasticDiffRotDiscreteCircle> - structure_factor( - new Mantid::CurveFitting::ElasticDiffRotDiscreteCircle()); + boost::shared_ptr<ElasticDiffRotDiscreteCircle> structure_factor( + new ElasticDiffRotDiscreteCircle()); structure_factor->setParameter("Height", I); structure_factor->setParameter("Radius", r); structure_factor->setAttributeValue("Q", Q); structure_factor->setAttributeValue("N", N); // initialize the convolution function - Mantid::CurveFitting::Convolution conv; + Convolution conv; conv.addFunction(resolution); conv.addFunction(structure_factor); @@ -124,7 +126,7 @@ public: "9,Intensity=2.9,Radius=2.3,Decay=0.468"; // Do a fit with no iterations - Mantid::CurveFitting::Fit fitalg; + Algorithms::Fit fitalg; TS_ASSERT_THROWS_NOTHING(fitalg.initialize()); TS_ASSERT(fitalg.isInitialized()); fitalg.setProperty("Function", funtion_string); @@ -172,7 +174,7 @@ public: const double tao = 0.45; const double Q = 0.7; const int N = 4; - Mantid::CurveFitting::DiffRotDiscreteCircle func; + DiffRotDiscreteCircle func; func.init(); func.setParameter("f1.Intensity", I); func.setParameter("f1.Radius", R); @@ -181,8 +183,7 @@ public: func.setAttributeValue("N", N); // check values where correctly initialized - auto ids = boost::dynamic_pointer_cast< - Mantid::CurveFitting::InelasticDiffRotDiscreteCircle>( + auto ids = boost::dynamic_pointer_cast<InelasticDiffRotDiscreteCircle>( func.getFunction(1)); TS_ASSERT_EQUALS(ids->getParameter("Intensity"), I); TS_ASSERT_EQUALS(ids->getParameter("Radius"), R); @@ -192,8 +193,7 @@ public: // check the ties were applied correctly func.applyTies(); // elastic parameters are tied to inelastic parameters - auto eds = boost::dynamic_pointer_cast< - Mantid::CurveFitting::ElasticDiffRotDiscreteCircle>( + auto eds = boost::dynamic_pointer_cast<ElasticDiffRotDiscreteCircle>( func.getFunction(0)); TS_ASSERT_EQUALS(eds->getParameter("Height"), I); TS_ASSERT_EQUALS(eds->getParameter("Radius"), R); @@ -207,15 +207,14 @@ public: const double tao = 0.45; // This should set parameters of the inelastic part - Mantid::CurveFitting::DiffRotDiscreteCircle func; + DiffRotDiscreteCircle func; func.init(); func.setParameter("Intensity", I); func.setParameter("Radius", R); func.setParameter("Decay", tao); // check the parameter of the inelastic part - auto ifunc = boost::dynamic_pointer_cast< - Mantid::CurveFitting::InelasticDiffRotDiscreteCircle>( + auto ifunc = boost::dynamic_pointer_cast<InelasticDiffRotDiscreteCircle>( func.getFunction(1)); TS_ASSERT_EQUALS(ifunc->getParameter("Intensity"), I); TS_ASSERT_EQUALS(ifunc->getParameter("Radius"), R); @@ -223,8 +222,7 @@ public: // check the parameters of the elastic part func.applyTies(); // elastic parameters are tied to inelastic parameters - auto efunc = boost::dynamic_pointer_cast< - Mantid::CurveFitting::ElasticDiffRotDiscreteCircle>( + auto efunc = boost::dynamic_pointer_cast<ElasticDiffRotDiscreteCircle>( func.getFunction(0)); TS_ASSERT_EQUALS(efunc->getParameter("Height"), I); TS_ASSERT_EQUALS(efunc->getParameter("Radius"), R); @@ -244,7 +242,7 @@ public: "Radius=1.567,Decay=7.567))"; // Initialize the fit function in the Fit algorithm - Mantid::CurveFitting::Fit fitalg; + Algorithms::Fit fitalg; TS_ASSERT_THROWS_NOTHING(fitalg.initialize()); TS_ASSERT(fitalg.isInitialized()); fitalg.setProperty("Function", funtion_string); @@ -277,8 +275,7 @@ public: Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty("Function"); auto fitalg_conv = - boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>( - fitalg_function); + boost::dynamic_pointer_cast<Convolution>(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 @@ -342,7 +339,7 @@ private: << ",Shift=" << S << ")"; // Initialize the fit function in the Fit algorithm - Mantid::CurveFitting::Fit fitalg; + Algorithms::Fit fitalg; TS_ASSERT_THROWS_NOTHING(fitalg.initialize()); TS_ASSERT(fitalg.isInitialized()); fitalg.setProperty("Function", function_stream.str()); @@ -384,8 +381,7 @@ private: Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty("Function"); auto fitalg_conv = - boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>( - fitalg_function); + boost::dynamic_pointer_cast<Convolution>(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 @@ -525,7 +521,7 @@ private: // create a data workspace using a Fit algorithm Mantid::DataObjects::Workspace2D_sptr - generateWorkspaceFromFitAlgorithm(Mantid::CurveFitting::Fit &fitalg) { + generateWorkspaceFromFitAlgorithm(Algorithms::Fit &fitalg) { using namespace Mantid::Kernel; using namespace Mantid::Geometry; diff --git a/Framework/CurveFitting/test/DiffSphereTest.h b/Framework/CurveFitting/test/Functions/DiffSphereTest.h similarity index 94% rename from Framework/CurveFitting/test/DiffSphereTest.h rename to Framework/CurveFitting/test/Functions/DiffSphereTest.h index 45ef43ca1072ea36e61282e52501506d296c26c3..06807332917f92d65dcc128bff337207ef34e7fa 100644 --- a/Framework/CurveFitting/test/DiffSphereTest.h +++ b/Framework/CurveFitting/test/Functions/DiffSphereTest.h @@ -1,7 +1,6 @@ #ifndef DIFFSPHERETEST_H_ #define DIFFSPHERETEST_H_ -#include <iostream> #include <fstream> #include <limits> #include <numeric> @@ -11,17 +10,21 @@ // Include local copy of Valgrind header to avoid creating a dependency #include "valgrind.h" -#include "MantidCurveFitting/DiffSphere.h" -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/Convolution.h" +#include "MantidCurveFitting/Functions/DiffSphere.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Functions/Convolution.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/AlgorithmFactory.h" #include "MantidGeometry/Instrument/ReferenceFrame.h" #include "MantidTestHelpers/ComponentCreationHelper.h" +using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; + class DiffSphereTest : public CxxTest::TestSuite { public: bool skipTests() { @@ -43,7 +46,7 @@ public: "Sigma=0.002);name=ElasticDiffSphere,Q=0.5,Height=47.014,Radius=3.567)"; // Initialize the fit function in the Fit algorithm - Mantid::CurveFitting::Fit fitalg; + Algorithms::Fit fitalg; TS_ASSERT_THROWS_NOTHING(fitalg.initialize()); TS_ASSERT(fitalg.isInitialized()); fitalg.setProperty("Function", funtion_string); @@ -83,8 +86,7 @@ public: Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty("Function"); auto fitalg_conv = - boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>( - fitalg_function); + boost::dynamic_pointer_cast<Convolution>(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 @@ -133,16 +135,15 @@ public: // of the 99 coefficients to break down // initialize the elastic part - boost::shared_ptr<Mantid::CurveFitting::ElasticDiffSphere> elastic_part( - new Mantid::CurveFitting::ElasticDiffSphere()); + boost::shared_ptr<ElasticDiffSphere> elastic_part(new ElasticDiffSphere()); elastic_part->setParameter("Height", I); elastic_part->setParameter("Radius", R); elastic_part->setAttributeValue("Q", Q); elastic_part->init(); // initialize the inelastic part - boost::shared_ptr<Mantid::CurveFitting::InelasticDiffSphere> inelastic_part( - new Mantid::CurveFitting::InelasticDiffSphere()); + boost::shared_ptr<InelasticDiffSphere> inelastic_part( + new InelasticDiffSphere()); inelastic_part->setParameter("Intensity", I); inelastic_part->setParameter("Radius", R); inelastic_part->setParameter("Diffusion", D); @@ -186,7 +187,7 @@ public: const double Q(0.5); // Initialize the fit function in the Fit algorithm - Mantid::CurveFitting::Fit fitalg; + Algorithms::Fit fitalg; TS_ASSERT_THROWS_NOTHING(fitalg.initialize()); TS_ASSERT(fitalg.isInitialized()); std::ostringstream funtion_stream; @@ -206,18 +207,15 @@ public: Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty("Function"); // main function fitalg_function->initialize(); - auto fitalg_conv = - boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>( - fitalg_function); // cast to Convolution + auto fitalg_conv = boost::dynamic_pointer_cast<Convolution>( + fitalg_function); // cast to Convolution fitalg_function = fitalg_conv->getFunction(1); // DiffSphere auto fitalg_structure_factor = - boost::dynamic_pointer_cast<Mantid::CurveFitting::DiffSphere>( - fitalg_function); + boost::dynamic_pointer_cast<DiffSphere>(fitalg_function); fitalg_function = fitalg_structure_factor->getFunction(0); auto fitalg_elastic = - boost::dynamic_pointer_cast<Mantid::CurveFitting::ElasticDiffSphere>( - fitalg_function); + boost::dynamic_pointer_cast<ElasticDiffSphere>(fitalg_function); TS_ASSERT_DELTA(fitalg_elastic->getParameter("Height"), I_0, std::numeric_limits<double>::epsilon()); TS_ASSERT_DELTA(fitalg_elastic->getParameter("Radius"), R_0, @@ -230,8 +228,7 @@ public: fitalg_function = fitalg_structure_factor->getFunction(1); auto fitalg_inelastic = - boost::dynamic_pointer_cast<Mantid::CurveFitting::InelasticDiffSphere>( - fitalg_function); + boost::dynamic_pointer_cast<InelasticDiffSphere>(fitalg_function); TS_ASSERT_DELTA(fitalg_inelastic->getParameter("Intensity"), I_0, std::numeric_limits<double>::epsilon()); TS_ASSERT_DELTA(fitalg_inelastic->getParameter("Radius"), R_0, @@ -332,7 +329,7 @@ private: simQ = 0.20092; // Initialize the fit function in the Fit algorithm - Mantid::CurveFitting::Fit fitalg; + Algorithms::Fit fitalg; TS_ASSERT_THROWS_NOTHING(fitalg.initialize()); TS_ASSERT(fitalg.isInitialized()); std::ostringstream funtion_stream; @@ -399,8 +396,7 @@ private: Mantid::API::IFunction_sptr fitalg_function = fitalg.getProperty("Function"); auto fitalg_conv = - boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>( - fitalg_function); + boost::dynamic_pointer_cast<Convolution>(fitalg_function); Mantid::API::IFunction_sptr fitalg_resolution = fitalg_conv->getFunction(0); TS_ASSERT_DELTA(fitalg_resolution->getParameter("PeakCentre"), S, @@ -458,7 +454,7 @@ private: // create a data workspace using a Fit algorithm Mantid::DataObjects::Workspace2D_sptr - generateWorkspaceFromFitAlgorithm(Mantid::CurveFitting::Fit &fitalg) { + generateWorkspaceFromFitAlgorithm(Algorithms::Fit &fitalg) { using namespace Mantid::Kernel; using namespace Mantid::Geometry; diff --git a/Framework/CurveFitting/test/DynamicKuboToyabeTest.h b/Framework/CurveFitting/test/Functions/DynamicKuboToyabeTest.h similarity index 95% rename from Framework/CurveFitting/test/DynamicKuboToyabeTest.h rename to Framework/CurveFitting/test/Functions/DynamicKuboToyabeTest.h index cb987b5fc70802662484bb4c949f927c2b696a77..dd533ab427dc806cd9709c3986360e37ded82496 100644 --- a/Framework/CurveFitting/test/DynamicKuboToyabeTest.h +++ b/Framework/CurveFitting/test/Functions/DynamicKuboToyabeTest.h @@ -3,14 +3,15 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/DynamicKuboToyabe.h" -#include "MantidCurveFitting/StaticKuboToyabe.h" +#include "MantidCurveFitting/Functions/DynamicKuboToyabe.h" +#include "MantidCurveFitting/Functions/StaticKuboToyabe.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; class DynamicKuboToyabeTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/EndErfcTest.h b/Framework/CurveFitting/test/Functions/EndErfcTest.h similarity index 92% rename from Framework/CurveFitting/test/EndErfcTest.h rename to Framework/CurveFitting/test/Functions/EndErfcTest.h index 8e2ba2f3485752e855f833486be3d5dc079979b5..dc03dd49687bc3504fa6fede22461e39bd487145 100644 --- a/Framework/CurveFitting/test/EndErfcTest.h +++ b/Framework/CurveFitting/test/Functions/EndErfcTest.h @@ -3,11 +3,8 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/EndErfc.h" -#include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/EndErfc.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Workspace2D.h" @@ -16,6 +13,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; class EndErfcTest : public CxxTest::TestSuite { @@ -41,7 +40,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/ExpDecayMuonTest.h b/Framework/CurveFitting/test/Functions/ExpDecayMuonTest.h similarity index 89% rename from Framework/CurveFitting/test/ExpDecayMuonTest.h rename to Framework/CurveFitting/test/Functions/ExpDecayMuonTest.h index bf17e5d9a7728820700c5cccac72a17cf1b66225..02a079776da1b8fc1632ca1ddc4e09cd632bcaff 100644 --- a/Framework/CurveFitting/test/ExpDecayMuonTest.h +++ b/Framework/CurveFitting/test/Functions/ExpDecayMuonTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ExpDecayMuon.h" +#include "MantidCurveFitting/Functions/ExpDecayMuon.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Workspace2D.h" @@ -16,6 +16,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::DataObjects; class ExpDecayMuonTest : public CxxTest::TestSuite { @@ -48,7 +50,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/ExpDecayOscTest.h b/Framework/CurveFitting/test/Functions/ExpDecayOscTest.h similarity index 90% rename from Framework/CurveFitting/test/ExpDecayOscTest.h rename to Framework/CurveFitting/test/Functions/ExpDecayOscTest.h index 865c28d2c1c9811aae3c25d04b01e35ed13e8975..9c91b5e7dccd6734f9deb754062e9da48fcc81a9 100644 --- a/Framework/CurveFitting/test/ExpDecayOscTest.h +++ b/Framework/CurveFitting/test/Functions/ExpDecayOscTest.h @@ -4,9 +4,9 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "MantidCurveFitting/ExpDecayOsc.h" -#include "MantidCurveFitting/Fit.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Functions/ExpDecayOsc.h" +#include "MantidCurveFitting/Algorithms/Fit.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Workspace2D.h" @@ -14,6 +14,9 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Constraints; using namespace Mantid::DataObjects; class ExpDecayOscTest : public CxxTest::TestSuite { @@ -48,7 +51,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/ExpDecayTest.h b/Framework/CurveFitting/test/Functions/ExpDecayTest.h similarity index 90% rename from Framework/CurveFitting/test/ExpDecayTest.h rename to Framework/CurveFitting/test/Functions/ExpDecayTest.h index fbfa2c5a556b69117e0bf3163c16e4b3285a5738..149edd05e1a5ba33f31244e8764be4b53a4c5692 100644 --- a/Framework/CurveFitting/test/ExpDecayTest.h +++ b/Framework/CurveFitting/test/Functions/ExpDecayTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ExpDecay.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -19,6 +19,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::DataObjects; class ExpDecayTest : public CxxTest::TestSuite { @@ -51,7 +53,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/FlatBackgroundTest.h b/Framework/CurveFitting/test/Functions/FlatBackgroundTest.h similarity index 92% rename from Framework/CurveFitting/test/FlatBackgroundTest.h rename to Framework/CurveFitting/test/Functions/FlatBackgroundTest.h index a93d1a379247bb7222bb0af32ee6889c581f9ad7..821dfed7a8478416ac589cca32e44d24e2e87dba 100644 --- a/Framework/CurveFitting/test/FlatBackgroundTest.h +++ b/Framework/CurveFitting/test/Functions/FlatBackgroundTest.h @@ -4,13 +4,12 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> -#include "MantidCurveFitting/FlatBackground.h" +#include "MantidCurveFitting/Functions/FlatBackground.h" using namespace Mantid; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class FlatBackgroundTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/FullprofPolynomialTest.h b/Framework/CurveFitting/test/Functions/FullprofPolynomialTest.h similarity index 92% rename from Framework/CurveFitting/test/FullprofPolynomialTest.h rename to Framework/CurveFitting/test/Functions/FullprofPolynomialTest.h index 2ecf9c6d841e358fb2ebab5aaf284bcc245302e2..42b9226a157d35194382d641ca202f57561deb76 100644 --- a/Framework/CurveFitting/test/FullprofPolynomialTest.h +++ b/Framework/CurveFitting/test/Functions/FullprofPolynomialTest.h @@ -3,17 +3,19 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/FullprofPolynomial.h" +#include "MantidCurveFitting/Functions/FullprofPolynomial.h" #include "MantidAPI/IFunction.h" #include "MantidAPI/WorkspaceFactory.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" -using Mantid::CurveFitting::FullprofPolynomial; +using Mantid::CurveFitting::Functions::FullprofPolynomial; using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Algorithms; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::DataObjects; using namespace Mantid::Kernel; @@ -87,7 +89,7 @@ public: tofbkgd->setParameter("A3", 0.0); // Set up fit - CurveFitting::Fit fitalg; + CurveFitting::Algorithms::Fit fitalg; TS_ASSERT_THROWS_NOTHING(fitalg.initialize()); TS_ASSERT(fitalg.isInitialized()); diff --git a/Framework/CurveFitting/test/GausDecayTest.h b/Framework/CurveFitting/test/Functions/GausDecayTest.h similarity index 90% rename from Framework/CurveFitting/test/GausDecayTest.h rename to Framework/CurveFitting/test/Functions/GausDecayTest.h index d3a087a5a047ce48be4856fa3eb57ce798df056f..3771d22c694d4c4438d2c3681fb7435e5dc634ac 100644 --- a/Framework/CurveFitting/test/GausDecayTest.h +++ b/Framework/CurveFitting/test/Functions/GausDecayTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/GausDecay.h" +#include "MantidCurveFitting/Functions/GausDecay.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -21,6 +21,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; using namespace Mantid::DataHandling; @@ -52,7 +54,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/GausOscTest.h b/Framework/CurveFitting/test/Functions/GausOscTest.h similarity index 91% rename from Framework/CurveFitting/test/GausOscTest.h rename to Framework/CurveFitting/test/Functions/GausOscTest.h index 434cf9ba475c4eb988b4c6239aeedc90c829b9b3..0e31dc9c702bb0f9a5499f3a7ffcceaf22dd8d86 100644 --- a/Framework/CurveFitting/test/GausOscTest.h +++ b/Framework/CurveFitting/test/Functions/GausOscTest.h @@ -4,11 +4,11 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "MantidCurveFitting/GausOsc.h" +#include "MantidCurveFitting/Functions/GausOsc.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -22,6 +22,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; using namespace Mantid::DataHandling; @@ -57,7 +59,7 @@ public: void testAgainstMockData() // Parts of test disabled because it does not give // result like that obtained in mantidplot. { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/GaussianComptonProfileTest.h b/Framework/CurveFitting/test/Functions/GaussianComptonProfileTest.h similarity index 94% rename from Framework/CurveFitting/test/GaussianComptonProfileTest.h rename to Framework/CurveFitting/test/Functions/GaussianComptonProfileTest.h index 546dd4a9de2cb7c9d032fbff41062962064a02c6..dfec3f0af151f71660962a523f453ec815eb1a96 100644 --- a/Framework/CurveFitting/test/GaussianComptonProfileTest.h +++ b/Framework/CurveFitting/test/Functions/GaussianComptonProfileTest.h @@ -2,12 +2,13 @@ #define MANTID_CURVEFITTING_GAUSSIANCOMPTONPROFILETEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/GaussianComptonProfile.h" +#include "MantidCurveFitting/Functions/GaussianComptonProfile.h" #include "MantidAPI/FunctionDomain1D.h" #include "ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::GaussianComptonProfile; +using Mantid::CurveFitting::Functions::GaussianComptonProfile; +using Mantid::CurveFitting::Functions::ComptonProfile; class GaussianComptonProfileTest : public CxxTest::TestSuite { public: @@ -40,8 +41,7 @@ public: } void test_Function_Has_One_Intensity_Coefficient() { - boost::shared_ptr<Mantid::CurveFitting::ComptonProfile> profile = - createFunction(); + boost::shared_ptr<ComptonProfile> profile = createFunction(); auto intensityIndices = profile->intensityParameterIndices(); TS_ASSERT_EQUALS(1, intensityIndices.size()); diff --git a/Framework/CurveFitting/test/GaussianTest.h b/Framework/CurveFitting/test/Functions/GaussianTest.h similarity index 95% rename from Framework/CurveFitting/test/GaussianTest.h rename to Framework/CurveFitting/test/Functions/GaussianTest.h index 91492c50f5ab2aa2bd0da295408e010fec8d0561..079292914546c5b19922438bcc98aab4ab79b476 100644 --- a/Framework/CurveFitting/test/GaussianTest.h +++ b/Framework/CurveFitting/test/Functions/GaussianTest.h @@ -3,11 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/InstrumentDataService.h" @@ -23,14 +22,19 @@ #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" -#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h" -#include "MantidCurveFitting/UserFunction.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h" +#include "MantidCurveFitting/Functions/UserFunction.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" using namespace Mantid; using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::CostFunctions; +using namespace Mantid::CurveFitting::Constraints; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; using namespace Mantid::DataHandling; @@ -201,7 +205,7 @@ public: costFun->setFittingFunction(fnWithBk, domain, values); // TS_ASSERT_EQUALS(costFun->nParams(),3); - LevenbergMarquardtMDMinimizer s; + FuncMinimisers::LevenbergMarquardtMDMinimizer s; s.initialize(costFun); TS_ASSERT(s.minimize()); @@ -236,7 +240,7 @@ public: TS_ASSERT_THROWS_NOTHING(AnalysisDataService::Instance().add(wsName, ws2D)); // Initialise algorithm - Fit alg; + Algorithms::Fit alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT(alg.isInitialized()); @@ -305,7 +309,7 @@ public: Mantid::MantidVec &e = ws2D->dataE(0); // error values of counts getMockData(y, e); - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); @@ -358,7 +362,7 @@ public: // put this workspace in the data service TS_ASSERT_THROWS_NOTHING(AnalysisDataService::Instance().add(wsName, ws2D)); - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); @@ -424,7 +428,7 @@ public: ConfigService::Instance().getString("curvefitting.peakRadius"); ConfigService::Instance().setString("curvefitting.peakRadius", "5"); - Fit alg; + Algorithms::Fit alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT(alg.isInitialized()); diff --git a/Framework/CurveFitting/test/GramCharlierComptonProfileTest.h b/Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h similarity index 94% rename from Framework/CurveFitting/test/GramCharlierComptonProfileTest.h rename to Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h index 8220bfd74ed2e60ec30d4ada2ee6b3282141622a..905278a19172c6d03ee6b237f972058c2da5d16a 100644 --- a/Framework/CurveFitting/test/GramCharlierComptonProfileTest.h +++ b/Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h @@ -2,11 +2,12 @@ #define MANTID_CURVEFITTING_GRAMCHARLIERCOMPTONPROFILETEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/GramCharlierComptonProfile.h" +#include "MantidCurveFitting/Functions/GramCharlierComptonProfile.h" #include "ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::GramCharlierComptonProfile; +using Mantid::CurveFitting::Functions::ComptonProfile; +using Mantid::CurveFitting::Functions::GramCharlierComptonProfile; class GramCharlierComptonProfileTest : public CxxTest::TestSuite { public: @@ -58,8 +59,7 @@ public: void test_Function_Returns_Same_Number_Intensity_Coefficents_As_Active_Hermite_Coefficients_If_KFSE_Is_Fixed() { - boost::shared_ptr<Mantid::CurveFitting::ComptonProfile> profile = - createFunction(); + boost::shared_ptr<ComptonProfile> profile = createFunction(); profile->setAttributeValue("HermiteCoeffs", "1 0 1"); // turn on C_0 & C_4 profile->fix(profile->parameterIndex("FSECoeff")); @@ -69,8 +69,7 @@ public: void test_Function_Returns_Same_Number_Intensity_Coefficents_As_Active_Hermite_Coefficients_Plus_One_If_KFSE_Is_Free() { - boost::shared_ptr<Mantid::CurveFitting::ComptonProfile> profile = - createFunction(); + boost::shared_ptr<ComptonProfile> profile = createFunction(); profile->setAttributeValue("HermiteCoeffs", "1 0 1"); // turn on C_0 & C_4 auto intensityIndices = profile->intensityParameterIndices(); diff --git a/Framework/CurveFitting/test/IkedaCarpenterPVTest.h b/Framework/CurveFitting/test/Functions/IkedaCarpenterPVTest.h similarity index 96% rename from Framework/CurveFitting/test/IkedaCarpenterPVTest.h rename to Framework/CurveFitting/test/Functions/IkedaCarpenterPVTest.h index 53cc7b2f7d9a362e1915efffd4cfeb308c8be2b9..df2182987c94074e520b9ee41fedffc68bff08f7 100644 --- a/Framework/CurveFitting/test/IkedaCarpenterPVTest.h +++ b/Framework/CurveFitting/test/Functions/IkedaCarpenterPVTest.h @@ -3,8 +3,8 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/IkedaCarpenterPV.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/IkedaCarpenterPV.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/ConfigService.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -102,6 +102,7 @@ public: void testAgainstMockData() { using namespace Mantid::API; using namespace Mantid::CurveFitting; + using namespace Mantid::CurveFitting::Functions; /** * Changing compiler on OS X has yet again caused this (and only this) test to @@ -172,6 +173,7 @@ public: void test_Against_Data_In_DeltaE() { using namespace Mantid::API; using namespace Mantid::CurveFitting; + using namespace Mantid::CurveFitting::Functions; #if !(defined __APPLE__) @@ -253,6 +255,7 @@ private: Mantid::API::IAlgorithm_sptr runFit(const std::string &wsName) { using namespace Mantid::API; using namespace Mantid::CurveFitting; + using namespace Mantid::CurveFitting::Functions; // set up fitting function and pass to Fit IkedaCarpenterPV icpv; @@ -265,7 +268,7 @@ private: icpv.tie("Kappa", "46.025921"); icpv.setParameter("X0", 45.0); - auto alg = boost::shared_ptr<IAlgorithm>(new Fit); + auto alg = boost::shared_ptr<IAlgorithm>(new Algorithms::Fit); alg->initialize(); alg->setPropertyValue("Function", icpv.asString()); // Set general Fit parameters diff --git a/Framework/CurveFitting/test/LinearBackgroundTest.h b/Framework/CurveFitting/test/Functions/LinearBackgroundTest.h similarity index 92% rename from Framework/CurveFitting/test/LinearBackgroundTest.h rename to Framework/CurveFitting/test/Functions/LinearBackgroundTest.h index f281f018e0533813b77359d129e0e5b63497cba0..03f2d8341c2adbb05608afa567f854141bc8298d 100644 --- a/Framework/CurveFitting/test/LinearBackgroundTest.h +++ b/Framework/CurveFitting/test/Functions/LinearBackgroundTest.h @@ -3,9 +3,9 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/LinearBackground.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -17,8 +17,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; -using Mantid::CurveFitting::LinearBackground; -using Mantid::CurveFitting::Fit; +using Mantid::CurveFitting::Functions::LinearBackground; +using Mantid::CurveFitting::Algorithms::Fit; using namespace Mantid::DataObjects; using namespace Mantid::DataHandling; diff --git a/Framework/CurveFitting/test/LogNormalTest.h b/Framework/CurveFitting/test/Functions/LogNormalTest.h similarity index 92% rename from Framework/CurveFitting/test/LogNormalTest.h rename to Framework/CurveFitting/test/Functions/LogNormalTest.h index b6ca2231c59266dcc8b9538d6c5b43c1a7c7ca69..d4391f687f2020a2aab3d304feae0ad7e181ec74 100644 --- a/Framework/CurveFitting/test/LogNormalTest.h +++ b/Framework/CurveFitting/test/Functions/LogNormalTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/LogNormal.h" +#include "MantidCurveFitting/Functions/LogNormal.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -19,6 +19,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; class LogNormalTest : public CxxTest::TestSuite { @@ -54,7 +56,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/Lorentzian1DTest.h b/Framework/CurveFitting/test/Functions/Lorentzian1DTest.h similarity index 96% rename from Framework/CurveFitting/test/Lorentzian1DTest.h rename to Framework/CurveFitting/test/Functions/Lorentzian1DTest.h index 10d4d940f1751a5491e9528d421f16d347c75714..d56d87abe45f2cf3e6dd7bb6b2719c5e6b4f8a67 100644 --- a/Framework/CurveFitting/test/Lorentzian1DTest.h +++ b/Framework/CurveFitting/test/Functions/Lorentzian1DTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Lorentzian1D.h" +#include "MantidCurveFitting/Functions/Lorentzian1D.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -12,7 +12,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; -using Mantid::CurveFitting::Lorentzian1D; +using Mantid::CurveFitting::Functions::Lorentzian1D; using namespace Mantid::DataObjects; class Lorentzian1DTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/LorentzianTest.h b/Framework/CurveFitting/test/Functions/LorentzianTest.h similarity index 87% rename from Framework/CurveFitting/test/LorentzianTest.h rename to Framework/CurveFitting/test/Functions/LorentzianTest.h index f4fa3ef83c727c495bf6ba4650de053a2a6859c3..50f9bc895d555bd215ed6dd191b9d617e2718612 100644 --- a/Framework/CurveFitting/test/LorentzianTest.h +++ b/Framework/CurveFitting/test/Functions/LorentzianTest.h @@ -3,12 +3,13 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Lorentzian.h" +#include "MantidCurveFitting/Functions/Lorentzian.h" #include "MantidCurveFitting/Jacobian.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" #include <boost/make_shared.hpp> +using Mantid::CurveFitting::Functions::Lorentzian; class LorentzianTest : public CxxTest::TestSuite { public: @@ -41,7 +42,7 @@ public: } void test_categories() { - Mantid::CurveFitting::Lorentzian forCat; + Lorentzian forCat; const std::vector<std::string> categories = forCat.categories(); TS_ASSERT(categories.size() == 1); TS_ASSERT(categories[0] == "Peak"); @@ -49,7 +50,7 @@ public: void test_FWHM() { double hwhm = 0.5; - Mantid::CurveFitting::Lorentzian lor; + Lorentzian lor; lor.initialize(); lor.setParameter("Amplitude", 1.0); lor.setParameter("PeakCentre", 0.0); @@ -63,7 +64,7 @@ public: } void test_height() { - Mantid::CurveFitting::Lorentzian lor; + Lorentzian lor; lor.initialize(); lor.setHeight(2.0); lor.setCentre(3.0); @@ -78,7 +79,7 @@ public: } void test_height_zero_width() { - Mantid::CurveFitting::Lorentzian lor; + Lorentzian lor; lor.initialize(); lor.setHeight(2.0); lor.setCentre(3.0); @@ -96,7 +97,7 @@ public: } void testIntensity() { - Mantid::CurveFitting::Lorentzian lor; + Lorentzian lor; lor.initialize(); lor.setHeight(2.0); lor.setCentre(3.0); @@ -110,15 +111,15 @@ public: } private: - class TestableLorentzian : public Mantid::CurveFitting::Lorentzian { + class TestableLorentzian : public Lorentzian { public: void functionLocal(double *out, const double *xValues, const size_t nData) const { - Mantid::CurveFitting::Lorentzian::functionLocal(out, xValues, nData); + Lorentzian::functionLocal(out, xValues, nData); } void functionDerivLocal(Mantid::API::Jacobian *out, const double *xValues, const size_t nData) { - Mantid::CurveFitting::Lorentzian::functionDerivLocal(out, xValues, nData); + Lorentzian::functionDerivLocal(out, xValues, nData); } }; diff --git a/Framework/CurveFitting/test/MuonFInteractionTest.h b/Framework/CurveFitting/test/Functions/MuonFInteractionTest.h similarity index 93% rename from Framework/CurveFitting/test/MuonFInteractionTest.h rename to Framework/CurveFitting/test/Functions/MuonFInteractionTest.h index b9b5b3b7d968869e05b05e394344826c27ed76c4..a03d49a13135f5697a6f46e2ca9d2a8a2c067e89 100644 --- a/Framework/CurveFitting/test/MuonFInteractionTest.h +++ b/Framework/CurveFitting/test/Functions/MuonFInteractionTest.h @@ -3,11 +3,8 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/MuonFInteraction.h" -#include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/MuonFInteraction.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -19,6 +16,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; class MuonFInteractionTest : public CxxTest::TestSuite { @@ -54,7 +53,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/NeutronBk2BkExpConvPVoigtTest.h b/Framework/CurveFitting/test/Functions/NeutronBk2BkExpConvPVoigtTest.h similarity index 99% rename from Framework/CurveFitting/test/NeutronBk2BkExpConvPVoigtTest.h rename to Framework/CurveFitting/test/Functions/NeutronBk2BkExpConvPVoigtTest.h index 946ebe697dc0713f9887fa454ad16d3ad3f90294..ad44379ead2f7307b6fff1d56f2bda5df4561ac5 100644 --- a/Framework/CurveFitting/test/NeutronBk2BkExpConvPVoigtTest.h +++ b/Framework/CurveFitting/test/Functions/NeutronBk2BkExpConvPVoigtTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h" +#include "MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h" using namespace std; -using Mantid::CurveFitting::NeutronBk2BkExpConvPVoigt; +using Mantid::CurveFitting::Functions::NeutronBk2BkExpConvPVoigt; class NeutronBk2BkExpConvPVoigtTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/PawleyFunctionTest.h b/Framework/CurveFitting/test/Functions/PawleyFunctionTest.h similarity index 99% rename from Framework/CurveFitting/test/PawleyFunctionTest.h rename to Framework/CurveFitting/test/Functions/PawleyFunctionTest.h index 141f4d008e4764a8fdbb892a25f23da0b1f51422..f746d52c86d2c82aa215978eafe8cb2ea0257b04 100644 --- a/Framework/CurveFitting/test/PawleyFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/PawleyFunctionTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/PawleyFunction.h" +#include "MantidCurveFitting/Functions/PawleyFunction.h" #include "MantidGeometry/Crystal/PointGroup.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/FunctionFactory.h" @@ -11,6 +11,7 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid::Kernel; diff --git a/Framework/CurveFitting/test/PeakParameterFunctionTest.h b/Framework/CurveFitting/test/Functions/PeakParameterFunctionTest.h similarity index 97% rename from Framework/CurveFitting/test/PeakParameterFunctionTest.h rename to Framework/CurveFitting/test/Functions/PeakParameterFunctionTest.h index 4f5bb3317308e6f871d5c0f994b693b99be1c5d3..80cf00d80492ae098d07649a3cf5b8c882d8aca7 100644 --- a/Framework/CurveFitting/test/PeakParameterFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/PeakParameterFunctionTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/PeakParameterFunction.h" +#include "MantidCurveFitting/Functions/PeakParameterFunction.h" #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionFactory.h" @@ -13,6 +13,7 @@ #include "MantidCurveFitting/Jacobian.h" using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class PeakParameterFunctionTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/PolynomialTest.h b/Framework/CurveFitting/test/Functions/PolynomialTest.h similarity index 92% rename from Framework/CurveFitting/test/PolynomialTest.h rename to Framework/CurveFitting/test/Functions/PolynomialTest.h index c33a5e183567d675eb3ad72a41be6b0052334813..13d0461f676997d8bc7ccc44f69831644154cb02 100644 --- a/Framework/CurveFitting/test/PolynomialTest.h +++ b/Framework/CurveFitting/test/Functions/PolynomialTest.h @@ -3,15 +3,16 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Polynomial.h" +#include "MantidCurveFitting/Functions/Polynomial.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidAPI/WorkspaceFactory.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" -using Mantid::CurveFitting::Polynomial; +using Mantid::CurveFitting::Functions::Polynomial; using namespace Mantid; using namespace API; using namespace Kernel; +using namespace Mantid::CurveFitting::Algorithms; class PolynomialTest : public CxxTest::TestSuite { public: @@ -45,7 +46,7 @@ public: // put this workspace in the data service TS_ASSERT_THROWS_NOTHING(AnalysisDataService::Instance().add(wsName, ws2D)); - CurveFitting::Fit alg2; + CurveFitting::Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/ProcessBackgroundTest.h b/Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h similarity index 99% rename from Framework/CurveFitting/test/ProcessBackgroundTest.h rename to Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h index 393ef4b2ceb904fc8a169e8317b46abcf277693b..9ad20b34455b34d2f8d1d236501ce8af4c42ae4d 100644 --- a/Framework/CurveFitting/test/ProcessBackgroundTest.h +++ b/Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ProcessBackground.h" +#include "MantidCurveFitting/Functions/ProcessBackground.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidAPI/WorkspaceFactory.h" @@ -11,7 +11,7 @@ #include <fstream> -using Mantid::CurveFitting::ProcessBackground; +using Mantid::CurveFitting::Functions::ProcessBackground; using namespace Mantid; using namespace Mantid::API; using namespace Kernel; diff --git a/Framework/CurveFitting/test/ProductFunctionTest.h b/Framework/CurveFitting/test/Functions/ProductFunctionTest.h similarity index 94% rename from Framework/CurveFitting/test/ProductFunctionTest.h rename to Framework/CurveFitting/test/Functions/ProductFunctionTest.h index 48cb11dc1fea7b8bde2140d39d630e177960b956..a34711c1d98af800f1f0c991ade79c0a39b44026 100644 --- a/Framework/CurveFitting/test/ProductFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/ProductFunctionTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ProductFunction.h" -#include "MantidCurveFitting/Fit.h" -#include "MantidCurveFitting/Gaussian.h" +#include "MantidCurveFitting/Functions/ProductFunction.h" +#include "MantidCurveFitting/Functions/Gaussian.h" #include "MantidCurveFitting/Jacobian.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" @@ -19,6 +19,9 @@ #include "MantidAPI/FunctionValues.h" typedef Mantid::DataObjects::Workspace2D_sptr WS_type; +using Mantid::CurveFitting::Functions::ProductFunction; +using Mantid::CurveFitting::Functions::Gaussian; +using Mantid::CurveFitting::Algorithms::Fit; class ProductFunctionMWTest_Gauss : public Mantid::API::IPeakFunction { public: @@ -99,7 +102,7 @@ DECLARE_FUNCTION(ProductFunctionMWTest_Linear) class ProductFunctionTest : public CxxTest::TestSuite { public: void testFunction() { - Mantid::CurveFitting::ProductFunction prodF; + ProductFunction prodF; Mantid::API::IFunction_sptr gauss1(new ProductFunctionMWTest_Gauss); gauss1->setParameter(0, 1.1); @@ -154,8 +157,7 @@ public: prodF.asString()); TS_ASSERT(fun); - Mantid::CurveFitting::ProductFunction *prodF1 = - dynamic_cast<Mantid::CurveFitting::ProductFunction *>(fun.get()); + ProductFunction *prodF1 = dynamic_cast<ProductFunction *>(fun.get()); TS_ASSERT(prodF1); TS_ASSERT_EQUALS(prodF1->nFunctions(), 4); @@ -182,12 +184,12 @@ public: } void testProductFunction() { - Mantid::CurveFitting::ProductFunction prodF; + ProductFunction prodF; double c1 = 1.0; double h1 = 3.0; double s1 = 0.5; - Mantid::API::IFunction_sptr f0(new Mantid::CurveFitting::Gaussian); + Mantid::API::IFunction_sptr f0(new Gaussian); f0->initialize(); f0->setParameter("PeakCentre", c1); f0->setParameter("Height", h1); @@ -208,7 +210,7 @@ public: double c2 = 2; double h2 = 10.0; double s2 = 0.5; - Mantid::API::IFunction_sptr f1(new Mantid::CurveFitting::Gaussian); + Mantid::API::IFunction_sptr f1(new Gaussian); f1->initialize(); f1->setParameter("PeakCentre", c2); f1->setParameter("Height", h2); @@ -249,7 +251,7 @@ public: Mantid::API::AnalysisDataService::Instance().add(wsName, ws); - Mantid::CurveFitting::Fit fit; + Mantid::CurveFitting::Algorithms::Fit fit; fit.initialize(); f0->tie("PeakCentre", "1.0"); @@ -284,14 +286,14 @@ public: } void testForCategories() { - Mantid::CurveFitting::ProductFunction forCat; + ProductFunction forCat; const std::vector<std::string> categories = forCat.categories(); TS_ASSERT(categories.size() == 1); TS_ASSERT(categories[0] == "General"); } void testDerivatives() { - Mantid::CurveFitting::ProductFunction prodF; + ProductFunction prodF; Mantid::API::IFunction_sptr linear1(new ProductFunctionMWTest_Linear); linear1->setParameter(0, 1.0); diff --git a/Framework/CurveFitting/test/ProductLinearExpTest.h b/Framework/CurveFitting/test/Functions/ProductLinearExpTest.h similarity index 96% rename from Framework/CurveFitting/test/ProductLinearExpTest.h rename to Framework/CurveFitting/test/Functions/ProductLinearExpTest.h index 99cb313f5f6ebbfd17f9a148b1d9250e945652fc..a198b826c7ae86af588c6f966874bde85024b175 100644 --- a/Framework/CurveFitting/test/ProductLinearExpTest.h +++ b/Framework/CurveFitting/test/Functions/ProductLinearExpTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ProductLinearExp.h" -#include "MantidCurveFitting/ExpDecay.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/ProductFunction.h" +#include "MantidCurveFitting/Functions/ProductLinearExp.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Functions/ProductFunction.h" #include "MantidCurveFitting/Jacobian.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" @@ -16,6 +16,7 @@ #include <boost/make_shared.hpp> using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class ProductLinearExpTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/ProductQuadraticExpTest.h b/Framework/CurveFitting/test/Functions/ProductQuadraticExpTest.h similarity index 96% rename from Framework/CurveFitting/test/ProductQuadraticExpTest.h rename to Framework/CurveFitting/test/Functions/ProductQuadraticExpTest.h index 51604e1a486f1b734ac181257475df8c162fdb91..c6c4385de3e644ddc19eb57c44e70fa1ed07c65a 100644 --- a/Framework/CurveFitting/test/ProductQuadraticExpTest.h +++ b/Framework/CurveFitting/test/Functions/ProductQuadraticExpTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ProductQuadraticExp.h" -#include "MantidCurveFitting/ExpDecay.h" -#include "MantidCurveFitting/Quadratic.h" -#include "MantidCurveFitting/ProductFunction.h" +#include "MantidCurveFitting/Functions/ProductQuadraticExp.h" +#include "MantidCurveFitting/Functions/ExpDecay.h" +#include "MantidCurveFitting/Functions/Quadratic.h" +#include "MantidCurveFitting/Functions/ProductFunction.h" #include "MantidCurveFitting/Jacobian.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" @@ -16,6 +16,7 @@ #include <boost/make_shared.hpp> using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class ProductQuadraticExpTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/PseudoVoigtTest.h b/Framework/CurveFitting/test/Functions/PseudoVoigtTest.h similarity index 98% rename from Framework/CurveFitting/test/PseudoVoigtTest.h rename to Framework/CurveFitting/test/Functions/PseudoVoigtTest.h index 53a4d256f16cf76d0714a5b84ee8f5d9f0c548ef..fd94bc3955f8d97674c3d4a57dc417ba80c34dab 100644 --- a/Framework/CurveFitting/test/PseudoVoigtTest.h +++ b/Framework/CurveFitting/test/Functions/PseudoVoigtTest.h @@ -3,13 +3,13 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/PseudoVoigt.h" +#include "MantidCurveFitting/Functions/PseudoVoigt.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidCurveFitting/Jacobian.h" #include <boost/make_shared.hpp> -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/Lorentzian.h" +#include "MantidCurveFitting/Functions/Gaussian.h" +#include "MantidCurveFitting/Functions/Lorentzian.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -17,6 +17,7 @@ #include "MantidKernel/MersenneTwister.h" using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; using namespace Mantid::DataObjects; diff --git a/Framework/CurveFitting/test/QuadraticTest.h b/Framework/CurveFitting/test/Functions/QuadraticTest.h similarity index 92% rename from Framework/CurveFitting/test/QuadraticTest.h rename to Framework/CurveFitting/test/Functions/QuadraticTest.h index 110a2f079bbd45b51546c5fddc2e384197dc4ce8..293b34a479a774bb824a08c6e21c509b25d17a39 100644 --- a/Framework/CurveFitting/test/QuadraticTest.h +++ b/Framework/CurveFitting/test/Functions/QuadraticTest.h @@ -3,9 +3,9 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Quadratic.h" +#include "MantidCurveFitting/Functions/Quadratic.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -17,8 +17,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; -using Mantid::CurveFitting::Quadratic; -using Mantid::CurveFitting::Fit; +using Mantid::CurveFitting::Functions::Quadratic; +using Mantid::CurveFitting::Algorithms::Fit; using namespace Mantid::DataObjects; using namespace Mantid::DataHandling; diff --git a/Framework/CurveFitting/test/ReflectivityMulfTest.h b/Framework/CurveFitting/test/Functions/ReflectivityMulfTest.h similarity index 96% rename from Framework/CurveFitting/test/ReflectivityMulfTest.h rename to Framework/CurveFitting/test/Functions/ReflectivityMulfTest.h index 7c045ddccc3a764e0a3126bfa990e485fb6cee90..b32cfb9c05f1a3aa4c7e65b45a632af23e3b5853 100644 --- a/Framework/CurveFitting/test/ReflectivityMulfTest.h +++ b/Framework/CurveFitting/test/Functions/ReflectivityMulfTest.h @@ -3,13 +3,14 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ReflectivityMulf.h" +#include "MantidCurveFitting/Functions/ReflectivityMulf.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; class ReflectivityMulfTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/ResolutionTest.h b/Framework/CurveFitting/test/Functions/ResolutionTest.h similarity index 96% rename from Framework/CurveFitting/test/ResolutionTest.h rename to Framework/CurveFitting/test/Functions/ResolutionTest.h index 5dfdd646bdea04ae81665ad2bee4fabb533325a4..7ac7e7a642c912f6a0cd301f390f0908b776dedb 100644 --- a/Framework/CurveFitting/test/ResolutionTest.h +++ b/Framework/CurveFitting/test/Functions/ResolutionTest.h @@ -3,9 +3,9 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Resolution.h" -#include "MantidCurveFitting/Fit.h" -#include "MantidCurveFitting/Convolution.h" +#include "MantidCurveFitting/Functions/Resolution.h" +#include "MantidCurveFitting/Algorithms/Fit.h" +#include "MantidCurveFitting/Functions/Convolution.h" #include "MantidAPI/IPeakFunction.h" #include "MantidAPI/FunctionFactory.h" #include <Poco/File.h> @@ -13,6 +13,7 @@ #include <fstream> using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class ResolutionTest_Gauss : public IPeakFunction { @@ -169,7 +170,7 @@ public: conv.addFunction(res); conv.addFunction(gauss); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setPropertyValue("Function", conv.asString()); fit.setPropertyValue("InputWorkspace", "ResolutionTest_WS"); diff --git a/Framework/CurveFitting/test/SimpleChebfunTest.h b/Framework/CurveFitting/test/Functions/SimpleChebfunTest.h similarity index 98% rename from Framework/CurveFitting/test/SimpleChebfunTest.h rename to Framework/CurveFitting/test/Functions/SimpleChebfunTest.h index 7d13981bb5581d93df5691dcdcf992a64f561550..c512c001280461964ebd0b5a38694aae74a7d6e9 100644 --- a/Framework/CurveFitting/test/SimpleChebfunTest.h +++ b/Framework/CurveFitting/test/Functions/SimpleChebfunTest.h @@ -3,12 +3,13 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/SimpleChebfun.h" +#include "MantidCurveFitting/Functions/SimpleChebfun.h" #include <cmath> using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; namespace { double Sin(double x) { return sin(x); } diff --git a/Framework/CurveFitting/test/StaticKuboToyabeTest.h b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTest.h similarity index 91% rename from Framework/CurveFitting/test/StaticKuboToyabeTest.h rename to Framework/CurveFitting/test/Functions/StaticKuboToyabeTest.h index 6d188da076a69e7035b6f2e9c8dd7ad74e085c03..75aabd12039f6c9253ca7a6683e7352c39939be0 100644 --- a/Framework/CurveFitting/test/StaticKuboToyabeTest.h +++ b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/StaticKuboToyabe.h" +#include "MantidCurveFitting/Functions/StaticKuboToyabe.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -19,6 +19,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::DataObjects; class StaticKuboToyabeTest : public CxxTest::TestSuite { @@ -50,7 +51,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/StaticKuboToyabeTimesExpDecayTest.h b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesExpDecayTest.h similarity index 91% rename from Framework/CurveFitting/test/StaticKuboToyabeTimesExpDecayTest.h rename to Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesExpDecayTest.h index 1546f743eefec9d8b70eae292361d17d15c34f32..41872069e5d1ce649428af575ca217ba8050f801 100644 --- a/Framework/CurveFitting/test/StaticKuboToyabeTimesExpDecayTest.h +++ b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesExpDecayTest.h @@ -3,16 +3,18 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h" +#include "MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h" #include "MantidAPI/FunctionFactory.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" -using Mantid::CurveFitting::StaticKuboToyabeTimesExpDecay; +using Mantid::CurveFitting::Functions::StaticKuboToyabeTimesExpDecay; using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; class StaticKuboToyabeTimesExpDecayTest : public CxxTest::TestSuite { @@ -69,7 +71,7 @@ public: } void test_AgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/StaticKuboToyabeTimesGausDecayTest.h b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesGausDecayTest.h similarity index 91% rename from Framework/CurveFitting/test/StaticKuboToyabeTimesGausDecayTest.h rename to Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesGausDecayTest.h index e49a1065582563e8098f0e810c661b1418d0b023..f257182091434c6f21ab1bac0b9c17afa3e90b29 100644 --- a/Framework/CurveFitting/test/StaticKuboToyabeTimesGausDecayTest.h +++ b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesGausDecayTest.h @@ -3,15 +3,17 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h" +#include "MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h" #include "MantidAPI/FunctionFactory.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidDataObjects/Workspace2D.h" -using Mantid::CurveFitting::StaticKuboToyabeTimesGausDecay; +using Mantid::CurveFitting::Functions::StaticKuboToyabeTimesGausDecay; using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; class StaticKuboToyabeTimesGausDecayTest : public CxxTest::TestSuite { @@ -68,7 +70,7 @@ public: } void test_AgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/StretchExpMuonTest.h b/Framework/CurveFitting/test/Functions/StretchExpMuonTest.h similarity index 91% rename from Framework/CurveFitting/test/StretchExpMuonTest.h rename to Framework/CurveFitting/test/Functions/StretchExpMuonTest.h index dcf022beceeabfaa68bd7539a38575e69929b90b..8bbbfb9041cd005233bdd865d79009bcdcb0f444 100644 --- a/Framework/CurveFitting/test/StretchExpMuonTest.h +++ b/Framework/CurveFitting/test/Functions/StretchExpMuonTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/StretchExpMuon.h" +#include "MantidCurveFitting/Functions/StretchExpMuon.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -19,6 +19,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; class StretchExpMuonTest : public CxxTest::TestSuite { @@ -54,7 +56,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/StretchExpTest.h b/Framework/CurveFitting/test/Functions/StretchExpTest.h similarity index 93% rename from Framework/CurveFitting/test/StretchExpTest.h rename to Framework/CurveFitting/test/Functions/StretchExpTest.h index 8ad7fbd15465389bc445b84126dcbe845ee15314..a17208356f7b9261d4ab4551706426a3fe683297 100644 --- a/Framework/CurveFitting/test/StretchExpTest.h +++ b/Framework/CurveFitting/test/Functions/StretchExpTest.h @@ -3,11 +3,11 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/StretchExp.h" +#include "MantidCurveFitting/Functions/StretchExp.h" #include "MantidAPI/CompositeFunction.h" -#include "MantidCurveFitting/LinearBackground.h" -#include "MantidCurveFitting/BoundaryConstraint.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/Functions/LinearBackground.h" +#include "MantidCurveFitting/Constraints/BoundaryConstraint.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -21,6 +21,8 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; +using namespace Mantid::CurveFitting::Algorithms; using namespace Mantid::DataObjects; class StretchExpTest_Jacobian : public Mantid::API::Jacobian { @@ -65,7 +67,7 @@ public: } void testAgainstMockData() { - Fit alg2; + Algorithms::Fit alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); TS_ASSERT(alg2.isInitialized()); diff --git a/Framework/CurveFitting/test/TabulatedFunctionTest.h b/Framework/CurveFitting/test/Functions/TabulatedFunctionTest.h similarity index 98% rename from Framework/CurveFitting/test/TabulatedFunctionTest.h rename to Framework/CurveFitting/test/Functions/TabulatedFunctionTest.h index f243adc77658f580826be8c15e34342bf1fbb2ad..1937f365c1cab0b8a9f5d3f4a557868d3c3ed357 100644 --- a/Framework/CurveFitting/test/TabulatedFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/TabulatedFunctionTest.h @@ -3,8 +3,8 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/TabulatedFunction.h" -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/Functions/TabulatedFunction.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidCurveFitting/Jacobian.h" #include "MantidAPI/FunctionDomain.h" #include "MantidAPI/AlgorithmFactory.h" @@ -19,6 +19,7 @@ #include <fstream> using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; namespace { diff --git a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpAlphaTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpAlphaTest.h similarity index 90% rename from Framework/CurveFitting/test/ThermalNeutronBk2BkExpAlphaTest.h rename to Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpAlphaTest.h index 93179e749256588a67025dc326afb4959f9e1955..5a61091389e989eee6469986bb54e6cccf5bc672 100644 --- a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpAlphaTest.h +++ b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpAlphaTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h" using namespace Mantid; -using Mantid::CurveFitting::ThermalNeutronBk2BkExpAlpha; +using Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpAlpha; class ThermalNeutronBk2BkExpAlphaTest : public CxxTest::TestSuite { public: @@ -36,7 +36,7 @@ public: vec_tof.push_back(124187); // 2. Initialize the method - Mantid::CurveFitting::ThermalNeutronBk2BkExpAlpha function; + ThermalNeutronBk2BkExpAlpha function; function.initialize(); function.setParameter("Alph0", 4.026); diff --git a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpBetaTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpBetaTest.h similarity index 90% rename from Framework/CurveFitting/test/ThermalNeutronBk2BkExpBetaTest.h rename to Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpBetaTest.h index 226e9229d10ac60170f0eb72ae3c26767133d927..978370be21897feafe65708f61d40d7e7a0b7a24 100644 --- a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpBetaTest.h +++ b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpBetaTest.h @@ -3,10 +3,10 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h" using namespace Mantid; -using Mantid::CurveFitting::ThermalNeutronBk2BkExpBeta; +using Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpBeta; class ThermalNeutronBk2BkExpBetaTest : public CxxTest::TestSuite { public: @@ -36,7 +36,7 @@ public: vec_tof.push_back(124187); // 2. Initialize the method - Mantid::CurveFitting::ThermalNeutronBk2BkExpBeta function; + ThermalNeutronBk2BkExpBeta function; function.initialize(); function.setParameter("Beta0", 3.489); diff --git a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpConvPVoigtTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpConvPVoigtTest.h similarity index 99% rename from Framework/CurveFitting/test/ThermalNeutronBk2BkExpConvPVoigtTest.h rename to Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpConvPVoigtTest.h index 4c4aaccc8a542460d3dc7441f8515ef72ef252a4..ee593a2d2fbb7f09ae2663dc081eba4d765c95b4 100644 --- a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpConvPVoigtTest.h +++ b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpConvPVoigtTest.h @@ -2,16 +2,15 @@ #define MANTID_CURVEFITTING_THERMALNEUTRONBK2BKEXPCONVPVTEST_H_ #include <cxxtest/TestSuite.h> -#include <iostream> #include <fstream> #include <cmath> -#include "MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h" using namespace Mantid; using namespace Kernel; using namespace std; -using Mantid::CurveFitting::ThermalNeutronBk2BkExpConvPVoigt; +using Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpConvPVoigt; class ThermalNeutronBk2BkExpConvPVoigtTest : public CxxTest::TestSuite { public: @@ -138,7 +137,7 @@ public: generateData(vecX, vecY, vecE); // 1. Create peak - CurveFitting::ThermalNeutronBk2BkExpConvPVoigt peak; + ThermalNeutronBk2BkExpConvPVoigt peak; peak.initialize(); peak.setMillerIndex(1, 1, 1); diff --git a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpSigmaTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpSigmaTest.h similarity index 89% rename from Framework/CurveFitting/test/ThermalNeutronBk2BkExpSigmaTest.h rename to Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpSigmaTest.h index 3e861dafcbdd461b342e18e1a692e2c113528995..cdc782f28503b2189db8142fda18c6ed8420b43e 100644 --- a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpSigmaTest.h +++ b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpSigmaTest.h @@ -3,9 +3,9 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h" +#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h" -using Mantid::CurveFitting::ThermalNeutronBk2BkExpSigma; +using Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpSigma; using namespace Mantid; class ThermalNeutronBk2BkExpSigmaTest : public CxxTest::TestSuite { @@ -36,7 +36,7 @@ public: vec_tof.push_back(124187); // 2. Initialize the method - Mantid::CurveFitting::ThermalNeutronBk2BkExpSigma function; + ThermalNeutronBk2BkExpSigma function; function.initialize(); function.setParameter("Sig2", sqrt(11.380)); diff --git a/Framework/CurveFitting/test/ThermalNeutronDtoTOFFunctionTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronDtoTOFFunctionTest.h similarity index 95% rename from Framework/CurveFitting/test/ThermalNeutronDtoTOFFunctionTest.h rename to Framework/CurveFitting/test/Functions/ThermalNeutronDtoTOFFunctionTest.h index 991cb0884f577e89b5bd47513ec117d8c12ad4a1..ef8adbfa43e6989e178c00b1fc2908887de122dc 100644 --- a/Framework/CurveFitting/test/ThermalNeutronDtoTOFFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/ThermalNeutronDtoTOFFunctionTest.h @@ -3,15 +3,14 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include <iostream> #include <math.h> #include <fstream> -#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h" +#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" -using Mantid::CurveFitting::ThermalNeutronDtoTOFFunction; +using Mantid::CurveFitting::Functions::ThermalNeutronDtoTOFFunction; using namespace Mantid; using namespace Mantid::API; @@ -45,7 +44,7 @@ public: vec_tof.push_back(124187); // 2. Initialize the method - Mantid::CurveFitting::ThermalNeutronDtoTOFFunction function; + ThermalNeutronDtoTOFFunction function; function.initialize(); function.setParameter("Dtt1", 22777.1); diff --git a/Framework/CurveFitting/test/UserFunction1DTest.h b/Framework/CurveFitting/test/Functions/UserFunction1DTest.h similarity index 96% rename from Framework/CurveFitting/test/UserFunction1DTest.h rename to Framework/CurveFitting/test/Functions/UserFunction1DTest.h index 43abd49d3c90739abf922eac37866fa98c5f0ecb..8ea1cd7792cca9458adabe1b2842ce987f6e0ac9 100644 --- a/Framework/CurveFitting/test/UserFunction1DTest.h +++ b/Framework/CurveFitting/test/Functions/UserFunction1DTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/UserFunction1D.h" +#include "MantidCurveFitting/Functions/UserFunction1D.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/FrameworkManager.h" #include "MantidDataObjects/Workspace2D.h" @@ -11,6 +11,7 @@ #include "MantidAPI/ITableWorkspace.h" using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class UserFunction1DTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/UserFunctionTest.h b/Framework/CurveFitting/test/Functions/UserFunctionTest.h similarity index 95% rename from Framework/CurveFitting/test/UserFunctionTest.h rename to Framework/CurveFitting/test/Functions/UserFunctionTest.h index 7355f7120938957f2b0057217199df9962db4214..b527257a1754fe4503333ffb399c9b3db34eafe7 100644 --- a/Framework/CurveFitting/test/UserFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/UserFunctionTest.h @@ -3,11 +3,12 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidAPI/Jacobian.h" #include "MantidAPI/FunctionDomain1D.h" using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::API; class UserFunctionTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/VesuvioResolutionTest.h b/Framework/CurveFitting/test/Functions/VesuvioResolutionTest.h similarity index 96% rename from Framework/CurveFitting/test/VesuvioResolutionTest.h rename to Framework/CurveFitting/test/Functions/VesuvioResolutionTest.h index 2e0fe33a435ea860f9d78d19a367bdbe1ecc6ade..8488b55e50588cf4734bf3b03463c4c3dd374660 100644 --- a/Framework/CurveFitting/test/VesuvioResolutionTest.h +++ b/Framework/CurveFitting/test/Functions/VesuvioResolutionTest.h @@ -2,11 +2,11 @@ #define MANTID_CURVEFITTING_VESUVIORESOLUTIONTEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/VesuvioResolution.h" +#include "MantidCurveFitting/Functions/VesuvioResolution.h" #include "ComptonProfileTestHelpers.h" -using Mantid::CurveFitting::VesuvioResolution; +using Mantid::CurveFitting::Functions::VesuvioResolution; class VesuvioResolutionTest : public CxxTest::TestSuite { public: diff --git a/Framework/CurveFitting/test/VoigtTest.h b/Framework/CurveFitting/test/Functions/VoigtTest.h similarity index 98% rename from Framework/CurveFitting/test/VoigtTest.h rename to Framework/CurveFitting/test/Functions/VoigtTest.h index 769a77f2d4b6c5e9f70cb825bbf23d2553d9add5..74c76e0aa518baa8c9d7ed76c45d70b2b04ea523 100644 --- a/Framework/CurveFitting/test/VoigtTest.h +++ b/Framework/CurveFitting/test/Functions/VoigtTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "MantidCurveFitting/Voigt.h" +#include "MantidCurveFitting/Functions/Voigt.h" #include "MantidAPI/FunctionDomain1D.h" #include "MantidAPI/FunctionValues.h" @@ -12,7 +12,7 @@ #include <boost/scoped_ptr.hpp> #include <boost/make_shared.hpp> -using Mantid::CurveFitting::Voigt; +using Mantid::CurveFitting::Functions::Voigt; using Mantid::API::IFunction; class VoigtTest : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/valgrind.h b/Framework/CurveFitting/test/Functions/valgrind.h similarity index 100% rename from Framework/CurveFitting/test/valgrind.h rename to Framework/CurveFitting/test/Functions/valgrind.h diff --git a/Framework/CurveFitting/test/MultiDomainCreatorTest.h b/Framework/CurveFitting/test/MultiDomainCreatorTest.h index 83eafed823d50e2c85f4faf697a3271c4d50aa29..1694bf0d114b7a05bd639b8defe1c3786fc4461d 100644 --- a/Framework/CurveFitting/test/MultiDomainCreatorTest.h +++ b/Framework/CurveFitting/test/MultiDomainCreatorTest.h @@ -12,7 +12,7 @@ #include "MantidAPI/ParamFunction.h" #include "MantidCurveFitting/MultiDomainCreator.h" #include "MantidCurveFitting/FitMW.h" -#include "MantidCurveFitting/UserFunction.h" +#include "MantidCurveFitting/Functions/UserFunction.h" #include "MantidKernel/PropertyManager.h" #include "MantidTestHelpers/FakeObjects.h" @@ -20,11 +20,11 @@ #include <cxxtest/TestSuite.h> #include <boost/make_shared.hpp> #include <algorithm> -#include <iostream> using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; class MultiDomainCreatorTest_Fun : public IFunction1D, public ParamFunction { public: diff --git a/Framework/CurveFitting/test/MultiDomainFunctionTest.h b/Framework/CurveFitting/test/MultiDomainFunctionTest.h index f99acf8e0d5ff8e99d07a562e4e5a0510e7fae9b..b379b210af6f1737273136468e9e6e052958e2f0 100644 --- a/Framework/CurveFitting/test/MultiDomainFunctionTest.h +++ b/Framework/CurveFitting/test/MultiDomainFunctionTest.h @@ -9,20 +9,21 @@ #include "MantidAPI/ParamFunction.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/FrameworkManager.h" -#include "MantidCurveFitting/CostFuncLeastSquares.h" -#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h" -#include "MantidCurveFitting/Fit.h" +#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" +#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h" +#include "MantidCurveFitting/Algorithms/Fit.h" #include "MantidTestHelpers/FakeObjects.h" #include <cxxtest/TestSuite.h> #include <boost/make_shared.hpp> #include <algorithm> -#include <iostream> using namespace Mantid; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::CostFunctions; +using namespace Mantid::CurveFitting::Algorithms; class MultiDomainFunctionTest_Function : public virtual IFunction1D, public virtual ParamFunction { @@ -162,7 +163,7 @@ public: costFun->setFittingFunction(multi, domain, values); TS_ASSERT_EQUALS(costFun->nParams(), 6); - LevenbergMarquardtMDMinimizer s; + FuncMinimisers::LevenbergMarquardtMDMinimizer s; s.initialize(costFun); TS_ASSERT(s.minimize()); @@ -186,7 +187,7 @@ public: multi->getFunction(2)->setParameter("A", 0); multi->getFunction(2)->setParameter("B", 0); - Fit fit; + Algorithms::Fit fit; fit.initialize(); fit.setProperty("Function", boost::dynamic_pointer_cast<IFunction>(multi)); fit.setProperty("InputWorkspace", ws1); diff --git a/Framework/CurveFitting/test/SpecialFunctionSupportTest.h b/Framework/CurveFitting/test/SpecialFunctionSupportTest.h index 4117c204942f384dd9403e591a2232cd5aeee87f..60cef0c51dcc6e96a18cd04a3ae6d78e49cb90e0 100644 --- a/Framework/CurveFitting/test/SpecialFunctionSupportTest.h +++ b/Framework/CurveFitting/test/SpecialFunctionSupportTest.h @@ -5,7 +5,7 @@ #include <complex> #include "MantidCurveFitting/SpecialFunctionSupport.h" -#include "MantidCurveFitting/Lorentzian1D.h" +#include "MantidCurveFitting/Functions/Lorentzian1D.h" #include "MantidKernel/UnitFactory.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" diff --git a/Framework/DataHandling/CMakeLists.txt b/Framework/DataHandling/CMakeLists.txt index 049c3199007152f5bf2e911d9557314d0282e510..073b714476895963e67645f6fb98f45005d6e9b0 100644 --- a/Framework/DataHandling/CMakeLists.txt +++ b/Framework/DataHandling/CMakeLists.txt @@ -50,7 +50,6 @@ set ( SRC_FILES src/LoadILLIndirect.cpp src/LoadILLReflectometry.cpp src/LoadILLSANS.cpp - src/LoadISISNexus.cpp src/LoadISISNexus2.cpp src/LoadInstrument.cpp src/LoadInstrumentFromNexus.cpp @@ -79,13 +78,11 @@ set ( SRC_FILES src/LoadPreNexusMonitors.cpp src/LoadQKK.cpp src/LoadRKH.cpp - src/LoadRaw.cpp src/LoadRaw/byte_rel_comp.cpp src/LoadRaw/isisraw.cpp src/LoadRaw/isisraw2.cpp src/LoadRaw/item_struct.cpp src/LoadRaw/vms_convert.cpp - src/LoadRaw2.cpp src/LoadRaw3.cpp src/LoadRawBin0.cpp src/LoadRawHelper.cpp @@ -210,7 +207,6 @@ set ( INC_FILES inc/MantidDataHandling/LoadILLIndirect.h inc/MantidDataHandling/LoadILLReflectometry.h inc/MantidDataHandling/LoadILLSANS.h - inc/MantidDataHandling/LoadISISNexus.h inc/MantidDataHandling/LoadISISNexus2.h inc/MantidDataHandling/LoadInstrument.h inc/MantidDataHandling/LoadInstrumentFromNexus.h @@ -239,8 +235,6 @@ set ( INC_FILES inc/MantidDataHandling/LoadPreNexusMonitors.h inc/MantidDataHandling/LoadQKK.h inc/MantidDataHandling/LoadRKH.h - inc/MantidDataHandling/LoadRaw.h - inc/MantidDataHandling/LoadRaw2.h inc/MantidDataHandling/LoadRaw3.h inc/MantidDataHandling/LoadRawBin0.h inc/MantidDataHandling/LoadRawHelper.h @@ -390,12 +384,10 @@ set ( TEST_FILES LoadPreNexusTest.h LoadQKKTest.h LoadRKHTest.h - LoadRaw2Test.h LoadRaw3Test.h LoadRawBin0Test.h LoadRawSaveNxsLoadNxsTest.h LoadRawSpectrum0Test.h - LoadRawTest.h LoadReflTBLTest.h LoadSINQFocusTest.h LoadSNSspecTest.h diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadANSTOHelper.h b/Framework/DataHandling/inc/MantidDataHandling/LoadANSTOHelper.h index 7776187428c496f80e7c7011322cb10a5be3ddfa..134809d2757324a1e06eb5ab96e667ced139839e 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadANSTOHelper.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadANSTOHelper.h @@ -22,6 +22,7 @@ namespace Mantid { namespace DataHandling { namespace ANSTO { + /// pointer to the vector of events typedef std::vector<DataObjects::TofEvent> *EventVector_pt; @@ -47,61 +48,75 @@ public: void complete(); }; -class EventCounter { -private: +class EventProcessor { +protected: // fields - std::vector<size_t> &m_eventCounts; - const std::vector<bool> &m_mask; - const std::vector<int> &m_offsets; + const std::vector<bool> &m_roi; const size_t m_stride; - const size_t m_pixelsCutOffL; - const size_t m_tubeBinning; - const size_t m_finalBinsY; - // tof boundaries - double m_tofMin; - double m_tofMax; - // correction + // tof correction const double m_period; const double m_phase; + // boundaries + const double m_tofMinBoundary; + const double m_tofMaxBoundary; + + // methods + virtual void endOfFrameImpl() = 0; + virtual void addEventImpl(size_t id, double tof) = 0; public: // construction - EventCounter(std::vector<size_t> &eventCounts, const std::vector<bool> &mask, - const std::vector<int> &offsets, size_t stride, - size_t pixelsCutOffL, size_t tubeBinning, size_t finalBinsY, - double periode, double phase); - - // properties - double tofMin() const; - double tofMax() const; + EventProcessor(const std::vector<bool> &roi, const size_t stride, + const double period, const double phase, + const double tofMinBoundary, const double tofMaxBoundary); // methods + void endOfFrame(); void addEvent(size_t x, size_t y, double tof); }; -class EventAssigner { -private: +class EventCounter : public EventProcessor { +protected: // fields - std::vector<EventVector_pt> &m_eventVectors; - const std::vector<bool> &m_mask; - const std::vector<int> &m_offsets; - const size_t m_stride; - const size_t m_pixelsCutOffL; - const size_t m_tubeBinning; - const size_t m_finalBinsY; - // correction - const double m_period; - const double m_phase; + std::vector<size_t> &m_eventCounts; + // number of frames + size_t m_numFrames; + // tof + double m_tofMin; + double m_tofMax; + + // methods + virtual void endOfFrameImpl(); + virtual void addEventImpl(size_t id, double tof); public: // construction - EventAssigner(std::vector<EventVector_pt> &eventVectors, - const std::vector<bool> &mask, const std::vector<int> &offsets, - size_t stride, size_t pixelsCutOffL, size_t tubeBinning, - size_t finalBinsY, double periode, double phase); + EventCounter(const std::vector<bool> &roi, const size_t stride, + const double period, const double phase, + const double tofMinBoundary, const double tofMaxBoundary, + std::vector<size_t> &eventCounts); + + // properties + size_t numFrames() const; + double tofMin() const; + double tofMax() const; +}; + +class EventAssigner : public EventProcessor { +protected: + // fields + std::vector<EventVector_pt> &m_eventVectors; // methods - void addEvent(size_t x, size_t y, double tof); + virtual void endOfFrameImpl(); + virtual void addEventImpl(size_t id, double tof); + +public: + // construction + EventAssigner(const std::vector<bool> &roi, const size_t stride, + const double period, const double phase, + const double tofMinBoundary, const double tofMaxBoundary, + std::vector<EventVector_pt> &eventVectors); }; class FastReadOnlyFile { @@ -125,6 +140,7 @@ public: }; namespace Tar { + struct EntryHeader { // cppcheck-suppress unusedStructMember char FileName[100]; @@ -158,8 +174,6 @@ struct EntryHeader { char FilenamePrefix[155]; }; -template <size_t N> int64_t octalToInt(char(&str)[N]); - class File { static const auto BUFFER_SIZE = 4096; @@ -206,8 +220,10 @@ public: size_t read(void *dst, size_t size); int read_byte(); }; -} -} -} -} + +} // Tar +} // ANSTO +} // DataHandling +} // Mantid + #endif // DATAHANDING_ANSTO_H_ \ No newline at end of file diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadBBY.h b/Framework/DataHandling/inc/MantidDataHandling/LoadBBY.h index 75c9c4f54e4a70d0c700cc4efd5ec45e89962667..37cfc22c64995142aff1445f08cc7d68b660b4fd 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadBBY.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadBBY.h @@ -15,8 +15,7 @@ namespace Mantid { namespace DataHandling { /** Loads a Bilby data file. Implements API::IFileLoader and its file check methods -to -recognise a file as the one containing Bilby data. +to recognise a file as the one containing Bilby data. @author David Mannicke (ANSTO), Anders Markvardsen (ISIS), Roman Tolchenov (Tessella plc) @@ -34,7 +33,7 @@ the Free Software Foundation; either version 3 of the License, or 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 +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 @@ -45,6 +44,32 @@ Code Documentation is available at: <http://doxygen.mantidproject.org> */ class DLLExport LoadBBY : public API::IFileLoader<Kernel::FileDescriptor> { + + struct InstrumentInfo { + // + int32_t bm_counts; + int32_t att_pos; + // + double period_master; + double period_slave; + double phase_slave; + // + double L1_chopper_value; + double L2_det_value; + // + double L2_curtainl_value; + double L2_curtainr_value; + double L2_curtainu_value; + double L2_curtaind_value; + // + double D_det_value; + // + double D_curtainl_value; + double D_curtainr_value; + double D_curtainu_value; + double D_curtaind_value; + }; + public: // construction LoadBBY() {} @@ -68,26 +93,26 @@ protected: virtual void exec(); private: + // region of intreset + static std::vector<bool> createRoiVector(const std::string &maskfile); + // instrument creation - Geometry::Instrument_sptr - createInstrument(ANSTO::Tar::File &tarFile, size_t pixelsCutOffL, - size_t pixelsCutOffH, size_t tubeBinning, size_t finalBinsY); + Geometry::Instrument_sptr createInstrument(ANSTO::Tar::File &tarFile, + InstrumentInfo &instrumentInfo); // load nx dataset template <class T> - static bool loadNXDataSet(T &value, NeXus::NXEntry &entry, - const std::string &path); + static bool loadNXDataSet(NeXus::NXEntry &entry, const std::string &path, + T &value); // binary file access - template <class Counter> + template <class EventProcessor> static void loadEvents(API::Progress &prog, const char *progMsg, - ANSTO::Tar::File &file, const double tofMinBoundary, - const double tofMaxBoundary, Counter &counter); - static std::vector<bool> createMaskVector(const std::string &filename, - bool &fileLoaded); - static std::vector<int> createOffsetVector(const std::string &filename, - bool &fileLoaded); + ANSTO::Tar::File &tarFile, + EventProcessor &eventProcessor); }; -} -} + +} // DataHandling +} // Mantid + #endif // DATAHANDING_LOADBBY_H_ \ No newline at end of file diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadISISNexus.h b/Framework/DataHandling/inc/MantidDataHandling/LoadISISNexus.h deleted file mode 100644 index e81fc82275a9ac8d29169ffcd77018c8ca2a05f6..0000000000000000000000000000000000000000 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadISISNexus.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef MANTID_DATAHANDLING_LOADISISNEXUS_H_ -#define MANTID_DATAHANDLING_LOADISISNEXUS_H_ - -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- -#include "MantidAPI/Algorithm.h" -#include "MantidAPI/DeprecatedAlgorithm.h" - -namespace Mantid { -namespace DataHandling { -/** THIS VERSION OF THIS ALGORITHM HAS BEEN REMOVED FROM MANTID. - Superseded by LoadISISNexus2. - What's left in this class is just a stub. - - 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 <http://www.gnu.org/licenses/>. - - File change history is stored at: <https://github.com/mantidproject/mantid>. - Code Documentation is available at: <http://doxygen.mantidproject.org> - */ -class DLLExport LoadISISNexus : public API::Algorithm, - public API::DeprecatedAlgorithm { -public: - /// Default constructor - LoadISISNexus(); - /// Destructor - virtual ~LoadISISNexus() {} - /// Algorithm's name for identification overriding a virtual method - virtual const std::string name() const { return "LoadISISNexus"; } - /// Summary of algorithms purpose - virtual const std::string summary() const { - return "*** This version of LoadISISNexus has been removed from Mantid. " - "You should use the current version of this algorithm or try an " - "earlier release of Mantid. ***"; - } - - /// Algorithm's version for identification overriding a virtual method - virtual int version() const { return 1; } - /// Algorithm's category for identification overriding a virtual method - virtual const std::string category() const { return "DataHandling\\Nexus"; } - -private: - void init(); - void exec(); -}; - -} // namespace DataHandling -} // namespace Mantid - -#endif /*MANTID_DATAHANDLING_LOADISISNEXUS_H_*/ diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadRaw.h b/Framework/DataHandling/inc/MantidDataHandling/LoadRaw.h deleted file mode 100644 index 82ce68297481ee05f184ae03a3697250def31419..0000000000000000000000000000000000000000 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadRaw.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef MANTID_DATAHANDLING_LOADRAW_H_ -#define MANTID_DATAHANDLING_LOADRAW_H_ - -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- -#include "MantidAPI/Algorithm.h" -#include "MantidAPI/DeprecatedAlgorithm.h" - -namespace Mantid { -namespace DataHandling { -/** THIS VERSION OF THIS ALGORITHM HAS BEEN REMOVED FROM MANTID. - Superseded by LoadRaw3. - What's left in this class is just a stub. - - Copyright © 2007-2013 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 <http://www.gnu.org/licenses/>. - - File change history is stored at: <https://github.com/mantidproject/mantid>. - Code Documentation is available at: <http://doxygen.mantidproject.org> -*/ -class DLLExport LoadRaw : public API::Algorithm, - public API::DeprecatedAlgorithm { -public: - /// Default constructor - LoadRaw(); - /// Destructor - ~LoadRaw() {} - /// Algorithm's name for identification overriding a virtual method - virtual const std::string name() const { return "LoadRaw"; } - /// Summary of algorithms purpose - virtual const std::string summary() const { - return "*** This version of LoadRaw has been removed from Mantid. You " - "should use the current version of this algorithm or try an earlier " - "release of Mantid. ***"; - } - - /// Algorithm's version for identification overriding a virtual method - virtual int version() const { return 1; } - /// Algorithm's category for identification overriding a virtual method - virtual const std::string category() const { return "DataHandling\\Raw"; } - -private: - void init(); - void exec(); -}; - -} // namespace DataHandling -} // namespace Mantid - -#endif /*MANTID_DATAHANDLING_LOADRAW_H_*/ diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadRaw2.h b/Framework/DataHandling/inc/MantidDataHandling/LoadRaw2.h deleted file mode 100644 index a828e1efee77a7c5823229cca85faa19e9bc4065..0000000000000000000000000000000000000000 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadRaw2.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef MANTID_DATAHANDLING_LOADRAW2_H_ -#define MANTID_DATAHANDLING_LOADRAW2_H_ - -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- -#include "MantidAPI/Algorithm.h" -#include "MantidAPI/DeprecatedAlgorithm.h" - -namespace Mantid { -namespace DataHandling { -/** THIS VERSION OF THIS ALGORITHM HAS BEEN REMOVED FROM MANTID. - Superseded by LoadRaw3. - What's left in this class is just a stub. - - Copyright © 2007-2013 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 <http://www.gnu.org/licenses/>. - - File change history is stored at: <https://github.com/mantidproject/mantid>. - Code Documentation is available at: <http://doxygen.mantidproject.org> -*/ -class DLLExport LoadRaw2 : public API::Algorithm, - public API::DeprecatedAlgorithm { -public: - /// Default constructor - LoadRaw2(); - /// Destructor - ~LoadRaw2() {} - /// Algorithm's name for identification overriding a virtual method - virtual const std::string name() const { return "LoadRaw"; } - /// Summary of algorithms purpose - virtual const std::string summary() const { - return "*** This version of LoadRaw has been removed from Mantid. You " - "should use the current version of this algorithm or try an earlier " - "release of Mantid. ***"; - } - - /// Algorithm's version for identification overriding a virtual method - virtual int version() const { return 2; } - /// Algorithm's category for identification overriding a virtual method - virtual const std::string category() const { return "DataHandling\\Raw"; } - -private: - void init(); - void exec(); -}; - -} // namespace DataHandling -} // namespace Mantid - -#endif /*MANTID_DATAHANDLING_LOADRAW2_H_*/ diff --git a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp index 3684648d6bb8b1eaee1361bd746a1860eb5ce325..78f98e8ac21bdebfd1cfc1142000ad17c84845b8 100644 --- a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp +++ b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp @@ -3,7 +3,6 @@ #include <sstream> #include <stdexcept> #include <functional> -#include <iostream> #include <set> #include <vector> #include <Poco/File.h> diff --git a/Framework/DataHandling/src/FindDetectorsPar.cpp b/Framework/DataHandling/src/FindDetectorsPar.cpp index a47d89cc73190dcc42beab2306c15fa242ec62ae..ebf13530cb10af84b215944a36f5ec26b906d378 100644 --- a/Framework/DataHandling/src/FindDetectorsPar.cpp +++ b/Framework/DataHandling/src/FindDetectorsPar.cpp @@ -13,7 +13,6 @@ #include <Poco/File.h> #include <limits> -#include <iostream> namespace Mantid { namespace DataHandling { diff --git a/Framework/DataHandling/src/ISISDataArchive.cpp b/Framework/DataHandling/src/ISISDataArchive.cpp index cf814ef149f66db057e227949477c6cddbcad672..033e7187378799512317c1a90cf582ac62de2f57 100644 --- a/Framework/DataHandling/src/ISISDataArchive.cpp +++ b/Framework/DataHandling/src/ISISDataArchive.cpp @@ -12,7 +12,6 @@ #include <Poco/Exception.h> #include <sstream> -#include <iostream> namespace Mantid { namespace DataHandling { diff --git a/Framework/DataHandling/src/LoadANSTOHelper.cpp b/Framework/DataHandling/src/LoadANSTOHelper.cpp index 55394d84ab274c7aac5c9d744bd0d1a87e73d274..2e539fb756adc0e48415746d9fcd9bbb5229d2e1 100644 --- a/Framework/DataHandling/src/LoadANSTOHelper.cpp +++ b/Framework/DataHandling/src/LoadANSTOHelper.cpp @@ -9,11 +9,10 @@ #include "MantidGeometry/Objects/ShapeFactory.h" #include "MantidNexus/NexusClasses.h" -//#include <Poco/File.h> - namespace Mantid { namespace DataHandling { namespace ANSTO { + // ProgressTracker ProgressTracker::ProgressTracker(API::Progress &progBar, const char *msg, int64_t target, size_t count) @@ -49,26 +48,16 @@ void ProgressTracker::complete() { } } -// EventCounter -EventCounter::EventCounter(std::vector<size_t> &eventCounts, - const std::vector<bool> &mask, - const std::vector<int> &offsets, size_t stride, - size_t pixelsCutOffL, size_t tubeBinning, - size_t finalBinsY, double periode, double phase) - : m_eventCounts(eventCounts), m_mask(mask), m_offsets(offsets), - m_stride(stride), m_pixelsCutOffL(pixelsCutOffL), - m_tubeBinning(tubeBinning), m_finalBinsY(finalBinsY), - m_tofMin(std::numeric_limits<double>::max()), - m_tofMax(std::numeric_limits<double>::min()), m_period(periode), - m_phase(phase) {} -double EventCounter::tofMin() const { - return m_tofMin <= m_tofMax ? m_tofMin : 0.0; -} -double EventCounter::tofMax() const { - return m_tofMin <= m_tofMax ? m_tofMax : 0.0; -} -void EventCounter::addEvent(size_t x, size_t y, double tof) { - // correction +// EventProcessor +EventProcessor::EventProcessor(const std::vector<bool> &roi, + const size_t stride, const double period, + const double phase, const double tofMinBoundary, + const double tofMaxBoundary) + : m_roi(roi), m_stride(stride), m_period(period), m_phase(phase), + m_tofMinBoundary(tofMinBoundary), m_tofMaxBoundary(tofMaxBoundary) {} +void EventProcessor::endOfFrame() { endOfFrameImpl(); } +void EventProcessor::addEvent(size_t x, size_t y, double tof) { + // tof correction if (m_period > 0.0) { tof += m_phase; while (tof > m_period) @@ -77,51 +66,61 @@ void EventCounter::addEvent(size_t x, size_t y, double tof) { tof += m_period; } - y = y + (size_t)m_offsets[x]; - if (y < m_stride) { // sufficient because yNew is size_t - if (m_mask[m_stride * x + y]) { - if (m_tofMin > tof) - m_tofMin = tof; - if (m_tofMax < tof) - m_tofMax = tof; + // check if event is in valid range + if ((y < m_stride) && (m_tofMinBoundary <= tof) && + (tof <= m_tofMaxBoundary)) { - // transformation to bin index - size_t j = (y - m_pixelsCutOffL) / m_tubeBinning; + // detector id + size_t id = m_stride * x + y; - m_eventCounts[m_finalBinsY * x + j]++; - } + // check if neutron is in region of intreset + if (m_roi[id]) + addEventImpl(id, tof); } } -// EventAssigner -EventAssigner::EventAssigner(std::vector<EventVector_pt> &eventVectors, - const std::vector<bool> &mask, - const std::vector<int> &offsets, size_t stride, - size_t pixelsCutOffL, size_t tubeBinning, - size_t finalBinsY, double periode, double phase) - : m_eventVectors(eventVectors), m_mask(mask), m_offsets(offsets), - m_stride(stride), m_pixelsCutOffL(pixelsCutOffL), - m_tubeBinning(tubeBinning), m_finalBinsY(finalBinsY), m_period(periode), - m_phase(phase) {} -void EventAssigner::addEvent(size_t x, size_t y, double tof) { - // correction - if (m_period > 0.0) { - tof += m_phase; - while (tof > m_period) - tof -= m_period; - while (tof < 0) - tof += m_period; - } - - y = y + (size_t)m_offsets[x]; - if (y < m_stride) { // sufficient because yNew is size_t - if (m_mask[m_stride * x + y]) { - // transformation to bin index - size_t j = (y - m_pixelsCutOffL) / m_tubeBinning; +// EventCounter +EventCounter::EventCounter(const std::vector<bool> &roi, const size_t stride, + const double period, const double phase, + const double tofMinBoundary, + const double tofMaxBoundary, + std::vector<size_t> &eventCounts) + : EventProcessor(roi, stride, period, phase, tofMinBoundary, + tofMaxBoundary), + m_eventCounts(eventCounts), m_numFrames(0), + m_tofMin(std::numeric_limits<double>::max()), + m_tofMax(std::numeric_limits<double>::min()) {} +size_t EventCounter::numFrames() const { return m_numFrames; } +double EventCounter::tofMin() const { + return m_tofMin <= m_tofMax ? m_tofMin : 0.0; +} +double EventCounter::tofMax() const { + return m_tofMin <= m_tofMax ? m_tofMax : 0.0; +} +void EventCounter::endOfFrameImpl() { m_numFrames++; } +void EventCounter::addEventImpl(size_t id, double tof) { + if (m_tofMin > tof) + m_tofMin = tof; + if (m_tofMax < tof) + m_tofMax = tof; + + m_eventCounts[id]++; +} - m_eventVectors[m_finalBinsY * x + j]->push_back(tof); - } - } +// EventAssigner +EventAssigner::EventAssigner(const std::vector<bool> &roi, const size_t stride, + const double period, const double phase, + const double tofMinBoundary, + const double tofMaxBoundary, + std::vector<EventVector_pt> &eventVectors) + : EventProcessor(roi, stride, period, phase, tofMinBoundary, + tofMaxBoundary), + m_eventVectors(eventVectors) {} +void EventAssigner::endOfFrameImpl() { + // ignore +} +void EventAssigner::addEventImpl(size_t id, double tof) { + m_eventVectors[id]->push_back(tof); } // FastReadOnlyFile @@ -332,7 +331,8 @@ int File::read_byte() { m_position++; return m_buffer[m_bufferPosition++]; } -} -} -} // namespace -} // namespace \ No newline at end of file + +} // Tar +} // ANSTO +} // DataHandling +} // Mantid \ No newline at end of file diff --git a/Framework/DataHandling/src/LoadBBY.cpp b/Framework/DataHandling/src/LoadBBY.cpp index 8697cb516daf673774849deae53ec9430ff138a2..5c670badbacd110171d22b117186b3d4f9f54c32 100644 --- a/Framework/DataHandling/src/LoadBBY.cpp +++ b/Framework/DataHandling/src/LoadBBY.cpp @@ -1,5 +1,6 @@ #include "MantidDataHandling/LoadBBY.h" #include "MantidDataObjects/EventWorkspace.h" +#include "MantidKernel/PropertyWithValue.h" #include "MantidAPI/FileProperty.h" #include "MantidAPI/RegisterFileLoader.h" #include "MantidAPI/WorkspaceValidators.h" @@ -10,9 +11,12 @@ #include "MantidNexus/NexusClasses.h" #include <Poco/TemporaryFile.h> +#include <math.h> +#include <stdio.h> namespace Mantid { namespace DataHandling { + // register the algorithm into the AlgorithmFactory DECLARE_FILELOADER_ALGORITHM(LoadBBY) @@ -20,11 +24,37 @@ DECLARE_FILELOADER_ALGORITHM(LoadBBY) static const size_t HISTO_BINS_X = 240; static const size_t HISTO_BINS_Y = 256; // 100 = 40 + 20 + 40 -static const size_t Progress_LoadBinFile = 40; -static const size_t Progress_ReserveMemory = 20; +static const size_t Progress_LoadBinFile = 48; +static const size_t Progress_ReserveMemory = 4; +static const size_t Progress_Total = + 2 * Progress_LoadBinFile + Progress_ReserveMemory; + +static char const *const FilenameStr = "Filename"; +static char const *const MaskStr = "Mask"; + +static char const *const PeriodMasterStr = "PeriodMaster"; +static char const *const PeriodSlaveStr = "PeriodSlave"; +static char const *const PhaseSlaveStr = "PhaseSlave"; + +static char const *const FilterByTofMinStr = "FilterByTofMin"; +static char const *const FilterByTofMaxStr = "FilterByTofMax"; using ANSTO::EventVector_pt; +template <typename TYPE> +void AddSinglePointTimeSeriesProperty(API::LogManager &logManager, + const std::string &time, + const std::string &name, + const TYPE value) { + // create time series property and add single value + Kernel::TimeSeriesProperty<TYPE> *p = + new Kernel::TimeSeriesProperty<TYPE>(name); + p->addValue(time, value); + + // add to log manager + logManager.addProperty(p); +} + class BbyDetectorBankFactory { private: // fields @@ -83,7 +113,7 @@ int LoadBBY::confidence(Kernel::FileDescriptor &descriptor) const { * read from after the execution (output). */ void LoadBBY::init() { - // Specify file extensions which can be associated with a BBY file. + // Specify file extensions which can be associated with a specific file. std::vector<std::string> exts; // Declare the Filename algorithm property. Mandatory. Sets the path to the @@ -91,181 +121,110 @@ void LoadBBY::init() { exts.clear(); exts.push_back(".tar"); declareProperty( - new API::FileProperty("Filename", "", API::FileProperty::Load, exts), + new API::FileProperty(FilenameStr, "", API::FileProperty::Load, exts), "The input filename of the stored data"); // mask exts.clear(); exts.push_back(".xml"); declareProperty( - new API::FileProperty("Mask", "", API::FileProperty::OptionalLoad, exts), + new API::FileProperty(MaskStr, "", API::FileProperty::OptionalLoad, exts), "The input filename of the mask data"); - // offsets - exts.clear(); - exts.push_back(".csv"); - declareProperty(new API::FileProperty("TubeOffsets", "", - API::FileProperty::OptionalLoad, exts), - "The input filename of the tube offset data"); - + // OutputWorkspace declareProperty(new API::WorkspaceProperty<API::IEventWorkspace>( "OutputWorkspace", "", Kernel::Direction::Output)); - declareProperty(new Kernel::PropertyWithValue<size_t>( - "TubeBinning", 1, Kernel::Direction::Input), - "Default: 1"); - + // FilterByTofMin declareProperty(new Kernel::PropertyWithValue<double>( - "FilterByTofMin", 0, Kernel::Direction::Input), + FilterByTofMinStr, 0, Kernel::Direction::Input), "Optional: To exclude events that do not fall within a range " "of times-of-flight. " "This is the minimum accepted value in microseconds. Keep " "blank to load all events."); + + // FilterByTofMax declareProperty(new Kernel::PropertyWithValue<double>( - "FilterByTofMax", 50000000, Kernel::Direction::Input), + FilterByTofMaxStr, EMPTY_DBL(), Kernel::Direction::Input), "Optional: To exclude events that do not fall within a range " "of times-of-flight. " "This is the maximum accepted value in microseconds. Keep " "blank to load all events."); + + // FilterByTimeStart declareProperty( new Kernel::PropertyWithValue<double>("FilterByTimeStart", EMPTY_DBL(), Kernel::Direction::Input), "Optional: To only include events after the provided start time, in " "seconds (relative to the start of the run)."); + + // FilterByTimeStop declareProperty( new Kernel::PropertyWithValue<double>("FilterByTimeStop", EMPTY_DBL(), Kernel::Direction::Input), "Optional: To only include events before the provided stop time, in " "seconds (relative to the start of the run)."); + // period and phase declareProperty(new Kernel::PropertyWithValue<double>( - "PeriodMaster", 0.0, Kernel::Direction::Input), - "Optional:"); + PeriodMasterStr, EMPTY_DBL(), Kernel::Direction::Input), + "Optional"); declareProperty(new Kernel::PropertyWithValue<double>( - "PeriodSlave", 0.0, Kernel::Direction::Input), - "Optional:"); + PeriodSlaveStr, EMPTY_DBL(), Kernel::Direction::Input), + "Optional"); declareProperty(new Kernel::PropertyWithValue<double>( - "PhaseSlave", 0.0, Kernel::Direction::Input), - "Optional:"); + PhaseSlaveStr, EMPTY_DBL(), Kernel::Direction::Input), + "Optional"); - std::string grpOptional = "Optional"; - setPropertyGroup("TubeBinning", grpOptional); - setPropertyGroup("FilterByTofMin", grpOptional); - setPropertyGroup("FilterByTofMax", grpOptional); + std::string grpOptional = "Filters"; + setPropertyGroup(FilterByTofMinStr, grpOptional); + setPropertyGroup(FilterByTofMaxStr, grpOptional); setPropertyGroup("FilterByTimeStart", grpOptional); setPropertyGroup("FilterByTimeStop", grpOptional); std::string grpPhaseCorrection = "Phase Correction"; - setPropertyGroup("PeriodMaster", grpPhaseCorrection); - setPropertyGroup("PeriodSlave", grpPhaseCorrection); - setPropertyGroup("PhaseSlave", grpPhaseCorrection); + setPropertyGroup(PeriodMasterStr, grpPhaseCorrection); + setPropertyGroup(PeriodSlaveStr, grpPhaseCorrection); + setPropertyGroup(PhaseSlaveStr, grpPhaseCorrection); } /** * Execute the algorithm. */ void LoadBBY::exec() { - // Delete the output workspace name if it existed std::string outName = getPropertyValue("OutputWorkspace"); if (API::AnalysisDataService::Instance().doesExist(outName)) API::AnalysisDataService::Instance().remove(outName); // Get the name of the data file. - std::string filename = getPropertyValue("Filename"); - ANSTO::Tar::File file(filename); - if (!file.good()) - return; + std::string filename = getPropertyValue(FilenameStr); + ANSTO::Tar::File tarFile(filename); + if (!tarFile.good()) + throw std::invalid_argument("invalid BBY file"); - // load mask file - bool maskFileLoaded = false; - std::vector<bool> mask = - createMaskVector(getPropertyValue("Mask"), maskFileLoaded); - - // load tube offsets - bool offsetFileLoaded = false; - std::vector<int> offsets = - createOffsetVector(getPropertyValue("TubeOffsets"), offsetFileLoaded); - for (size_t x = 0; x != HISTO_BINS_X; x++) { - int offset = offsets[x]; - if (offset != 0) { - maskFileLoaded = true; - - size_t s0 = HISTO_BINS_Y * x; - if (offset > 0) { - for (int y = 0; y != offset; y++) - mask[s0 + (size_t)y] = false; - } else { // if (offset < 0) - for (size_t y = HISTO_BINS_Y + static_cast<size_t>(offset); - y != HISTO_BINS_Y; y++) - mask[s0 + y] = false; - } - } - } + // region of intreset + std::vector<bool> roi = createRoiVector(getPropertyValue(MaskStr)); - size_t nBins = 1; - - size_t tubeBinning = getProperty("TubeBinning"); - if (tubeBinning < 1) - tubeBinning = 1; - else if (tubeBinning > HISTO_BINS_Y) - tubeBinning = HISTO_BINS_Y; - - size_t finalBinsY = HISTO_BINS_Y / tubeBinning; - size_t pixelsCutOff = HISTO_BINS_Y % tubeBinning; - size_t pixelsCutOffH = pixelsCutOff / 2; - size_t pixelsCutOffL = pixelsCutOff - pixelsCutOffH; - - // update masking - if (tubeBinning > 1) - for (size_t x = 0; x != HISTO_BINS_X; x++) { - size_t s0 = HISTO_BINS_Y * x; - - // mask out cut off pixels (low) - for (size_t y = 0; y < pixelsCutOffL; y++) - mask[s0 + y] = false; - - // mask out cut off pixels (high) - for (size_t y = HISTO_BINS_Y - pixelsCutOffH; y < HISTO_BINS_Y; y++) - mask[s0 + y] = false; - - // if one pixel is masked then all pixels in that binning group have to be - // masked - for (size_t j = 0; j < finalBinsY; j++) { - size_t y0 = j * tubeBinning + pixelsCutOffL; - for (size_t dy = 0; dy < tubeBinning; dy++) - // if one pixel is masked ... - if (!mask[s0 + y0 + dy]) { - for (dy = 0; dy < tubeBinning; dy++) - mask[s0 + y0 + dy] = false; // ... mask all pixels - break; - } - } - } + double tofMinBoundary = getProperty(FilterByTofMinStr); + double tofMaxBoundary = getProperty(FilterByTofMaxStr); - double tofMinBoundary = getProperty("FilterByTofMin"); - double tofMaxBoundary = getProperty("FilterByTofMax"); - - // "loading neutron counts", "creating neutron event lists" and "loading - // neutron events" - API::Progress prog(this, 0.0, 1.0, Progress_LoadBinFile + - Progress_ReserveMemory + - Progress_LoadBinFile); + API::Progress prog(this, 0.0, 1.0, Progress_Total); prog.doReport("creating instrument"); // create workspace DataObjects::EventWorkspace_sptr eventWS = boost::make_shared<DataObjects::EventWorkspace>(); - eventWS->initialize(finalBinsY * HISTO_BINS_X, - nBins + 1, // number of TOF bin boundaries - nBins); + eventWS->initialize(HISTO_BINS_Y * HISTO_BINS_X, + 2, // number of TOF bin boundaries + 1); // set the units eventWS->getAxis(0)->unit() = Kernel::UnitFactory::Instance().create("TOF"); eventWS->setYUnit("Counts"); // set title - const std::vector<std::string> &subFiles = file.files(); + const std::vector<std::string> &subFiles = tarFile.files(); for (auto itr = subFiles.begin(); itr != subFiles.end(); ++itr) if (itr->compare(0, 3, "BBY") == 0) { std::string title = *itr; @@ -280,66 +239,73 @@ void LoadBBY::exec() { break; } - // set auxiliaries - eventWS->mutableRun().addProperty("Filename", filename); - // eventWS->mutableRun().addProperty("run_number", 1); - // eventWS->mutableRun().addProperty("run_start", "1991-01-01T00:00:00", true - // ); - // eventWS->mutableRun().addProperty("duration", duration[0], units); - // create instrument - Geometry::Instrument_sptr instrument = createInstrument( - file, pixelsCutOffL, pixelsCutOffH, tubeBinning, finalBinsY); - eventWS->setInstrument(instrument); + InstrumentInfo instrumentInfo; - // load events + // Geometry::Instrument_sptr instrument = + createInstrument(tarFile, /* ref */ instrumentInfo); + // eventWS->setInstrument(instrument); + // load events size_t numberHistograms = eventWS->getNumberHistograms(); std::vector<EventVector_pt> eventVectors(numberHistograms, NULL); std::vector<size_t> eventCounts(numberHistograms, 0); - std::vector<detid_t> detIDs = instrument->getDetectorIDs(); // phase correction - double periodMaster = getProperty("PeriodMaster"); - double periodSlave = getProperty("PeriodSlave"); - double phaseSlave = getProperty("PhaseSlave"); - - if ((periodMaster < 0.0) || (periodSlave < 0.0)) - throw std::runtime_error( - "Please specify a positive value for PeriodMaster and PeriodSlave."); + Kernel::Property *periodMasterProperty = + getPointerToProperty(PeriodMasterStr); + Kernel::Property *periodSlaveProperty = getPointerToProperty(PeriodSlaveStr); + Kernel::Property *phaseSlaveProperty = getPointerToProperty(PhaseSlaveStr); + + double periodMaster; + double periodSlave; + double phaseSlave; + + if (periodMasterProperty->isDefault() || periodSlaveProperty->isDefault() || + phaseSlaveProperty->isDefault()) { + + if (!periodMasterProperty->isDefault() || + !periodSlaveProperty->isDefault() || !phaseSlaveProperty->isDefault()) { + throw std::invalid_argument("Please specify PeriodMaster, PeriodSlave " + "and PhaseSlave or none of them."); + } - bool setPeriodMaster = periodMaster > 0.0; - bool setPeriodSlave = periodSlave > 0.0; - bool setPhaseSlave = phaseSlave != 0.0; + // if values have not been specified in loader then use values from hdf file + periodMaster = instrumentInfo.period_master; + periodSlave = instrumentInfo.period_slave; + phaseSlave = instrumentInfo.phase_slave; + } else { + periodMaster = getProperty(PeriodMasterStr); + periodSlave = getProperty(PeriodSlaveStr); + phaseSlave = getProperty(PhaseSlaveStr); - if ((setPeriodMaster != setPeriodSlave) || setPhaseSlave) - throw std::runtime_error("Please specify PeriodMaster, PeriodSlave and " - "PhaseSlave or none of them."); + if ((periodMaster < 0.0) || (periodSlave < 0.0)) + throw std::invalid_argument( + "Please specify a positive value for PeriodMaster and PeriodSlave."); + } - double periode = periodSlave > 0.0 ? periodSlave : periodMaster; + double period = periodSlave; double shift = -1.0 / 6.0 * periodMaster - periodSlave * phaseSlave / 360.0; // count total events per pixel to reserve necessary memory - ANSTO::EventCounter eventCounter(eventCounts, mask, offsets, HISTO_BINS_Y, - pixelsCutOffL, tubeBinning, finalBinsY, - periode, shift); - loadEvents(prog, "loading neutron counts", file, tofMinBoundary, - tofMaxBoundary, eventCounter); + ANSTO::EventCounter eventCounter(roi, HISTO_BINS_Y, period, shift, + tofMinBoundary, tofMaxBoundary, eventCounts); + + loadEvents(prog, "loading neutron counts", tarFile, eventCounter); // prepare event storage ANSTO::ProgressTracker progTracker(prog, "creating neutron event lists", numberHistograms, Progress_ReserveMemory); + for (size_t i = 0; i != numberHistograms; ++i) { DataObjects::EventList &eventList = eventWS->getEventList(i); - eventList.setSortOrder( - DataObjects::PULSETIME_SORT); // why not PULSETIME[TOF]_SORT ? + eventList.setSortOrder(DataObjects::PULSETIME_SORT); eventList.reserve(eventCounts[i]); - detid_t id = detIDs[i]; - eventList.setDetectorID(id); - eventList.setSpectrumNo(id); + eventList.setDetectorID(Mantid::detid_t(i)); + eventList.setSpectrumNo(Mantid::detid_t(i)); DataObjects::getEventsFrom(eventList, eventVectors[i]); @@ -347,52 +313,35 @@ void LoadBBY::exec() { } progTracker.complete(); - ANSTO::EventAssigner eventAssigner(eventVectors, mask, offsets, HISTO_BINS_Y, - pixelsCutOffL, tubeBinning, finalBinsY, - periode, shift); - loadEvents(prog, "loading neutron events", file, tofMinBoundary, - tofMaxBoundary, eventAssigner); + ANSTO::EventAssigner eventAssigner(roi, HISTO_BINS_Y, period, shift, + tofMinBoundary, tofMaxBoundary, + eventVectors); + + loadEvents(prog, "loading neutron events", tarFile, eventAssigner); Kernel::cow_ptr<MantidVec> axis; MantidVec &xRef = axis.access(); xRef.resize(2, 0.0); - xRef[0] = std::max(0.0, eventCounter.tofMin() - - 1); // just to make sure the bins hold it all + xRef[0] = std::max( + 0.0, + floor(eventCounter.tofMin())); // just to make sure the bins hold it all xRef[1] = eventCounter.tofMax() + 1; eventWS->setAllX(axis); - if (maskFileLoaded) { - // count total number of masked bins - size_t maskedBins = 0; - - for (size_t x = 0; x != HISTO_BINS_X; x++) { - size_t s0 = HISTO_BINS_Y * x; - for (size_t j = 0; j < finalBinsY; j++) { - size_t y0 = j * tubeBinning + pixelsCutOffL; - for (size_t dy = 0; dy < tubeBinning; dy++) - if (!mask[s0 + y0 + dy]) { - maskedBins++; - break; - } - } - } + // count total number of masked bins + size_t maskedBins = 0; + for (size_t i = 0; i != roi.size(); i++) + if (!roi[i]) + maskedBins++; + if (maskedBins > 0) { // create list of masked bins std::vector<size_t> maskIndexList(maskedBins); - size_t binIndex = 0; size_t maskIndex = 0; - for (size_t x = 0; x != HISTO_BINS_X; x++) { - size_t s0 = HISTO_BINS_Y * x; - for (size_t j = 0; j < finalBinsY; j++, binIndex++) { - size_t y0 = j * tubeBinning + pixelsCutOffL; - for (size_t dy = 0; dy < tubeBinning; dy++) - if (!mask[s0 + y0 + dy]) { - maskIndexList[maskIndex++] = binIndex; - break; - } - } - } + for (size_t i = 0; i != roi.size(); i++) + if (!roi[i]) + maskIndexList[maskIndex++] = i; API::IAlgorithm_sptr maskingAlg = createChildAlgorithm("MaskDetectors"); maskingAlg->setProperty("Workspace", eventWS); @@ -400,53 +349,143 @@ void LoadBBY::exec() { maskingAlg->executeAsChildAlg(); } + // set log values + API::LogManager &logManager = eventWS->mutableRun(); + + logManager.addProperty("filename", filename); + logManager.addProperty("att_pos", static_cast<int>(instrumentInfo.att_pos)); + logManager.addProperty("frame_count", + static_cast<int>(eventCounter.numFrames())); + logManager.addProperty("period", period); + + // currently beam monitor counts are not available, instead number of frames + // times period is used + logManager.addProperty( + "bm_counts", static_cast<double>(eventCounter.numFrames()) * period / + 1.0e6); // static_cast<double>(instrumentInfo.bm_counts) + + // currently + Kernel::time_duration duration = + boost::posix_time::microseconds(static_cast<boost::int64_t>( + static_cast<double>(eventCounter.numFrames()) * period)); + + Kernel::DateAndTime start_time("2000-01-01T00:00:00"); + Kernel::DateAndTime end_time(start_time + duration); + + logManager.addProperty("start_time", start_time.toISO8601String()); + logManager.addProperty("end_time", end_time.toISO8601String()); + + std::string time_str = start_time.toISO8601String(); + AddSinglePointTimeSeriesProperty(logManager, time_str, "L1_chopper_value", + instrumentInfo.L1_chopper_value); + AddSinglePointTimeSeriesProperty(logManager, time_str, "L2_det_value", + instrumentInfo.L2_det_value); + AddSinglePointTimeSeriesProperty(logManager, time_str, "L2_curtainl_value", + instrumentInfo.L2_curtainl_value); + AddSinglePointTimeSeriesProperty(logManager, time_str, "L2_curtainr_value", + instrumentInfo.L2_curtainr_value); + AddSinglePointTimeSeriesProperty(logManager, time_str, "L2_curtainu_value", + instrumentInfo.L2_curtainu_value); + AddSinglePointTimeSeriesProperty(logManager, time_str, "L2_curtaind_value", + instrumentInfo.L2_curtaind_value); + AddSinglePointTimeSeriesProperty(logManager, time_str, "D_det_value", + instrumentInfo.D_det_value); + AddSinglePointTimeSeriesProperty(logManager, time_str, "D_curtainl_value", + instrumentInfo.D_curtainl_value); + AddSinglePointTimeSeriesProperty(logManager, time_str, "D_curtainr_value", + instrumentInfo.D_curtainr_value); + AddSinglePointTimeSeriesProperty(logManager, time_str, "D_curtainu_value", + instrumentInfo.D_curtainu_value); + AddSinglePointTimeSeriesProperty(logManager, time_str, "D_curtaind_value", + instrumentInfo.D_curtaind_value); + AddSinglePointTimeSeriesProperty(logManager, time_str, "curtain_rotation", + 10.0); + + API::IAlgorithm_sptr loadInstrumentAlg = + createChildAlgorithm("LoadInstrument"); + loadInstrumentAlg->setProperty("Workspace", eventWS); + loadInstrumentAlg->setPropertyValue("InstrumentName", "BILBY"); + loadInstrumentAlg->executeAsChildAlg(); + setProperty("OutputWorkspace", eventWS); } -// instrument creation -Geometry::Instrument_sptr LoadBBY::createInstrument(ANSTO::Tar::File &tarFile, - size_t pixelsCutOffL, - size_t pixelsCutOffH, - size_t tubeBinning, - size_t finalBinsY) { - // instrument - Geometry::Instrument_sptr instrument = - boost::make_shared<Geometry::Instrument>("BILBY"); - instrument->setDefaultViewAxis("Z-"); +// region of intreset +std::vector<bool> LoadBBY::createRoiVector(const std::string &maskfile) { + std::vector<bool> result(HISTO_BINS_Y * HISTO_BINS_X, true); + + if (maskfile.length() == 0) + return result; + + std::ifstream input(maskfile.c_str()); + if (!input.good()) + throw std::invalid_argument("invalid mask file"); + + std::string line; + while (std::getline(input, line)) { + auto i0 = line.find("<detids>"); + auto iN = line.find("</detids>"); + + if ((i0 != std::string::npos) && (iN != std::string::npos) && (i0 < iN)) { + line = line.substr(i0 + 8, iN - i0 - 8); // 8 = len("<detids>") + std::stringstream ss(line); + + std::string item; + while (std::getline(ss, item, ',')) { + auto k = item.find('-'); + + size_t p0, p1; + if (k != std::string::npos) { + p0 = boost::lexical_cast<size_t>(item.substr(0, k)); + p1 = boost::lexical_cast<size_t>( + item.substr(k + 1, item.size() - k - 1)); + + if (p0 > p1) + std::swap(p0, p1); + } else { + p0 = boost::lexical_cast<size_t>(item); + p1 = p0; + } - // source - Geometry::ObjComponent *source = - new Geometry::ObjComponent("Source", instrument.get()); - instrument->add(source); - instrument->markAsSource(source); + if (p0 < result.size()) { + if (p1 >= result.size()) + p1 = result.size() - 1; - //// chopper - // Geometry::ObjComponent *chopperPoint = new - // Geometry::ObjComponent("Chopper", instrument.get()); - // instrument->add(chopper); - // instrument->markAsChopperPoint(chopper); + while (p0 <= p1) + result[p0++] = false; + } + } + } + } - // sample - Geometry::ObjComponent *samplePos = - new Geometry::ObjComponent("Sample", instrument.get()); - instrument->add(samplePos); - instrument->markAsSamplePos(samplePos); + return result; +} + +// instrument creation +Geometry::Instrument_sptr +LoadBBY::createInstrument(ANSTO::Tar::File &tarFile, + InstrumentInfo &instrumentInfo) { + instrumentInfo.bm_counts = 0; + instrumentInfo.att_pos = 0; - double L2_det_value = 33.15616015625; - double L1_chopper_value = 18.47258984375; - // double L1_source_value = 9.35958984375; + instrumentInfo.period_master = 0.0; + instrumentInfo.period_slave = 0.0; + instrumentInfo.phase_slave = 0.0; - double L2_curtainl_value = 23.28446093750; - double L2_curtainr_value = 23.28201953125; - double L2_curtainu_value = 24.28616015625; - double L2_curtaind_value = 24.28235937500; + instrumentInfo.L1_chopper_value = 18.47258984375; + instrumentInfo.L2_det_value = 33.15616015625; - double D_det_value = (8.4 + 2.0) / (2 * 1000); + instrumentInfo.L2_curtainl_value = 23.28446093750; + instrumentInfo.L2_curtainr_value = 23.28201953125; + instrumentInfo.L2_curtainu_value = 24.28616015625; + instrumentInfo.L2_curtaind_value = 24.28235937500; - double D_curtainl_value = 0.3816; - double D_curtainr_value = 0.4024; - double D_curtainu_value = 0.3947; - double D_curtaind_value = 0.3978; + instrumentInfo.D_det_value = (8.4 + 2.0) / (2 * 1000); + + instrumentInfo.D_curtainl_value = 0.3816; + instrumentInfo.D_curtainr_value = 0.4024; + instrumentInfo.D_curtainu_value = 0.3947; + instrumentInfo.D_curtaind_value = 0.3978; // extract hdf file int64_t fileSize = 0; @@ -459,7 +498,7 @@ Geometry::Instrument_sptr LoadBBY::createInstrument(ANSTO::Tar::File &tarFile, } if (fileSize != 0) { - // create tmp file + // extract hdf file into tmp file Poco::TemporaryFile hdfFile; boost::shared_ptr<FILE> handle(fopen(hdfFile.path().c_str(), "wb"), fclose); if (handle) { @@ -473,37 +512,72 @@ Geometry::Instrument_sptr LoadBBY::createInstrument(ANSTO::Tar::File &tarFile, NeXus::NXRoot root(hdfFile.path()); NeXus::NXEntry entry = root.openFirstEntry(); - float tmp; + float tmp_float; + int32_t tmp_int32 = 0; const double toMeters = 1.0 / 1000; - if (loadNXDataSet(tmp, entry, "instrument/L2_det")) - L2_det_value = tmp * toMeters; - if (loadNXDataSet(tmp, entry, "instrument/Ltof_det")) - L1_chopper_value = tmp * toMeters - L2_det_value; - // if (loadNXDataSet(tmp, entry, "instrument/L1")) - // L1_source_value = tmp * toMeters; - - if (loadNXDataSet(tmp, entry, "instrument/L2_curtainl")) - L2_curtainl_value = tmp * toMeters; - if (loadNXDataSet(tmp, entry, "instrument/L2_curtainr")) - L2_curtainr_value = tmp * toMeters; - if (loadNXDataSet(tmp, entry, "instrument/L2_curtainu")) - L2_curtainu_value = tmp * toMeters; - if (loadNXDataSet(tmp, entry, "instrument/L2_curtaind")) - L2_curtaind_value = tmp * toMeters; - - if (loadNXDataSet(tmp, entry, "instrument/detector/curtainl")) - D_curtainl_value = tmp * toMeters; - if (loadNXDataSet(tmp, entry, "instrument/detector/curtainr")) - D_curtainr_value = tmp * toMeters; - if (loadNXDataSet(tmp, entry, "instrument/detector/curtainu")) - D_curtainu_value = tmp * toMeters; - if (loadNXDataSet(tmp, entry, "instrument/detector/curtaind")) - D_curtaind_value = tmp * toMeters; + if (loadNXDataSet(entry, "monitor/bm1_counts", tmp_int32)) + instrumentInfo.bm_counts = tmp_int32; + if (loadNXDataSet(entry, "instrument/att_pos", tmp_float)) + instrumentInfo.att_pos = + static_cast<int32_t>(tmp_float + 0.5f); // [1.0, 2.0, ..., 5.0] + + if (loadNXDataSet(entry, "instrument/master_chopper_freq", tmp_float)) + instrumentInfo.period_master = 1.0 / tmp_float * 1.0e6; + if (loadNXDataSet(entry, "instrument/t0_chopper_freq", tmp_float)) + instrumentInfo.period_slave = 1.0 / tmp_float * 1.0e6; + if (loadNXDataSet(entry, "instrument/t0_chopper_phase", tmp_float)) + instrumentInfo.phase_slave = tmp_float < 999.0 ? tmp_float : 0.0; + + if (loadNXDataSet(entry, "instrument/L2_det", tmp_float)) + instrumentInfo.L2_det_value = tmp_float * toMeters; + if (loadNXDataSet(entry, "instrument/Ltof_det", tmp_float)) + instrumentInfo.L1_chopper_value = + tmp_float * toMeters - instrumentInfo.L2_det_value; + // if (loadNXDataSet(entry, "instrument/L1", tmp_float)) + // instrumentInfo.L1_source_value = tmp_float * toMeters; + + if (loadNXDataSet(entry, "instrument/L2_curtainl", tmp_float)) + instrumentInfo.L2_curtainl_value = tmp_float * toMeters; + if (loadNXDataSet(entry, "instrument/L2_curtainr", tmp_float)) + instrumentInfo.L2_curtainr_value = tmp_float * toMeters; + if (loadNXDataSet(entry, "instrument/L2_curtainu", tmp_float)) + instrumentInfo.L2_curtainu_value = tmp_float * toMeters; + if (loadNXDataSet(entry, "instrument/L2_curtaind", tmp_float)) + instrumentInfo.L2_curtaind_value = tmp_float * toMeters; + + if (loadNXDataSet(entry, "instrument/detector/curtainl", tmp_float)) + instrumentInfo.D_curtainl_value = tmp_float * toMeters; + if (loadNXDataSet(entry, "instrument/detector/curtainr", tmp_float)) + instrumentInfo.D_curtainr_value = tmp_float * toMeters; + if (loadNXDataSet(entry, "instrument/detector/curtainu", tmp_float)) + instrumentInfo.D_curtainu_value = tmp_float * toMeters; + if (loadNXDataSet(entry, "instrument/detector/curtaind", tmp_float)) + instrumentInfo.D_curtaind_value = tmp_float * toMeters; } } - source->setPos(0.0, 0.0, -L1_chopper_value); + return Geometry::Instrument_sptr(); + + /* + // instrument + Geometry::Instrument_sptr instrument = + boost::make_shared<Geometry::Instrument>("BILBY"); + instrument->setDefaultViewAxis("Z-"); + + // source + Geometry::ObjComponent *source = new Geometry::ObjComponent("Source", + instrument.get()); + instrument->add(source); + instrument->markAsSource(source); + + // sample + Geometry::ObjComponent *samplePos = new Geometry::ObjComponent("Sample", + instrument.get()); + instrument->add(samplePos); + instrument->markAsSamplePos(samplePos); + + source->setPos(0.0, 0.0, -instrumentInfo.L1_chopper_value); samplePos->setPos(0.0, 0.0, 0.0); // dimensions of the detector (height is in y direction, width is in x @@ -520,14 +594,6 @@ Geometry::Instrument_sptr LoadBBY::createInstrument(ANSTO::Tar::File &tarFile, double pixel_width = width / static_cast<double>(xPixelCount); double pixel_height = height / static_cast<double>(yPixelCount); - // adjusting for binning - auto diffPixelsCutOff = (pixelsCutOffL - pixelsCutOffH); - double detectorYOffset = static_cast<double>(diffPixelsCutOff) * pixel_height; - - yPixelCount = finalBinsY; - pixel_height *= static_cast<double>(tubeBinning); - height = pixel_height * static_cast<double>(finalBinsY); - // final number of pixels size_t pixelCount = xPixelCount * yPixelCount; @@ -543,19 +609,16 @@ Geometry::Instrument_sptr LoadBBY::createInstrument(ANSTO::Tar::File &tarFile, // http://www.mantidproject.org/HowToDefineGeometricShape for details on // shapes in Mantid. std::string detXML = - "<cuboid id=\"pixel\">" - "<left-front-bottom-point x=\"+" + - pixel_width_str + "\" y=\"-" + pixel_height_str + - "\" z=\"0\" />" - "<left-front-top-point x=\"+" + - pixel_width_str + "\" y=\"-" + pixel_height_str + "\" z=\"" + - pixel_depth_str + "\" />" - "<left-back-bottom-point x=\"-" + - pixel_width_str + "\" y=\"-" + pixel_height_str + - "\" z=\"0\" />" - "<right-front-bottom-point x=\"+" + - pixel_width_str + "\" y=\"+" + pixel_height_str + "\" z=\"0\" />" - "</cuboid>"; + "<cuboid id=\"pixel\">" + "<left-front-bottom-point x=\"+"+pixel_width_str+"\" + y=\"-"+pixel_height_str+"\" z=\"0\" />" + "<left-front-top-point x=\"+"+pixel_width_str+"\" + y=\"-"+pixel_height_str+"\" z=\""+pixel_depth_str+"\" />" + "<left-back-bottom-point x=\"-"+pixel_width_str+"\" + y=\"-"+pixel_height_str+"\" z=\"0\" />" + "<right-front-bottom-point x=\"+"+pixel_width_str+"\" + y=\"+"+pixel_height_str+"\" z=\"0\" />" + "</cuboid>"; // Create a shape object which will be shared by all pixels. Geometry::Object_sptr pixelShape = @@ -564,77 +627,83 @@ Geometry::Instrument_sptr LoadBBY::createInstrument(ANSTO::Tar::File &tarFile, // create detector banks BbyDetectorBankFactory factory( instrument, pixelShape, xPixelCount, yPixelCount, pixel_width, - pixel_height, - Kernel::V3D(0, (height - pixel_height) / 2 - detectorYOffset, 0)); + pixel_height, Kernel::V3D(0, (height - pixel_height) / 2, 0)); // curtain l factory.createAndAssign(0 * pixelCount, - Kernel::V3D(+D_curtainl_value, 0, L2_curtainl_value), + Kernel::V3D(+instrumentInfo.D_curtainl_value, 0, + instrumentInfo.L2_curtainl_value), Kernel::Quat(0, Kernel::V3D(0, 0, 1)) * Kernel::Quat(angle, Kernel::V3D(0, 1, 0))); // curtain r factory.createAndAssign(1 * pixelCount, - Kernel::V3D(-D_curtainr_value, 0, L2_curtainr_value), + Kernel::V3D(-instrumentInfo.D_curtainr_value, 0, + instrumentInfo.L2_curtainr_value), Kernel::Quat(180, Kernel::V3D(0, 0, 1)) * Kernel::Quat(angle, Kernel::V3D(0, 1, 0))); // curtain u factory.createAndAssign(2 * pixelCount, - Kernel::V3D(0, +D_curtainu_value, L2_curtainu_value), + Kernel::V3D(0, +instrumentInfo.D_curtainu_value, + instrumentInfo.L2_curtainu_value), Kernel::Quat(90, Kernel::V3D(0, 0, 1)) * Kernel::Quat(angle, Kernel::V3D(0, 1, 0))); // curtain d factory.createAndAssign(3 * pixelCount, - Kernel::V3D(0, -D_curtaind_value, L2_curtaind_value), + Kernel::V3D(0, -instrumentInfo.D_curtaind_value, + instrumentInfo.L2_curtaind_value), Kernel::Quat(-90, Kernel::V3D(0, 0, 1)) * Kernel::Quat(angle, Kernel::V3D(0, 1, 0))); // back 1 (left) factory.createAndAssign(4 * pixelCount, - Kernel::V3D(+D_det_value, 0, L2_det_value), + Kernel::V3D(+instrumentInfo.D_det_value, 0, + instrumentInfo.L2_det_value), Kernel::Quat(0, Kernel::V3D(0, 0, 1))); // back 2 (right) factory.createAndAssign(5 * pixelCount, - Kernel::V3D(-D_det_value, 0, L2_det_value), + Kernel::V3D(-instrumentInfo.D_det_value, 0, + instrumentInfo.L2_det_value), Kernel::Quat(180, Kernel::V3D(0, 0, 1))); return instrument; + */ } // load nx dataset template <class T> -bool LoadBBY::loadNXDataSet(T &value, NeXus::NXEntry &entry, - const std::string &path) { +bool LoadBBY::loadNXDataSet(NeXus::NXEntry &entry, const std::string &path, + T &value) { try { - // if (entry.isValid(path)) { - NeXus::NXDataSetTyped<T> dataSet = entry.openNXDataSet<float>(path); + NeXus::NXDataSetTyped<T> dataSet = entry.openNXDataSet<T>(path); dataSet.load(); value = *dataSet(); return true; - //} } catch (std::runtime_error &) { + return false; } - return false; } // read counts/events from binary file -template <class Counter> +template <class EventProcessor> void LoadBBY::loadEvents(API::Progress &prog, const char *progMsg, - ANSTO::Tar::File &file, const double tofMinBoundary, - const double tofMaxBoundary, Counter &counter) { + ANSTO::Tar::File &tarFile, + EventProcessor &eventProcessor) { prog.doReport(progMsg); + bool countsInFrame = false; + // select bin file int64_t fileSize = 0; - const std::vector<std::string> &files = file.files(); + const std::vector<std::string> &files = tarFile.files(); for (auto itr = files.begin(); itr != files.end(); ++itr) if (itr->rfind(".bin") == itr->length() - 4) { - file.select(itr->c_str()); - fileSize = file.selected_size(); + tarFile.select(itr->c_str()); + fileSize = tarFile.selected_size(); break; } @@ -650,12 +719,12 @@ void LoadBBY::loadEvents(API::Progress &prog, const char *progMsg, unsigned int dt = 0; double tof = 0.0; - if ((fileSize == 0) || !file.skip(128)) + if ((fileSize == 0) || !tarFile.skip(128)) return; int state = 0; unsigned int c; - while ((c = (unsigned int)file.read_byte()) != (unsigned int)-1) { + while ((c = (unsigned int)tarFile.read_byte()) != (unsigned int)-1) { bool event_ended = false; switch (state) { @@ -697,104 +766,27 @@ void LoadBBY::loadEvents(API::Progress &prog, const char *progMsg, if ((x == 0) && (y == 0) && (dt == 0xFFFFFFFF)) { tof = 0.0; + + // only count frames that contain neutrons + if (countsInFrame) { + eventProcessor.endOfFrame(); + countsInFrame = false; + } } else if ((x >= HISTO_BINS_X) || (y >= HISTO_BINS_Y)) { } else { // conversion from 100 nanoseconds to 1 microsecond tof += ((int)dt) * 0.1; - if ((tofMinBoundary <= tof) && (tof <= tofMaxBoundary)) - counter.addEvent(x, y, tof); + eventProcessor.addEvent(x, y, tof); + countsInFrame = true; } - progTracker.update(file.selected_position()); + progTracker.update(tarFile.selected_position()); } } -} - -// load mask file -std::vector<bool> LoadBBY::createMaskVector(const std::string &filename, - bool &fileLoaded) { - std::vector<bool> result(HISTO_BINS_X * HISTO_BINS_Y, true); - - std::ifstream input(filename.c_str()); - if (input.good()) { - std::string line; - while (std::getline(input, line)) { - - auto i0 = line.find("<detids>"); - auto iN = line.find("</detids>"); - - if ((i0 != std::string::npos) && (iN != std::string::npos) && (i0 < iN)) { - - line = line.substr(i0 + 8, iN - i0 - 8); - std::stringstream ss(line); - - std::string item; - while (std::getline(ss, item, ',')) { - auto k = item.find('-'); - - size_t p0, p1; - if (k != std::string::npos) { - p0 = boost::lexical_cast<size_t>(item.substr(0, k)); - p1 = boost::lexical_cast<size_t>( - item.substr(k + 1, item.size() - k - 1)); - - if (p0 > p1) - std::swap(p0, p1); - } else { - p0 = boost::lexical_cast<size_t>(item); - p1 = p0; - } - - if (p0 < result.size()) { - - if (p1 >= result.size()) - p1 = result.size() - 1; - - while (p0 <= p1) - result[p0++] = false; - } - } - } - } - fileLoaded = true; - } else { - fileLoaded = false; - } - return result; -} - -// load tube offset file -std::vector<int> LoadBBY::createOffsetVector(const std::string &filename, - bool &fileLoaded) { - std::vector<int> result(HISTO_BINS_X, 0); - - std::ifstream input(filename.c_str()); - if (input.good()) { - std::string line; - while (std::getline(input, line)) { - auto i1 = line.find_first_of(",;"); - if (i1 == std::string::npos) - continue; - - auto i2 = line.find_first_of(",;", i1 + 1); - if (i2 == std::string::npos) - i2 = line.size(); - - size_t index = boost::lexical_cast<size_t>(line.substr(0, i1)); - int offset = - boost::lexical_cast<int>(line.substr(i1 + 1, line.size() - i1 - 1)); - - if (index < HISTO_BINS_X) - result[index] = offset; - } - fileLoaded = true; - } else { - fileLoaded = false; - } - - return result; + if (countsInFrame) + eventProcessor.endOfFrame(); } // DetectorBankFactory @@ -811,7 +803,8 @@ void BbyDetectorBankFactory::createAndAssign(size_t startIndex, // create a RectangularDetector which represents a rectangular array of pixels Geometry::RectangularDetector *bank = new Geometry::RectangularDetector( "bank", - m_instrument.get()); // ??? possible memory leak!? "new" without "delete" + m_instrument.get()); // Bank gets registered with instrument component. + // instrument acts as sink and manages lifetime. bank->initialize(m_pixelShape, // x @@ -831,5 +824,6 @@ void BbyDetectorBankFactory::createAndAssign(size_t startIndex, bank->rotate(rot); bank->translate(pos - center); } -} // namespace -} // namespace \ No newline at end of file + +} // DataHandling +} // Mantid \ No newline at end of file diff --git a/Framework/DataHandling/src/LoadEventPreNexus.cpp b/Framework/DataHandling/src/LoadEventPreNexus.cpp index 2024d53cfc9d8ec6fb544ab442cc61e4e262c815..43f73c8f10abe5c91fba36406380bfab82c5570c 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus.cpp @@ -26,7 +26,6 @@ #include <sstream> #include <stdexcept> #include <functional> -#include <iostream> #include <set> #include <vector> #include <Poco/File.h> diff --git a/Framework/DataHandling/src/LoadEventPreNexus2.cpp b/Framework/DataHandling/src/LoadEventPreNexus2.cpp index e50dd9c66b0d7d2a6543b327d8ac164224da4dbc..0b44191476242498ef428a714124c880ef33881c 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus2.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus2.cpp @@ -3,7 +3,6 @@ #include <sstream> #include <stdexcept> #include <functional> -#include <iostream> #include <set> #include <vector> #include <Poco/File.h> diff --git a/Framework/DataHandling/src/LoadGSS.cpp b/Framework/DataHandling/src/LoadGSS.cpp index 9ddea8c26c208e5ff974ed8f0dda42b49d17186a..eb228a845fad9e75f85288cf57e9aac4b2626faf 100644 --- a/Framework/DataHandling/src/LoadGSS.cpp +++ b/Framework/DataHandling/src/LoadGSS.cpp @@ -14,10 +14,8 @@ #include <boost/math/special_functions/fpclassify.hpp> #include <Poco/File.h> -#include <iostream> #include <fstream> #include <sstream> -#include <iomanip> using namespace Mantid::DataHandling; using namespace Mantid::API; @@ -35,7 +33,8 @@ DECLARE_FILELOADER_ALGORITHM(LoadGSS) * be used */ int LoadGSS::confidence(Kernel::FileDescriptor &descriptor) const { - if (!descriptor.isAscii()) + + if (!descriptor.isAscii() || descriptor.extension() == ".tar") return 0; std::string str; diff --git a/Framework/DataHandling/src/LoadILL.cpp b/Framework/DataHandling/src/LoadILL.cpp index 0f84c252a6f86a32fa9d6b811cc2a0ead98442ae..402c72e967211aaf27eb2c52f5d8053d50008cbf 100644 --- a/Framework/DataHandling/src/LoadILL.cpp +++ b/Framework/DataHandling/src/LoadILL.cpp @@ -14,7 +14,6 @@ #include <limits> #include <algorithm> -#include <iostream> #include <vector> #include <cmath> diff --git a/Framework/DataHandling/src/LoadILLIndirect.cpp b/Framework/DataHandling/src/LoadILLIndirect.cpp index 30c647209dfe11825a329fc814826eee2d9cabad..269c04e8bb0d431f50218baa900ddf5c6a1b34f9 100644 --- a/Framework/DataHandling/src/LoadILLIndirect.cpp +++ b/Framework/DataHandling/src/LoadILLIndirect.cpp @@ -7,8 +7,6 @@ #include <boost/algorithm/string.hpp> #include <nexus/napi.h> -#include <iostream> -#include <iomanip> // std::setw namespace Mantid { namespace DataHandling { diff --git a/Framework/DataHandling/src/LoadILLReflectometry.cpp b/Framework/DataHandling/src/LoadILLReflectometry.cpp index 2230840c96f62720f70a4ad9adf2b59c79a773ce..18a7f5888d66210f3d3a443a45e13b9af4673e42 100644 --- a/Framework/DataHandling/src/LoadILLReflectometry.cpp +++ b/Framework/DataHandling/src/LoadILLReflectometry.cpp @@ -13,7 +13,6 @@ #include <algorithm> #include <nexus/napi.h> -#include <iostream> namespace Mantid { namespace DataHandling { diff --git a/Framework/DataHandling/src/LoadISISNexus.cpp b/Framework/DataHandling/src/LoadISISNexus.cpp deleted file mode 100644 index a7400ce969278369234a51b1fb93c362a7886a98..0000000000000000000000000000000000000000 --- a/Framework/DataHandling/src/LoadISISNexus.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- -#include "MantidDataHandling/LoadISISNexus.h" -#include "MantidKernel/ArrayProperty.h" - -namespace Mantid { -namespace DataHandling { -// Register the algorithm into the algorithm factory -DECLARE_ALGORITHM(LoadISISNexus) - -using namespace Kernel; -using namespace API; - -LoadISISNexus::LoadISISNexus() : Algorithm(), DeprecatedAlgorithm() { - useAlgorithm("LoadISISNexus", 2); -} - -/** Initialises the algorithm with the properties as they were when this - * algorithm was removed from Mantid, - * though all validators have been removed - */ -void LoadISISNexus::init() { - // Leaving the properties as they were when the algorithm body was removed, - // but with validation removed so that people reach the error message in exec - // more easily. - declareProperty("Filename", "", "The name of the Nexus file to load"); - declareProperty(new WorkspaceProperty<Workspace>("OutputWorkspace", "None", - Direction::Output)); - - declareProperty("SpectrumMin", 0); - declareProperty("SpectrumMax", Mantid::EMPTY_INT()); - declareProperty(new ArrayProperty<int>("SpectrumList")); - declareProperty("EntryNumber", 0, "0 indicates that every entry is loaded " - "into a separate workspace within a group. " - "A positive number identifies one entry to " - "be loaded into one worskspace"); -} - -/** Prints a message indicating that this algorithm has been removed. - * @throw Exception::NotImplementedError Always - */ -void LoadISISNexus::exec() { - throw Kernel::Exception::NotImplementedError( - "This version of LoadISISNexus has been removed from Mantid. " - "You should use the current version of this algorithm or try an earlier " - "release of Mantid."); -} - -} // namespace DataHandling -} // namespace Mantid diff --git a/Framework/DataHandling/src/LoadInstrument.cpp b/Framework/DataHandling/src/LoadInstrument.cpp index 595dd5d8b1c2906242d08febb2bf4590341193ea..6337801bb66a5e8918a61ebe4f0d90f6ef65c258 100644 --- a/Framework/DataHandling/src/LoadInstrument.cpp +++ b/Framework/DataHandling/src/LoadInstrument.cpp @@ -20,7 +20,6 @@ #include <Poco/Exception.h> #include <sstream> #include <fstream> -#include <iostream> #include "MantidGeometry/Instrument/InstrumentDefinitionParser.h" using Poco::XML::DOMParser; diff --git a/Framework/DataHandling/src/LoadIsawDetCal.cpp b/Framework/DataHandling/src/LoadIsawDetCal.cpp index 99294d57ece947559d6331666732392507341ad8..5a7ddf61096bc0e18243b50d626eb116159d9055 100644 --- a/Framework/DataHandling/src/LoadIsawDetCal.cpp +++ b/Framework/DataHandling/src/LoadIsawDetCal.cpp @@ -21,7 +21,6 @@ #include <fstream> #include <numeric> #include <cmath> -#include <iomanip> #include "MantidAPI/WorkspaceValidators.h" namespace Mantid { diff --git a/Framework/DataHandling/src/LoadLLB.cpp b/Framework/DataHandling/src/LoadLLB.cpp index 353f8ccc8b4a1e89701592f71f6d6220277b99be..bc37e7062bcefcc6c1ebd042366bd6936c0577ed 100644 --- a/Framework/DataHandling/src/LoadLLB.cpp +++ b/Framework/DataHandling/src/LoadLLB.cpp @@ -7,7 +7,6 @@ #include <limits> #include <algorithm> -#include <iostream> #include <vector> #include <cmath> diff --git a/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp b/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp index 7327e048fb6445863854111b7e63a2c31c916939..f6ec882919c2a00f79be240fba05634083782134 100644 --- a/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp +++ b/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp @@ -4,7 +4,6 @@ #include "MantidAPI/FileProperty.h" #include "MantidKernel/ConfigService.h" -#include <iostream> #include <fstream> #include <sys/stat.h> #include <sstream> diff --git a/Framework/DataHandling/src/LoadMLZ.cpp b/Framework/DataHandling/src/LoadMLZ.cpp index 7d2b4b9c94d561a71d319cf29b3a54fe74b5dda5..7f516fd0b87c3293659a9716d160ed8fe7c53742 100644 --- a/Framework/DataHandling/src/LoadMLZ.cpp +++ b/Framework/DataHandling/src/LoadMLZ.cpp @@ -12,7 +12,6 @@ #include <limits> #include <algorithm> -#include <iostream> #include <vector> #include <cmath> //----------------------------------------------------------------------- diff --git a/Framework/DataHandling/src/LoadPreNexusMonitors.cpp b/Framework/DataHandling/src/LoadPreNexusMonitors.cpp index af5cce8e457c5ff57dc471f3558ac0ee03913784..2ab2dd8416b18d698b3197865c85cf8f8036ce1a 100644 --- a/Framework/DataHandling/src/LoadPreNexusMonitors.cpp +++ b/Framework/DataHandling/src/LoadPreNexusMonitors.cpp @@ -1,7 +1,6 @@ #include <cmath> #include <cstdlib> #include <fstream> -#include <iostream> #include <iterator> #include "MantidDataHandling/LoadPreNexusMonitors.h" diff --git a/Framework/DataHandling/src/LoadQKK.cpp b/Framework/DataHandling/src/LoadQKK.cpp index 859b592c087dcf441b7443d5963c1562b2e607eb..316cffc185ab4b6e02656661ef7d28664ddee6ac 100644 --- a/Framework/DataHandling/src/LoadQKK.cpp +++ b/Framework/DataHandling/src/LoadQKK.cpp @@ -14,9 +14,7 @@ #include <boost/math/special_functions/fpclassify.hpp> #include <Poco/File.h> -#include <iostream> #include <fstream> -#include <iomanip> using namespace Mantid::DataHandling; using namespace Mantid::API; diff --git a/Framework/DataHandling/src/LoadRaw.cpp b/Framework/DataHandling/src/LoadRaw.cpp deleted file mode 100644 index ca9bc9a017349310a1bea542b1bd6fbda2a42ecf..0000000000000000000000000000000000000000 --- a/Framework/DataHandling/src/LoadRaw.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- -#include "MantidDataHandling/LoadRaw.h" -#include "MantidKernel/ArrayProperty.h" - -namespace Mantid { -namespace DataHandling { -// Register the algorithm into the algorithm factory -DECLARE_ALGORITHM(LoadRaw) - -using namespace Kernel; -using namespace API; - -/// Empty default constructor -LoadRaw::LoadRaw() : Algorithm(), DeprecatedAlgorithm() { - useAlgorithm("LoadRaw", 3); -} - -/** Initialises the algorithm with the properties as they were when this - * algorithm was removed from Mantid, - * though all validators have been removed - */ -void LoadRaw::init() { - declareProperty( - "Filename", "", - "The name of the RAW file to read, including its full or relative\n" - "path. (N.B. case sensitive if running on Linux)."); - declareProperty( - new WorkspaceProperty<>("OutputWorkspace", "None", Direction::Output), - "The name of the workspace that will be created, filled with the\n" - "read-in data and stored in the Analysis Data Service. If the input\n" - "RAW file contains multiple periods higher periods will be stored in\n" - "separate workspaces called OutputWorkspace_PeriodNo."); - - declareProperty( - new PropertyWithValue<specid_t>("SpectrumMin", 1), - "The index number of the first spectrum to read. Only used if\n" - "spectrum_max is set."); - declareProperty( - new PropertyWithValue<specid_t>("SpectrumMax", Mantid::EMPTY_INT()), - "The number of the last spectrum to read. Only used if explicitly\n" - "set."); - - declareProperty( - new ArrayProperty<specid_t>("SpectrumList"), - "A comma-separated list of individual spectra to read. Only used if\n" - "explicitly set."); -} - -/** Prints a message indicating that this algorithm has been removed. - * @throw Exception::NotImplementedError Always - */ -void LoadRaw::exec() { - throw Kernel::Exception::NotImplementedError( - "This version of LoadRaw has been removed from Mantid. " - "You should use the current version of this algorithm or try an earlier " - "release of Mantid."); -} - -} // namespace DataHandling -} // namespace Mantid diff --git a/Framework/DataHandling/src/LoadRaw2.cpp b/Framework/DataHandling/src/LoadRaw2.cpp deleted file mode 100644 index 6274b56e56cbf2b208626f48866e1ec12a6f1cdb..0000000000000000000000000000000000000000 --- a/Framework/DataHandling/src/LoadRaw2.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- -#include "MantidDataHandling/LoadRaw2.h" -#include "MantidKernel/ArrayProperty.h" -#include "MantidKernel/ListValidator.h" - -namespace Mantid { -namespace DataHandling { -// Register the algorithm into the algorithm factory -DECLARE_ALGORITHM(LoadRaw2) - -using namespace Kernel; -using namespace API; - -/// Empty default constructor -LoadRaw2::LoadRaw2() : Algorithm(), DeprecatedAlgorithm() { - useAlgorithm("LoadRaw", 3); -} - -/** Initialises the algorithm with the properties as they were when this - * algorithm was removed from Mantid, - * though all validators have been removed - */ -void LoadRaw2::init() { - declareProperty( - "Filename", "", - "The name of the RAW file to read, including its full or relative\n" - "path. (N.B. case sensitive if running on Linux)."); - declareProperty( - new WorkspaceProperty<>("OutputWorkspace", "None", Direction::Output), - "The name of the workspace that will be created, filled with the\n" - "read-in data and stored in the Analysis Data Service. If the input\n" - "RAW file contains multiple periods higher periods will be stored in\n" - "separate workspaces called OutputWorkspace_PeriodNo."); - - declareProperty( - "SpectrumMin", 1, - "The index number of the first spectrum to read. Only used if\n" - "spectrum_max is set."); - declareProperty( - "SpectrumMax", Mantid::EMPTY_INT(), - "The number of the last spectrum to read. Only used if explicitly\n" - "set."); - - declareProperty( - new ArrayProperty<specid_t>("SpectrumList"), - "A comma-separated list of individual spectra to read. Only used if\n" - "explicitly set."); - std::vector<std::string> m_cache_options; - m_cache_options.push_back("If Slow"); - m_cache_options.push_back("Always"); - m_cache_options.push_back("Never"); - declareProperty("Cache", "If Slow", - boost::make_shared<StringListValidator>(m_cache_options)); -} - -/** Prints a message indicating that this algorithm has been removed. - * @throw Exception::NotImplementedError Always - */ -void LoadRaw2::exec() { - throw Kernel::Exception::NotImplementedError( - "This version of LoadRaw has been removed from Mantid. " - "You should use the current version of this algorithm or try an earlier " - "release of Mantid."); -} - -} // namespace DataHandling -} // namespace Mantid diff --git a/Framework/DataHandling/src/LoadSINQFocus.cpp b/Framework/DataHandling/src/LoadSINQFocus.cpp index 096ebd88e5a0502a09025304770cc026c29b3071..59d15f805e84b121b1cac833ae5131c78b734f68 100644 --- a/Framework/DataHandling/src/LoadSINQFocus.cpp +++ b/Framework/DataHandling/src/LoadSINQFocus.cpp @@ -7,7 +7,6 @@ #include <limits> #include <algorithm> -#include <iostream> #include <vector> #include <cmath> diff --git a/Framework/DataHandling/src/LoadSpice2D.cpp b/Framework/DataHandling/src/LoadSpice2D.cpp index d3c4216fa836dbe4bd7ea0bcd2247be394cf0207..79219379943c9564c7345614c2e7ff3a7af5bb46 100644 --- a/Framework/DataHandling/src/LoadSpice2D.cpp +++ b/Framework/DataHandling/src/LoadSpice2D.cpp @@ -23,7 +23,6 @@ #include <Poco/DOM/Text.h> #include <Poco/SAX/InputSource.h> -#include <iostream> //----------------------------------------------------------------------- using Poco::XML::DOMParser; diff --git a/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp b/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp index 583264085f922631fb3505eb62e172d38e053824..5defd4a05be97697762812dec559c5e255ca7bf5 100644 --- a/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp +++ b/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp @@ -602,6 +602,9 @@ bool LoadSpiceXML2DDet::getHB3AWavelength(MatrixWorkspace_sptr dataws, if (fabs(m1pos - (-25.870000)) < 0.2) { wavelength = 1.003; haswavelength = true; + } else if (fabs(m1pos - (-39.17)) < 0.2) { + wavelength = 1.5424; + haswavelength = true; } else { g_log.warning() << "m1 position " << m1pos << " does not have defined mapping to " @@ -615,6 +618,9 @@ bool LoadSpiceXML2DDet::getHB3AWavelength(MatrixWorkspace_sptr dataws, if (fabs(m1pos - (-25.870000)) < 0.2) { wavelength = 1.003; haswavelength = true; + } else if (fabs(m1pos - (-39.17)) < 0.2) { + wavelength = 1.5424; + haswavelength = true; } else { g_log.warning() << "m1 position " << m1pos << " does not have defined mapping to " diff --git a/Framework/DataHandling/src/SNSDataArchive.cpp b/Framework/DataHandling/src/SNSDataArchive.cpp index 6045f308b664750a869d738b3239a9e859e8664a..028dcde170b592a6ae3672ea4e844d60a827ab44 100644 --- a/Framework/DataHandling/src/SNSDataArchive.cpp +++ b/Framework/DataHandling/src/SNSDataArchive.cpp @@ -1,7 +1,6 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include <iostream> #include <sstream> #include "MantidKernel/Logger.h" diff --git a/Framework/DataHandling/src/SaveCSV.cpp b/Framework/DataHandling/src/SaveCSV.cpp index 9cef6163fd73f6052987747645028d5bd93f5eaf..d73643c83010381ad103c3e75ae2cd31ff594d64 100644 --- a/Framework/DataHandling/src/SaveCSV.cpp +++ b/Framework/DataHandling/src/SaveCSV.cpp @@ -27,7 +27,6 @@ #include "MantidAPI/FileProperty.h" #include <fstream> // used to get ofstream -#include <iomanip> // setw() used below /* @class SaveCSV diff --git a/Framework/DataHandling/src/SaveFocusedXYE.cpp b/Framework/DataHandling/src/SaveFocusedXYE.cpp index 6da1189b5b82f5fe19fca15a3d58cf30a1c26d19..f6b917b15e21d2aaf92d1af68e3434b3aeae611a 100644 --- a/Framework/DataHandling/src/SaveFocusedXYE.cpp +++ b/Framework/DataHandling/src/SaveFocusedXYE.cpp @@ -8,7 +8,6 @@ #include <Poco/File.h> #include <Poco/Path.h> #include <fstream> -#include <iomanip> #include <cmath> #include <exception> diff --git a/Framework/DataHandling/src/SaveFullprofResolution.cpp b/Framework/DataHandling/src/SaveFullprofResolution.cpp index 057694d26f34084f38d9c9d58927a26df9275549..5ef18d5b0dbb77ae0f8b397b478ff89c5fc6c910 100644 --- a/Framework/DataHandling/src/SaveFullprofResolution.cpp +++ b/Framework/DataHandling/src/SaveFullprofResolution.cpp @@ -8,7 +8,6 @@ #include <boost/algorithm/string.hpp> #include <Poco/File.h> -#include <iomanip> #include <fstream> using namespace Mantid; diff --git a/Framework/DataHandling/src/SaveGSS.cpp b/Framework/DataHandling/src/SaveGSS.cpp index d3e1cb6520fd1fc1fb7a60533ab44baabbaf435b..460f326f800f6ccb0538b63aa49f9b59740bf633 100644 --- a/Framework/DataHandling/src/SaveGSS.cpp +++ b/Framework/DataHandling/src/SaveGSS.cpp @@ -11,7 +11,6 @@ #include <Poco/File.h> #include <Poco/Path.h> #include <fstream> -#include <iomanip> namespace Mantid { namespace DataHandling { diff --git a/Framework/DataHandling/src/SaveNISTDAT.cpp b/Framework/DataHandling/src/SaveNISTDAT.cpp index 38441e68e44ab90d19fe8c73af59ecc541a6a458..0b32dc7d6dcf8e41fed88f6c0715e9cdc582aa21 100644 --- a/Framework/DataHandling/src/SaveNISTDAT.cpp +++ b/Framework/DataHandling/src/SaveNISTDAT.cpp @@ -5,7 +5,6 @@ #include "MantidAPI/FileProperty.h" #include "MantidAPI/WorkspaceValidators.h" #include <fstream> // used to get ofstream -#include <iostream> namespace Mantid { namespace DataHandling { diff --git a/Framework/DataHandling/src/SavePAR.cpp b/Framework/DataHandling/src/SavePAR.cpp index d318f94f549b5072121b412dc0b0a41673fd668e..bf4ea3d2395a941f182cc0b72ebe719a69d24fa9 100644 --- a/Framework/DataHandling/src/SavePAR.cpp +++ b/Framework/DataHandling/src/SavePAR.cpp @@ -8,7 +8,6 @@ #include <cstdio> #include <fstream> -#include <iomanip> namespace Mantid { namespace DataHandling { diff --git a/Framework/DataHandling/src/SavePDFGui.cpp b/Framework/DataHandling/src/SavePDFGui.cpp index e6c1c2e622d94e525fbce57e4fd959bd4243b81f..5afcbc2d76bcc9e1aef9f24b8b38b8bf08d609fc 100644 --- a/Framework/DataHandling/src/SavePDFGui.cpp +++ b/Framework/DataHandling/src/SavePDFGui.cpp @@ -2,7 +2,6 @@ #include "MantidAPI/FileProperty.h" #include "MantidKernel/MantidVersion.h" #include <fstream> -#include <iomanip> namespace Mantid { namespace DataHandling { diff --git a/Framework/DataHandling/src/SavePHX.cpp b/Framework/DataHandling/src/SavePHX.cpp index 7c221896f8be4c88e1ae055a6dfd1bfad7bb027c..579ba691415232329674dca274aee32009a4a907 100644 --- a/Framework/DataHandling/src/SavePHX.cpp +++ b/Framework/DataHandling/src/SavePHX.cpp @@ -8,7 +8,6 @@ #include <cstdio> #include <fstream> -#include <iomanip> namespace Mantid { namespace DataHandling { diff --git a/Framework/DataHandling/src/SaveRKH.cpp b/Framework/DataHandling/src/SaveRKH.cpp index 33316a700ba158eaf07f5d19761ebac94d586452..0caf9bc73b08d734b1e07e9cdeb799c9b1501e43 100644 --- a/Framework/DataHandling/src/SaveRKH.cpp +++ b/Framework/DataHandling/src/SaveRKH.cpp @@ -7,8 +7,6 @@ #include <Poco/LocalDateTime.h> #include <Poco/DateTimeFormatter.h> -#include <iomanip> - namespace Mantid { namespace DataHandling { diff --git a/Framework/DataHandling/test/AppendGeometryToSNSNexusTest.h b/Framework/DataHandling/test/AppendGeometryToSNSNexusTest.h index 14df378e7575cd321a132031ccc29bc906eaf5c7..4d8dc7386436b7b97358ec94991e4a70882f9fba 100644 --- a/Framework/DataHandling/test/AppendGeometryToSNSNexusTest.h +++ b/Framework/DataHandling/test/AppendGeometryToSNSNexusTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataHandling/AppendGeometryToSNSNexus.h" diff --git a/Framework/DataHandling/test/CompressEventsTest.h b/Framework/DataHandling/test/CompressEventsTest.h index 5523f08c4afc2f2f2e63b86e0f509ce66a691392..1c2981657a414f0a56850c200ced1b9dd6c6afd6 100644 --- a/Framework/DataHandling/test/CompressEventsTest.h +++ b/Framework/DataHandling/test/CompressEventsTest.h @@ -6,7 +6,6 @@ #include "MantidDataHandling/CompressEvents.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include <iostream> using Mantid::MantidVecPtr; using namespace Mantid::Kernel; diff --git a/Framework/DataHandling/test/DetermineChunkingTest.h b/Framework/DataHandling/test/DetermineChunkingTest.h index cf2f5bc2c6142c456743d6c3c3f6b48c668245e7..b15a648fa30b8751bfc4dd1e4ccfe52778001314 100644 --- a/Framework/DataHandling/test/DetermineChunkingTest.h +++ b/Framework/DataHandling/test/DetermineChunkingTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataHandling/DetermineChunking.h" #include "MantidDataObjects/TableWorkspace.h" diff --git a/Framework/DataHandling/test/DownloadInstrumentTest.h b/Framework/DataHandling/test/DownloadInstrumentTest.h index 587b9fe1e47fa6d085dcb43ab83413d70280e5bd..fb5e0e482000d0a8efb3dc50aa4abd9157edb68f 100644 --- a/Framework/DataHandling/test/DownloadInstrumentTest.h +++ b/Framework/DataHandling/test/DownloadInstrumentTest.h @@ -10,7 +10,6 @@ #include <Poco/File.h> #include <Poco/Path.h> -#include <iostream> #include <fstream> #include <string> #include <cstdio> diff --git a/Framework/DataHandling/test/FilterEventsByLogValuePreNexusTest.h b/Framework/DataHandling/test/FilterEventsByLogValuePreNexusTest.h index 7cc915f7298bcff463344a31afe7092aca1f0791..0358926efa0edbd7bb46be3308424b57a6816aab 100644 --- a/Framework/DataHandling/test/FilterEventsByLogValuePreNexusTest.h +++ b/Framework/DataHandling/test/FilterEventsByLogValuePreNexusTest.h @@ -16,7 +16,6 @@ #include "MantidKernel/TimeSeriesProperty.h" #include "MantidDataHandling/FilterEventsByLogValuePreNexus.h" #include <cxxtest/TestSuite.h> -#include <iostream> #include <Poco/File.h> using namespace Mantid::Geometry; diff --git a/Framework/DataHandling/test/GenerateGroupingPowderTest.h b/Framework/DataHandling/test/GenerateGroupingPowderTest.h index f4476d6057a04f38bdc8625385be0f707aba919b..85b0c8fd37dfbeccc5609b5f5a3629e7697c4e76 100644 --- a/Framework/DataHandling/test/GenerateGroupingPowderTest.h +++ b/Framework/DataHandling/test/GenerateGroupingPowderTest.h @@ -4,9 +4,7 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> #include <fstream> -#include <iomanip> #include "MantidDataHandling/LoadEmptyInstrument.h" #include "MantidDataHandling/GenerateGroupingPowder.h" #include "MantidDataHandling/LoadDetectorsGroupingFile.h" diff --git a/Framework/DataHandling/test/GroupDetectors2Test.h b/Framework/DataHandling/test/GroupDetectors2Test.h index f6ba151d45ebaedfe3a48131cb3c9b2679f17451..0d1e297b86b85bdcfa52639486b6ebd40fd985f5 100644 --- a/Framework/DataHandling/test/GroupDetectors2Test.h +++ b/Framework/DataHandling/test/GroupDetectors2Test.h @@ -15,7 +15,6 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <cxxtest/TestSuite.h> #include <fstream> -#include <iostream> #include <numeric> #include <Poco/Path.h> #include "MantidDataHandling/MaskDetectors.h" diff --git a/Framework/DataHandling/test/GroupDetectorsTest.h b/Framework/DataHandling/test/GroupDetectorsTest.h index a8f801e769a6919c2e945e1ae44c0284e07ff4bf..ab826382895e670051a5c6cfda66279e687afb20 100644 --- a/Framework/DataHandling/test/GroupDetectorsTest.h +++ b/Framework/DataHandling/test/GroupDetectorsTest.h @@ -11,7 +11,6 @@ #include "MantidGeometry/Instrument.h" #include "MantidGeometry/Instrument/Detector.h" #include "MantidGeometry/Instrument/DetectorGroup.h" -#include <iostream> using Mantid::DataHandling::GroupDetectors; using Mantid::MantidVecPtr; diff --git a/Framework/DataHandling/test/LoadBBYTest.h b/Framework/DataHandling/test/LoadBBYTest.h index 6973745e264c5711c144529a3972117a43986d5e..106c4df0a8472782e522fa28e359e0054f29e988 100644 --- a/Framework/DataHandling/test/LoadBBYTest.h +++ b/Framework/DataHandling/test/LoadBBYTest.h @@ -21,45 +21,101 @@ using namespace Mantid::DataObjects; class LoadBBYTest : public CxxTest::TestSuite { public: - void testInit() { + void test_load_bby_algorithm_init() { + LoadBBY algToBeTested; + TS_ASSERT_THROWS_NOTHING(algToBeTested.initialize()); TS_ASSERT(algToBeTested.isInitialized()); } - // test loading of bilby dataset - void testExec() { + void test_load_bby_algorithm() { + LoadBBY algToBeTested; + if (!algToBeTested.isInitialized()) algToBeTested.initialize(); - outputSpace = "LoadBBYTest"; + std::string outputSpace = "LoadBBYTest"; algToBeTested.setPropertyValue("OutputWorkspace", outputSpace); - // Should fail because mandatory parameter has not been set + // should fail because mandatory parameter has not been set TS_ASSERT_THROWS(algToBeTested.execute(), std::runtime_error); - inputFile = "BBY0000014.tar"; + // should succeed now + std::string inputFile = "BBY0000014.tar"; algToBeTested.setPropertyValue("Filename", inputFile); TS_ASSERT_THROWS_NOTHING(algToBeTested.execute()); TS_ASSERT(algToBeTested.isExecuted()); - // get workspace generated + // get workspace generated MatrixWorkspace_sptr output = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>( outputSpace); - // test it is as expected + // check number of histograms TS_ASSERT_EQUALS(output->getNumberHistograms(), 61440); double sum = 0.0; for (size_t i = 0; i < output->getNumberHistograms(); i++) sum += output->readY(i)[0]; sum *= 1.0e22; TS_ASSERT_DELTA(sum / 1.0E27, 2.0, 0.0001); - } -private: - LoadBBY algToBeTested; - std::string inputFile; - std::string outputSpace; + // check that all required log values are there + auto run = output->run(); + + // test start and end time + TS_ASSERT( + run.getProperty("start_time")->value().compare("2000-01-01T00:00:00") == + 0) + TS_ASSERT( + run.getProperty("end_time")->value().compare("2000-01-01T00:00:00") == + 0) + + // test data properties + TS_ASSERT_EQUALS(run.getPropertyValueAsType<int>("att_pos"), 1); + TS_ASSERT_EQUALS(run.getPropertyValueAsType<int>("frame_count"), 4); + TS_ASSERT_DELTA(run.getPropertyValueAsType<double>("period"), 0, 1.0e-5); + TS_ASSERT_DELTA(run.getPropertyValueAsType<double>("bm_counts"), 0, 1.0e-5); + + // test instrument setup + TS_ASSERT_DELTA(dynamic_cast<TimeSeriesProperty<double> *>( + run.getProperty("L1_chopper_value"))->firstValue(), + 18.4726, 1.0e-3); + + TS_ASSERT_DELTA(dynamic_cast<TimeSeriesProperty<double> *>( + run.getProperty("L2_det_value"))->firstValue(), + 33.1562, 1.0e-3); + TS_ASSERT_DELTA(dynamic_cast<TimeSeriesProperty<double> *>( + run.getProperty("L2_curtainl_value"))->firstValue(), + 23.2845, 1.0e-3); + TS_ASSERT_DELTA(dynamic_cast<TimeSeriesProperty<double> *>( + run.getProperty("L2_curtainr_value"))->firstValue(), + 23.2820, 1.0e-3); + TS_ASSERT_DELTA(dynamic_cast<TimeSeriesProperty<double> *>( + run.getProperty("L2_curtainu_value"))->firstValue(), + 24.2862, 1.0e-3); + TS_ASSERT_DELTA(dynamic_cast<TimeSeriesProperty<double> *>( + run.getProperty("L2_curtaind_value"))->firstValue(), + 24.2824, 1.0e-3); + + TS_ASSERT_DELTA(dynamic_cast<TimeSeriesProperty<double> *>( + run.getProperty("D_det_value"))->firstValue(), + 0.0052, 1.0e-4); + TS_ASSERT_DELTA(dynamic_cast<TimeSeriesProperty<double> *>( + run.getProperty("D_curtainl_value"))->firstValue(), + 0.3816, 1.0e-4); + TS_ASSERT_DELTA(dynamic_cast<TimeSeriesProperty<double> *>( + run.getProperty("D_curtainr_value"))->firstValue(), + 0.4024, 1.0e-4); + TS_ASSERT_DELTA(dynamic_cast<TimeSeriesProperty<double> *>( + run.getProperty("D_curtainu_value"))->firstValue(), + 0.3947, 1.0e-4); + TS_ASSERT_DELTA(dynamic_cast<TimeSeriesProperty<double> *>( + run.getProperty("D_curtaind_value"))->firstValue(), + 0.3978, 1.0e-4); + TS_ASSERT_DELTA(dynamic_cast<TimeSeriesProperty<double> *>( + run.getProperty("curtain_rotation"))->firstValue(), + 10, 1.0e-7); + } }; #endif /*LoadBBYTEST_H_*/ diff --git a/Framework/DataHandling/test/LoadCalFileTest.h b/Framework/DataHandling/test/LoadCalFileTest.h index c673ee55dff66f2722883ff3ddc8939cbf39542a..6299545b388b1333c890ba3fc85b613977d196ea 100644 --- a/Framework/DataHandling/test/LoadCalFileTest.h +++ b/Framework/DataHandling/test/LoadCalFileTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataHandling/LoadCalFile.h" #include "MantidDataObjects/GroupingWorkspace.h" diff --git a/Framework/DataHandling/test/LoadDetectorInfoTest.h b/Framework/DataHandling/test/LoadDetectorInfoTest.h index fec164099da7d0619a2041f313ee669dc76e6b2c..106258dba36758744cff9102c07278d90c9c4914 100644 --- a/Framework/DataHandling/test/LoadDetectorInfoTest.h +++ b/Framework/DataHandling/test/LoadDetectorInfoTest.h @@ -19,7 +19,6 @@ #include <algorithm> #include <fstream> #include <vector> -#include <iostream> #include <boost/lexical_cast.hpp> #include <nexus/NeXusFile.hpp> diff --git a/Framework/DataHandling/test/LoadDetectorsGroupingFileTest.h b/Framework/DataHandling/test/LoadDetectorsGroupingFileTest.h index e71c52d34afdbc2c7c4e4c2819d99b0895deeac3..90765cb64596b99fe15ba5777426106486a996e4 100644 --- a/Framework/DataHandling/test/LoadDetectorsGroupingFileTest.h +++ b/Framework/DataHandling/test/LoadDetectorsGroupingFileTest.h @@ -11,8 +11,6 @@ #include "Poco/File.h" #include <cxxtest/TestSuite.h> -#include <iostream> -#include <iomanip> #include <fstream> using namespace Mantid; diff --git a/Framework/DataHandling/test/LoadDspacemapTest.h b/Framework/DataHandling/test/LoadDspacemapTest.h index d5714fe3713dadecf4b9bb5e57f800d1b7fc3fc5..d00455638b4fb0e6c1aa1a1cd2077560b1c4c5c8 100644 --- a/Framework/DataHandling/test/LoadDspacemapTest.h +++ b/Framework/DataHandling/test/LoadDspacemapTest.h @@ -10,8 +10,6 @@ #include <cstring> #include <cxxtest/TestSuite.h> #include <fstream> -#include <iomanip> -#include <iostream> #include <vector> using namespace Mantid::DataHandling; diff --git a/Framework/DataHandling/test/LoadEventNexusTest.h b/Framework/DataHandling/test/LoadEventNexusTest.h index 7b53cf6a34a889f9260087e47f63d984462847f0..9ce546c2c3ad11681bb72ee28dcb039a008ef9cd 100644 --- a/Framework/DataHandling/test/LoadEventNexusTest.h +++ b/Framework/DataHandling/test/LoadEventNexusTest.h @@ -11,7 +11,6 @@ #include "MantidKernel/TimeSeriesProperty.h" #include "MantidDataHandling/LoadEventNexus.h" #include <cxxtest/TestSuite.h> -#include <iostream> using namespace Mantid::Geometry; using namespace Mantid::API; diff --git a/Framework/DataHandling/test/LoadISISNexusTest.h b/Framework/DataHandling/test/LoadISISNexusTest.h index c6c357ed55983e21a8642d1411b279fe607d3340..3b29024c82fc17221611aff7926c9ca8d84a6479 100644 --- a/Framework/DataHandling/test/LoadISISNexusTest.h +++ b/Framework/DataHandling/test/LoadISISNexusTest.h @@ -15,7 +15,6 @@ #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/WorkspaceGroup.h" -#include "MantidDataHandling/LoadISISNexus.h" #include "MantidDataHandling/LoadISISNexus2.h" #include <cmath> @@ -546,14 +545,6 @@ public: "Always"); } - // Test the stub remnant of version 1 of this algorithm - that it can be run - // without setting any properties, and throws an exception. - void testRemovedVersion1Throws() { - LoadISISNexus v1; - v1.setRethrows(true); - TS_ASSERT_THROWS_NOTHING(v1.initialize()); - TS_ASSERT_THROWS(v1.execute(), Exception::NotImplementedError) - } void testExecMonExcluded() { Mantid::API::FrameworkManager::Instance(); LoadISISNexus2 ld; diff --git a/Framework/DataHandling/test/LoadInstrumentTest.h b/Framework/DataHandling/test/LoadInstrumentTest.h index b488f7c14586c018af3972250df1ff79555a2908..497edfa26b5c2cc8a3276688360886559228c599 100644 --- a/Framework/DataHandling/test/LoadInstrumentTest.h +++ b/Framework/DataHandling/test/LoadInstrumentTest.h @@ -17,7 +17,6 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <cxxtest/TestSuite.h> #include <fstream> -#include <iostream> #include <string> #include <vector> #include "MantidAPI/ExperimentInfo.h" diff --git a/Framework/DataHandling/test/LoadMaskTest.h b/Framework/DataHandling/test/LoadMaskTest.h index 4003dc57e5785e661032528e1290fa76a33a7e8e..a44631c89ccc8894e17885b2956c4b6cfe05ac24 100644 --- a/Framework/DataHandling/test/LoadMaskTest.h +++ b/Framework/DataHandling/test/LoadMaskTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include <sstream> #include "boost/assign/list_of.hpp" diff --git a/Framework/DataHandling/test/LoadNXSPETest.h b/Framework/DataHandling/test/LoadNXSPETest.h index 2f878a61a5946ed682849b57ba9f6483e5c13f4f..f2c7994e83db5e2451a1b746dd750ea8315a5e8d 100644 --- a/Framework/DataHandling/test/LoadNXSPETest.h +++ b/Framework/DataHandling/test/LoadNXSPETest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataHandling/LoadNXSPE.h" diff --git a/Framework/DataHandling/test/LoadNexusLogsTest.h b/Framework/DataHandling/test/LoadNexusLogsTest.h index 068c4a56b1470669870dff9f7ae201ee5cafc357..7e8f678637b6a91d589696c48e4d3f1d7a79e9c9 100644 --- a/Framework/DataHandling/test/LoadNexusLogsTest.h +++ b/Framework/DataHandling/test/LoadNexusLogsTest.h @@ -17,7 +17,6 @@ using namespace Mantid::DataHandling; #include <cxxtest/TestSuite.h> #include "MantidAPI/WorkspaceGroup.h" -#include <iostream> class LoadNexusLogsTest : public CxxTest::TestSuite { public: diff --git a/Framework/DataHandling/test/LoadParameterFileTest.h b/Framework/DataHandling/test/LoadParameterFileTest.h index 55c38c44234792cba6d54f07c20b4e73df8950bf..8492f8086b89f8d6627e213e1021459dba9ffb76 100644 --- a/Framework/DataHandling/test/LoadParameterFileTest.h +++ b/Framework/DataHandling/test/LoadParameterFileTest.h @@ -12,7 +12,6 @@ #include "MantidAPI/Algorithm.h" #include <vector> -#include <iostream> using namespace Mantid::API; using namespace Mantid::Kernel; diff --git a/Framework/DataHandling/test/LoadPreNexusTest.h b/Framework/DataHandling/test/LoadPreNexusTest.h index 6b683bfb06d64d10cab4eff6ae118e41026cd311..ebaec312a33fe377d89468c01523a18517141d9c 100644 --- a/Framework/DataHandling/test/LoadPreNexusTest.h +++ b/Framework/DataHandling/test/LoadPreNexusTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataHandling/LoadPreNexus.h" diff --git a/Framework/DataHandling/test/LoadRaw2Test.h b/Framework/DataHandling/test/LoadRaw2Test.h deleted file mode 100644 index baf9e9560545752b6b8b2ba3a01807a0a6ae9b3c..0000000000000000000000000000000000000000 --- a/Framework/DataHandling/test/LoadRaw2Test.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef LOADRAW2TEST_H_ -#define LOADRAW2TEST_H_ - -#include "MantidDataHandling/LoadRaw2.h" - -class LoadRaw2Test : public CxxTest::TestSuite { -public: - static LoadRaw2Test *createSuite() { return new LoadRaw2Test(); } - static void destroySuite(LoadRaw2Test *suite) { delete suite; } - - // Test the stub remnant of version 1 of this algorithm - that it can be run - // without setting any properties, and throws an exception. - void testRemovedVersion1Throws() { - Mantid::DataHandling::LoadRaw2 v2; - v2.setRethrows(true); - TS_ASSERT_THROWS_NOTHING(v2.initialize()); - TS_ASSERT_THROWS(v2.execute(), - Mantid::Kernel::Exception::NotImplementedError) - } -}; - -#endif /*LOADRAWTEST_H_*/ diff --git a/Framework/DataHandling/test/LoadRawTest.h b/Framework/DataHandling/test/LoadRawTest.h deleted file mode 100644 index d1d0c3fe95b7af85be27f2eef8a542a824e2151b..0000000000000000000000000000000000000000 --- a/Framework/DataHandling/test/LoadRawTest.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef LOADRAWTEST_H_ -#define LOADRAWTEST_H_ - -#include "MantidDataHandling/LoadRaw.h" - -class LoadRawTest : public CxxTest::TestSuite { -public: - static LoadRawTest *createSuite() { return new LoadRawTest(); } - static void destroySuite(LoadRawTest *suite) { delete suite; } - - // Test the stub remnant of version 1 of this algorithm - that it can be run - // without setting any properties, and throws an exception. - void testRemovedVersion1Throws() { - Mantid::DataHandling::LoadRaw v1; - v1.setRethrows(true); - TS_ASSERT_THROWS_NOTHING(v1.initialize()); - TS_ASSERT_THROWS(v1.execute(), - Mantid::Kernel::Exception::NotImplementedError) - } -}; - -#endif /*LOADRAWTEST_H_*/ diff --git a/Framework/DataHandling/test/LoadSNSNexusTest.h b/Framework/DataHandling/test/LoadSNSNexusTest.h index 53c71ebbadff62e5c2b2ff34e27205c060c1b075..dc1ada623d3326bc69f12198b9f5e3e221950a3d 100644 --- a/Framework/DataHandling/test/LoadSNSNexusTest.h +++ b/Framework/DataHandling/test/LoadSNSNexusTest.h @@ -15,7 +15,6 @@ using namespace Mantid::Kernel; #include <cxxtest/TestSuite.h> #include "MantidAPI/WorkspaceGroup.h" -#include <iostream> class LoadSNSNexusTest : public CxxTest::TestSuite { public: diff --git a/Framework/DataHandling/test/LoadVulcanCalFileTest.h b/Framework/DataHandling/test/LoadVulcanCalFileTest.h index 2e97a33fd059197e38585ddbe26bdc0dafa52e2c..c4855a01b93816753524ac0443e601ad1e911452 100644 --- a/Framework/DataHandling/test/LoadVulcanCalFileTest.h +++ b/Framework/DataHandling/test/LoadVulcanCalFileTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataHandling/LoadVulcanCalFile.h" #include "MantidDataObjects/GroupingWorkspace.h" diff --git a/Framework/DataHandling/test/MergeLogsTest.h b/Framework/DataHandling/test/MergeLogsTest.h index 9676875b9e92b45f747054e54d52962ce11158e9..3983186be0450deadd48b0bba4b7d046439499ba 100644 --- a/Framework/DataHandling/test/MergeLogsTest.h +++ b/Framework/DataHandling/test/MergeLogsTest.h @@ -8,8 +8,6 @@ #include "MantidAPI/WorkspaceFactory.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidKernel/DateAndTime.h" -#include <iostream> -#include <iomanip> #include "MantidDataHandling/MergeLogs.h" diff --git a/Framework/DataHandling/test/ModifyDetectorDotDatFileTest.h b/Framework/DataHandling/test/ModifyDetectorDotDatFileTest.h index 28f323b8d9d1ea7ad63454f369fd3f992b8e7f6c..025d4d4ef3f4089d6b44b5459e8217415afc2eaf 100644 --- a/Framework/DataHandling/test/ModifyDetectorDotDatFileTest.h +++ b/Framework/DataHandling/test/ModifyDetectorDotDatFileTest.h @@ -4,9 +4,7 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> #include <sstream> -#include <iomanip> #include "MantidDataHandling/ModifyDetectorDotDatFile.h" #include "MantidDataHandling/LoadEmptyInstrument.h" diff --git a/Framework/DataHandling/test/MoveInstrumentComponentTest.h b/Framework/DataHandling/test/MoveInstrumentComponentTest.h index f797f70b4e477447c2d1ac201f90dc8c5c105842..83b5522ab4c73d9bc92dd1557c5fc6e2acdd587e 100644 --- a/Framework/DataHandling/test/MoveInstrumentComponentTest.h +++ b/Framework/DataHandling/test/MoveInstrumentComponentTest.h @@ -15,7 +15,6 @@ #include "MantidGeometry/Instrument/Component.h" #include "MantidGeometry/Instrument/Detector.h" #include <vector> -#include <iostream> using namespace Mantid::API; using namespace Mantid::Kernel; diff --git a/Framework/DataHandling/test/NexusTesterTest.h b/Framework/DataHandling/test/NexusTesterTest.h index 3c7e10dca2f201da7c4d094da59225872941dce1..53b59b9a484d71a61a36146c4cf65c3240e3e3a3 100644 --- a/Framework/DataHandling/test/NexusTesterTest.h +++ b/Framework/DataHandling/test/NexusTesterTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataHandling/NexusTester.h" #include <Poco/File.h> diff --git a/Framework/DataHandling/test/ProcessDasNexusLogTest.h b/Framework/DataHandling/test/ProcessDasNexusLogTest.h index 0751b97d0b8161800dea8f6363f3e062cd0fbb73..57034fe9926bcb8834198420f90c612547584324 100644 --- a/Framework/DataHandling/test/ProcessDasNexusLogTest.h +++ b/Framework/DataHandling/test/ProcessDasNexusLogTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataHandling/ProcessDasNexusLog.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" diff --git a/Framework/DataHandling/test/RawFileInfoTest.h b/Framework/DataHandling/test/RawFileInfoTest.h index 6a6a4de6443788e556e5f5c2a0c6d650f494cd09..ad68b2485b0afdf7c8f313e03a2b738e300f6929 100644 --- a/Framework/DataHandling/test/RawFileInfoTest.h +++ b/Framework/DataHandling/test/RawFileInfoTest.h @@ -5,9 +5,6 @@ #include "MantidDataHandling/RawFileInfo.h" #include "MantidAPI/ITableWorkspace.h" -#include <iostream> -#include <iomanip> - using namespace Mantid::DataHandling; class RawFileInfoTest : public CxxTest::TestSuite { diff --git a/Framework/DataHandling/test/RenameLogTest.h b/Framework/DataHandling/test/RenameLogTest.h index 9a561afd1d996b8c6163a397573b5a6029967b23..4363e39e1751c9aa42f3cd7b931f5271aa09faaf 100644 --- a/Framework/DataHandling/test/RenameLogTest.h +++ b/Framework/DataHandling/test/RenameLogTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataHandling/RenameLog.h" #include "MantidKernel/TimeSeriesProperty.h" diff --git a/Framework/DataHandling/test/SaveCalFileTest.h b/Framework/DataHandling/test/SaveCalFileTest.h index bf9edf3f913fb6f5e2ae430bc9ba6a08155060a0..cdd7025bb62c4c66ac33de8ed84cc96ef0be0039 100644 --- a/Framework/DataHandling/test/SaveCalFileTest.h +++ b/Framework/DataHandling/test/SaveCalFileTest.h @@ -12,8 +12,6 @@ #include <cxxtest/TestSuite.h> #include <Poco/File.h> #include <fstream> -#include <iomanip> -#include <iostream> #include <iosfwd> using namespace Mantid::DataHandling; diff --git a/Framework/DataHandling/test/SaveDaveGrpTest.h b/Framework/DataHandling/test/SaveDaveGrpTest.h index a9d6fce08001a725f21ea7c2add7d86fb6a1340e..c3b009b45f0b07e6137bbcda114f1da24244b918 100644 --- a/Framework/DataHandling/test/SaveDaveGrpTest.h +++ b/Framework/DataHandling/test/SaveDaveGrpTest.h @@ -4,9 +4,7 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> #include <fstream> -#include <iomanip> #include "MantidDataHandling/LoadEventNexus.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidDataHandling/SaveDaveGrp.h" diff --git a/Framework/DataHandling/test/SaveDetectorsGroupingTest.h b/Framework/DataHandling/test/SaveDetectorsGroupingTest.h index cc66311ef92c90840647634e3b71f3b899893640..bd3b2f93e9e5c26922cf22bb9ef254401c002cc3 100644 --- a/Framework/DataHandling/test/SaveDetectorsGroupingTest.h +++ b/Framework/DataHandling/test/SaveDetectorsGroupingTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataHandling/SaveDetectorsGrouping.h" #include "MantidDataHandling/LoadDetectorsGroupingFile.h" diff --git a/Framework/DataHandling/test/SaveDspacemapTest.h b/Framework/DataHandling/test/SaveDspacemapTest.h index 5a90c23d6266b13a618b0db982ba6a8c9fb26cb7..4b2bbffb535bd59aceb4cc4f44c27163f5ff21d5 100644 --- a/Framework/DataHandling/test/SaveDspacemapTest.h +++ b/Framework/DataHandling/test/SaveDspacemapTest.h @@ -8,8 +8,6 @@ #include "MantidKernel/Timer.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <Poco/File.h> using namespace Mantid::DataHandling; diff --git a/Framework/DataHandling/test/SaveFullprofResolutionTest.h b/Framework/DataHandling/test/SaveFullprofResolutionTest.h index 7b5648dfa604a84724aa830a47be5b322e9354f0..c2da2add45ee3a28a2db169b951e6e92277c8353 100644 --- a/Framework/DataHandling/test/SaveFullprofResolutionTest.h +++ b/Framework/DataHandling/test/SaveFullprofResolutionTest.h @@ -10,7 +10,6 @@ #include <Poco/File.h> #include <fstream> -#include <iostream> using namespace std; using namespace Mantid; diff --git a/Framework/DataHandling/test/SaveIsawDetCalTest.h b/Framework/DataHandling/test/SaveIsawDetCalTest.h index 780f05166b8d4b97fe1aa66ad81fd0caff44122b..88c63a3e415b5621da479217ee00c05a5638936f 100644 --- a/Framework/DataHandling/test/SaveIsawDetCalTest.h +++ b/Framework/DataHandling/test/SaveIsawDetCalTest.h @@ -7,8 +7,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <Poco/File.h> #include "MantidTestHelpers/WorkspaceCreationHelper.h" diff --git a/Framework/DataHandling/test/SaveMaskTest.h b/Framework/DataHandling/test/SaveMaskTest.h index d2503727ad0f554306e4543822e80cabc86867ce..5f10a4447ccef6b98b2b9c928784e0fe429e8742 100644 --- a/Framework/DataHandling/test/SaveMaskTest.h +++ b/Framework/DataHandling/test/SaveMaskTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataHandling/SaveMask.h" #include "MantidDataHandling/LoadMask.h" diff --git a/Framework/DataHandling/test/XMLInstrumentParameterTest.h b/Framework/DataHandling/test/XMLInstrumentParameterTest.h index 2cf0226dfa943284b02c635fa09ffeea6c7d32cb..4e022520d27dc7d60a663338d0723b6255371a84 100644 --- a/Framework/DataHandling/test/XMLInstrumentParameterTest.h +++ b/Framework/DataHandling/test/XMLInstrumentParameterTest.h @@ -11,8 +11,6 @@ #include "MantidKernel/ConfigService.h" #include "MantidKernel/TimeSeriesProperty.h" -#include <iostream> - using namespace Mantid::API; using namespace Mantid::Kernel; using namespace Mantid::DataHandling; diff --git a/Framework/DataObjects/inc/MantidDataObjects/ReflectometryTransform.h b/Framework/DataObjects/inc/MantidDataObjects/ReflectometryTransform.h index df759cbde1876e89076cb262b4d131109e6d53ce..88785293ff8374ce5fd1fb00345a6385e97d542f 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/ReflectometryTransform.h +++ b/Framework/DataObjects/inc/MantidDataObjects/ReflectometryTransform.h @@ -88,6 +88,8 @@ public: boost::shared_ptr<Mantid::DataObjects::TableWorkspace> &vertexes, bool dumpVertexes, std::string outputDimensions) const; + Mantid::API::IMDHistoWorkspace_sptr + executeMDNormPoly(Mantid::API::MatrixWorkspace_const_sptr inputWs) const; virtual ~ReflectometryTransform(); ReflectometryTransform(const std::string &d0Label, const std::string &d0ID, double d0Min, double d0Max, const std::string &d1Label, diff --git a/Framework/DataObjects/src/CoordTransformAffine.cpp b/Framework/DataObjects/src/CoordTransformAffine.cpp index e9e0f9a688b2eb382fb126506862a84218a01e94..8f9584d60611d8494855d9ba7c35aa9cd2886a50 100644 --- a/Framework/DataObjects/src/CoordTransformAffine.cpp +++ b/Framework/DataObjects/src/CoordTransformAffine.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include "MantidAPI/CoordTransform.h" #include "MantidDataObjects/CoordTransformAffine.h" diff --git a/Framework/DataObjects/src/EventList.cpp b/Framework/DataObjects/src/EventList.cpp index 0e4260274c51f30ffc7e0f5ef92655b603462e01..efb6e74c71354d9c2d6207883c39d49a6e1e95f2 100644 --- a/Framework/DataObjects/src/EventList.cpp +++ b/Framework/DataObjects/src/EventList.cpp @@ -9,7 +9,6 @@ #include <cfloat> #include <functional> -#include <iostream> #include <limits> #include <math.h> #include <Poco/ScopedLock.h> diff --git a/Framework/DataObjects/src/Events.cpp b/Framework/DataObjects/src/Events.cpp index ffb9e0c32be66444983897ff87f1e350885b8f32..c348378709154eee116ba569d9bbdbf1cc4ab2f1 100644 --- a/Framework/DataObjects/src/Events.cpp +++ b/Framework/DataObjects/src/Events.cpp @@ -5,7 +5,6 @@ #include "MantidKernel/Exception.h" #include "MantidKernel/DateAndTime.h" #include <functional> -#include <iostream> #include <math.h> using std::ostream; diff --git a/Framework/DataObjects/src/Histogram1D.cpp b/Framework/DataObjects/src/Histogram1D.cpp index da29de62522ac388380e1d6e3cc44943fa098a4c..077adc23d521dc3918eed3ecc069da2e66043b0e 100644 --- a/Framework/DataObjects/src/Histogram1D.cpp +++ b/Framework/DataObjects/src/Histogram1D.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include "MantidDataObjects/Histogram1D.h" #include "MantidKernel/Exception.h" #include "MantidAPI/WorkspaceFactory.h" diff --git a/Framework/DataObjects/src/PeaksWorkspace.cpp b/Framework/DataObjects/src/PeaksWorkspace.cpp index 33bcd0d5000d73fafdda717204df636efa41d5d0..083c66123c4b9222af4c529934c007b27cdb7c9f 100644 --- a/Framework/DataObjects/src/PeaksWorkspace.cpp +++ b/Framework/DataObjects/src/PeaksWorkspace.cpp @@ -22,7 +22,6 @@ #include <boost/shared_ptr.hpp> #include <exception> #include <fstream> -#include <iostream> #include <math.h> #include <ostream> #include <stdio.h> diff --git a/Framework/DataObjects/src/RebinnedOutput.cpp b/Framework/DataObjects/src/RebinnedOutput.cpp index b6addfb0c0e60cff56d8f6025f82bcaed57d0ed0..3be5eff9d10632258dae16c3bbf99c00c7a2e6ca 100644 --- a/Framework/DataObjects/src/RebinnedOutput.cpp +++ b/Framework/DataObjects/src/RebinnedOutput.cpp @@ -3,7 +3,6 @@ #include "MantidAPI/WorkspaceFactory.h" #include <algorithm> -#include <iostream> namespace Mantid { namespace DataObjects { diff --git a/Framework/DataObjects/src/ReflectometryTransform.cpp b/Framework/DataObjects/src/ReflectometryTransform.cpp index c07b6481867a3660c27cdc57050156464f880780..dbd709079bb54cd5f8f2712449254d47c76636bf 100644 --- a/Framework/DataObjects/src/ReflectometryTransform.cpp +++ b/Framework/DataObjects/src/ReflectometryTransform.cpp @@ -305,6 +305,44 @@ Mantid::API::MatrixWorkspace_sptr ReflectometryTransform::execute( return ws; } +IMDHistoWorkspace_sptr ReflectometryTransform::executeMDNormPoly( + MatrixWorkspace_const_sptr inputWs) const { + + auto input_x_dim = inputWs->getXDimension(); + + MDHistoDimension_sptr dim0 = MDHistoDimension_sptr(new MDHistoDimension( + input_x_dim->getName(), input_x_dim->getDimensionId(), + input_x_dim->getUnits(), + static_cast<Mantid::coord_t>(input_x_dim->getMinimum()), + static_cast<Mantid::coord_t>(input_x_dim->getMaximum()), + input_x_dim->getNBins())); + + auto input_y_dim = inputWs->getYDimension(); + + MDHistoDimension_sptr dim1 = MDHistoDimension_sptr(new MDHistoDimension( + input_y_dim->getName(), input_y_dim->getDimensionId(), + input_y_dim->getUnits(), + static_cast<Mantid::coord_t>(input_y_dim->getMinimum()), + static_cast<Mantid::coord_t>(input_y_dim->getMaximum()), + input_y_dim->getNBins())); + + auto outWs = boost::make_shared<MDHistoWorkspace>(dim0, dim1); + + for (size_t nHistoIndex = 0; nHistoIndex < inputWs->getNumberHistograms(); + ++nHistoIndex) { + const MantidVec X = inputWs->readX(nHistoIndex); + const MantidVec Y = inputWs->readY(nHistoIndex); + const MantidVec E = inputWs->readE(nHistoIndex); + + for (size_t nBinIndex = 0; nBinIndex < inputWs->blocksize(); ++nBinIndex) { + auto value_index = outWs->getLinearIndex(nBinIndex, nHistoIndex); + outWs->setSignalAt(value_index, Y[nBinIndex]); + outWs->setErrorSquaredAt(value_index, E[nBinIndex] * E[nBinIndex]); + } + } + return outWs; +} + /** * Execution path for NormalisedPolygon Rebinning * @param inputWs : Workspace to be rebinned @@ -391,7 +429,6 @@ MatrixWorkspace_sptr ReflectometryTransform::executeNormPoly( m_calculator->createQuad(lamUpper, lamLower, thetaUpper, thetaLower); FractionalRebinning::rebinToFractionalOutput(inputQ, inputWS, i, j, outWS, zBinsVec); - // Find which qy bin this point lies in const auto qIndex = std::upper_bound(zBinsVec.begin(), zBinsVec.end(), inputQ[0].Y()) - @@ -413,11 +450,9 @@ MatrixWorkspace_sptr ReflectometryTransform::executeNormPoly( } outWS->finalize(); FractionalRebinning::normaliseOutput(outWS, inputWS); - // Set the output spectrum-detector mapping SpectrumDetectorMapping outputDetectorMap(specNumberMapping, detIDMapping); outWS->updateSpectraUsing(outputDetectorMap); - outWS->getAxis(0)->title() = m_d0Label; outWS->setYUnit(""); outWS->setYUnitLabel("Intensity"); diff --git a/Framework/DataObjects/src/TableWorkspace.cpp b/Framework/DataObjects/src/TableWorkspace.cpp index 80290952df3b2ed7f6dd530f2b46e329dd357764..c352028bfd15d5f210bd0409cb2cb8dc000b6d85 100644 --- a/Framework/DataObjects/src/TableWorkspace.cpp +++ b/Framework/DataObjects/src/TableWorkspace.cpp @@ -4,7 +4,6 @@ #include "MantidAPI/WorkspaceProperty.h" #include "MantidAPI/WorkspaceFactory.h" -#include <iostream> #include <queue> namespace Mantid { diff --git a/Framework/DataObjects/test/CoordTransformAlignedTest.h b/Framework/DataObjects/test/CoordTransformAlignedTest.h index f15e0fe7a0ab22a0d80e04f22a7292f94fbd9bbe..746bebcae5d86836c2d7489730ff93e0770f00d0 100644 --- a/Framework/DataObjects/test/CoordTransformAlignedTest.h +++ b/Framework/DataObjects/test/CoordTransformAlignedTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataObjects/CoordTransformAligned.h" #include "MantidKernel/Matrix.h" diff --git a/Framework/DataObjects/test/CoordTransformDistanceTest.h b/Framework/DataObjects/test/CoordTransformDistanceTest.h index 27774e7bf32d3917daca8497f5112a428cd1b61b..77ac156e205c6b197e3a68c7223f568a50d72777 100644 --- a/Framework/DataObjects/test/CoordTransformDistanceTest.h +++ b/Framework/DataObjects/test/CoordTransformDistanceTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/Timer.h" #include "MantidDataObjects/CoordTransformDistance.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include "MantidAPI/CoordTransform.h" #include <boost/scoped_ptr.hpp> diff --git a/Framework/DataObjects/test/EventWorkspaceMRUTest.h b/Framework/DataObjects/test/EventWorkspaceMRUTest.h index 75dafe93107e6d6e1fa5aef751534ed8152d2c50..3d66875d8dc7762859b20c53531aab871808fb89 100644 --- a/Framework/DataObjects/test/EventWorkspaceMRUTest.h +++ b/Framework/DataObjects/test/EventWorkspaceMRUTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataObjects/EventWorkspaceMRU.h" diff --git a/Framework/DataObjects/test/GroupingWorkspaceTest.h b/Framework/DataObjects/test/GroupingWorkspaceTest.h index de94e12bb9338086e989e970a2d134d6a13d4a12..ee0db8b637f01c9044689190e5a87fca61b795bc 100644 --- a/Framework/DataObjects/test/GroupingWorkspaceTest.h +++ b/Framework/DataObjects/test/GroupingWorkspaceTest.h @@ -7,8 +7,6 @@ #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::API; diff --git a/Framework/DataObjects/test/MDBinTest.h b/Framework/DataObjects/test/MDBinTest.h index 58746ad2f118909cc3127cc1e0644feca5598aa5..451ddc9e0744980a5e384ab9f74b96e31e3fa82e 100644 --- a/Framework/DataObjects/test/MDBinTest.h +++ b/Framework/DataObjects/test/MDBinTest.h @@ -6,8 +6,6 @@ #include "MantidDataObjects/MDBin.h" #include "MantidDataObjects/MDEventFactory.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::DataObjects; diff --git a/Framework/DataObjects/test/MDBoxBaseTest.h b/Framework/DataObjects/test/MDBoxBaseTest.h index fe6cf91509931dfd3e6474dac604e1c9baf10684..1efac0d88690ba2b4b3a4f0d5784ffac4cab44b1 100644 --- a/Framework/DataObjects/test/MDBoxBaseTest.h +++ b/Framework/DataObjects/test/MDBoxBaseTest.h @@ -7,8 +7,6 @@ #include "MantidKernel/Timer.h" #include "MantidDataObjects/MDBoxBase.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <Poco/File.h> #include "MantidAPI/CoordTransform.h" diff --git a/Framework/DataObjects/test/MDBoxIteratorTest.h b/Framework/DataObjects/test/MDBoxIteratorTest.h index 54f0c4ef0bda4ea4a0fe9f5367ed5161730309cd..cebfb6ab66fb58d0cf6ad7959874d99f6b87cda6 100644 --- a/Framework/DataObjects/test/MDBoxIteratorTest.h +++ b/Framework/DataObjects/test/MDBoxIteratorTest.h @@ -12,8 +12,6 @@ #include "MantidDataObjects/MDBox.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <gmock/gmock.h> using namespace Mantid::DataObjects; diff --git a/Framework/DataObjects/test/MDEventFactoryTest.h b/Framework/DataObjects/test/MDEventFactoryTest.h index 5d9a1486e995cac057546d2b75e9aee657851acb..35dddb546641612b946513a97fe91074fbd6af60 100644 --- a/Framework/DataObjects/test/MDEventFactoryTest.h +++ b/Framework/DataObjects/test/MDEventFactoryTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include <MantidKernel/Timer.h> #include <MantidKernel/System.h> -#include <iostream> -#include <iomanip> #include <MantidDataObjects/MDEventFactory.h> diff --git a/Framework/DataObjects/test/MDGridBoxTest.h b/Framework/DataObjects/test/MDGridBoxTest.h index 0f8321bc99bbc1eda16f00ee65593960191b32c0..343c1507c852f2e6ab8abfb95b0fb7f4d9458916 100644 --- a/Framework/DataObjects/test/MDGridBoxTest.h +++ b/Framework/DataObjects/test/MDGridBoxTest.h @@ -27,7 +27,6 @@ #include <boost/random/variate_generator.hpp> #include <cmath> #include <cxxtest/TestSuite.h> -#include <iomanip> #include <map> #include <memory> #include <Poco/File.h> diff --git a/Framework/DataObjects/test/MDHistoWorkspaceTest.h b/Framework/DataObjects/test/MDHistoWorkspaceTest.h index 34e0819e614dfabc65c96e2a8370d2369ca13f07..d289a06ffa2282df2b0ad7dd226cb9f36885f281 100644 --- a/Framework/DataObjects/test/MDHistoWorkspaceTest.h +++ b/Framework/DataObjects/test/MDHistoWorkspaceTest.h @@ -16,8 +16,6 @@ #include <boost/scoped_array.hpp> #include <boost/scoped_ptr.hpp> #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include "MantidAPI/ExperimentInfo.h" #include "MantidKernel/Strings.h" diff --git a/Framework/DataObjects/test/MDLeanEventTest.h b/Framework/DataObjects/test/MDLeanEventTest.h index 6bda924df6433bf4dbc0e7b176eb6d02851a98db..89b3bf02ed8404f6341c967cb5fdd1ddcfc5426b 100644 --- a/Framework/DataObjects/test/MDLeanEventTest.h +++ b/Framework/DataObjects/test/MDLeanEventTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/Timer.h" #include "MantidDataObjects/MDLeanEvent.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <boost/scoped_array.hpp> diff --git a/Framework/DataObjects/test/OffsetsWorkspaceTest.h b/Framework/DataObjects/test/OffsetsWorkspaceTest.h index 64525613150722aca0f2a0798cf9e1e624c73f9a..08f5bff01aa0ce8691a045bfd08e5373725ad446 100644 --- a/Framework/DataObjects/test/OffsetsWorkspaceTest.h +++ b/Framework/DataObjects/test/OffsetsWorkspaceTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataObjects/OffsetsWorkspace.h" #include "MantidTestHelpers/ComponentCreationHelper.h" diff --git a/Framework/DataObjects/test/PeakColumnTest.h b/Framework/DataObjects/test/PeakColumnTest.h index 0c68f2805ff2ee97dd7278e3969a6dfb16e541da..247db3453822bf3475f0a308d581cdab0660cbb3 100644 --- a/Framework/DataObjects/test/PeakColumnTest.h +++ b/Framework/DataObjects/test/PeakColumnTest.h @@ -8,8 +8,6 @@ #include "MantidTestHelpers/ComponentCreationHelper.h" #include <boost/make_shared.hpp> -#include <iostream> -#include <iomanip> using namespace Mantid::DataObjects; diff --git a/Framework/DataObjects/test/PeakTest.h b/Framework/DataObjects/test/PeakTest.h index e2e41b04aa4d42f601128b258bbca09e59ddf128..43043ba0b1c10fec8ccb54d7441e8b03aa2a5119 100644 --- a/Framework/DataObjects/test/PeakTest.h +++ b/Framework/DataObjects/test/PeakTest.h @@ -10,8 +10,6 @@ #include "MantidKernel/V3D.h" #include "MantidKernel/PhysicalConstants.h" #include "MantidGeometry/Instrument/ReferenceFrame.h" -#include <iostream> -#include <iomanip> #include <gmock/gmock.h> #include "MantidDataObjects/Peak.h" diff --git a/Framework/DataObjects/test/PeaksWorkspaceTest.h b/Framework/DataObjects/test/PeaksWorkspaceTest.h index dccfacf8b750eb1ed90998f95811b68ebe28fd5e..3ffb18821ed63a22a906b908c50c422ce1bf54ac 100644 --- a/Framework/DataObjects/test/PeaksWorkspaceTest.h +++ b/Framework/DataObjects/test/PeaksWorkspaceTest.h @@ -5,9 +5,7 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" #include "MantidAPI/FileProperty.h" -#include <iostream> #include <fstream> -#include <iomanip> #include <stdio.h> #include <cmath> #include "MantidDataObjects/PeaksWorkspace.h" diff --git a/Framework/DataObjects/test/RebinnedOutputTest.h b/Framework/DataObjects/test/RebinnedOutputTest.h index 41a3c5e3df6c9ca7753b5d83d27c0cbae345c8e5..87535e4f83f825a106610eec549648e46bf7f326 100644 --- a/Framework/DataObjects/test/RebinnedOutputTest.h +++ b/Framework/DataObjects/test/RebinnedOutputTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidDataObjects/RebinnedOutput.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" diff --git a/Framework/DataObjects/test/SpecialWorkspace2DTest.h b/Framework/DataObjects/test/SpecialWorkspace2DTest.h index 6ecb30dbf29b315a67321bd5e303512d6cd85dc8..9598500b31560a7431da88ae9ef797a53952a208 100644 --- a/Framework/DataObjects/test/SpecialWorkspace2DTest.h +++ b/Framework/DataObjects/test/SpecialWorkspace2DTest.h @@ -8,8 +8,6 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAPI/WorkspaceProperty.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid::DataObjects; using namespace Mantid::Geometry; diff --git a/Framework/DataObjects/test/SplittersWorkspaceTest.h b/Framework/DataObjects/test/SplittersWorkspaceTest.h index a667a0715f99b46986ea980b25d7cf3fe00cc906..45f52e9334e7cd73ad1f9368fda2e53b376731df 100644 --- a/Framework/DataObjects/test/SplittersWorkspaceTest.h +++ b/Framework/DataObjects/test/SplittersWorkspaceTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" #include "MantidAPI/WorkspaceProperty.h" -#include <iostream> -#include <iomanip> #include "MantidDataObjects/SplittersWorkspace.h" diff --git a/Framework/DataObjects/test/TableColumnTest.h b/Framework/DataObjects/test/TableColumnTest.h index 26288968aabac768073955cff8d7bf47b8a22f96..1e33aa1324719f2a40aa43e6cc5a550ecf7a8ba7 100644 --- a/Framework/DataObjects/test/TableColumnTest.h +++ b/Framework/DataObjects/test/TableColumnTest.h @@ -8,7 +8,6 @@ #include "MantidTestHelpers/ComponentCreationHelper.h" #include <boost/make_shared.hpp> -#include <iostream> using namespace Mantid::DataObjects; diff --git a/Framework/GPUAlgorithms/test/GPUAlgorithmTest.h b/Framework/GPUAlgorithms/test/GPUAlgorithmTest.h index c92156a57737ef7c9b6c6e40b0b5aea6c2a44687..8128dd5080266e481eeefd410ff444d5b753ca0b 100644 --- a/Framework/GPUAlgorithms/test/GPUAlgorithmTest.h +++ b/Framework/GPUAlgorithms/test/GPUAlgorithmTest.h @@ -4,7 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> #include <iomanip> #include "MantidGPUAlgorithms/GPUAlgorithm.h" diff --git a/Framework/GPUAlgorithms/test/GPUTesterTest.h b/Framework/GPUAlgorithms/test/GPUTesterTest.h index e1014f011366e77deff1deaa0216288b74ac9292..70e00ec653f5aac0ad04aa26f78d760aa38d699c 100644 --- a/Framework/GPUAlgorithms/test/GPUTesterTest.h +++ b/Framework/GPUAlgorithms/test/GPUTesterTest.h @@ -4,7 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> #include <iomanip> #include "MantidGPUAlgorithms/GPUTester.h" diff --git a/Framework/Geometry/inc/MantidGeometry/Crystal/SymmetryOperationFactory.h b/Framework/Geometry/inc/MantidGeometry/Crystal/SymmetryOperationFactory.h index eabe3833aea905a12a8c8e4c174800ff5ec768d1..7a348ca0714e503a5f47be15dbb56d9b9290dcb0 100644 --- a/Framework/Geometry/inc/MantidGeometry/Crystal/SymmetryOperationFactory.h +++ b/Framework/Geometry/inc/MantidGeometry/Crystal/SymmetryOperationFactory.h @@ -1,16 +1,15 @@ #ifndef MANTID_GEOMETRY_SYMMETRYOPERATIONFACTORY_H_ #define MANTID_GEOMETRY_SYMMETRYOPERATIONFACTORY_H_ +#include <list> +#include <map> + #include "MantidGeometry/DllConfig.h" #include "MantidKernel/SingletonHolder.h" #include "MantidGeometry/Crystal/SymmetryOperation.h" #include "MantidGeometry/Crystal/SymmetryOperationSymbolParser.h" #include "MantidKernel/RegistrationHelper.h" -#include <list> -#include <map> -#include <iostream> - namespace Mantid { namespace Geometry { /** diff --git a/Framework/Geometry/src/Crystal/IndexingUtils.cpp b/Framework/Geometry/src/Crystal/IndexingUtils.cpp index 65d194797e790a40d3b121ecae51509c698c5bb4..dbd81b746f307617f0a1bb1b631b7ae53ceba55b 100644 --- a/Framework/Geometry/src/Crystal/IndexingUtils.cpp +++ b/Framework/Geometry/src/Crystal/IndexingUtils.cpp @@ -3,7 +3,6 @@ #include "MantidKernel/Quat.h" #include <boost/math/special_functions/fpclassify.hpp> #include "MantidGeometry/Crystal/OrientedLattice.h" -#include <iostream> #include <stdexcept> #include <algorithm> diff --git a/Framework/Geometry/src/Crystal/NiggliCell.cpp b/Framework/Geometry/src/Crystal/NiggliCell.cpp index baf61f0b7e33472c586f1dd2ef3037e42b1a616d..bb91bf0167070d508fdb153610699a31bdf8af3d 100644 --- a/Framework/Geometry/src/Crystal/NiggliCell.cpp +++ b/Framework/Geometry/src/Crystal/NiggliCell.cpp @@ -3,7 +3,6 @@ #include "MantidKernel/Quat.h" #include <boost/math/special_functions/fpclassify.hpp> #include "MantidGeometry/Crystal/OrientedLattice.h" -#include <iostream> #include <stdexcept> #include <algorithm> diff --git a/Framework/Geometry/src/Crystal/PointGroup.cpp b/Framework/Geometry/src/Crystal/PointGroup.cpp index e0805c6529cd039ca1c80c8803e5b5a5ae4a95ab..85ff7e7dee15c76c8aa5945cd10c4be0929577af 100644 --- a/Framework/Geometry/src/Crystal/PointGroup.cpp +++ b/Framework/Geometry/src/Crystal/PointGroup.cpp @@ -4,7 +4,6 @@ #include <set> #include <boost/make_shared.hpp> #include <boost/algorithm/string.hpp> -#include <iostream> #include "MantidGeometry/Crystal/PointGroupFactory.h" #include "MantidGeometry/Crystal/SymmetryOperationFactory.h" diff --git a/Framework/Geometry/src/Crystal/ScalarUtils.cpp b/Framework/Geometry/src/Crystal/ScalarUtils.cpp index 7dda5e72a8a311f0fbb3378a27db1d0cef784ada..096cbabf474a832b4b82a10cd92da237707671aa 100644 --- a/Framework/Geometry/src/Crystal/ScalarUtils.cpp +++ b/Framework/Geometry/src/Crystal/ScalarUtils.cpp @@ -1,6 +1,5 @@ /* File: ScalarUtils.cpp */ -#include <iostream> #include <stdexcept> #include "MantidGeometry/Crystal/ScalarUtils.h" #include "MantidGeometry/Crystal/ReducedCell.h" diff --git a/Framework/Geometry/src/Math/BnId.cpp b/Framework/Geometry/src/Math/BnId.cpp index 25a999388cb556f39dac36496cb77df09b1f7b84..556e536328f8335cbaa46035cff0c20b17e8cfeb 100644 --- a/Framework/Geometry/src/Math/BnId.cpp +++ b/Framework/Geometry/src/Math/BnId.cpp @@ -1,6 +1,4 @@ #include <fstream> -#include <iomanip> -#include <iostream> #include <cmath> #include <vector> #include <set> diff --git a/Framework/Geometry/src/Math/PolyBase.cpp b/Framework/Geometry/src/Math/PolyBase.cpp index eac6ba5b99a7b0fb476bc5bed2e86b2f2860906f..b3738109c6f350986650c2eeba1589f1e7381a80 100644 --- a/Framework/Geometry/src/Math/PolyBase.cpp +++ b/Framework/Geometry/src/Math/PolyBase.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <cmath> #include <complex> #include <vector> diff --git a/Framework/Geometry/src/Math/PolygonIntersection.cpp b/Framework/Geometry/src/Math/PolygonIntersection.cpp index f18f0c27a411980dd9ba5042ffd25b532e6860e1..29d1b209a9db0d6ad6b97927a9d4deb757cd4ada 100644 --- a/Framework/Geometry/src/Math/PolygonIntersection.cpp +++ b/Framework/Geometry/src/Math/PolygonIntersection.cpp @@ -7,8 +7,6 @@ #include "MantidKernel/Logger.h" #include "MantidKernel/V2D.h" -#include <iostream> - using namespace Mantid::Kernel; namespace Mantid { diff --git a/Framework/Geometry/src/Math/RotCounter.cpp b/Framework/Geometry/src/Math/RotCounter.cpp index 7a56cae785b97cb973c54b7ab832ea696e9b15a8..387a1041f871ed866bd8ce84c8092176dbbd08ac 100644 --- a/Framework/Geometry/src/Math/RotCounter.cpp +++ b/Framework/Geometry/src/Math/RotCounter.cpp @@ -1,6 +1,4 @@ #include <fstream> -#include <iomanip> -#include <iostream> #include <algorithm> #include <iterator> #include <vector> diff --git a/Framework/Geometry/src/Objects/RuleItems.cpp b/Framework/Geometry/src/Objects/RuleItems.cpp index ebac656d63dc2f0c0fbc336d9085383382801cf8..505fda685eefb8cb1668c676c0785172bb42886c 100644 --- a/Framework/Geometry/src/Objects/RuleItems.cpp +++ b/Framework/Geometry/src/Objects/RuleItems.cpp @@ -1,6 +1,4 @@ #include <fstream> -#include <iomanip> -#include <iostream> #include <complex> #include <cmath> #include <vector> diff --git a/Framework/Geometry/src/Objects/Track.cpp b/Framework/Geometry/src/Objects/Track.cpp index 8bfb529d73086bc33f91f11160d66ebe336ba0ca..ccb4c9dca1a7969d2514c42b9dfa9474a4993414 100644 --- a/Framework/Geometry/src/Objects/Track.cpp +++ b/Framework/Geometry/src/Objects/Track.cpp @@ -6,7 +6,6 @@ #include <cmath> #include <algorithm> -#include <iostream> namespace Mantid { namespace Geometry { diff --git a/Framework/Geometry/src/Rendering/vtkGeometryCacheReader.cpp b/Framework/Geometry/src/Rendering/vtkGeometryCacheReader.cpp index 76dd2da3ea2906d7bf49c01d7aae535247804325..ddfc5d61177d547f9f04b0bdcbeb9d373539900b 100644 --- a/Framework/Geometry/src/Rendering/vtkGeometryCacheReader.cpp +++ b/Framework/Geometry/src/Rendering/vtkGeometryCacheReader.cpp @@ -6,7 +6,6 @@ #include <Poco/SAX/InputSource.h> #include <Poco/Exception.h> #include <Poco/DOM/Element.h> -#include <iostream> using Poco::XML::DOMParser; using Poco::XML::InputSource; diff --git a/Framework/Geometry/src/Rendering/vtkGeometryCacheWriter.cpp b/Framework/Geometry/src/Rendering/vtkGeometryCacheWriter.cpp index 2054aaad0899ec99e3f73983ff15096ee26e6e49..91cd38f113ba74cbf03f04173cc6b9e8948b80de 100644 --- a/Framework/Geometry/src/Rendering/vtkGeometryCacheWriter.cpp +++ b/Framework/Geometry/src/Rendering/vtkGeometryCacheWriter.cpp @@ -1,5 +1,4 @@ #include <fstream> -#include <iostream> #include <sstream> #include "MantidGeometry/Rendering/vtkGeometryCacheWriter.h" diff --git a/Framework/Geometry/src/Surfaces/Cone.cpp b/Framework/Geometry/src/Surfaces/Cone.cpp index c40f71e018ce5c827bf6ba4dff2cdee7002005f1..c584fe7daf6219fe6c88706a00f36312d92aebb7 100644 --- a/Framework/Geometry/src/Surfaces/Cone.cpp +++ b/Framework/Geometry/src/Surfaces/Cone.cpp @@ -1,6 +1,4 @@ #include <fstream> -#include <iomanip> -#include <iostream> #include <sstream> #include <cmath> #include <complex> diff --git a/Framework/Geometry/src/Surfaces/Torus.cpp b/Framework/Geometry/src/Surfaces/Torus.cpp index 77cf5ea14f9724c35bd4c27b904cd98cf7e9a69e..2f8ed1d860da8cd65e01d6f37e4e7664ff1aa4a8 100644 --- a/Framework/Geometry/src/Surfaces/Torus.cpp +++ b/Framework/Geometry/src/Surfaces/Torus.cpp @@ -1,6 +1,4 @@ #include <fstream> -#include <iomanip> -#include <iostream> #include <string> #include <sstream> #include <cmath> diff --git a/Framework/Geometry/test/BoundingBoxTest.h b/Framework/Geometry/test/BoundingBoxTest.h index a071493595c75f74aa7feed18c96d3c32678468c..12071a5b559a0d646a1f11bc5abec90765c0b92c 100644 --- a/Framework/Geometry/test/BoundingBoxTest.h +++ b/Framework/Geometry/test/BoundingBoxTest.h @@ -5,7 +5,6 @@ #include "MantidGeometry/Objects/BoundingBox.h" #include "MantidGeometry/Objects/Track.h" #include "MantidKernel/Timer.h" -#include <iostream> using namespace Mantid; using namespace Mantid::Geometry; diff --git a/Framework/Geometry/test/CompAssemblyTest.h b/Framework/Geometry/test/CompAssemblyTest.h index fd3602f6097cdc3014ef1ffb795379e9eb99a8f9..1e69012097a679c430a6c6a50b6f9074a76bf0ab 100644 --- a/Framework/Geometry/test/CompAssemblyTest.h +++ b/Framework/Geometry/test/CompAssemblyTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include <iostream> #include <string> #include "MantidGeometry/Instrument/CompAssembly.h" #include "MantidKernel/V3D.h" diff --git a/Framework/Geometry/test/ComponentParserTest.h b/Framework/Geometry/test/ComponentParserTest.h index 1f23e83ad62124f7065243d47510de81c197bce4..d8732db12453024ecd57147780038f2ab26146d9 100644 --- a/Framework/Geometry/test/ComponentParserTest.h +++ b/Framework/Geometry/test/ComponentParserTest.h @@ -7,8 +7,6 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/V3D.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <Poco/SAX/SAXParser.h> #include <sstream> #include "MantidKernel/CPUTimer.h" diff --git a/Framework/Geometry/test/ComponentTest.h b/Framework/Geometry/test/ComponentTest.h index 4137d5bf3d82342fd1896a683eada8c3f2627025..479ec51f31da3220fda70fca2522f00d4074e4d0 100644 --- a/Framework/Geometry/test/ComponentTest.h +++ b/Framework/Geometry/test/ComponentTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include <iostream> #include <string> #include "MantidGeometry/Instrument/Component.h" #include "MantidKernel/V3D.h" diff --git a/Framework/Geometry/test/ConventionalCellTest.h b/Framework/Geometry/test/ConventionalCellTest.h index adb468c13f2668f9824bf9989e9f6816f10e0dd6..69d2b965b4159f465fa787f497750f7a8cd92349 100644 --- a/Framework/Geometry/test/ConventionalCellTest.h +++ b/Framework/Geometry/test/ConventionalCellTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include <MantidKernel/Timer.h> #include <MantidKernel/System.h> -#include <iostream> -#include <iomanip> #include <MantidKernel/V3D.h> #include <MantidKernel/Matrix.h> diff --git a/Framework/Geometry/test/DetectorTest.h b/Framework/Geometry/test/DetectorTest.h index f7c2495e2bc27b2e1d15272b180789eae37d9875..c9181e9192c6138a23d8449207327460821b2660 100644 --- a/Framework/Geometry/test/DetectorTest.h +++ b/Framework/Geometry/test/DetectorTest.h @@ -6,7 +6,6 @@ #include "MantidGeometry/Instrument/Detector.h" #include "MantidGeometry/Instrument/Component.h" #include <cmath> -#include <iostream> using namespace Mantid::Geometry; using Mantid::Kernel::V3D; diff --git a/Framework/Geometry/test/GoniometerTest.h b/Framework/Geometry/test/GoniometerTest.h index 9ae9bddf5f62f7a94c2afcbcc072b2d1609e3719..7cfad5d1b3fb4dfaac13bceeaa4b28c1b3f75f3c 100644 --- a/Framework/Geometry/test/GoniometerTest.h +++ b/Framework/Geometry/test/GoniometerTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> #include "MantidGeometry/Instrument/Goniometer.h" -#include <iostream> #include <stdexcept> #include <string> #include "MantidKernel/Quat.h" diff --git a/Framework/Geometry/test/IndexingUtilsTest.h b/Framework/Geometry/test/IndexingUtilsTest.h index 57449f7b04aef88e0626df657e2355b152b2eb92..f1ed265dda4b9bde93a3394fc37bd06cc3d8cbd6 100644 --- a/Framework/Geometry/test/IndexingUtilsTest.h +++ b/Framework/Geometry/test/IndexingUtilsTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include <MantidKernel/Timer.h> #include <MantidKernel/System.h> -#include <iostream> -#include <iomanip> #include <MantidKernel/V3D.h> #include <MantidKernel/Matrix.h> #include "MantidGeometry/Crystal/OrientedLattice.h" diff --git a/Framework/Geometry/test/MDBoxImplicitFunctionTest.h b/Framework/Geometry/test/MDBoxImplicitFunctionTest.h index 28ba764bda03d81d87bbd3b3d0860c837237e2f8..e27544409c8f17e2117c039d93023797d735ae22 100644 --- a/Framework/Geometry/test/MDBoxImplicitFunctionTest.h +++ b/Framework/Geometry/test/MDBoxImplicitFunctionTest.h @@ -6,8 +6,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Geometry; diff --git a/Framework/Geometry/test/MDHistoDimensionTest.h b/Framework/Geometry/test/MDHistoDimensionTest.h index 63474366e71feb31ac8cd55fc15750397225417a..f6dca8e74baeeebf6aeb7b03aec7c71b1cc1d11c 100644 --- a/Framework/Geometry/test/MDHistoDimensionTest.h +++ b/Framework/Geometry/test/MDHistoDimensionTest.h @@ -7,8 +7,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Geometry; diff --git a/Framework/Geometry/test/MDPlaneTest.h b/Framework/Geometry/test/MDPlaneTest.h index 05b165291f843fa7eb46e6ff5efaf39fb925c7dc..8004fa018dd1a38d75fc3b6e36820ecdc094289d 100644 --- a/Framework/Geometry/test/MDPlaneTest.h +++ b/Framework/Geometry/test/MDPlaneTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include "MantidKernel/VMD.h" using namespace Mantid; diff --git a/Framework/Geometry/test/NearestNeighboursFactoryTest.h b/Framework/Geometry/test/NearestNeighboursFactoryTest.h index 775478822a2d66aae1a45a8950467895a9d06b08..6230725124021dc0c95d5712007ee363732f387f 100644 --- a/Framework/Geometry/test/NearestNeighboursFactoryTest.h +++ b/Framework/Geometry/test/NearestNeighboursFactoryTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidGeometry/Instrument/NearestNeighboursFactory.h" #include "MantidTestHelpers/ComponentCreationHelper.h" diff --git a/Framework/Geometry/test/NiggliCellTest.h b/Framework/Geometry/test/NiggliCellTest.h index d21190d49674d51eca5b40cb3893729e4800f06d..63611e2186286d820852357a2a8a3a9afaaaa619 100644 --- a/Framework/Geometry/test/NiggliCellTest.h +++ b/Framework/Geometry/test/NiggliCellTest.h @@ -2,8 +2,6 @@ #define MANTID_GEOMETRY_NiggliCellTEST_H_ #include <cxxtest/TestSuite.h> -#include <iostream> -#include <iomanip> #include "MantidKernel/Matrix.h" #include "MantidGeometry/Crystal/NiggliCell.h" #include "MantidGeometry/Crystal/OrientedLattice.h" diff --git a/Framework/Geometry/test/ObjCompAssemblyTest.h b/Framework/Geometry/test/ObjCompAssemblyTest.h index 178682005c61f3996836dc2d35c95df9833cc77d..1acc727c0e74fac213b40fb6bbb6ac7f1c580892 100644 --- a/Framework/Geometry/test/ObjCompAssemblyTest.h +++ b/Framework/Geometry/test/ObjCompAssemblyTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include <iostream> #include <string> #include "MantidGeometry/Instrument/ObjCompAssembly.h" #include "MantidKernel/V3D.h" diff --git a/Framework/Geometry/test/ObjectTest.h b/Framework/Geometry/test/ObjectTest.h index 310d397050826794553db08562a0caf77ef09ec1..2c80fd8a7580ad11658eff9a983c7ff8eb744602 100644 --- a/Framework/Geometry/test/ObjectTest.h +++ b/Framework/Geometry/test/ObjectTest.h @@ -7,7 +7,6 @@ #include <vector> #include <algorithm> #include <ctime> -#include <iomanip> #include <boost/shared_ptr.hpp> diff --git a/Framework/Geometry/test/OrientedLatticeTest.h b/Framework/Geometry/test/OrientedLatticeTest.h index d2536f13fd73e55e8afddebc91e7d8985964742b..487231edeec3de4c8cc5637df5c6d38a8453afbc 100644 --- a/Framework/Geometry/test/OrientedLatticeTest.h +++ b/Framework/Geometry/test/OrientedLatticeTest.h @@ -2,8 +2,6 @@ #define MANTID_GEOMETRY_ORIENTEDLATTICETEST_H_ #include <cxxtest/TestSuite.h> -#include <iostream> -#include <iomanip> #include "MantidKernel/Matrix.h" #include "MantidGeometry/Crystal/OrientedLattice.h" #include "MantidTestHelpers/NexusTestHelper.h" diff --git a/Framework/Geometry/test/ParCompAssemblyTest.h b/Framework/Geometry/test/ParCompAssemblyTest.h index 048ca5fb8420d5c9dc7db27df993f12a0f071e24..bd9212db670654af6d13df7756267c8f88c30590 100644 --- a/Framework/Geometry/test/ParCompAssemblyTest.h +++ b/Framework/Geometry/test/ParCompAssemblyTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include <iostream> #include <string> #include "MantidGeometry/Instrument/CompAssembly.h" #include "MantidGeometry/Instrument/CompAssembly.h" diff --git a/Framework/Geometry/test/ParComponentFactoryTest.h b/Framework/Geometry/test/ParComponentFactoryTest.h index 950f0efeb087491a1737ad6971290742cbd016ca..0fb537e000a2612503ce87bc94c0e1a7e78cd94a 100644 --- a/Framework/Geometry/test/ParComponentFactoryTest.h +++ b/Framework/Geometry/test/ParComponentFactoryTest.h @@ -7,8 +7,6 @@ #include "MantidKernel/Timer.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid::Geometry; diff --git a/Framework/Geometry/test/ParObjCompAssemblyTest.h b/Framework/Geometry/test/ParObjCompAssemblyTest.h index 2efae136a5d4b89f9d2d2f53553e9136390b45a6..dd42abb3f8159039cccf4635116e33d3cb08e9a0 100644 --- a/Framework/Geometry/test/ParObjCompAssemblyTest.h +++ b/Framework/Geometry/test/ParObjCompAssemblyTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include <iostream> #include <string> #include "MantidGeometry/Instrument/ObjCompAssembly.h" #include "MantidGeometry/Instrument/ObjCompAssembly.h" diff --git a/Framework/Geometry/test/ParametrizedComponentTest.h b/Framework/Geometry/test/ParametrizedComponentTest.h index 467950faf55d0f05e2fe56e4815a9aff54ee61d3..b9120c7a335946ab2dc947f69dc8e1ae9bfb73d8 100644 --- a/Framework/Geometry/test/ParametrizedComponentTest.h +++ b/Framework/Geometry/test/ParametrizedComponentTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include <iostream> #include <string> #include <boost/make_shared.hpp> #include "MantidGeometry/Instrument/Component.h" diff --git a/Framework/Geometry/test/PointGroupTest.h b/Framework/Geometry/test/PointGroupTest.h index 6256893a3cf8d783ad8aeb19e9dacc501cc9591e..406a4508cbeba6cf9e551d51dc3c80014c75b7ee 100644 --- a/Framework/Geometry/test/PointGroupTest.h +++ b/Framework/Geometry/test/PointGroupTest.h @@ -7,8 +7,6 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/Strings.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidGeometry/Crystal/PointGroupFactory.h" #include "MantidGeometry/Crystal/PointGroup.h" #include <boost/lexical_cast.hpp> diff --git a/Framework/Geometry/test/RectangularDetectorPixelTest.h b/Framework/Geometry/test/RectangularDetectorPixelTest.h index 04fd8a6593e8b7bab16c4fd56e2167502c4d761e..83b920ad7e8ae801d5cb3cb610addc598a97701b 100644 --- a/Framework/Geometry/test/RectangularDetectorPixelTest.h +++ b/Framework/Geometry/test/RectangularDetectorPixelTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidGeometry/Instrument/RectangularDetectorPixel.h" diff --git a/Framework/Geometry/test/RectangularDetectorTest.h b/Framework/Geometry/test/RectangularDetectorTest.h index ee6903e0b456286e51bf0bf83b8bf99544d9a08d..a0c1ca0b9641c44f04622b67366f491b96a3fb91 100644 --- a/Framework/Geometry/test/RectangularDetectorTest.h +++ b/Framework/Geometry/test/RectangularDetectorTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include <iostream> #include <string> #include "MantidGeometry/Instrument/RectangularDetector.h" #include "MantidKernel/V3D.h" diff --git a/Framework/Geometry/test/ReducedCellTest.h b/Framework/Geometry/test/ReducedCellTest.h index cf2f44bcf77f04755f3ad9a780da44c803a4af0c..3065f6553b8f4bfef760bcf488dd61c673304bf6 100644 --- a/Framework/Geometry/test/ReducedCellTest.h +++ b/Framework/Geometry/test/ReducedCellTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include <MantidKernel/Timer.h> #include <MantidKernel/System.h> -#include <iostream> -#include <iomanip> #include <MantidKernel/V3D.h> #include <MantidKernel/Matrix.h> diff --git a/Framework/Geometry/test/ReferenceFrameTest.h b/Framework/Geometry/test/ReferenceFrameTest.h index 69cc05033f470f815ad481a8f9b2904d188b8e12..f203819da2d9f77200d5c7ae6c7e8db1d8142632 100644 --- a/Framework/Geometry/test/ReferenceFrameTest.h +++ b/Framework/Geometry/test/ReferenceFrameTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" #include "MantidKernel/V3D.h" -#include <iostream> -#include <iomanip> #include "MantidGeometry/Instrument/ReferenceFrame.h" diff --git a/Framework/Geometry/test/ReflectionConditionTest.h b/Framework/Geometry/test/ReflectionConditionTest.h index 2e34272915650aca3e73e16b0136e66dd52ebff6..ba8a2582881d160185ea962ae026cc953743472b 100644 --- a/Framework/Geometry/test/ReflectionConditionTest.h +++ b/Framework/Geometry/test/ReflectionConditionTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <set> using namespace Mantid::Geometry; diff --git a/Framework/Geometry/test/ScalarUtilsTest.h b/Framework/Geometry/test/ScalarUtilsTest.h index a428b760331d2d5e4450f4bc62b86f1781d93cbd..1bc65f8e32dba06728ce01f90608ea62f14c723a 100644 --- a/Framework/Geometry/test/ScalarUtilsTest.h +++ b/Framework/Geometry/test/ScalarUtilsTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include <MantidKernel/Timer.h> #include <MantidKernel/System.h> -#include <iostream> -#include <iomanip> #include <MantidKernel/V3D.h> #include <MantidKernel/Matrix.h> diff --git a/Framework/Geometry/test/UnitCellTest.h b/Framework/Geometry/test/UnitCellTest.h index e05a25f66eb5ea15a161005dd2f7b48e35055d76..b2ddd021baa71004dc95c8b2ea218dde28dd5c7e 100644 --- a/Framework/Geometry/test/UnitCellTest.h +++ b/Framework/Geometry/test/UnitCellTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include <MantidKernel/Timer.h> #include <MantidKernel/System.h> -#include <iostream> -#include <iomanip> #include <MantidKernel/Matrix.h> #include <MantidGeometry/Crystal/UnitCell.h> diff --git a/Framework/Geometry/test/XMLInstrumentParameterTest.h b/Framework/Geometry/test/XMLInstrumentParameterTest.h index a6d4d47cd7fe70be96a5c68fdd35cd1a9e3defda..e09348f8176ba66db8662ebc67b6d53bbee3c779 100644 --- a/Framework/Geometry/test/XMLInstrumentParameterTest.h +++ b/Framework/Geometry/test/XMLInstrumentParameterTest.h @@ -6,8 +6,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <boost/shared_ptr.hpp> #include <boost/make_shared.hpp> diff --git a/Framework/ICat/inc/MantidICat/GSoap/stdsoap2.h b/Framework/ICat/inc/MantidICat/GSoap/stdsoap2.h index b3d143893045d72c4eb796465af862d9b7612449..e80b4e0c43ffab7ddf841a67d471edd142b5e435 100644 --- a/Framework/ICat/inc/MantidICat/GSoap/stdsoap2.h +++ b/Framework/ICat/inc/MantidICat/GSoap/stdsoap2.h @@ -639,7 +639,6 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com #if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT) #include <string> -#include <iostream> #endif #ifdef WITH_NOHTTP diff --git a/Framework/ICat/src/GSoap/stdsoap2.cpp b/Framework/ICat/src/GSoap/stdsoap2.cpp index b6eda2bb1b90a6411f9df79d9ab14733110b021d..ec26daa1e2e5e4ba9c1137565e6c2f1d5d763e28 100644 --- a/Framework/ICat/src/GSoap/stdsoap2.cpp +++ b/Framework/ICat/src/GSoap/stdsoap2.cpp @@ -59,6 +59,10 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com #include "MantidICat/GSoap/stdsoap2.h" +#if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT) +#include <iostream> +#endif + #if defined(VXWORKS) && defined(WM_SECURE_KEY_STORAGE) #include <ipcom_key_db.h> #endif diff --git a/Framework/Kernel/inc/MantidKernel/ANN/ANN.h b/Framework/Kernel/inc/MantidKernel/ANN/ANN.h index db5de2b1e41320925b0544ca7a346b8df966d42d..30d66ac44a7fda27459bfd92bfa513a01d9fc04a 100644 --- a/Framework/Kernel/inc/MantidKernel/ANN/ANN.h +++ b/Framework/Kernel/inc/MantidKernel/ANN/ANN.h @@ -107,10 +107,10 @@ // basic includes //---------------------------------------------------------------------- -#include <cstdlib> // standard lib includes -#include <cmath> // math includes -#include <iostream> // I/O streams -#include <cstring> // C-style strings +#include <cstdlib> // standard lib includes +#include <cmath> // math includes +#include <iosfwd> // I/O streams +#include <cstring> // C-style strings //---------------------------------------------------------------------- // Limits diff --git a/Framework/Kernel/src/ANN/ANN.cpp b/Framework/Kernel/src/ANN/ANN.cpp index 67f9c84987efd4b2b1e84affd8e403d78b6fe35b..3cba35cc6c6c6ba5a6c811683917d91b1de35f4d 100644 --- a/Framework/Kernel/src/ANN/ANN.cpp +++ b/Framework/Kernel/src/ANN/ANN.cpp @@ -27,6 +27,7 @@ //---------------------------------------------------------------------- #include <cstdlib> // C standard lib defs +#include <iostream> // I/O streams #include "MantidKernel/ANN/ANNx.h" // all ANN includes #include "MantidKernel/ANN/ANNperf.h" // ANN Perf Header diff --git a/Framework/Kernel/src/Atom.cpp b/Framework/Kernel/src/Atom.cpp index 7a9e2551517b3de90b58f93b514b58d07efdd2c2..43452e3b8d6467c8a4c33a1f2d586910165169f7 100644 --- a/Framework/Kernel/src/Atom.cpp +++ b/Framework/Kernel/src/Atom.cpp @@ -1,5 +1,4 @@ #include <algorithm> -#include <iostream> // REMOVE #include <sstream> #include <stdexcept> #include "MantidKernel/Atom.h" diff --git a/Framework/Kernel/src/DllOpen.cpp b/Framework/Kernel/src/DllOpen.cpp index 927e518eac7df182180cb0f55d0da10ad47a2a09..e66b0dced4b5b1714d7988834008ec8a09160939 100644 --- a/Framework/Kernel/src/DllOpen.cpp +++ b/Framework/Kernel/src/DllOpen.cpp @@ -1,5 +1,4 @@ #include <string> -#include <iostream> /* If the OS is Windows then LoadLibrary, GetProcAddress and FreeLibrary are used. diff --git a/Framework/Kernel/src/Exception.cpp b/Framework/Kernel/src/Exception.cpp index ee12a3b5d95a6b68f7bd9fe3825158b2c11cf47a..26e6e194942991c765de3e0bed348d5e4764c77a 100644 --- a/Framework/Kernel/src/Exception.cpp +++ b/Framework/Kernel/src/Exception.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <sstream> #include "MantidKernel/Exception.h" diff --git a/Framework/Kernel/src/FacilityInfo.cpp b/Framework/Kernel/src/FacilityInfo.cpp index b85fb675073190996a71f4ab9fa71dc90a6401c5..9a42c5a20839d19cba3db33d3a9db7852cb8215c 100644 --- a/Framework/Kernel/src/FacilityInfo.cpp +++ b/Framework/Kernel/src/FacilityInfo.cpp @@ -2,7 +2,6 @@ // Includes //---------------------------------------------------------------------- #include <algorithm> -#include <iostream> #include "MantidKernel/FacilityInfo.h" #include "MantidKernel/ConfigService.h" diff --git a/Framework/Kernel/src/LibraryManager.cpp b/Framework/Kernel/src/LibraryManager.cpp index 438e55b9b1d016d31908b5824f22886a5ea992b7..da72c1042cb65c1941276552fe625c0181efb42c 100644 --- a/Framework/Kernel/src/LibraryManager.cpp +++ b/Framework/Kernel/src/LibraryManager.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include "MantidKernel/ConfigService.h" #include "MantidKernel/DllOpen.h" diff --git a/Framework/Kernel/src/Memory.cpp b/Framework/Kernel/src/Memory.cpp index a1f11272d0ac8ca2f642115b8bd1e441366ca495..448b22767877e15c80932f654fd6d317fae79479 100644 --- a/Framework/Kernel/src/Memory.cpp +++ b/Framework/Kernel/src/Memory.cpp @@ -1,8 +1,6 @@ #include "MantidKernel/Memory.h" #include "MantidKernel/Logger.h" -#include <iostream> -#include <iomanip> #include <sstream> #ifdef __linux__ diff --git a/Framework/Kernel/src/NetworkProxyOSX.cpp b/Framework/Kernel/src/NetworkProxyOSX.cpp index b3dbeb96dbc9dded88e2029784f5664d176298a9..5bdae5c9c297078640f34c5be7d481dee3fc852e 100644 --- a/Framework/Kernel/src/NetworkProxyOSX.cpp +++ b/Framework/Kernel/src/NetworkProxyOSX.cpp @@ -5,7 +5,6 @@ #include <SystemConfiguration/SystemConfiguration.h> #include <CoreFoundation/CoreFoundation.h> #include <CFNetwork/CFProxySupport.h> -#include <iostream> #include <sstream> #include <string> #include <vector> diff --git a/Framework/Kernel/src/NeutronAtom.cpp b/Framework/Kernel/src/NeutronAtom.cpp index 03874b20567f64528a9cde28317cfeeb01480b99..4469af38fb770fe88a084f6a1eab6c803ecabb84 100644 --- a/Framework/Kernel/src/NeutronAtom.cpp +++ b/Framework/Kernel/src/NeutronAtom.cpp @@ -4,7 +4,6 @@ #include "MantidKernel/NeutronAtom.h" #include "MantidKernel/PhysicalConstants.h" #include <algorithm> -#include <iostream> // REMOVE #include <sstream> #include <stdexcept> #include <boost/math/special_functions/fpclassify.hpp> diff --git a/Framework/Kernel/src/ProxyInfo.cpp b/Framework/Kernel/src/ProxyInfo.cpp index 1299ff719d8c1b81e5dc8a6d2592b662c537395c..c34da7a9411eb39b398ea93b3054f749d17e8496 100644 --- a/Framework/Kernel/src/ProxyInfo.cpp +++ b/Framework/Kernel/src/ProxyInfo.cpp @@ -1,6 +1,5 @@ #include "MantidKernel/ProxyInfo.h" #include <stdexcept> -#include <iostream> namespace Mantid { namespace Kernel { diff --git a/Framework/Kernel/src/Strings.cpp b/Framework/Kernel/src/Strings.cpp index c396f0e02c9b9179337274b07a24758d49aabed5..c2bf98bd5ac359c668662ad04aab5db601603e03 100644 --- a/Framework/Kernel/src/Strings.cpp +++ b/Framework/Kernel/src/Strings.cpp @@ -11,7 +11,6 @@ #include <cmath> #include <fstream> -#include <iomanip> using std::size_t; diff --git a/Framework/Kernel/src/ThreadSafeLogStream.cpp b/Framework/Kernel/src/ThreadSafeLogStream.cpp index e487fe13169a12b03237808fdea8a943162b9e4a..23eceb0c53eef5544e24bd5fc04bf1f8db227871 100644 --- a/Framework/Kernel/src/ThreadSafeLogStream.cpp +++ b/Framework/Kernel/src/ThreadSafeLogStream.cpp @@ -2,7 +2,6 @@ // Includes //----------------------------------------------- #include "MantidKernel/ThreadSafeLogStream.h" -#include <iostream> using namespace Mantid::Kernel; diff --git a/Framework/Kernel/src/V3D.cpp b/Framework/Kernel/src/V3D.cpp index 0d504d14bec5e04587d15b7f7926880a05733493..fc9ef31b403d5923fdb627ecd8687344d357bd96 100644 --- a/Framework/Kernel/src/V3D.cpp +++ b/Framework/Kernel/src/V3D.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <cmath> #include <float.h> #include <vector> diff --git a/Framework/Kernel/src/VectorHelper.cpp b/Framework/Kernel/src/VectorHelper.cpp index 71a917e2628e76750d6f9e67d0b0ee217bc6fe55..61aedadfc83fefb11da536e3229170dc378d050e 100644 --- a/Framework/Kernel/src/VectorHelper.cpp +++ b/Framework/Kernel/src/VectorHelper.cpp @@ -3,7 +3,6 @@ #include "MantidKernel/VectorHelper.h" #include <algorithm> -#include <iostream> #include <numeric> #include <sstream> #include <boost/algorithm/string.hpp> diff --git a/Framework/Kernel/test/ArrayLengthValidatorTest.h b/Framework/Kernel/test/ArrayLengthValidatorTest.h index fee68f88eb36cf7df2ccb4345bd990a9750be547..11f5912f56b56009e15028c6b49fafda04b5065a 100644 --- a/Framework/Kernel/test/ArrayLengthValidatorTest.h +++ b/Framework/Kernel/test/ArrayLengthValidatorTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include <vector> #include "MantidKernel/ArrayLengthValidator.h" diff --git a/Framework/Kernel/test/BoseEinsteinDistributionTest.h b/Framework/Kernel/test/BoseEinsteinDistributionTest.h index 8648aca16e781cebae037bd859cb1d10b1f5e0db..38809270e4610ce1cae724b1dc473f50c20d184b 100644 --- a/Framework/Kernel/test/BoseEinsteinDistributionTest.h +++ b/Framework/Kernel/test/BoseEinsteinDistributionTest.h @@ -6,9 +6,6 @@ #include <cxxtest/TestSuite.h> -#include <iostream> -#include <iomanip> - class BoseEinsteinDistributionTest : public CxxTest::TestSuite { public: void test_Standard_Distribution_Gives_Correct_Value_Away_From_Edge() { diff --git a/Framework/Kernel/test/CPUTimerTest.h b/Framework/Kernel/test/CPUTimerTest.h index 4e7ce55ff50a9af6541c8ca93050a8e6460679d2..802291637de8183b9e630b26cc747d586f9ac01b 100644 --- a/Framework/Kernel/test/CPUTimerTest.h +++ b/Framework/Kernel/test/CPUTimerTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidKernel/CPUTimer.h" diff --git a/Framework/Kernel/test/CompositeValidatorTest.h b/Framework/Kernel/test/CompositeValidatorTest.h index c13f5f990999f3a4021dca837102cd488cf83cb6..72f33a82d16bc9d0fd6d262e51ca374b057105b9 100644 --- a/Framework/Kernel/test/CompositeValidatorTest.h +++ b/Framework/Kernel/test/CompositeValidatorTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidKernel/CompositeValidator.h" #include "MantidKernel/BoundedValidator.h" diff --git a/Framework/Kernel/test/DiskBufferISaveableTest.h b/Framework/Kernel/test/DiskBufferISaveableTest.h index b75dbfba8bf0bb56d4c096d9197f8083ed08923e..d6c674ec2860962343651c2fa12d5722e5301fca 100644 --- a/Framework/Kernel/test/DiskBufferISaveableTest.h +++ b/Framework/Kernel/test/DiskBufferISaveableTest.h @@ -13,8 +13,6 @@ #include <boost/multi_index/mem_fun.hpp> #include <boost/multi_index/sequenced_index.hpp> #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Kernel; diff --git a/Framework/Kernel/test/DiskBufferTest.h b/Framework/Kernel/test/DiskBufferTest.h index 8da5e7cc4e300aa0df0d927dfe6ce4561a94f4e9..82a451b6ffc6870fd1b7fc13948048a69d833e0f 100644 --- a/Framework/Kernel/test/DiskBufferTest.h +++ b/Framework/Kernel/test/DiskBufferTest.h @@ -13,8 +13,6 @@ #include <boost/multi_index/mem_fun.hpp> #include <boost/multi_index/sequenced_index.hpp> #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Kernel; diff --git a/Framework/Kernel/test/EnabledWhenPropertyTest.h b/Framework/Kernel/test/EnabledWhenPropertyTest.h index af3453572a2335fcd2bcce083b4490b80a96fd04..20caf9b265779c621e59133c88cc061453eb00b4 100644 --- a/Framework/Kernel/test/EnabledWhenPropertyTest.h +++ b/Framework/Kernel/test/EnabledWhenPropertyTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidKernel/EnabledWhenProperty.h" #include "MantidKernel/PropertyManager.h" diff --git a/Framework/Kernel/test/FreeBlockTest.h b/Framework/Kernel/test/FreeBlockTest.h index 9cf27660d301a82c85a6556004cd0c0aeef95cac..1cf4e7408db6d6d197123bca277f90b6d9fcd550 100644 --- a/Framework/Kernel/test/FreeBlockTest.h +++ b/Framework/Kernel/test/FreeBlockTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Kernel; diff --git a/Framework/Kernel/test/FunctionTaskTest.h b/Framework/Kernel/test/FunctionTaskTest.h index b1ce5a461081200257dfc83002c9ae0d5e68d419..ff7054fa190719905c45b676defe03a3973630c8 100644 --- a/Framework/Kernel/test/FunctionTaskTest.h +++ b/Framework/Kernel/test/FunctionTaskTest.h @@ -7,9 +7,6 @@ #include "MantidKernel/Task.h" #include "MantidKernel/FunctionTask.h" -#include <iostream> -#include <iomanip> - using namespace Mantid::Kernel; /** Functions for use by the tasks */ diff --git a/Framework/Kernel/test/HermitePolynomialsTest.h b/Framework/Kernel/test/HermitePolynomialsTest.h index 8e11b8279bfe37a52f1b043cb87f39ead8743f1f..7cfde2e885efa143f3bf5660067bf725f3b7008c 100644 --- a/Framework/Kernel/test/HermitePolynomialsTest.h +++ b/Framework/Kernel/test/HermitePolynomialsTest.h @@ -2,7 +2,6 @@ #define MANTID_KERNEL_HERMITEPOLYNOMIALSTEST_H_ #include <cxxtest/TestSuite.h> -#include <iomanip> #include "MantidKernel/Math/Distributions/HermitePolynomials.h" class HermitePolynomialsTest : public CxxTest::TestSuite { diff --git a/Framework/Kernel/test/IPropertySettingsTest.h b/Framework/Kernel/test/IPropertySettingsTest.h index 3183c96e0d1dc62b28be4fc4123bafd061a8acb9..bb1e4afebba871bbb15805038853b4d21c1212f6 100644 --- a/Framework/Kernel/test/IPropertySettingsTest.h +++ b/Framework/Kernel/test/IPropertySettingsTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidKernel/IPropertySettings.h" using namespace Mantid; diff --git a/Framework/Kernel/test/ISaveableTest.h b/Framework/Kernel/test/ISaveableTest.h index 2c053fef2c6174fe4971a8afb3ffe0b38dde63ec..14be0493129e2fcf3e062e2a094a7659d8341901 100644 --- a/Framework/Kernel/test/ISaveableTest.h +++ b/Framework/Kernel/test/ISaveableTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; diff --git a/Framework/Kernel/test/LogParserTest.h b/Framework/Kernel/test/LogParserTest.h index 558b1c2bd8faaf2adca6403ea137a6c0875103ed..0cf62d8730c89ef30b35c9ec78626360841e8e02 100644 --- a/Framework/Kernel/test/LogParserTest.h +++ b/Framework/Kernel/test/LogParserTest.h @@ -3,7 +3,6 @@ #include <cxxtest/TestSuite.h> -#include <iostream> #include <fstream> #include "MantidKernel/LogParser.h" diff --git a/Framework/Kernel/test/MagneticFormFactorTableTest.h b/Framework/Kernel/test/MagneticFormFactorTableTest.h index 1762991bdfb25ba87980528285a20cf6662ff199..1d660d419e635a62a49b871ce6bb465f5fd44ce9 100644 --- a/Framework/Kernel/test/MagneticFormFactorTableTest.h +++ b/Framework/Kernel/test/MagneticFormFactorTableTest.h @@ -6,8 +6,6 @@ #include <boost/scoped_ptr.hpp> -#include <iomanip> - using Mantid::PhysicalConstants::MagneticFormFactorTable; class MagneticFormFactorTableTest : public CxxTest::TestSuite { diff --git a/Framework/Kernel/test/MemoryTest.h b/Framework/Kernel/test/MemoryTest.h index c2e55c723f63f4870bacdd64586982bf64ac0709..4b515aa9a277a10b2452da378d236f52f4322060 100644 --- a/Framework/Kernel/test/MemoryTest.h +++ b/Framework/Kernel/test/MemoryTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidKernel/Memory.h" #include "MantidKernel/MultiThreaded.h" diff --git a/Framework/Kernel/test/MutexTest.h b/Framework/Kernel/test/MutexTest.h index 2f52b64eac2d45988310fbd9d5ab5b2ac43159bf..47194481d641533003258aba139b9fe259425796 100644 --- a/Framework/Kernel/test/MutexTest.h +++ b/Framework/Kernel/test/MutexTest.h @@ -5,7 +5,6 @@ #include "MantidKernel/MultiThreaded.h" #include "MantidKernel/ThreadPool.h" #include "MantidKernel/FunctionTask.h" -#include <iostream> #include "MantidKernel/CPUTimer.h" #include <Poco/RWLock.h> using namespace Mantid::Kernel; diff --git a/Framework/Kernel/test/ProgressBaseTest.h b/Framework/Kernel/test/ProgressBaseTest.h index cecacc02982b5a7cd4a826ce7a52c2844150fc39..ac58b058210985420321a3bd68ada7c86d6a9841 100644 --- a/Framework/Kernel/test/ProgressBaseTest.h +++ b/Framework/Kernel/test/ProgressBaseTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidKernel/ProgressBase.h" diff --git a/Framework/Kernel/test/ProgressTextTest.h b/Framework/Kernel/test/ProgressTextTest.h index e70ab338386cf17b660216143bd68faa30b53f43..03432ae35fd58cfdd877e0cf38daa08138d4191b 100644 --- a/Framework/Kernel/test/ProgressTextTest.h +++ b/Framework/Kernel/test/ProgressTextTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include <cstdlib> #include "MantidKernel/ProgressText.h" diff --git a/Framework/Kernel/test/StdoutChannelTest.h b/Framework/Kernel/test/StdoutChannelTest.h index e0ef37350d8875bfc478351183b98b575e9fd753..3c24efdf4ecf160e4b86478c2b36da005a1aa19d 100644 --- a/Framework/Kernel/test/StdoutChannelTest.h +++ b/Framework/Kernel/test/StdoutChannelTest.h @@ -5,7 +5,6 @@ #include "MantidKernel/StdoutChannel.h" #include "MantidKernel/Logger.h" -#include <iostream> #include <Poco/Logger.h> #include <Poco/NullChannel.h> #include <Poco/AutoPtr.h> diff --git a/Framework/Kernel/test/TaskTest.h b/Framework/Kernel/test/TaskTest.h index b9d2fc3f0a1050aa543c8032815fc17e21135741..975a27f179e93dcfe4576d66fcbccbe2f8d1f80f 100644 --- a/Framework/Kernel/test/TaskTest.h +++ b/Framework/Kernel/test/TaskTest.h @@ -6,9 +6,6 @@ #include <MantidKernel/Timer.h> #include "MantidKernel/Task.h" -#include <iostream> -#include <iomanip> - using namespace Mantid::Kernel; namespace TaskTestNamespace { diff --git a/Framework/Kernel/test/ThreadPoolRunnableTest.h b/Framework/Kernel/test/ThreadPoolRunnableTest.h index 009dae5e2b8c40fece751eaa4921eb080b10a37f..9d7470406d7de456048cb68bf22c068cb4f32ff0 100644 --- a/Framework/Kernel/test/ThreadPoolRunnableTest.h +++ b/Framework/Kernel/test/ThreadPoolRunnableTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include <MantidKernel/Timer.h> #include <MantidKernel/System.h> -#include <iostream> -#include <iomanip> #include <MantidKernel/ThreadPoolRunnable.h> #include <MantidKernel/ThreadScheduler.h> diff --git a/Framework/Kernel/test/ThreadPoolTest.h b/Framework/Kernel/test/ThreadPoolTest.h index c8aaca80a53e0963993b41410820afc983b280a8..624221f4cfdbc1c57ca439e897e72884a90af002 100644 --- a/Framework/Kernel/test/ThreadPoolTest.h +++ b/Framework/Kernel/test/ThreadPoolTest.h @@ -13,8 +13,6 @@ #include <boost/bind.hpp> #include <boost/make_shared.hpp> -#include <iostream> -#include <iomanip> #include <Poco/Mutex.h> #include <cstdlib> diff --git a/Framework/Kernel/test/ThreadSchedulerMutexesTest.h b/Framework/Kernel/test/ThreadSchedulerMutexesTest.h index 9c8166f6795ad7713d1d00adef340b6253daff62..bc74c0d5dd6256175b3fe1fd5d36388b86a20c71 100644 --- a/Framework/Kernel/test/ThreadSchedulerMutexesTest.h +++ b/Framework/Kernel/test/ThreadSchedulerMutexesTest.h @@ -5,8 +5,6 @@ #include <MantidKernel/Timer.h> #include <MantidKernel/System.h> #include <boost/make_shared.hpp> -#include <iostream> -#include <iomanip> #include <MantidKernel/ThreadSchedulerMutexes.h> diff --git a/Framework/Kernel/test/ThreadSchedulerTest.h b/Framework/Kernel/test/ThreadSchedulerTest.h index 16786463bf19d92497f7c98c3ef75de4c5a332f8..31d6e7f7b29465af685ac9c0cdf83ac373f1da50 100644 --- a/Framework/Kernel/test/ThreadSchedulerTest.h +++ b/Framework/Kernel/test/ThreadSchedulerTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include <MantidKernel/Timer.h> #include <MantidKernel/System.h> -#include <iostream> -#include <iomanip> #include <MantidKernel/ThreadScheduler.h> #include <MantidKernel/Task.h> diff --git a/Framework/Kernel/test/UnitConversionTest.h b/Framework/Kernel/test/UnitConversionTest.h index f3b0a259c7b4dae6fb661cb33db16feb68da93ae..369caac852ad64d24fd85e11192719c38fc3b8c3 100644 --- a/Framework/Kernel/test/UnitConversionTest.h +++ b/Framework/Kernel/test/UnitConversionTest.h @@ -6,8 +6,6 @@ #include "MantidKernel/Exception.h" #include "MantidKernel/PhysicalConstants.h" -#include <iomanip> - using Mantid::Kernel::UnitConversion; class UnitConversionTest : public CxxTest::TestSuite { diff --git a/Framework/Kernel/test/UtilsTest.h b/Framework/Kernel/test/UtilsTest.h index fd76bb7e91bed37c52d64f4a4149d674e14706a7..767a1a4b4dd2835ff42151c18dfe8cc4ce5df69f 100644 --- a/Framework/Kernel/test/UtilsTest.h +++ b/Framework/Kernel/test/UtilsTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidKernel/Utils.h" diff --git a/Framework/Kernel/test/VMDTest.h b/Framework/Kernel/test/VMDTest.h index 27ac5cc6087a7326551f026156cfe36609580d96..0d550ab59a508ebce516b1ca4b6b48ed55d047b2 100644 --- a/Framework/Kernel/test/VMDTest.h +++ b/Framework/Kernel/test/VMDTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" #include <cmath> -#include <iostream> -#include <iomanip> #include "MantidKernel/VMD.h" diff --git a/Framework/Kernel/test/VectorHelperTest.h b/Framework/Kernel/test/VectorHelperTest.h index 2573f0b11e962c396acdca2dd289834c62d1e2ec..16f9f4b86a2f79e2fe41a07dc55323e44066e000 100644 --- a/Framework/Kernel/test/VectorHelperTest.h +++ b/Framework/Kernel/test/VectorHelperTest.h @@ -5,8 +5,6 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/VectorHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <boost/assign/list_of.hpp> using namespace Mantid::Kernel; diff --git a/Framework/Kernel/test/VisibleWhenPropertyTest.h b/Framework/Kernel/test/VisibleWhenPropertyTest.h index 1ed5da48cd5bcc75fc86adb8a01bd7c13f83ca7d..197009c33bdc9c841ba2cd705ee024caed7ea845 100644 --- a/Framework/Kernel/test/VisibleWhenPropertyTest.h +++ b/Framework/Kernel/test/VisibleWhenPropertyTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidKernel/VisibleWhenProperty.h" #include "MantidKernel/PropertyManagerOwner.h" diff --git a/Framework/LiveData/test/LiveDataAlgorithmTest.h b/Framework/LiveData/test/LiveDataAlgorithmTest.h index a3eb949773fcdee51a810d6fe7b34e526d136aa6..0e2b7344b381ddaa4b09cdbadf40dab822f75423 100644 --- a/Framework/LiveData/test/LiveDataAlgorithmTest.h +++ b/Framework/LiveData/test/LiveDataAlgorithmTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidLiveData/LiveDataAlgorithm.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidTestHelpers/FacilityHelper.h" diff --git a/Framework/LiveData/test/LoadLiveDataTest.h b/Framework/LiveData/test/LoadLiveDataTest.h index 91b69f5ad0ec7a4693c19dd7aed8d051fcf991ba..77bdef423f6cb70ec7abff8bc81c80ccec2d0570 100644 --- a/Framework/LiveData/test/LoadLiveDataTest.h +++ b/Framework/LiveData/test/LoadLiveDataTest.h @@ -7,8 +7,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include <numeric> #include "MantidDataObjects/Workspace2D.h" #include "MantidKernel/ConfigService.h" diff --git a/Framework/LiveData/test/MonitorLiveDataTest.h b/Framework/LiveData/test/MonitorLiveDataTest.h index fc9d1e9a653e7809b43829021a78677f74e913ba..0fdd7f94b60b762ca57152ba142c5f37a6407838 100644 --- a/Framework/LiveData/test/MonitorLiveDataTest.h +++ b/Framework/LiveData/test/MonitorLiveDataTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidLiveData/MonitorLiveData.h" #include "MantidAPI/AlgorithmManager.h" diff --git a/Framework/LiveData/test/StartLiveDataTest.h b/Framework/LiveData/test/StartLiveDataTest.h index 8f7729d14eea1dde91094dd99bbcdc97688a64b4..023343ebd11be6149873e508b8dd7c9c1df932bf 100644 --- a/Framework/LiveData/test/StartLiveDataTest.h +++ b/Framework/LiveData/test/StartLiveDataTest.h @@ -6,8 +6,6 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> #include "MantidKernel/SingletonHolder.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/FrameworkManager.h" diff --git a/Framework/MDAlgorithms/CMakeLists.txt b/Framework/MDAlgorithms/CMakeLists.txt index d52d54087d1ee9ad8e3c019dbc931d490c2f9416..f3e9e4d04a2db2271f828af463f363f2364f2462 100644 --- a/Framework/MDAlgorithms/CMakeLists.txt +++ b/Framework/MDAlgorithms/CMakeLists.txt @@ -19,6 +19,7 @@ set ( SRC_FILES src/ConvToMDSelector.cpp src/ConvertCWPDMDToSpectra.cpp src/ConvertCWSDExpToMomentum.cpp + src/ConvertCWSDMDtoHKL.cpp src/ConvertMDHistoToMatrixWorkspace.cpp src/ConvertSpiceDataToRealSpace.cpp src/ConvertToDetectorFaceMD.cpp @@ -138,6 +139,7 @@ set ( INC_FILES inc/MantidMDAlgorithms/ConvToMDBase.h inc/MantidMDAlgorithms/ConvertCWPDMDToSpectra.h inc/MantidMDAlgorithms/ConvertCWSDExpToMomentum.h + inc/MantidMDAlgorithms/ConvertCWSDMDtoHKL.h inc/MantidMDAlgorithms/ConvertMDHistoToMatrixWorkspace.h inc/MantidMDAlgorithms/ConvertSpiceDataToRealSpace.h inc/MantidMDAlgorithms/ConvertToDetectorFaceMD.h @@ -257,6 +259,7 @@ set ( TEST_FILES CompareMDWorkspacesTest.h ConvertCWPDMDToSpectraTest.h ConvertCWSDExpToMomentumTest.h + ConvertCWSDMDtoHKLTest.h ConvertEventsToMDTest.h ConvertMDHistoToMatrixWorkspaceTest.h ConvertSpiceDataToRealSpaceTest.h diff --git a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertCWSDMDtoHKL.h b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertCWSDMDtoHKL.h new file mode 100644 index 0000000000000000000000000000000000000000..6879be0456ee797b4df6442510d5ad6894024197 --- /dev/null +++ b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertCWSDMDtoHKL.h @@ -0,0 +1,107 @@ +#ifndef MANTID_MDALGORITHMS_CONVERTCWSDMDTOHKL_H_ +#define MANTID_MDALGORITHMS_CONVERTCWSDMDTOHKL_H_ + +#include "MantidMDAlgorithms/DllConfig.h" +#include "MantidKernel/System.h" +#include "MantidAPI/Algorithm.h" +#include "MantidAPI/IMDEventWorkspace_fwd.h" +#include "MantidDataObjects/PeaksWorkspace.h" +#include "MantidKernel/Matrix.h" +#include "MantidKernel/V3D.h" + +namespace Mantid { +namespace MDAlgorithms { + +/** ConvertCWSDMDtoHKL : TODO: DESCRIPTION + + 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 <http://www.gnu.org/licenses/>. + + File change history is stored at: <https://github.com/mantidproject/mantid> + Code Documentation is available at: <http://doxygen.mantidproject.org> +*/ +class MANTID_MDALGORITHMS_DLL ConvertCWSDMDtoHKL : public API::Algorithm { +public: + ConvertCWSDMDtoHKL(); + virtual ~ConvertCWSDMDtoHKL(); + + /// Algorithm's name + virtual const std::string name() const { return "ConvertCWSDMDtoHKL"; } + + /// Summary of algorithms purpose + virtual const std::string summary() const { + return "Convert constant wavelength single crystal diffractomer's data" + "in MDEventWorkspace and in unit of Q-sample to the HKL space " + "by UB matrix."; + } + + /// Algorithm's version + virtual int version() const { return (1); } + + /// Algorithm's category for identification + virtual const std::string category() const { + return "Diffraction;MDAlgorithms"; + } + +private: + /// Initialisation code + void init(); + + /// Execution code + void exec(); + + void exportEvents(API::IMDEventWorkspace_sptr mdws, + std::vector<Kernel::V3D> &vec_event_qsample, + std::vector<signal_t> &vec_event_signal, + std::vector<detid_t> &vec_event_det); + + void convertFromQSampleToHKL(const std::vector<Kernel::V3D> &q_vectors, + std::vector<Kernel::V3D> &miller_indices); + + API::IMDEventWorkspace_sptr + createHKLMDWorkspace(const std::vector<Kernel::V3D> &vec_hkl, + const std::vector<signal_t> &vec_signal, + const std::vector<detid_t> &vec_detid); + + void addMDEvents(std::vector<std::vector<coord_t>> &vec_q_sample, + std::vector<float> &vec_signal); + + void + saveMDToFile(std::vector<std::vector<Mantid::coord_t>> &vec_event_qsample, + std::vector<float> &vec_event_signal); + + void saveEventsToFile(const std::string &filename, + std::vector<Kernel::V3D> &vec_event_pos, + std::vector<signal_t> &vec_event_signal, + std::vector<detid_t> &vec_event_detid); + + void getUBMatrix(); + + void getRange(const std::vector<Kernel::V3D> vec_hkl, + std::vector<double> &extentMins, + std::vector<double> &extentMaxs); + + API::IMDEventWorkspace_sptr m_outputWS; + + Kernel::Matrix<double> m_UB; +}; + +} // namespace MDAlgorithms +} // namespace Mantid + +#endif /* MANTID_MDALGORITHMS_CONVERTCWSDMDTOHKL_H_ */ diff --git a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadILLAsciiHelper.h b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadILLAsciiHelper.h index f4e5d2fadaf3ddee29820c6de4fc596aac9881da..d2005ab91e8df6e47da8fd2229014e77737d649a 100644 --- a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadILLAsciiHelper.h +++ b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadILLAsciiHelper.h @@ -3,7 +3,6 @@ #include "MantidMDAlgorithms/DllConfig.h" -#include <iostream> #include <fstream> #include <vector> #include <string> diff --git a/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp b/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ebee9b77c9e84a78b80ef741ee177271aab55475 --- /dev/null +++ b/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp @@ -0,0 +1,403 @@ +#include "MantidMDAlgorithms/ConvertCWSDMDtoHKL.h" + +#include "MantidAPI/WorkspaceProperty.h" +#include "MantidAPI/IMDEventWorkspace.h" +#include "MantidAPI/IMDIterator.h" + +#include "MantidGeometry/Crystal/IndexingUtils.h" +#include "MantidGeometry/Crystal/OrientedLattice.h" +#include "MantidKernel/BoundedValidator.h" +#include "MantidKernel/ArrayProperty.h" + +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidAPI/ExperimentInfo.h" +#include "MantidGeometry/Instrument/ComponentHelper.h" +#include "MantidMDAlgorithms/MDWSDescription.h" +#include "MantidMDAlgorithms/MDWSTransform.h" +#include "MantidAPI/FileProperty.h" +#include "MantidDataObjects/MDBoxBase.h" +#include "MantidDataObjects/MDEventInserter.h" + +#include <fstream> + +namespace Mantid { +namespace MDAlgorithms { + +using namespace Mantid::API; +using namespace Mantid::Kernel; +using namespace Mantid::MDAlgorithms; +using namespace Mantid::DataObjects; +using namespace Mantid::Geometry; + +DECLARE_ALGORITHM(ConvertCWSDMDtoHKL) + +//---------------------------------------------------------------------------------------------- +/** Constructor + */ +ConvertCWSDMDtoHKL::ConvertCWSDMDtoHKL() {} + +//---------------------------------------------------------------------------------------------- +/** Destructor + */ +ConvertCWSDMDtoHKL::~ConvertCWSDMDtoHKL() {} + +//---------------------------------------------------------------------------------------------- +/** Init + */ +void ConvertCWSDMDtoHKL::init() { + declareProperty(new WorkspaceProperty<IMDEventWorkspace>("InputWorkspace", "", + Direction::Input), + "Name of the input MDEventWorkspace that stores detectors " + "counts from a constant-wave powder diffraction experiment."); + + declareProperty(new WorkspaceProperty<PeaksWorkspace>("PeaksWorkspace", "", + Direction::Input, + PropertyMode::Optional), + "Input Peaks Workspace"); + + declareProperty( + new ArrayProperty<double>("UBMatrix"), + "A comma seperated list of doubles for UB matrix from (0,0), (0,1)" + "... (2,1),(2,2)"); + + declareProperty(new WorkspaceProperty<IMDEventWorkspace>( + "OutputWorkspace", "", Direction::Output), + "Name of the output MDEventWorkspace in HKL-space."); + + std::vector<std::string> exts; + exts.push_back(".dat"); + declareProperty( + new FileProperty("QSampleFileName", "", API::FileProperty::OptionalSave), + "Name of file for sample sample."); + + declareProperty( + new FileProperty("HKLFileName", "", API::FileProperty::OptionalSave), + "Name of file for HKL."); +} + +//---------------------------------------------------------------------------------------------- +/** Exec + */ +void ConvertCWSDMDtoHKL::exec() { + // Get inputs + IMDEventWorkspace_sptr inputWS = getProperty("InputWorkspace"); + if (inputWS->getSpecialCoordinateSystem() != Mantid::Kernel::QSample) { + std::stringstream errmsg; + errmsg << "Input MDEventWorkspace's coordinate system is not QSample but " + << inputWS->getSpecialCoordinateSystem() << "."; + throw std::invalid_argument(errmsg.str()); + } + + getUBMatrix(); + + // Test indexing. Will be delete soon + if (true) { + Kernel::V3D qsample; // [1.36639,-2.52888,-4.77349] + qsample.setX(1.36639); + qsample.setY(-2.52888); + qsample.setZ(-4.77349); + + std::vector<Kernel::V3D> vec_qsample; + vec_qsample.push_back(qsample); + std::vector<Kernel::V3D> vec_mindex(0); + + convertFromQSampleToHKL(vec_qsample, vec_mindex); + g_log.notice() << "[DB Number of returned Miller Index = " + << vec_mindex.size() << "\n"; + g_log.notice() << "[DB] Output HKL = " << vec_mindex[0].toString() << "\n"; + } + + // Get events information for future processing + std::vector<Kernel::V3D> vec_event_qsample; + std::vector<signal_t> vec_event_signal; + std::vector<detid_t> vec_event_det; + exportEvents(inputWS, vec_event_qsample, vec_event_signal, vec_event_det); + + std::string qsamplefilename = getPropertyValue("QSampleFileName"); + // Abort with an empty string + if (qsamplefilename.size() > 0) + saveEventsToFile(qsamplefilename, vec_event_qsample, vec_event_signal, + vec_event_det); + + // Convert to HKL + std::vector<Kernel::V3D> vec_event_hkl; + convertFromQSampleToHKL(vec_event_qsample, vec_event_hkl); + + // Get file name + std::string hklfilename = getPropertyValue("HKLFileName"); + // Abort mission if no file name is given + if (hklfilename.size() > 0) + saveEventsToFile(hklfilename, vec_event_hkl, vec_event_signal, + vec_event_det); + + // Create output workspace + m_outputWS = + createHKLMDWorkspace(vec_event_hkl, vec_event_signal, vec_event_det); + + setProperty("OutputWorkspace", m_outputWS); +} + +void ConvertCWSDMDtoHKL::getUBMatrix() { + std::string peakwsname = getPropertyValue("PeaksWorkspace"); + if (peakwsname.size() > 0 && + AnalysisDataService::Instance().doesExist(peakwsname)) { + // Get from peak works + DataObjects::PeaksWorkspace_sptr peakws = getProperty("PeaksWorkspace"); + m_UB = + Kernel::Matrix<double>(peakws->sample().getOrientedLattice().getUB()); + } else { + // Get from ... + std::vector<double> ub_array = getProperty("UBMatrix"); + if (ub_array.size() != 9) + throw std::invalid_argument("Input UB matrix must have 9 elements"); + + m_UB = Kernel::Matrix<double>(3, 3); + for (size_t i = 0; i < 3; ++i) { + for (size_t j = 0; j < 3; ++j) { + m_UB[i][j] = ub_array[i * 3 + j]; + } + } + } + + return; +} + +//-------------------------------------------------------------------------- +/** Export events from an MDEventWorkspace for future processing + * It is a convenient algorithm if number of events are few relative to + * number of detectors + */ +void ConvertCWSDMDtoHKL::exportEvents( + IMDEventWorkspace_sptr mdws, std::vector<Kernel::V3D> &vec_event_qsample, + std::vector<signal_t> &vec_event_signal, + std::vector<detid_t> &vec_event_det) { + // Set the size of the output vectors + size_t numevents = mdws->getNEvents(); + g_log.information() << "Number of events = " << numevents << "\n"; + + vec_event_qsample.resize(numevents); + vec_event_signal.resize(numevents); + vec_event_det.resize(numevents); + + // Go through to get value + IMDIterator *mditer = mdws->createIterator(); + size_t nextindex = 1; + bool scancell = true; + size_t currindex = 0; + while (scancell) { + size_t numevent_cell = mditer->getNumEvents(); + for (size_t iev = 0; iev < numevent_cell; ++iev) { + // Check + if (currindex >= vec_event_qsample.size()) + throw std::runtime_error("Logic error in event size!"); + + float tempx = mditer->getInnerPosition(iev, 0); + float tempy = mditer->getInnerPosition(iev, 1); + float tempz = mditer->getInnerPosition(iev, 2); + signal_t signal = mditer->getInnerSignal(iev); + detid_t detid = mditer->getInnerDetectorID(iev); + Kernel::V3D qsample(tempx, tempy, tempz); + vec_event_qsample[currindex] = qsample; + vec_event_signal[currindex] = signal; + vec_event_det[currindex] = detid; + + ++currindex; + } + + // Advance to next cell + if (mditer->next()) { + // advance to next cell + mditer->jumpTo(nextindex); + ++nextindex; + } else { + // break the loop + scancell = false; + } + } + + return; +} + +//-------------------------------------------------------------------------- +/** Save Q-sample to file + */ +void ConvertCWSDMDtoHKL::saveMDToFile( + std::vector<std::vector<coord_t>> &vec_event_qsample, + std::vector<float> &vec_event_signal) { + // Get file name + std::string filename = getPropertyValue("QSampleFileName"); + + // Abort with an empty string + if (filename.size() == 0) + return; + if (vec_event_qsample.size() != vec_event_signal.size()) + throw std::runtime_error( + "Input vectors of Q-sample and signal have different sizes."); + + // Write to file + std::ofstream ofile; + ofile.open(filename.c_str()); + + size_t numevents = vec_event_qsample.size(); + for (size_t i = 0; i < numevents; ++i) { + ofile << vec_event_qsample[i][0] << ", " << vec_event_qsample[i][1] << ", " + << vec_event_qsample[i][2] << ", " << vec_event_signal[i] << "\n"; + } + ofile.close(); + + return; +} + +//-------------------------------------------------------------------------- +/** Save HKL to file for 3D visualization + */ +void ConvertCWSDMDtoHKL::saveEventsToFile( + const std::string &filename, std::vector<Kernel::V3D> &vec_event_pos, + std::vector<signal_t> &vec_event_signal, + std::vector<detid_t> &vec_event_detid) { + // Check + if (vec_event_detid.size() != vec_event_pos.size() || + vec_event_pos.size() != vec_event_signal.size()) + throw std::invalid_argument( + "Input vectors for HKL, signal and detector ID have different size."); + + std::ofstream ofile; + ofile.open(filename.c_str()); + + size_t numevents = vec_event_pos.size(); + for (size_t i = 0; i < numevents; ++i) { + ofile << vec_event_pos[i].X() << ", " << vec_event_pos[i].Y() << ", " + << vec_event_pos[i].Z() << ", " << vec_event_signal[i] << ", " + << vec_event_detid[i] << "\n"; + } + ofile.close(); + + return; +} + +//-------------------------------------------------------------------------- +/** Convert from Q-sample to HKL + */ +void ConvertCWSDMDtoHKL::convertFromQSampleToHKL( + const std::vector<V3D> &q_vectors, std::vector<V3D> &miller_indices) { + + Matrix<double> tempUB(m_UB); + + int original_indexed = 0; + double original_error = 0; + double tolerance = 0.55; // to make sure no output is invalid + original_indexed = IndexingUtils::CalculateMillerIndices( + tempUB, q_vectors, tolerance, miller_indices, original_error); + + g_log.notice() << "[DB] " << original_indexed << " peaks are indexed." + << "\n"; + + return; +} + +//---------------------------------------------------------------------------------------------- +/** Create output workspace + * @brief ConvertCWSDExpToMomentum::createExperimentMDWorkspace + * @return + */ +API::IMDEventWorkspace_sptr ConvertCWSDMDtoHKL::createHKLMDWorkspace( + const std::vector<Kernel::V3D> &vec_hkl, + const std::vector<signal_t> &vec_signal, + const std::vector<detid_t> &vec_detid) { + // Check + if (vec_hkl.size() != vec_signal.size() || + vec_signal.size() != vec_detid.size()) + throw std::invalid_argument("Input vectors for HKL, signal and detector " + "IDs are of different size!"); + + // Create workspace in Q_sample with dimenion as 3 + size_t nDimension = 3; + IMDEventWorkspace_sptr mdws = + MDEventFactory::CreateMDWorkspace(nDimension, "MDEvent"); + + // Extract Dimensions and add to the output workspace. + std::vector<std::string> vec_ID(3); + vec_ID[0] = "H"; + vec_ID[1] = "K"; + vec_ID[2] = "L"; + + std::vector<std::string> dimensionNames(3); + dimensionNames[0] = "H"; + dimensionNames[1] = "K"; + dimensionNames[2] = "L"; + + Mantid::Kernel::SpecialCoordinateSystem coordinateSystem = + Mantid::Kernel::HKL; + + // Add dimensions + std::vector<double> m_extentMins(3); + std::vector<double> m_extentMaxs(3); + std::vector<size_t> m_numBins(3, 100); + getRange(vec_hkl, m_extentMins, m_extentMaxs); + + for (size_t i = 0; i < nDimension; ++i) { + std::string id = vec_ID[i]; + std::string name = dimensionNames[i]; + // std::string units = "A^-1"; + std::string units = ""; + mdws->addDimension( + Geometry::MDHistoDimension_sptr(new Geometry::MDHistoDimension( + id, name, units, static_cast<coord_t>(m_extentMins[i]), + static_cast<coord_t>(m_extentMaxs[i]), m_numBins[i]))); + } + + // Set coordinate system + mdws->setCoordinateSystem(coordinateSystem); + + // Creates a new instance of the MDEventInserter to output workspace + MDEventWorkspace<MDEvent<3>, 3>::sptr mdws_mdevt_3 = + boost::dynamic_pointer_cast<MDEventWorkspace<MDEvent<3>, 3>>(mdws); + MDEventInserter<MDEventWorkspace<MDEvent<3>, 3>::sptr> inserter(mdws_mdevt_3); + + // Go though each spectrum to conver to MDEvent + for (size_t iq = 0; iq < vec_hkl.size(); ++iq) { + Kernel::V3D hkl = vec_hkl[iq]; + std::vector<Mantid::coord_t> millerindex(3); + millerindex[0] = static_cast<float>(hkl.X()); + millerindex[1] = static_cast<float>(hkl.Y()); + millerindex[2] = static_cast<float>(hkl.Z()); + + signal_t signal = vec_signal[iq]; + signal_t error = std::sqrt(signal); + uint16_t runnumber = 1; + detid_t detid = vec_detid[iq]; + + // Insert + inserter.insertMDEvent( + static_cast<float>(signal), static_cast<float>(error * error), + static_cast<uint16_t>(runnumber), detid, millerindex.data()); + } + + return mdws; +} + +void ConvertCWSDMDtoHKL::getRange(const std::vector<Kernel::V3D> vec_hkl, + std::vector<double> &extentMins, + std::vector<double> &extentMaxs) { + assert(extentMins.size() == 3); + assert(extentMaxs.size() == 3); + + for (size_t i = 0; i < 3; ++i) { + double minvalue = vec_hkl[0][i]; + double maxvalue = vec_hkl[0][i]; + for (size_t j = 1; j < vec_hkl.size(); ++j) { + double thisvalue = vec_hkl[j][i]; + if (thisvalue < minvalue) + minvalue = thisvalue; + else if (thisvalue > maxvalue) + maxvalue = thisvalue; + } + extentMins[i] = minvalue; + extentMaxs[i] = maxvalue; + } + + return; +} + +} // namespace MDAlgorithms +} // namespace Mantid diff --git a/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp b/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp index 43447b0003f073fe68f43902771e4a0ae16a4242..fe2dfbcc3e23ed987c6f0bb5d042c46f8b37ded7 100644 --- a/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp +++ b/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp @@ -3,6 +3,7 @@ #include "MantidAPI/IEventWorkspace.h" #include "MantidAPI/ITableWorkspace.h" #include "MantidAPI/WorkspaceValidators.h" +#include "MantidAPI/Progress.h" #include "MantidDataObjects/EventWorkspace.h" #include "MantidDataObjects/TableWorkspace.h" @@ -296,6 +297,7 @@ void ConvertToReflectometryQ::exec() { checkOutputDimensionalityChoice(outputDimensions); // TODO: This check can be // retired as soon as all // transforms have been + // Extract the incient theta angle from the logs if a user provided one is not // given. if (!bUseOwnIncidentTheta) { @@ -351,41 +353,66 @@ void ConvertToReflectometryQ::exec() { TableWorkspace_sptr vertexes = boost::make_shared<Mantid::DataObjects::TableWorkspace>(); - + Progress transSelectionProg(this, 0.0, 0.1, 2); if (outputAsMDWorkspace) { + transSelectionProg.report("Choosing Transformation"); if (transMethod == centerTransform()) { auto outputMDWS = transform->executeMD(inputWs, bc); + Progress transPerformProg(this, 0.1, 0.7, 5); + transPerformProg.report("Performed transformation"); // Copy ExperimentInfo (instrument, run, sample) to the output WS ExperimentInfo_sptr ei(inputWs->cloneExperimentInfo()); outputMDWS->addExperimentInfo(ei); outputWS = outputMDWS; } else if (transMethod == normPolyTransform()) { - throw std::runtime_error("Normalised Polynomial rebinning not supported " - "for multidimensional output."); - } else { - throw std::runtime_error("Unknown rebinning method: " + transMethod); - } - } else { - if (transMethod == centerTransform()) { - auto outputWS2D = transform->execute(inputWs); - outputWS2D->copyExperimentInfoFrom(inputWs.get()); - outputWS = outputWS2D; - } else if (transMethod == normPolyTransform()) { + Progress transPerformProg(this, 0.1, 0.7, 5); const bool dumpVertexes = this->getProperty("DumpVertexes"); auto vertexesTable = vertexes; - - auto outputWSRB = transform->executeNormPoly( + // perform the normalised polygon transformation + transPerformProg.report("Performing Transformation"); + auto normPolyTrans = transform->executeNormPoly( inputWs, vertexesTable, dumpVertexes, outputDimensions); - outputWSRB->copyExperimentInfoFrom(inputWs.get()); - outputWS = outputWSRB; + // copy any experiment info from input workspace + normPolyTrans->copyExperimentInfoFrom(inputWs.get()); + // produce MDHistoWorkspace from normPolyTrans workspace. + Progress outputToMDProg(this, 0.7, 0.75, 10); + auto outputMDWS = transform->executeMDNormPoly(normPolyTrans); + ExperimentInfo_sptr ei(normPolyTrans->cloneExperimentInfo()); + outputMDWS->addExperimentInfo(ei); + outputWS = outputMDWS; + outputToMDProg.report("Successfully output to MD"); } else { throw std::runtime_error("Unknown rebinning method: " + transMethod); } + } else if (transMethod == normPolyTransform()) { + transSelectionProg.report("Choosing Transformation"); + Progress transPerformProg(this, 0.1, 0.7, 5); + const bool dumpVertexes = this->getProperty("DumpVertexes"); + auto vertexesTable = vertexes; + // perform the normalised polygon transformation + transPerformProg.report("Performing Transformation"); + auto output2DWS = transform->executeNormPoly( + inputWs, vertexesTable, dumpVertexes, outputDimensions); + // copy any experiment info from input workspace + output2DWS->copyExperimentInfoFrom(inputWs.get()); + outputWS = output2DWS; + transPerformProg.report("Transformation Complete"); + } else if (transMethod == centerTransform()) { + transSelectionProg.report("Choosing Transformation"); + Progress transPerformProg(this, 0.1, 0.7, 5); + transPerformProg.report("Performing Transformation"); + auto output2DWS = transform->execute(inputWs); + output2DWS->copyExperimentInfoFrom(inputWs.get()); + outputWS = output2DWS; + } else { + throw std::runtime_error("Unknown rebinning method: " + transMethod); } // Execute the transform and bind to the output. setProperty("OutputWorkspace", outputWS); setProperty("OutputVertexes", vertexes); + Progress setPropertyProg(this, 0.8, 1.0, 2); + setPropertyProg.report("Success"); } } // namespace Mantid diff --git a/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp b/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp index a4efd01bb0b495f0c56ad4e300adbc3226beba5a..9bb7c6d1a1723019e115ccda352ef3039a6dccee 100644 --- a/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp +++ b/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp @@ -1,6 +1,5 @@ #include "MantidMDAlgorithms/ImportMDEventWorkspace.h" -#include <iostream> #include <fstream> #include "MantidAPI/FileProperty.h" diff --git a/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp b/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp index 15f5a9a509f02a065b4283e6c88fe78e3b8b98be..86c15fc3b05b07f906ef23c84d4676e85ce1f41a 100644 --- a/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp +++ b/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp @@ -2,7 +2,6 @@ #include "MantidAPI/FileProperty.h" #include <deque> -#include <iostream> #include <fstream> #include <iterator> diff --git a/Framework/MDAlgorithms/src/Integrate3DEvents.cpp b/Framework/MDAlgorithms/src/Integrate3DEvents.cpp index 8c1bf115599b74073af6a619828ab287548ebb83..f3db57b5fd7b3652e27e4bf5187cbf8311c872e5 100644 --- a/Framework/MDAlgorithms/src/Integrate3DEvents.cpp +++ b/Framework/MDAlgorithms/src/Integrate3DEvents.cpp @@ -1,5 +1,4 @@ #include <math.h> -#include <iostream> #include <fstream> #include <boost/math/special_functions/round.hpp> #include <boost/make_shared.hpp> diff --git a/Framework/MDAlgorithms/src/LoadILLAscii.cpp b/Framework/MDAlgorithms/src/LoadILLAscii.cpp index 835d1fe1868e3c0418d8980bf2187d5933fa4bfb..86aaa741729dfb73a32c08a17dbdd53ef4908b40 100644 --- a/Framework/MDAlgorithms/src/LoadILLAscii.cpp +++ b/Framework/MDAlgorithms/src/LoadILLAscii.cpp @@ -24,7 +24,6 @@ #include <algorithm> #include <iterator> // std::distance #include <sstream> -#include <iostream> #include <fstream> #include <stdio.h> #include <string.h> diff --git a/Framework/MDAlgorithms/src/LoadSQW.cpp b/Framework/MDAlgorithms/src/LoadSQW.cpp index 9df4976713119d2a4f29dabf0b30d306124e71aa..b3bc63d11e5ade978e0c4abcdba21b605c8c4abc 100644 --- a/Framework/MDAlgorithms/src/LoadSQW.cpp +++ b/Framework/MDAlgorithms/src/LoadSQW.cpp @@ -13,7 +13,6 @@ #include "MantidKernel/ThreadScheduler.h" #include "MantidMDAlgorithms/LoadSQW.h" #include "MantidAPI/RegisterFileLoader.h" -#include <iostream> #include <cfloat> #include "MantidDataObjects/MDBox.h" #include "MantidDataObjects/BoxControllerNeXusIO.h" diff --git a/Framework/MDAlgorithms/test/AndMDTest.h b/Framework/MDAlgorithms/test/AndMDTest.h index c7be7993349d7090a737fbcea2e29a5621fbc65a..24d050ac45b32a92a5195cfdb103ae8a1a08077a 100644 --- a/Framework/MDAlgorithms/test/AndMDTest.h +++ b/Framework/MDAlgorithms/test/AndMDTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidMDAlgorithms/AndMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" diff --git a/Framework/MDAlgorithms/test/ConvertCWSDMDtoHKLTest.h b/Framework/MDAlgorithms/test/ConvertCWSDMDtoHKLTest.h new file mode 100644 index 0000000000000000000000000000000000000000..d4044fec95e162a24b7145d0c042364eebd9943a --- /dev/null +++ b/Framework/MDAlgorithms/test/ConvertCWSDMDtoHKLTest.h @@ -0,0 +1,131 @@ +#ifndef MANTID_MDALGORITHMS_CONVERTCWSDMDTOHKLTEST_H_ +#define MANTID_MDALGORITHMS_CONVERTCWSDMDTOHKLTEST_H_ + +#include <cxxtest/TestSuite.h> + +#include "MantidMDAlgorithms/ConvertCWSDMDtoHKL.h" +#include "MantidTestHelpers/ComponentCreationHelper.h" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" +#include "MantidAPI/IMDEventWorkspace.h" +#include "MantidAPI/FrameworkManager.h" +#include "MantidGeometry/Instrument.h" + +using Mantid::MDAlgorithms::ConvertCWSDMDtoHKL; + +using namespace Mantid::API; +using namespace Mantid::MDAlgorithms; +using namespace Mantid::DataObjects; +using Mantid::Geometry::Instrument_sptr; +using Mantid::Kernel::PropertyWithValue; + +class ConvertCWSDMDtoHKLTest : 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 ConvertCWSDMDtoHKLTest *createSuite() { + return new ConvertCWSDMDtoHKLTest(); + } + static void destroySuite(ConvertCWSDMDtoHKLTest *suite) { delete suite; } + + //------------------------------------------------------------------------------- + void test_init() { + createMDEW(); + + ConvertCWSDMDtoHKL alg; + alg.initialize(); + TS_ASSERT(alg.isInitialized()); + } + + //------------------------------------------------------------------------------- + void test_convertToHKL() { + ConvertCWSDMDtoHKL alg; + alg.initialize(); + + TS_ASSERT_THROWS_NOTHING( + alg.setPropertyValue("InputWorkspace", m_qsampleWS->name())); + TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue( + "UBMatrix", "1.0, 0.5, 0., -0.2, 2.0, 0.4, 0., 1.11, 3.9")); + TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("OutputWorkspace", "HKLMD")); + + alg.execute(); + TS_ASSERT(alg.isExecuted()); + + IMDEventWorkspace_sptr hklws = + boost::dynamic_pointer_cast<IMDEventWorkspace>( + AnalysisDataService::Instance().retrieve("HKLMD")); + TS_ASSERT(hklws); + + size_t numevents = hklws->getNEvents(); + TS_ASSERT_EQUALS(numevents, 100); + + TS_ASSERT_EQUALS(hklws->getSpecialCoordinateSystem(), + Mantid::Kernel::SpecialCoordinateSystem::HKL); + } + +private: + //------------------------------------------------------------------------------- + /** Create the (blank) MDEW */ + void createMDEW() { + // ---- Start with empty MDEW ---- + FrameworkManager::Instance().exec( + "CreateMDWorkspace", 18, "Dimensions", "3", "EventType", "MDEvent", + "Extents", "-10,10,-10,10,-10,10", "Names", + "Q_sample_x,Q_sample_y,Q_sample_z", "Units", + "Q_Sample_X,Q_Sample_Y,Q_Sample_Z", "SplitInto", "5", "SplitThreshold", + "20", "MaxRecursionDepth", "15", "OutputWorkspace", "MDEWS"); + + // Give it an instrument + Instrument_sptr inst = + ComponentCreationHelper::createTestInstrumentRectangular2(1, 100, 0.05); + + TS_ASSERT_THROWS_NOTHING( + m_qsampleWS = + AnalysisDataService::Instance().retrieveWS<IMDEventWorkspace>( + "MDEWS")); + ExperimentInfo_sptr ei(new ExperimentInfo()); + ei->setInstrument(inst); + // Give it a run number + ei->mutableRun().addProperty( + new PropertyWithValue<std::string>("run_number", "12345"), true); + m_qsampleWS->addExperimentInfo(ei); + + // Add events + size_t num_events = 100; + double peakcentre_x = 0.4; + double peakcentre_y = -1.2; + double peakcentre_z = -1.0; + double radius = 0.5; + + // Add half of the events + std::ostringstream mess; + mess << num_events / 2 << ", " << peakcentre_x << ", " << peakcentre_y + << ", " << peakcentre_z << ", " << radius; + std::cout << mess.str() << "\n"; + FrameworkManager::Instance().exec("FakeMDEventData", 4, "InputWorkspace", + "MDEWS", "PeakParams", + mess.str().c_str()); + + // Add a center with more events (half radius, half the total), to create a + // "peak" + std::ostringstream mess2; + mess2 << num_events / 2 << ", " << peakcentre_x << ", " << peakcentre_y + << ", " << peakcentre_z << ", " << radius * 0.25; + std::cout << mess2.str() << "\n"; + FrameworkManager::Instance().exec("FakeMDEventData", 4, "InputWorkspace", + "MDEWS", "PeakParams", + mess2.str().c_str()); + + // Check + size_t numevents = m_qsampleWS->getNEvents(); + TS_ASSERT_EQUALS(numevents, 100); + + m_qsampleWS->setCoordinateSystem( + Mantid::Kernel::SpecialCoordinateSystem::QSample); + + return; + } + + IMDEventWorkspace_sptr m_qsampleWS; +}; + +#endif /* MANTID_MDALGORITHMS_CONVERTCWSDMDTOHKLTEST_H_ */ diff --git a/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h b/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h index fe9704e809e8726280d210c15f7cc14507b0c678..ac63a1421a01be939bb6ae788d6f9c9729107e9e 100644 --- a/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h +++ b/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h @@ -3,6 +3,7 @@ #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/IMDEventWorkspace.h" +#include "MantidAPI/IMDHistoWorkspace.h" #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/NumericAxis.h" #include "MantidAPI/WorkspaceGroup.h" @@ -195,6 +196,18 @@ public: TS_ASSERT_EQUALS(2, ws->run().getLogData().size()); } + void test_execute_qxqz_normalized_polygon_md() { + const bool outputAsMD = true; + auto alg = make_standard_algorithm("Q (lab frame)", outputAsMD); + alg->setProperty("Method", "NormalisedPolygon"); + alg->execute(); + auto ws = boost::dynamic_pointer_cast<Mantid::API::IMDHistoWorkspace>( + Mantid::API::AnalysisDataService::Instance().retrieve( + "OutputTransformedWorkspace")); + TS_ASSERT(ws != NULL); + TS_ASSERT_EQUALS(2, ws->getExperimentInfo(0)->run().getLogData().size()); + } + void test_execute_kikf_2D() { const bool outputAsMD = false; auto alg = make_standard_algorithm("K (incident, final)", outputAsMD); diff --git a/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h b/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h index 304d0f4e74def943b018bd08832812b946e29ad4..534d7b00cde935fba25e9f0769a7a1da88c3c7e7 100644 --- a/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h +++ b/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidMDAlgorithms/CreateMDHistoWorkspace.h" diff --git a/Framework/MDAlgorithms/test/DivideMDTest.h b/Framework/MDAlgorithms/test/DivideMDTest.h index 472b23933a91ff5aef9fc2b8bf8d3bae241be8ab..da0c61996aca83f817369e0172b232aa33a99238 100644 --- a/Framework/MDAlgorithms/test/DivideMDTest.h +++ b/Framework/MDAlgorithms/test/DivideMDTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidMDAlgorithms/DivideMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" diff --git a/Framework/MDAlgorithms/test/ExponentialMDTest.h b/Framework/MDAlgorithms/test/ExponentialMDTest.h index 44cd338b998611b29404fa0ff61a6245a1de6a15..fedef53adb58eb003365266a01f7c53b6b7bf066 100644 --- a/Framework/MDAlgorithms/test/ExponentialMDTest.h +++ b/Framework/MDAlgorithms/test/ExponentialMDTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidMDAlgorithms/ExponentialMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" diff --git a/Framework/MDAlgorithms/test/GreaterThanMDTest.h b/Framework/MDAlgorithms/test/GreaterThanMDTest.h index 5ee14f9c0b34b9116b4e6e9555a362408175f18b..a05aea3a7cd4563f0c441687b1af43f996a9fae8 100644 --- a/Framework/MDAlgorithms/test/GreaterThanMDTest.h +++ b/Framework/MDAlgorithms/test/GreaterThanMDTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidMDAlgorithms/GreaterThanMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" diff --git a/Framework/MDAlgorithms/test/LogarithmMDTest.h b/Framework/MDAlgorithms/test/LogarithmMDTest.h index dd6741aae479777d63e45b2f0d654cd3626848c3..d70a16b110dd34c7d36673ba1d73639addeff519 100644 --- a/Framework/MDAlgorithms/test/LogarithmMDTest.h +++ b/Framework/MDAlgorithms/test/LogarithmMDTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidMDAlgorithms/LogarithmMD.h" #include "MantidDataObjects/MDHistoWorkspace.h" diff --git a/Framework/MDAlgorithms/test/PowerMDTest.h b/Framework/MDAlgorithms/test/PowerMDTest.h index c461d190b87a4f9ceeb713c40f80dfc0646eb44e..33608b09b034ffa5906a499688c0d95e0ef248d0 100644 --- a/Framework/MDAlgorithms/test/PowerMDTest.h +++ b/Framework/MDAlgorithms/test/PowerMDTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidMDAlgorithms/PowerMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" diff --git a/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h b/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h index d446d23200ecd8ec3a125e400be4f2b1caee7f31..f6af57673dc8709cfa32b32df0a0fda860606e9b 100644 --- a/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h +++ b/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h @@ -5,8 +5,6 @@ #include <cmath> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidMDAlgorithms/ReflectometryTransformP.h" using namespace Mantid::DataObjects; diff --git a/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h b/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h index d2673dca505613912b08b650adcdff1f3bd6bad3..762ffd5f2d12c660586fb3b8f01095fac3a46d4d 100644 --- a/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h +++ b/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h @@ -9,8 +9,6 @@ #include <cxxtest/TestSuite.h> -#include <iomanip> - using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::Geometry; diff --git a/Framework/Nexus/test/NexusAPITest.h b/Framework/Nexus/test/NexusAPITest.h index 003ac5e4795f414929282d5ad254552a23712cb3..256f4854338b55f432aebac764ca7211ee14afb9 100644 --- a/Framework/Nexus/test/NexusAPITest.h +++ b/Framework/Nexus/test/NexusAPITest.h @@ -17,7 +17,6 @@ #include <cmath> #include <Poco/File.h> -#include <iostream> #include <string> #include <sstream> #include <cstring> diff --git a/Framework/PythonInterface/inc/MantidPythonInterface/kernel/StlExportDefinitions.h b/Framework/PythonInterface/inc/MantidPythonInterface/kernel/StlExportDefinitions.h index f02a77e81890363064914c9a3179051a8ffb7ce0..8ec053cc10aed0e6d623729ec609716ac7b5c9be 100644 --- a/Framework/PythonInterface/inc/MantidPythonInterface/kernel/StlExportDefinitions.h +++ b/Framework/PythonInterface/inc/MantidPythonInterface/kernel/StlExportDefinitions.h @@ -35,6 +35,8 @@ #include <vector> #include <set> +using boost::python::arg; + namespace Mantid { namespace PythonInterface { /** @@ -153,19 +155,20 @@ template <typename ElementType> struct std_set_exporter { boost::python::class_<w_t, std::auto_ptr<w_t>>(python_name.c_str()) .def(boost::python::init<w_t const &>()) // special methods - .def("__str__", &std_set_exporter::to_string) - .def("__len__", &w_t::size) - .def("__contains__", contains) - .def("__getitem__", getitem) - .def("__getinitargs__", getinitargs) + .def("__str__", &std_set_exporter::to_string, arg("self")) + .def("__len__", &w_t::size, arg("self")) + .def("__contains__", contains, (arg("self"), arg("element"))) + .def("__getitem__", getitem, (arg("self"), arg("index"))) + .def("__getinitargs__", getinitargs, arg("self")) // Standard methods - .def("size", &w_t::size) - .def("insert", insert_element) - .def("append", insert_element) - .def("insert", insert_set) - .def("extend", insert_set) - .def("erase", (std::size_t (w_t::*)(e_t const &)) & w_t::erase) - .def("clear", &w_t::clear) + .def("size", &w_t::size, arg("self")) + .def("insert", insert_element, (arg("self"), arg("element"))) + .def("append", insert_element, (arg("self"), arg("element"))) + .def("insert", insert_set, (arg("self"), arg("set"))) + .def("extend", insert_set, (arg("self"), arg("set"))) + .def("erase", (std::size_t (w_t::*)(e_t const &)) & w_t::erase, + (arg("self"), arg("index"))) + .def("clear", &w_t::clear, arg("self")) .enable_pickling() ; diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/ArrayBoundedValidator.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/ArrayBoundedValidator.cpp index 34625d4c7d1ecc8a5990dafa34750de305d1e77c..04d050698f8a9cf2020d253438220c7d3c56bc62 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/ArrayBoundedValidator.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/ArrayBoundedValidator.cpp @@ -12,26 +12,26 @@ namespace { class_<ArrayBoundedValidator<type>, bases<IValidator>, boost::noncopyable>( \ #prefix "ArrayBoundedValidator") \ .def(init<type, type>( \ - (arg("lowerBound"), arg("upperBound")), \ + (arg("self"), arg("lowerBound"), arg("upperBound")), \ "A validator to ensure each value is in the given range")) \ - .def("hasLower", &ArrayBoundedValidator<type>::hasLower, \ + .def("hasLower", &ArrayBoundedValidator<type>::hasLower, arg("self"), \ "Returns true if a lower bound has been set") \ - .def("hasUpper", &ArrayBoundedValidator<type>::hasUpper, \ + .def("hasUpper", &ArrayBoundedValidator<type>::hasUpper, arg("self"), \ "Returns true if an upper bound has been set") \ - .def("lower", &ArrayBoundedValidator<type>::lower, \ + .def("lower", &ArrayBoundedValidator<type>::lower, arg("self"), \ return_value_policy<copy_const_reference>(), \ "Returns the lower bound") \ - .def("upper", &ArrayBoundedValidator<type>::upper, \ + .def("upper", &ArrayBoundedValidator<type>::upper, arg("self"), \ return_value_policy<copy_const_reference>(), \ "Returns the upper bound") \ .def("setLower", &ArrayBoundedValidator<type>::setLower, \ - "Sets the lower bound") \ + (arg("self"), arg("lower")), "Sets the lower bound") \ .def("setUpper", &ArrayBoundedValidator<type>::setUpper, \ - "Sets the upper bound") \ + (arg("self"), arg("upper")), "Sets the upper bound") \ .def("clearLower", &ArrayBoundedValidator<type>::clearLower, \ - "Clear any set lower bound") \ + arg("self"), "Clear any set lower bound") \ .def("clearUpper", &ArrayBoundedValidator<type>::clearUpper, \ - "Clear any set upper bound"); + arg("self"), "Clear any set upper bound"); } void export_ArrayBoundedValidator() { diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/ArrayLengthValidator.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/ArrayLengthValidator.cpp index a275edcf7cbd7d2e22a7b6f7c6531dba434a8122..1c405b0a82329d73a07155177f8d132e2285c48d 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/ArrayLengthValidator.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/ArrayLengthValidator.cpp @@ -12,38 +12,42 @@ namespace { #define EXPORT_LENGTHVALIDATOR(type, prefix) \ class_<ArrayLengthValidator<type>, bases<IValidator>, boost::noncopyable>( \ #prefix "ArrayLengthValidator") \ - .def(init<int>(arg("length"), "Constructs a validator verifying that " \ - "an array is of the exact length given")) \ - .def(init<int, int>((arg("lenmin"), arg("lenmax")), \ + .def(init<int>((arg("self"), arg("length")), \ + "Constructs a validator verifying that " \ + "an array is of the exact length given")) \ + .def(init<int, int>((arg("self"), arg("lenmin"), arg("lenmax")), \ "Constructs a validator verifying that the length " \ "of an array is within the range given")) \ - .def("hasLength", &ArrayLengthValidator<type>::hasLength, \ + .def("hasLength", &ArrayLengthValidator<type>::hasLength, arg("self"), \ "Returns true if a single length has been set") \ .def("hasMinLength", &ArrayLengthValidator<type>::hasMinLength, \ - "Returns true if a minimum length has been set") \ + arg("self"), "Returns true if a minimum length has been set") \ .def("hasMaxLength", &ArrayLengthValidator<type>::hasMaxLength, \ - "Returns true if a maximum length has been set") \ + arg("self"), "Returns true if a maximum length has been set") \ .def("getLength", &ArrayLengthValidator<type>::getLength, \ - return_value_policy<copy_const_reference>(), \ + return_value_policy<copy_const_reference>(), arg("self"), \ "Returns the set fixed length") \ .def("getMinLength", &ArrayLengthValidator<type>::getMinLength, \ - return_value_policy<copy_const_reference>(), \ + return_value_policy<copy_const_reference>(), arg("self"), \ "Returns the set minimum length") \ .def("getMaxLength", &ArrayLengthValidator<type>::getMaxLength, \ - return_value_policy<copy_const_reference>(), \ + return_value_policy<copy_const_reference>(), arg("self"), \ "Returns the set maximum length") \ .def("setLength", &ArrayLengthValidator<type>::setLength, \ + (arg("self"), arg("length")), \ "Set the accepted length of an array") \ .def("clearLength", &ArrayLengthValidator<type>::clearLength, \ - "Clears accepted length of an array") \ + arg("self"), "Clears accepted length of an array") \ .def("setLengthMin", &ArrayLengthValidator<type>::setLengthMin, \ + (arg("self"), arg("minimum length")), \ "Set the accepted minimum length of an array") \ .def("setLengthMax", &ArrayLengthValidator<type>::setLengthMax, \ + (arg("self"), arg("maximum length")), \ "Set the accepted maximum length of an array") \ .def("clearLengthMin", &ArrayLengthValidator<type>::clearLengthMin, \ - "Set the accepted minimum length of an array") \ + arg("self"), "Set the accepted minimum length of an array") \ .def("clearLengthMax", &ArrayLengthValidator<type>::clearLengthMax, \ - "Set the accepted maximum length of an array"); + arg("self"), "Set the accepted maximum length of an array"); } void export_ArrayLengthValidator() { diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/ArrayProperty.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/ArrayProperty.cpp index 1316a070c69f5ed41ab2510ba1cf5e87d5209747..0a44570ab12ebb2728ead06f93df0c79c704c98d 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/ArrayProperty.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/ArrayProperty.cpp @@ -30,17 +30,17 @@ typedef return_value_policy<Policies::VectorRefToNumpy<Converters::Clone>> class_<ArrayProperty<type>, bases<PropertyWithValue<std::vector<type>>>, \ boost::noncopyable>(#prefix "ArrayProperty", no_init) \ .def(init<const std::string &, const unsigned int>( \ - (arg("name"), arg("direction") = Direction::Input), \ + (arg("self"), arg("name"), arg("direction") = Direction::Input), \ "Construct an ArrayProperty of type" #type)) \ \ .def(init<const std::string &, IValidator_sptr, const unsigned int>( \ - (arg("name"), arg("validator"), \ + (arg("self"), arg("name"), arg("validator"), \ arg("direction") = Direction::Input), \ "Construct an ArrayProperty of type" #type "with a validator")) \ \ .def(init<const std::string &, const std::string &, IValidator_sptr, \ const unsigned int>( \ - (arg("name"), arg("values"), \ + (arg("self"), arg("name"), arg("values"), \ arg("validator") = IValidator_sptr(new NullValidator), \ arg("direction") = Direction::Input), \ "Construct an ArrayProperty of type" #type \ diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/BoundedValidator.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/BoundedValidator.cpp index ada791077b4c3e5fe554f008ceb14cbc49896776..5aef737a654e84fc3e27b1d69d2519589aae449d 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/BoundedValidator.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/BoundedValidator.cpp @@ -68,34 +68,37 @@ createExclusiveBoundedValidator(object lower = object(), (arg("lower") = object(), arg("upper") = object(), \ arg("exclusive") = false))) \ .def("setLower", &BoundedValidator<ElementType>::setLower, \ - "Set the lower bound") \ + (arg("self"), arg("lower")), "Set the lower bound") \ .def("setUpper", &BoundedValidator<ElementType>::setUpper, \ - "Set the upper bound") \ + (arg("self"), arg("upper")), "Set the upper bound") \ .def("setLowerExclusive", \ &BoundedValidator<ElementType>::setLowerExclusive, \ + (arg("self"), arg("exclusive")), \ "Sets if the lower bound is exclusive") \ .def("setUpperExclusive", \ &BoundedValidator<ElementType>::setUpperExclusive, \ + (arg("self"), arg("exclusive")), \ "Sets if the upper bound is exclsuive") \ .def("setExclusive", &BoundedValidator<ElementType>::setExclusive, \ + (arg("self"), arg("exclusive")), \ "Sets both bounds to be inclusive/exclusive") \ - .def("lower", &BoundedValidator<ElementType>::lower, \ + .def("lower", &BoundedValidator<ElementType>::lower, arg("self"), \ return_value_policy<copy_const_reference>(), \ "Returns the lower bound") \ - .def("upper", &BoundedValidator<ElementType>::upper, \ + .def("upper", &BoundedValidator<ElementType>::upper, arg("self"), \ return_value_policy<copy_const_reference>(), \ "Returns the upper bound") \ .def("setBounds", &BoundedValidator<ElementType>::setBounds, \ - "Set both bounds") \ - .def("hasLower", &BoundedValidator<ElementType>::hasLower, \ + (arg("self"), arg("lower"), arg("upper")), "Set both bounds") \ + .def("hasLower", &BoundedValidator<ElementType>::hasLower, arg("self"), \ "Returns True if a lower bound has been set") \ - .def("hasUpper", &BoundedValidator<ElementType>::hasUpper, \ + .def("hasUpper", &BoundedValidator<ElementType>::hasUpper, arg("self"), \ "Returns True if an upper bound has been set") \ .def("isLowerExclusive", \ - &BoundedValidator<ElementType>::isLowerExclusive, \ + &BoundedValidator<ElementType>::isLowerExclusive, arg("self"), \ "Returns True if the lower bound is exclusive") \ .def("isUpperExclusive", \ - &BoundedValidator<ElementType>::isUpperExclusive, \ + &BoundedValidator<ElementType>::isUpperExclusive, arg("self"), \ "Returns True if the upper bound is exclusive"); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/CompositeValidator.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/CompositeValidator.cpp index 83780f72d6a41f262e386eef9018eee819ab7ca6..94f4416922ee772c84d371210918a467694f1e29 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/CompositeValidator.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/CompositeValidator.cpp @@ -40,5 +40,5 @@ void export_CompositeValidator() { .def("add", (void (CompositeValidator::*)(IValidator_sptr)) & CompositeValidator::add, - "Add another validator to the list"); + (arg("self"), arg("other")), "Add another validator to the list"); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/ConfigService.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/ConfigService.cpp index 0798d303ee64747d4d2ea69fce29625f04b81f88..61163771c9d2d3e88a73a25de32ab62e32c6cecb 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/ConfigService.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/ConfigService.cpp @@ -41,102 +41,117 @@ void export_ConfigService() { std_vector_exporter<FacilityInfo *>::wrap("std_vector_facilityinfo"); class_<ConfigServiceImpl, boost::noncopyable>("ConfigServiceImpl", no_init) - .def("reset", &ConfigServiceImpl::reset, + .def("reset", &ConfigServiceImpl::reset, arg("self"), "Clears all user settings and removes the user properties file") .def("getLocalFilename", &ConfigServiceImpl::getLocalFilename, - "Returns the path to the system wide properties file.") + arg("self"), "Returns the path to the system wide properties file.") - .def("getUserFilename", &ConfigServiceImpl::getUserFilename, + .def("getUserFilename", &ConfigServiceImpl::getUserFilename, arg("self"), "Returns the path to the user properties file") .def("getInstrumentDirectory", &ConfigServiceImpl::getInstrumentDirectory, + arg("self"), "Returns the directory used for the instrument definitions") .def("getInstrumentDirectories", - &ConfigServiceImpl::getInstrumentDirectories, + &ConfigServiceImpl::getInstrumentDirectories, arg("self"), return_value_policy<reference_existing_object>(), "Returns the list of directories searched for the instrument " "definitions") .def("getFacilityNames", &ConfigServiceImpl::getFacilityNames, - "Returns the default facility") + arg("self"), "Returns the default facility") - .def("getFacilities", &ConfigServiceImpl::getFacilities, + .def("getFacilities", &ConfigServiceImpl::getFacilities, arg("self"), "Returns the default facility") .def("getFacility", (const FacilityInfo &(ConfigServiceImpl::*)() const) & ConfigServiceImpl::getFacility, - return_value_policy<reference_existing_object>(), + arg("self"), return_value_policy<reference_existing_object>(), "Returns the default facility") .def("getFacility", (const FacilityInfo &(ConfigServiceImpl::*)(const std::string &) const) & ConfigServiceImpl::getFacility, - (arg("facilityName")), + (arg("self"), arg("facilityName")), return_value_policy<reference_existing_object>(), "Returns the named facility. Raises an RuntimeError if it does not " "exist") .def("setFacility", &ConfigServiceImpl::setFacility, + (arg("self"), arg("facilityName")), "Sets the current facility to the given name") .def("updateFacilities", &ConfigServiceImpl::updateFacilities, + (arg("self"), arg("fileName")), "Loads facility information from a provided file") .def("getInstrument", &ConfigServiceImpl::getInstrument, getInstrument_Overload( "Returns the named instrument. If name = \"\" then the " "default.instrument is returned", - (arg("instrumentName") = + (arg("self"), + arg("instrumentName") = ""))[return_value_policy<copy_const_reference>()]) .def("getString", &ConfigServiceImpl::getString, - getString_Overload("Returns the named key's value. If use_cache = " - "true [default] then relative paths->absolute", - (arg("key"), arg("use_cache") = true))) + getString_Overload( + "Returns the named key's value. If use_cache = " + "true [default] then relative paths->absolute", + (arg("self"), arg("key"), arg("use_cache") = true))) .def("setString", &ConfigServiceImpl::setString, + (arg("self"), arg("key"), arg("value")), "Set the given property name. " "If it does not exist it is added to the current configuration") - .def("hasProperty", &ConfigServiceImpl::hasProperty) + .def("hasProperty", &ConfigServiceImpl::hasProperty, + (arg("self"), arg("rootName"))) .def("getDataSearchDirs", &ConfigServiceImpl::getDataSearchDirs, - return_value_policy<copy_const_reference>(), + arg("self"), return_value_policy<copy_const_reference>(), "Return the current list of data search paths") .def("appendDataSearchDir", &ConfigServiceImpl::appendDataSearchDir, + (arg("self"), arg("path")), "Append a directory to the current list of data search paths") .def("setDataSearchDirs", (void (ConfigServiceImpl::*)(const std::string &)) & ConfigServiceImpl::setDataSearchDirs, + (arg("self"), arg("searchDirs")), "Set the whole datasearch.directories property from a single " "string. Entries should be separated by a ; character") .def("setDataSearchDirs", &setDataSearchDirs, + (arg("self"), arg("searchDirs")), "Set the datasearch.directories property from a list of strings.") .def("saveConfig", &ConfigServiceImpl::saveConfig, + (arg("self"), arg("filename")), "Saves the keys that have changed from their default to the given " "filename") .def("setFileLogLevel", &ConfigServiceImpl::setFileLogLevel, - "Sets the log level priority for the File log channel, logLevel 1 = " - "Fatal, 6 = information, 7 = Debug") + (arg("self"), arg("logLevel")), "Sets the log level priority for " + "the File log channel, logLevel 1 = " + "Fatal, 6 = information, 7 = Debug") .def("setConsoleLogLevel", &ConfigServiceImpl::setConsoleLogLevel, + (arg("self"), arg("logLevel")), "Sets the log level priority for the Console log channel, logLevel " "1 = Fatal, 6 = information, 7 = Debug") - .def("keys", &ConfigServiceImpl::keys) + .def("keys", &ConfigServiceImpl::keys, arg("self")) // Treat this as a dictionary - .def("__getitem__", &getStringUsingCache) - .def("__setitem__", &ConfigServiceImpl::setString) - .def("__contains__", &ConfigServiceImpl::hasProperty) + .def("__getitem__", &getStringUsingCache, (arg("self"), arg("key"))) + .def("__setitem__", &ConfigServiceImpl::setString, + (arg("self"), arg("key"), arg("value"))) + .def("__contains__", &ConfigServiceImpl::hasProperty, + (arg("self"), arg("key"))) .def("Instance", &ConfigService::Instance, return_value_policy<reference_existing_object>(), "Returns a reference to the ConfigService") diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/DataItem.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/DataItem.cpp index d9bc41f197f3602d975b346075e3f9841cf79ccf..00138aa8bb7557bd71cf8b05bb29e429f9c7556e 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/DataItem.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/DataItem.cpp @@ -10,13 +10,14 @@ void export_DataItem() { register_ptr_to_python<boost::shared_ptr<DataItem>>(); class_<DataItem, boost::noncopyable>("DataItem", no_init) - .def("id", &DataItem::id, "The string ID of the class") - .def("name", &DataItem::name, "The name of the object") - .def("threadSafe", &DataItem::threadSafe, "Returns true if the object " - "can be accessed safely from " - "multiple threads") - .def("__str__", &DataItem::name, + .def("id", &DataItem::id, arg("self"), "The string ID of the class") + .def("name", &DataItem::name, arg("self"), "The name of the object") + .def("threadSafe", &DataItem::threadSafe, arg("self"), + "Returns true if the object " + "can be accessed safely from " + "multiple threads") + .def("__str__", &DataItem::name, arg("self"), "Returns the string name of the object if it has been stored") - .def("__repr__", &DataItem::toString, + .def("__repr__", &DataItem::toString, arg("self"), "Returns a description of the object"); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/DateAndTime.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/DateAndTime.cpp index 89e35bf42b13ab837f83f58986d79e16f39ecbb1..4928393000b1b61d19e99d649308dca8a408f8f2 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/DateAndTime.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/DateAndTime.cpp @@ -5,6 +5,7 @@ using Mantid::Kernel::DateAndTime; using Mantid::Kernel::time_duration; using namespace boost::python; +using boost::python::arg; /** Circumvent a bug in IPython 1.1, which chokes on nanosecond precision * datetimes. @@ -19,17 +20,21 @@ std::string ISO8601StringPlusSpace(DateAndTime &self) { void export_DateAndTime() { class_<DateAndTime>("DateAndTime", no_init) // Constructors - .def(init<const std::string>("Construct from an ISO8601 string")) + .def(init<const std::string>((arg("self"), arg("ISO8601 string")), + "Construct from an ISO8601 string")) .def(init<double, double>( + (arg("self"), arg("seconds"), arg("nanoseconds")), "Construct using a number of seconds and nanoseconds (floats)")) .def(init<int64_t, int64_t>( + (arg("self"), arg("seconds"), arg("nanoseconds")), "Construct using a number of seconds and nanoseconds (integers)")) - .def(init<int64_t>("Construct a total number of nanoseconds")) - .def("total_nanoseconds", &DateAndTime::totalNanoseconds) - .def("totalNanoseconds", &DateAndTime::totalNanoseconds) - .def("setToMinimum", &DateAndTime::setToMinimum) - .def("__str__", &ISO8601StringPlusSpace) - .def("__long__", &DateAndTime::totalNanoseconds) + .def(init<int64_t>((arg("self"), arg("total nanoseconds")), + "Construct a total number of nanoseconds")) + .def("total_nanoseconds", &DateAndTime::totalNanoseconds, arg("self")) + .def("totalNanoseconds", &DateAndTime::totalNanoseconds, arg("self")) + .def("setToMinimum", &DateAndTime::setToMinimum, arg("self")) + .def("__str__", &ISO8601StringPlusSpace, arg("self")) + .def("__long__", &DateAndTime::totalNanoseconds, arg("self")) .def(self == self) .def(self != self) // cppcheck-suppress duplicateExpression @@ -43,22 +48,24 @@ void export_DateAndTime() { void export_time_duration() { class_<time_duration>("time_duration", no_init) - .def("hours", &time_duration::hours, + .def("hours", &time_duration::hours, arg("self"), "Returns the normalized number of hours") - .def("minutes", &time_duration::minutes, + .def("minutes", &time_duration::minutes, arg("self"), "Returns the normalized number of minutes +/-(0..59)") - .def("seconds", &time_duration::seconds, + .def("seconds", &time_duration::seconds, arg("self"), "Returns the normalized number of seconds +/-(0..59)") - .def("total_seconds", &time_duration::total_seconds, + .def("total_seconds", &time_duration::total_seconds, arg("self"), "Get the total number of seconds truncating any fractional seconds") .def("total_milliseconds", &time_duration::total_milliseconds, + arg("self"), "Get the total number of milliseconds truncating any remaining " "digits") .def("total_microseconds", &time_duration::total_microseconds, + arg("self"), "Get the total number of microseconds truncating any remaining " "digits") .def( - "total_nanoseconds", &time_duration::total_nanoseconds, + "total_nanoseconds", &time_duration::total_nanoseconds, arg("self"), "Get the total number of nanoseconds truncating any remaining digits") ; diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/DeltaEMode.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/DeltaEMode.cpp index 981ff7c54407f79e6b685664d118cf2be0c7209f..e3148bede17616f65de8dfa5494dc590a4beb101 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/DeltaEMode.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/DeltaEMode.cpp @@ -17,9 +17,9 @@ void export_DeltaEMode() { .export_values(); class_<DeltaEMode, boost::noncopyable>("DeltaEMode", no_init) - .def("asString", &DeltaEMode::asString, + .def("asString", &DeltaEMode::asString, arg("self"), "Returns the given type translated to a string") - .def("fromString", &DeltaEMode::fromString, + .def("fromString", &DeltaEMode::fromString, arg("modeStr"), "Returns the enumerated type translated from a string") .def("availableTypes", &DeltaEMode::availableTypes, return_value_policy<Policies::VectorToNumpy>(), diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/EnabledWhenProperty.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/EnabledWhenProperty.cpp index 32066286b3c981d1468a5d81ff13daba4c244206..9982028e943d1892288b44e4dc7eb4b9b8f38b32 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/EnabledWhenProperty.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/EnabledWhenProperty.cpp @@ -18,12 +18,12 @@ void export_EnabledWhenProperty() { "EnabledWhenProperty", no_init) // no default constructor .def(init<std::string, ePropertyCriterion, std::string>( - (arg("otherPropName"), arg("when"), arg("value")), + (arg("self"), arg("otherPropName"), arg("when"), arg("value")), "Enabled otherPropName property when value criterion meets that " "given by the 'when' argument")) .def(init<std::string, ePropertyCriterion>( - (arg("otherPropName"), arg("when")), + (arg("self"), arg("otherPropName"), arg("when")), "Enabled otherPropName property when criterion does not require a " "value, i.e isDefault")); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/FacilityInfo.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/FacilityInfo.cpp index e250fc97f7fca21f470c4b50c6ace25bb113862f..907c51778cf610aba31d1a672e6df9a6a320a04e 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/FacilityInfo.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/FacilityInfo.cpp @@ -13,56 +13,58 @@ void export_FacilityInfo() { class_<FacilityInfo>("FacilityInfo", no_init) - .def("name", &FacilityInfo::name, + .def("name", &FacilityInfo::name, arg("self"), return_value_policy<copy_const_reference>(), "Returns name of the facility as definined in the Facilities.xml " "file") - .def("__str__", &FacilityInfo::name, + .def("__str__", &FacilityInfo::name, arg("self"), return_value_policy<copy_const_reference>(), "Returns name of the facility as definined in the Facilities.xml " "file") - .def("zeroPadding", &FacilityInfo::zeroPadding, + .def("zeroPadding", &FacilityInfo::zeroPadding, arg("self"), "Returns default zero padding for this facility") - .def("delimiter", &FacilityInfo::delimiter, + .def("delimiter", &FacilityInfo::delimiter, arg("self"), return_value_policy<copy_const_reference>(), "Returns the delimiter between the instrument name and the run " "number.") - .def("extensions", &FacilityInfo::extensions, + .def("extensions", &FacilityInfo::extensions, arg("self"), "Returns the list of file extensions that are considered as " "instrument data files.") - .def("preferredExtension", &FacilityInfo::preferredExtension, + .def("preferredExtension", &FacilityInfo::preferredExtension, arg("self"), return_value_policy<copy_const_reference>(), "Returns the extension that is preferred for this facility") - .def("archiveSearch", &FacilityInfo::archiveSearch, + .def("archiveSearch", &FacilityInfo::archiveSearch, arg("self"), return_value_policy<copy_const_reference>(), "Return the archive search interface names") .def("instruments", (const std::vector<InstrumentInfo> &(FacilityInfo::*)() const) & FacilityInfo::instruments, - return_value_policy<copy_const_reference>(), + arg("self"), return_value_policy<copy_const_reference>(), "Returns a list of instruments of this facility as defined in the " "Facilities.xml file") .def("instruments", (std::vector<InstrumentInfo>( FacilityInfo::*)(const std::string &) const) & FacilityInfo::instruments, + (arg("self"), arg("technique")), "Returns a list of instruments of given technique") .def("instrument", &FacilityInfo::instrument, + (arg("self"), arg("instrumentName")), return_value_policy<copy_const_reference>(), "Returns the instrument with the given name") - .def("liveListener", &FacilityInfo::liveListener, + .def("liveListener", &FacilityInfo::liveListener, arg("self"), return_value_policy<copy_const_reference>(), "Returns the name of the default live listener") - .def("computeResources", &FacilityInfo::computeResources, + .def("computeResources", &FacilityInfo::computeResources, arg("self"), "Returns a vector of the available compute resources"); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/FilteredTimeSeriesProperty.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/FilteredTimeSeriesProperty.cpp index fc543101449c48e50a06c5bbfbaab9b53b9fc271..dcf283dbc0448b16201f5058ef507836cec2488a 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/FilteredTimeSeriesProperty.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/FilteredTimeSeriesProperty.cpp @@ -19,10 +19,11 @@ namespace { class_<FilteredTimeSeriesProperty<TYPE>, bases<TimeSeriesProperty<TYPE>>, \ boost::noncopyable>(#Prefix "FilteredTimeSeriesProperty", no_init) \ .def(init<TimeSeriesProperty<TYPE> *, const TimeSeriesProperty<bool> &, \ - const bool>("Constructor", (arg("source"), arg("filter"), \ - arg("transferOwner")))) \ + const bool>( \ + "Constructor", \ + (arg("self"), arg("source"), arg("filter"), arg("transferOwner")))) \ .def("unfiltered", &FilteredTimeSeriesProperty<TYPE>::unfiltered, \ - return_value_policy<RemoveConst>(), \ + (arg("self")), return_value_policy<RemoveConst>(), \ "Returns a time series containing the unfiltered data"); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/IPropertyManager.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/IPropertyManager.cpp index 6d95138c3c6571b6393ba45ed621e5a80e8f27fc..c1ff7244e8324999b904c3ed2a66dfde8be51dab 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/IPropertyManager.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/IPropertyManager.cpp @@ -111,65 +111,69 @@ void export_IPropertyManager() { register_ptr_to_python<IPropertyManager *>(); class_<IPropertyManager, boost::noncopyable>("IPropertyManager", no_init) - .def("propertyCount", &IPropertyManager::propertyCount, args("self"), + .def("propertyCount", &IPropertyManager::propertyCount, arg("self"), "Returns the number of properties being managed") .def("getProperty", &IPropertyManager::getPointerToProperty, - args("self", "name"), return_value_policy<return_by_value>(), + (arg("self"), arg("name")), return_value_policy<return_by_value>(), "Returns the property of the given name. Use .value to give the " "value") .def("getPropertyValue", &IPropertyManager::getPropertyValue, - args("self", "name"), + (arg("self"), arg("name")), "Returns a string representation of the named property's value") - .def("getProperties", &IPropertyManager::getProperties, args("self"), + .def("getProperties", &IPropertyManager::getProperties, arg("self"), return_value_policy<copy_const_reference>(), "Returns the list of properties managed by this object") - .def("declareProperty", &declareProperty, args("self", "name", "value"), + .def("declareProperty", &declareProperty, + (arg("self"), arg("name"), arg("value")), "Create a new named property") .def("setPropertyValue", &IPropertyManager::setPropertyValue, - args("self", "name", "value"), + (arg("self"), arg("name"), arg("value")), "Set the value of the named property via a string") - .def("setProperty", &setProperty, args("self", "name", "value"), + .def("setProperty", &setProperty, + (arg("self"), arg("name"), arg("value")), "Set the value of the named property") .def("setPropertySettings", &setPropertySettings, - args("self", "name", "settingsManager"), + (arg("self"), arg("name"), arg("settingsManager")), "Assign the given IPropertySettings object to the named property") .def("setPropertyGroup", &IPropertyManager::setPropertyGroup, - args("self", "name", "group"), "Set the group for a given property") + (arg("self"), arg("name"), arg("group")), + "Set the group for a given property") .def("existsProperty", &IPropertyManager::existsProperty, - args("self", "name"), "Returns whether a property exists") + (arg("self"), arg("name")), "Returns whether a property exists") // Special methods so that IPropertyManager acts like a dictionary // __len__, __getitem__, __setitem__, __delitem__, __iter__ and // __contains__ - .def("__len__", &IPropertyManager::propertyCount, args("self"), + .def("__len__", &IPropertyManager::propertyCount, arg("self"), "Returns the number of properties being managed") .def("__getitem__", &IPropertyManager::getPointerToProperty, - args("self", "name"), return_value_policy<return_by_value>(), + (arg("self"), arg("name")), return_value_policy<return_by_value>(), "Returns the property of the given name. Use .value to give the " "value") - .def("__setitem__", &declareOrSetProperty, args("self", "name", "value"), + .def("__setitem__", &declareOrSetProperty, + (arg("self"), arg("name"), arg("value")), "Set the value of the named property or create it if it doesn't " "exist") - .def("__delitem__", &deleteProperty, args("self", "name"), + .def("__delitem__", &deleteProperty, (arg("self"), arg("name")), "Delete the named property") // TODO .def("__iter__", iterator<std::vector<std::string> > ()) .def("__contains__", &IPropertyManager::existsProperty, - args("self", "name"), "Returns whether a property exists") + (arg("self"), arg("name")), "Returns whether a property exists") // Bonus methods to be even more like a dict - .def("has_key", &IPropertyManager::existsProperty, args("self", "name"), - "Returns whether a property exists") - .def("keys", &getKeys, args("self")) - .def("values", &IPropertyManager::getProperties, args("self"), + .def("has_key", &IPropertyManager::existsProperty, + (arg("self"), arg("name")), "Returns whether a property exists") + .def("keys", &getKeys, arg("self")) + .def("values", &IPropertyManager::getProperties, arg("self"), return_value_policy<copy_const_reference>(), "Returns the list of properties managed by this object"); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/IPropertySettings.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/IPropertySettings.cpp index 0cb00ba141e633c59b91a6642f84425371fb5e0c..fd960fc825ee672f356b8e749aaf328be27b2c69 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/IPropertySettings.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/IPropertySettings.cpp @@ -11,8 +11,10 @@ void export_IPropertySettings() { class_<IPropertySettings, boost::noncopyable>("IPropertySettings", no_init) .def("isEnabled", &IPropertySettings::isEnabled, + (arg("self"), arg("alg")), "Is the property to be shown as enabled in the GUI. Default true.") .def("isVisible", &IPropertySettings::isVisible, + (arg("self"), arg("alg")), "Is the property to be shown in the GUI? Default true."); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/InstrumentInfo.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/InstrumentInfo.cpp index 6d11545e04e9fd70d1322f49cd3c7a4c72998c7a..d72da5eea64e8dc3adddb0ec6e846008889996a8 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/InstrumentInfo.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/InstrumentInfo.cpp @@ -12,38 +12,41 @@ void export_InstrumentInfo() { std_vector_exporter<InstrumentInfo>::wrap("std_vector_InstrumentInfo"); class_<InstrumentInfo>("InstrumentInfo", no_init) - .def("name", &InstrumentInfo::name, + .def("name", &InstrumentInfo::name, arg("self"), "" "Returns the full name of the instrument as defined in the " "Facilites.xml file") - .def("shortName", &InstrumentInfo::shortName, + .def("shortName", &InstrumentInfo::shortName, arg("self"), "Returns the abbreviated name of the instrument as definined in the " "Facilites.xml file") - .def("__str__", &InstrumentInfo::shortName, + .def("__str__", &InstrumentInfo::shortName, arg("self"), "Returns the abbreviated name of the instrument as definined in the " "Facilites.xml file") .def("zeroPadding", &InstrumentInfo::zeroPadding, + (arg("self"), arg("runNumber")), "Returns zero padding for this instrument") .def("filePrefix", &InstrumentInfo::filePrefix, + (arg("self"), arg("runNumber")), "Returns file prefix for this instrument") - .def("delimiter", &InstrumentInfo::delimiter, "Returns the delimiter " - "between the instrument " - "name and the run number.") + .def("delimiter", &InstrumentInfo::delimiter, arg("self"), + "Returns the delimiter " + "between the instrument " + "name and the run number.") - .def("techniques", &InstrumentInfo::techniques, + .def("techniques", &InstrumentInfo::techniques, arg("self"), return_value_policy<copy_const_reference>(), "Return list of techniques this instrument supports") - .def("facility", &InstrumentInfo::facility, + .def("facility", &InstrumentInfo::facility, arg("self"), return_value_policy<copy_const_reference>(), "Returns the facility that contains this instrument.") - .def("instdae", &InstrumentInfo::liveDataAddress, + .def("instdae", &InstrumentInfo::liveDataAddress, arg("self"), return_value_policy<copy_const_reference>(), "Returns the host name and the port of the machine hosting DAE and " "providing port to connect to for a live data stream") diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/ListValidator.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/ListValidator.cpp index 75c2ae54ac615913071285c7dc662c2554369922..d13676fc3f7917019aac076cd0c6daa88a08e5f2 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/ListValidator.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/ListValidator.cpp @@ -35,6 +35,7 @@ createListValidator(const boost::python::list &allowedValues) { make_constructor(&createListValidator<type>, \ default_call_policies(), arg("allowedValues"))) \ .def("addAllowedValue", &ListValidator<type>::addAllowedValue, \ + (arg("self"), arg("value")), \ "Adds a value to the list of accepted values"); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/LogFilter.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/LogFilter.cpp index 89f9e7e29a98e6e89637ec0f45c5712be655f2a4..4a8b24348cd44569214bdd954ddeb8db54a5ee78 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/LogFilter.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/LogFilter.cpp @@ -11,10 +11,12 @@ using namespace boost::python; void export_LogFilter() { class_<LogFilter, boost::noncopyable>( "LogFilter", init<const Property *>( + (arg("self"), arg("property")), "Creates a log filter using the log to be filtered")) - .def("data", &LogFilter::data, return_value_policy<return_by_value>(), + .def("data", &LogFilter::data, arg("self"), + return_value_policy<return_by_value>(), "Returns a time series property filtered on current filter property") - .def("addFilter", &LogFilter::addFilter, + .def("addFilter", &LogFilter::addFilter, (arg("self"), arg("filter")), "Adds a filter to the current list"); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/Logger.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/Logger.cpp index 40d5a9c310f0b72fe6056a1cc90f53840a12882c..8494bdcd5fce1ec6680049775a0b6d5c466420bb 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/Logger.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/Logger.cpp @@ -25,28 +25,35 @@ void export_Logger() { // To distinguish between the overloaded functions typedef void (Logger::*LogLevelFunction)(const std::string &); - class_<Logger, boost::noncopyable>("Logger", init<std::string>(arg("name"))) + class_<Logger, boost::noncopyable>( + "Logger", init<std::string>((arg("self"), arg("name")))) .def("fatal", (LogLevelFunction)&Logger::fatal, + (arg("self"), arg("message")), "Send a message at fatal priority: " "An unrecoverable error has occured and the application will " "terminate") .def("error", (LogLevelFunction)&Logger::error, + (arg("self"), arg("message")), "Send a message at error priority: " "An error has occured but the framework is able to handle it and " "continue") .def("warning", (LogLevelFunction)&Logger::warning, + (arg("self"), arg("message")), "Send a message at warning priority: " "Something was wrong but the framework was able to continue despite " "the problem.") .def("notice", (LogLevelFunction)&Logger::notice, + (arg("self"), arg("message")), "Sends a message at notice priority: " "Really important information that should be displayed to the user, " "this should be minimal. The default logging level is set here " "unless it is altered.") .def("information", (LogLevelFunction)&Logger::information, + (arg("self"), arg("message")), "Send a message at information priority: " "Useful but not vital information to be relayed back to the user.") .def("debug", (LogLevelFunction)&Logger::debug, + (arg("self"), arg("message")), "Send a message at debug priority:" ". Anything that may be useful to understand what the code has been " "doing for debugging purposes.") diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/Material.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/Material.cpp index 36ee205659c6535475e268471bead2bbb0442b8e..5928f46115c8e5d58263a3324306403c9e23d6b3 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/Material.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/Material.cpp @@ -14,8 +14,8 @@ void export_Material() { register_ptr_to_python<boost::shared_ptr<Material>>(); class_<Material, boost::noncopyable>("Material", no_init) - .def("name", &Material::name, return_value_policy<copy_const_reference>(), - "Name of the material") + .def("name", &Material::name, arg("self"), + return_value_policy<copy_const_reference>(), "Name of the material") .add_property("numberDensity", make_function(&Material::numberDensity), "Number density") .add_property("temperature", make_function(&Material::temperature), @@ -23,18 +23,18 @@ void export_Material() { .add_property("pressure", make_function(&Material::pressure), "Pressure") .def("cohScatterXSection", (double (Material::*)(double) const)(&Material::cohScatterXSection), - (arg("lambda") = (double)NeutronAtom::ReferenceLambda), + (arg("self"), arg("lambda") = (double)NeutronAtom::ReferenceLambda), "Coherent Scattering Cross-Section") .def("incohScatterXSection", (double (Material::*)(double) const)(&Material::incohScatterXSection), - (arg("lambda") = (double)NeutronAtom::ReferenceLambda), + (arg("self"), arg("lambda") = (double)NeutronAtom::ReferenceLambda), "Incoherent Scattering Cross-Section") .def("totalScatterXSection", (double (Material::*)(double) const)(&Material::totalScatterXSection), - (arg("lambda") = (double)NeutronAtom::ReferenceLambda), + (arg("self"), arg("lambda") = (double)NeutronAtom::ReferenceLambda), "Total Scattering Cross-Section") .def("absorbXSection", (double (Material::*)(double) const)(&Material::absorbXSection), - (arg("lambda") = (double)NeutronAtom::ReferenceLambda), + (arg("self"), arg("lambda") = (double)NeutronAtom::ReferenceLambda), "Absorption Cross-Section"); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/Memory.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/Memory.cpp index 46aad239e32e0b3cebd83ae3ca11ca510013c9b5..a3bcdc1420274326010e8d42717fd136c4a8d160 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/Memory.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/Memory.cpp @@ -6,14 +6,15 @@ using namespace boost::python; void export_MemoryStats() { - class_<MemoryStats>("MemoryStats", init<>("Construct MemoryStats object.")) - .def("update", &MemoryStats::update, args("self")) - .def("totalMem", &MemoryStats::totalMem, args("self")) - .def("availMem", &MemoryStats::availMem, args("self")) - .def("residentMem", &MemoryStats::residentMem, args("self")) - .def("virtualMem", &MemoryStats::virtualMem, args("self")) - .def("reservedMem", &MemoryStats::reservedMem, args("self")) - .def("getFreeRatio", &MemoryStats::getFreeRatio, args("self")) - .def("getCurrentRSS", &MemoryStats::getCurrentRSS, args("self")) - .def("getPeakRSS", &MemoryStats::getPeakRSS, args("self")); + class_<MemoryStats>("MemoryStats", + init<>(arg("self"), "Construct MemoryStats object.")) + .def("update", &MemoryStats::update, arg("self")) + .def("totalMem", &MemoryStats::totalMem, arg("self")) + .def("availMem", &MemoryStats::availMem, arg("self")) + .def("residentMem", &MemoryStats::residentMem, arg("self")) + .def("virtualMem", &MemoryStats::virtualMem, arg("self")) + .def("reservedMem", &MemoryStats::reservedMem, arg("self")) + .def("getFreeRatio", &MemoryStats::getFreeRatio, arg("self")) + .def("getCurrentRSS", &MemoryStats::getCurrentRSS, arg("self")) + .def("getPeakRSS", &MemoryStats::getPeakRSS, arg("self")); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/ProgressBase.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/ProgressBase.cpp index 20b0764a66dcdc8dd73531372150a68aa9027c93..0dcef5d1d7e65df2895e25f7f5346f9a00fd0039 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/ProgressBase.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/ProgressBase.cpp @@ -7,35 +7,41 @@ using namespace boost::python; void export_ProgressBase() { class_<ProgressBase, boost::noncopyable>("ProgressBase", no_init) .def("report", (void (ProgressBase::*)()) & ProgressBase::report, + arg("self"), "Increment the progress by 1 and report with no message") .def("report", (void (ProgressBase::*)(const std::string &)) & ProgressBase::report, - (arg("msg")), "Increment the progress by 1 and report along with " - "the given message") + (arg("self"), arg("msg")), + "Increment the progress by 1 and report along with " + "the given message") .def("report", (void (ProgressBase::*)(int64_t, const std::string &)) & ProgressBase::report, - (arg("i"), arg("msg")), "Set the progress to given amount and " - "report along with the given message") + (arg("self"), arg("i"), arg("msg")), + "Set the progress to given amount and " + "report along with the given message") .def("reportIncrement", (void (ProgressBase::*)(size_t, const std::string &)) & ProgressBase::reportIncrement, - (arg("i"), arg("msg")), "Increment the progress by given amount and " - "report along with the given message") + (arg("self"), arg("i"), arg("msg")), + "Increment the progress by given amount and " + "report along with the given message") - .def("setNumSteps", &ProgressBase::setNumSteps, (arg("nsteps")), + .def("setNumSteps", &ProgressBase::setNumSteps, + (arg("self"), arg("nsteps")), "Sets a new number of steps for the current progress range") .def("resetNumSteps", &ProgressBase::resetNumSteps, - (arg("nsteps"), arg("start"), arg("end")), + (arg("self"), arg("nsteps"), arg("start"), arg("end")), "Resets the number of steps & progress range to the given values") - .def("setNotifyStep", &ProgressBase::setNotifyStep, (arg("notifyStep")), + .def("setNotifyStep", &ProgressBase::setNotifyStep, + (arg("self"), arg("notifyStep")), "Set how often the notifications are actually reported") - .def("getEstimatedTime", &ProgressBase::getEstimatedTime, + .def("getEstimatedTime", &ProgressBase::getEstimatedTime, arg("self"), "Returns an estimate of the time remaining. May not be to accurate " "if the reporting is lumpy."); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/PropertyHistory.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/PropertyHistory.cpp index 1459fee276c6ea112d01a47bfb4bb7e600d385a0..b373cd85709094ce91c42507fab412c66e54a5fe 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/PropertyHistory.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/PropertyHistory.cpp @@ -14,22 +14,22 @@ void export_PropertyHistory() { class_<PropertyHistory>("PropertyHistory", no_init) - .def("name", &PropertyHistory::name, + .def("name", &PropertyHistory::name, arg("self"), return_value_policy<copy_const_reference>(), "Returns the name of the property.") - .def("value", &PropertyHistory::value, + .def("value", &PropertyHistory::value, arg("self"), return_value_policy<copy_const_reference>(), "Returns the value of the property.") - .def("type", &PropertyHistory::type, + .def("type", &PropertyHistory::type, arg("self"), return_value_policy<copy_const_reference>(), "Returns the type of the property.") - .def("isDefault", &PropertyHistory::isDefault, + .def("isDefault", &PropertyHistory::isDefault, arg("self"), "Returns if the property value is the default value.") - .def("direction", &PropertyHistory::direction, + .def("direction", &PropertyHistory::direction, arg("self"), "Returns the direction of the property.") // ----------------- Operators -------------------------------------- .def(self_ns::str(self)); diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/Quat.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/Quat.cpp index 03d71fc376c4d774f2243b8f51f323a2a663694b..abcba6155a2a13b3dc1a9a711887e3754578a120 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/Quat.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/Quat.cpp @@ -5,11 +5,11 @@ #include <boost/python/copy_const_reference.hpp> #include <boost/python/register_ptr_to_python.hpp> #include <boost/python/return_value_policy.hpp> +#include <boost/python/return_arg.hpp> using Mantid::Kernel::Quat; using Mantid::Kernel::V3D; - -using boost::python::args; +using boost::python::arg; using boost::python::init; using boost::python::class_; using boost::python::self; @@ -28,43 +28,49 @@ void export_Quat() { "Quaternions are used for roations in 3D spaces and often " "implemented for " "computer graphics applications.", - init<>(args("self"), + init<>(arg("self"), "Construct a default Quat that will perform no transformation.")) .def(init<double, double, double, double>( - args("self", "w", "a", "b", "c"), "Constructor with values")) - .def(init<V3D, V3D>(args("self", "src", "dest"), + (arg("self"), arg("w"), arg("a"), arg("b"), arg("c")), + "Constructor with values")) + .def(init<V3D, V3D>((arg("self"), arg("src"), arg("dest")), "Construct a Quat between two vectors")) - .def(init<V3D, V3D, V3D>(args("self", "rX", "rY", "rZ"), + .def(init<V3D, V3D, V3D>((arg("self"), arg("rX"), arg("rY"), arg("rZ")), "Construct a Quaternion that performs a " "reference frame rotation.\nThe initial X,Y,Z " "vectors are aligned as expected: X=(1,0,0), " "Y=(0,1,0), Z=(0,0,1)")) - .def(init<double, V3D>(args("self", "deg", "axis"), + .def(init<double, V3D>((arg("self"), arg("deg"), arg("axis")), "Constructor from an angle(degrees) and an axis.")) - .def("rotate", &Quat::rotate, args("self", "v"), + .def("rotate", &Quat::rotate, (arg("self"), arg("v")), "Rotate the quaternion by the given vector") - .def("real", &Quat::real, args("self"), + .def("real", &Quat::real, arg("self"), "Returns the real part of the quaternion") - .def("imagI", &Quat::imagI, args("self"), + .def("imagI", &Quat::imagI, arg("self"), "Returns the ith imaginary component") - .def("imagJ", &Quat::imagJ, args("self"), + .def("imagJ", &Quat::imagJ, arg("self"), "Returns the jth imaginary component") - .def("imagK", &Quat::imagK, args("self"), + .def("imagK", &Quat::imagK, arg("self"), "Returns the kth imaginary component") - .def("len", &Quat::len, args("self"), + .def("len", &Quat::len, arg("self"), "Returns the 'length' of the quaternion") - .def("len2", &Quat::len2, args("self"), + .def("len2", &Quat::len2, arg("self"), "Returns the square of the 'length' of the quaternion") - .def(self + self) - .def(self += self) - .def(self - self) - .def(self -= self) - .def(self * self) - .def(self *= self) - .def(self == self) - .def(self != self) + .def("__add__", &Quat::operator+, (arg("left"), arg("right"))) + .def("__iadd__", &Quat::operator+=, boost::python::return_self<>(), + (arg("self"), arg("other"))) + .def("__sub__", &Quat::operator-, (arg("left"), arg("right"))) + .def("__isub__", &Quat::operator-=, boost::python::return_self<>(), + (arg("self"), arg("other"))) + .def("__mul__", &Quat::operator*, (arg("left"), arg("right"))) + .def("__imul__", &Quat::operator*=, boost::python::return_self<>(), + (arg("self"), arg("other"))) + .def("__eq__", &Quat::operator==, (arg("self"), arg("other"))) + .def("__ne__", &Quat::operator!=, (arg("self"), arg("other"))) .def("__getitem__", (const double &(Quat::*)(int) const) & Quat::operator[], - return_value_policy<copy_const_reference>()) - .def(boost::python::self_ns::str(self)); + return_value_policy<copy_const_reference>(), + (arg("self"), arg("index"))) + .def("__str__", &Quat::toString, arg("self")); + //.def(boost::python::self_ns::str(self)); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/Statistics.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/Statistics.cpp index 388fd50a172eda835b51d9927120893ef9c79d53..3cfaf72e9ec1d44d7e3816714d8a8d30c5f98de4 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/Statistics.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/Statistics.cpp @@ -233,33 +233,34 @@ void export_Statistics() { class_<Stats>("Stats", no_init) .def("getStatistics", &getStatisticsNumpy, getStatisticsOverloads( - args("data", "sorted"), + (arg("data"), arg("sorted")), "Determine the statistics for an array of data")) .staticmethod("getStatistics") - .def("getZscore", &getZscoreNumpy, args("data"), + .def("getZscore", &getZscoreNumpy, arg("data"), "Determine the Z score for an array of data") - .def("getZscore", &getZscoreNumpyDeprecated, args("data", "sorted"), + .def("getZscore", &getZscoreNumpyDeprecated, + (arg("data"), arg("sorted")), "Determine the Z score for an array of " "data (deprecated sorted argument)") .staticmethod("getZscore") .def("getModifiedZscore", &getModifiedZscoreNumpy, getModifiedZscoreOverloads( - args("data", "sorted"), + (arg("data"), arg("sorted")), "Determine the modified Z score for an array of data")) .staticmethod("getModifiedZscore") .def("getMomentsAboutOrigin", &getMomentsAboutOriginNumpy, getMomentsAboutOriginOverloads( - args("indep", "depend", "maxMoment"), + (arg("indep"), arg("depend"), arg("maxMoment")), "Calculate the first n-moments (inclusive) about the origin") [ReturnNumpyArray()]) .staticmethod("getMomentsAboutOrigin") .def("getMomentsAboutMean", &getMomentsAboutMeanNumpy, getMomentsAboutMeanOverloads( - args("indep", "depend", "maxMoment"), + (arg("indep"), arg("depend"), arg("maxMoment")), "Calculate the first n-moments (inclusive) about the mean") [ReturnNumpyArray()]) .staticmethod("getMomentsAboutMean"); diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/TimeSeriesProperty.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/TimeSeriesProperty.cpp index 933d2862f9bb37333438a49df8a1e0785b6e0e0f..7311d4ac1c2e826d66a3f4692a7a2cfa91317106 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/TimeSeriesProperty.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/TimeSeriesProperty.cpp @@ -12,6 +12,7 @@ using Mantid::Kernel::DateAndTime; using Mantid::Kernel::TimeSeriesProperty; using Mantid::Kernel::Property; using namespace boost::python; +using boost::python::arg; namespace { @@ -22,7 +23,8 @@ using Mantid::PythonInterface::Policies::VectorToNumpy; register_ptr_to_python<TimeSeriesProperty<TYPE> *>(); \ \ class_<TimeSeriesProperty<TYPE>, bases<Property>, boost::noncopyable>( \ - #Prefix "TimeSeriesProperty", init<const std::string &>()) \ + #Prefix "TimeSeriesProperty", \ + init<const std::string &>((arg("self"), arg("value")))) \ .add_property( \ "value", \ make_function( \ @@ -32,20 +34,26 @@ using Mantid::PythonInterface::Policies::VectorToNumpy; &Mantid::Kernel::TimeSeriesProperty<TYPE>::timesAsVector) \ .def("addValue", (void (TimeSeriesProperty<TYPE>::*)( \ const DateAndTime &, const TYPE)) & \ - TimeSeriesProperty<TYPE>::addValue) \ + TimeSeriesProperty<TYPE>::addValue, \ + (arg("self"), arg("time"), arg("value"))) \ .def("addValue", (void (TimeSeriesProperty<TYPE>::*)( \ const std::string &, const TYPE)) & \ - TimeSeriesProperty<TYPE>::addValue) \ - .def("valueAsString", &TimeSeriesProperty<TYPE>::value) \ - .def("size", &TimeSeriesProperty<TYPE>::size) \ - .def("firstTime", &TimeSeriesProperty<TYPE>::firstTime) \ - .def("firstValue", &TimeSeriesProperty<TYPE>::firstValue) \ - .def("lastTime", &TimeSeriesProperty<TYPE>::lastTime) \ - .def("lastValue", &TimeSeriesProperty<TYPE>::lastValue) \ - .def("nthValue", &TimeSeriesProperty<TYPE>::nthValue) \ - .def("nthTime", &TimeSeriesProperty<TYPE>::nthTime) \ - .def("getStatistics", &TimeSeriesProperty<TYPE>::getStatistics) \ - .def("timeAverageValue", &TimeSeriesProperty<TYPE>::timeAverageValue); + TimeSeriesProperty<TYPE>::addValue, \ + (arg("self"), arg("time"), arg("value"))) \ + .def("valueAsString", &TimeSeriesProperty<TYPE>::value, arg("self")) \ + .def("size", &TimeSeriesProperty<TYPE>::size, arg("self")) \ + .def("firstTime", &TimeSeriesProperty<TYPE>::firstTime, arg("self")) \ + .def("firstValue", &TimeSeriesProperty<TYPE>::firstValue, arg("self")) \ + .def("lastTime", &TimeSeriesProperty<TYPE>::lastTime, arg("self")) \ + .def("lastValue", &TimeSeriesProperty<TYPE>::lastValue, arg("self")) \ + .def("nthValue", &TimeSeriesProperty<TYPE>::nthValue, \ + (arg("self"), arg("index"))) \ + .def("nthTime", &TimeSeriesProperty<TYPE>::nthTime, \ + (arg("self"), arg("index"))) \ + .def("getStatistics", &TimeSeriesProperty<TYPE>::getStatistics, \ + arg("self")) \ + .def("timeAverageValue", &TimeSeriesProperty<TYPE>::timeAverageValue, \ + arg("self")); } void export_TimeSeriesProperty_Double() { diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/Unit.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/Unit.cpp index 41214aab50099f1331d4969307dd2757746c8391..ff85cee044ec2791322b67118a6bbf0a7a9aaf84 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/Unit.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/Unit.cpp @@ -33,15 +33,18 @@ void export_Unit() { register_ptr_to_python<boost::shared_ptr<Unit>>(); class_<Unit, boost::noncopyable>("Unit", no_init) - .def("name", &deprecatedName, + .def("name", &deprecatedName, arg("self"), "Return the full name of the unit (deprecated, use caption)") - .def("caption", &Unit::caption, "Return the full name of the unit") - .def("label", &deprecatedLabel, "Returns a plain-text label to be used " - "as the symbol for the unit (deprecated, " - "use symbol())") - .def("symbol", &Unit::label, "Returns a UnitLabel object that holds " - "information on the symbol to use for unit") + .def("caption", &Unit::caption, arg("self"), + "Return the full name of the unit") + .def("label", &deprecatedLabel, arg("self"), + "Returns a plain-text label to be used " + "as the symbol for the unit (deprecated, " + "use symbol())") + .def("symbol", &Unit::label, arg("self"), + "Returns a UnitLabel object that holds " + "information on the symbol to use for unit") .def( - "unitID", &Unit::unitID, + "unitID", &Unit::unitID, arg("self"), "Returns the string ID of the unit. This may/may not match its name"); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/UnitConversion.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/UnitConversion.cpp index c39d60da1ef271a30b5e6b0a5496f5d65037fecc..f2f7ea98ad5f94a21f9d019ad326588dc0e50232 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/UnitConversion.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/UnitConversion.cpp @@ -1,6 +1,5 @@ #include "MantidKernel/UnitConversion.h" #include <boost/python/class.hpp> -#include <boost/python/args.hpp> using Mantid::Kernel::UnitConversion; using Mantid::Kernel::DeltaEMode; diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/UnitFactory.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/UnitFactory.cpp index 8bdf277857fdc6791f4777c96d10a4189e5e024a..361e6b1a50e6df26d75f66c7a7af9e43a7701585 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/UnitFactory.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/UnitFactory.cpp @@ -14,10 +14,10 @@ using namespace boost::python; void export_UnitFactory() { class_<UnitFactoryImpl, boost::noncopyable>("UnitFactoryImpl", no_init) - .def("create", &UnitFactoryImpl::create, + .def("create", &UnitFactoryImpl::create, (arg("self"), arg("className")), "Creates a named unit if it exists in the factory") - .def("getKeys", &UnitFactoryImpl::getKeys, + .def("getKeys", &UnitFactoryImpl::getKeys, arg("self"), return_value_policy<Policies::VectorToNumpy>(), "Returns a list of units available from the factory") diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/UnitLabel.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/UnitLabel.cpp index 757fafecd8652725a165b004321d18a48ab158df..c85ced6900046f9cf9250cbaf3bc4687583b4779 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/UnitLabel.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/UnitLabel.cpp @@ -52,18 +52,19 @@ void export_UnitLabel() { .def(init<UnitLabel::AsciiString>( (arg("ascii")), "Construct a label from a plain-text string")) - .def("ascii", &UnitLabel::ascii, + .def("ascii", &UnitLabel::ascii, arg("self"), return_value_policy<copy_const_reference>(), "Return the label as a plain-text string") - .def("utf8", &utf8ToUnicode, "Return the label as a unicode string") + .def("utf8", &utf8ToUnicode, arg("self"), + "Return the label as a unicode string") .def("latex", &UnitLabel::latex, - return_value_policy<copy_const_reference>(), + return_value_policy<copy_const_reference>(), arg("self"), "Return the label as a plain-text string with latex formatting") // special functions .def("__str__", &UnitLabel::ascii, - return_value_policy<copy_const_reference>()) - .def("__unicode__", &utf8ToUnicode); + return_value_policy<copy_const_reference>(), arg("self")) + .def("__unicode__", &utf8ToUnicode, arg("self")); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/Units.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/Units.cpp index fd07fd24004cb2c7c3d7a61445016b23a09b1834..54888c959e00c8a0dd44c6306045505598c7afc1 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/Units.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/Units.cpp @@ -25,13 +25,15 @@ void setLabelFromStdString(Label &self, const std::string &caption, // have additional functionality over the base class void export_Label() { class_<Label, bases<Unit>, boost::noncopyable>("Label", no_init) - .def("setLabel", &setLabelFromStdString, (arg("caption"), arg("label")), + .def("setLabel", &setLabelFromStdString, + (arg("self"), arg("caption"), arg("label")), "Set the caption (e.g.Temperature) & label (K) on the unit") .def("setLabel", (void (Label::*)(const std::string &, const UnitLabel &)) & Label::setLabel, - (arg("caption"), arg("label")), "Set the caption (e.g.Temperature) " - "& label (K) on the unit, See the " - "UnitLabel class"); + (arg("self"), arg("caption"), arg("label")), + "Set the caption (e.g.Temperature) " + "& label (K) on the unit, See the " + "UnitLabel class"); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/V3D.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/V3D.cpp index bc4d9ce7ebd38b09a75b82c692408524dda1f32d..3b9f94dd6291bd7e797c990899758ee229354495 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/V3D.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/V3D.cpp @@ -28,30 +28,38 @@ void export_V3D() { class_<V3D>("V3D", init<>("Construct a V3D at the origin")) .def(init<double, double, double>( "Construct a V3D with X,Y,Z coordinates")) - .def("X", &V3D::X, return_value_policy<copy_const_reference>(), + .def("X", &V3D::X, arg("self"), + return_value_policy<copy_const_reference>(), "Returns the X coordinate") - .def("Y", &V3D::Y, return_value_policy<copy_const_reference>(), + .def("Y", &V3D::Y, arg("self"), + return_value_policy<copy_const_reference>(), "Returns the Y coordinate") - .def("Z", &V3D::Z, return_value_policy<copy_const_reference>(), + .def("Z", &V3D::Z, arg("self"), + return_value_policy<copy_const_reference>(), "Returns the Z coordinate") - .def("getX", &V3D::X, return_value_policy<copy_const_reference>(), + .def("getX", &V3D::X, arg("self"), + return_value_policy<copy_const_reference>(), "Returns the X coordinate") // Traditional name - .def("getY", &V3D::Y, return_value_policy<copy_const_reference>(), + .def("getY", &V3D::Y, arg("self"), + return_value_policy<copy_const_reference>(), "Returns the Y coordinate") // Traditional name - .def("getZ", &V3D::Z, return_value_policy<copy_const_reference>(), + .def("getZ", &V3D::Z, arg("self"), + return_value_policy<copy_const_reference>(), "Returns the Z coordinate") // Traditional name - .def("distance", &V3D::distance, + .def("distance", &V3D::distance, (arg("self"), arg("other")), "Returns the distance between this vector and another") - .def("angle", &V3D::angle, + .def("angle", &V3D::angle, (arg("self"), arg("other")), "Returns the angle between this vector and another") - .def("zenith", &V3D::zenith, + .def("zenith", &V3D::zenith, (arg("self"), arg("other")), "Returns the zenith between this vector and another") - .def("scalar_prod", &V3D::scalar_prod, + .def("scalar_prod", &V3D::scalar_prod, (arg("self"), arg("other")), "Computes the scalar product between this and another vector") - .def("cross_prod", &V3D::cross_prod, + .def("cross_prod", &V3D::cross_prod, (arg("self"), arg("other")), "Computes the cross product between this and another vector") - .def("norm", &V3D::norm, "Calculates the length of the vector") - .def("norm2", &V3D::norm2, "Calculates the squared length of the vector") + .def("norm", &V3D::norm, arg("self"), + "Calculates the length of the vector") + .def("norm2", &V3D::norm2, arg("self"), + "Calculates the squared length of the vector") .def(self + self) .def(self += self) .def(self - self) @@ -73,7 +81,8 @@ void export_V3D() { .def(self_ns::repr(self)) .def("__hash__", &hashV3D) .def("directionAngles", &V3D::directionAngles, + (arg("self"), arg("inDegrees")), "Calculate direction angles from direction cosines") - .def("directionAngles", &directionAnglesDefault, + .def("directionAngles", &directionAnglesDefault, arg("self"), "Calculate direction angles from direction cosines"); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/VMD.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/VMD.cpp index 3bcdb46bba8de05180940dc0dee22b01b5542526..aafd51e6176cf9bcbc87faac5768a7d8c560dd90 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/VMD.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/VMD.cpp @@ -48,50 +48,56 @@ void setItem(VMD &self, const size_t index, const VMD_t value) { void export_VMD() { class_<VMD>("VMD", - init<>("Default constructor gives an object with 1 dimension")) + init<>(arg("self"), + "Default constructor gives an object with 1 dimension")) .def(init<VMD_t, VMD_t>( "Constructs a 2 dimensional vector at the point given", - args(("val0"), ("val1")))) + (arg("self"), arg("val0"), arg("val1")))) .def(init<VMD_t, VMD_t, VMD_t>( "Constructs a 3 dimensional vector at the point given", - args(("val0"), ("val1"), ("val2")))) + (arg("self"), arg("val0"), arg("val1"), arg("val2")))) .def(init<VMD_t, VMD_t, VMD_t, VMD_t>( "Constructs a 4 dimensional vector at the point given", - args(("val0"), ("val1"), ("val2"), ("val3")))) + (arg("self"), arg("val0"), arg("val1"), arg("val2"), arg("val3")))) .def(init<VMD_t, VMD_t, VMD_t, VMD_t, VMD_t>( "Constructs a 5 dimensional vector at the point given", - args(("val0"), ("val1"), ("val2"), ("val3"), ("val4")))) + (arg("self"), arg("val0"), arg("val1"), arg("val2"), arg("val3"), + arg("val4")))) .def(init<VMD_t, VMD_t, VMD_t, VMD_t, VMD_t, VMD_t>( "Constructs a 6 dimensional vector at the point given", - args(("val0"), ("val1"), ("val2"), ("val3"), ("val5")))) + (arg("self"), arg("val0"), arg("val1"), arg("val2"), arg("val3"), + arg("val4"), arg("val5")))) - .def("getNumDims", &VMD::getNumDims, + .def("getNumDims", &VMD::getNumDims, arg("self"), "Returns the number of dimensions the contained in the vector") - .def("scalar_prod", &VMD::scalar_prod, + .def("scalar_prod", &VMD::scalar_prod, (arg("self"), arg("other")), "Returns the scalar product of this vector with another. If the " "number of dimensions do not match a RuntimeError is raised") - .def("cross_prod", &VMD::cross_prod, + .def("cross_prod", &VMD::cross_prod, (arg("self"), arg("other")), "Returns the cross product of this vector with another. If the " "number of dimensions do not match a RuntimeError is raised") - .def("norm", &VMD::norm, "Returns the length of the vector") + .def("norm", &VMD::norm, arg("self"), "Returns the length of the vector") - .def("norm2", &VMD::norm2, "Returns the the squared length of the vector") + .def("norm2", &VMD::norm2, arg("self"), + "Returns the the squared length of the vector") - .def("normalize", &VMD::normalize, "Normalizes the length of the vector " - "to unity and returns the length " - "before it was normalized") + .def("normalize", &VMD::normalize, arg("self"), + "Normalizes the length of the vector " + "to unity and returns the length " + "before it was normalized") - .def("angle", &VMD::angle, "Returns the angle between the vectors in " - "radians (0 < theta < pi). If the dimensions " - "do not match a RuntimeError is raised") + .def("angle", &VMD::angle, (arg("self"), arg("other")), + "Returns the angle between the vectors in " + "radians (0 < theta < pi). If the dimensions " + "do not match a RuntimeError is raised") //----------------------------- special methods //-------------------------------- - .def("__getitem__", &getItem) - .def("__setitem__", &setItem) + .def("__getitem__", &getItem, (arg("self"), arg("value"))) + .def("__setitem__", &setItem, (arg("self"), arg("index"), arg("value"))) .def(self == self) .def(self != self) // must define != as Python's default is to compare // object address diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/VisibleWhenProperty.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/VisibleWhenProperty.cpp index 4ea24b4b27c5cc146e46a2fcf0a343ec968648e6..c1797a4e592052d345362a0ccc444f0821d495c3 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/VisibleWhenProperty.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/VisibleWhenProperty.cpp @@ -8,12 +8,12 @@ void export_VisibleWhenProperty() { class_<VisibleWhenProperty, bases<EnabledWhenProperty>, boost::noncopyable>( "VisibleWhenProperty", no_init) .def(init<std::string, ePropertyCriterion, std::string>( - (arg("otherPropName"), arg("when"), arg("value")), + (arg("self"), arg("otherPropName"), arg("when"), arg("value")), "Enabled otherPropName property when value criterion meets that " "given by the 'when' argument")) .def(init<std::string, ePropertyCriterion>( - (arg("otherPropName"), arg("when")), + (arg("self"), arg("otherPropName"), arg("when")), "Enabled otherPropName property when criterion does not require a " "value, i.e isDefault")); } diff --git a/Framework/PythonInterface/plugins/algorithms/TOFTOFMergeRuns.py b/Framework/PythonInterface/plugins/algorithms/TOFTOFMergeRuns.py new file mode 100644 index 0000000000000000000000000000000000000000..443a8249b46b60ca036b0bec1e6482e55d983c88 --- /dev/null +++ b/Framework/PythonInterface/plugins/algorithms/TOFTOFMergeRuns.py @@ -0,0 +1,191 @@ +from mantid.kernel import Direction, StringArrayProperty, StringArrayLengthValidator +from mantid.api import PythonAlgorithm, AlgorithmFactory, WorkspaceProperty, WorkspaceGroup +import mantid.simpleapi as api +import numpy as np +from dateutil.parser import parse +import mlzutils + + +class TOFTOFMergeRuns(PythonAlgorithm): + """ Clean the Sample Logs of workspace after merging for TOFTOF instrument + """ + + mandatory_properties = ['channel_width', 'chopper_ratio', 'chopper_speed', 'Ei', 'wavelength', 'full_channels', 'EPP'] + optional_properties = ['temperature', 'run_title'] + properties_to_merge = ['temperature', 'monitor_counts', 'duration', 'run_number', 'run_start', 'run_end'] + must_have_properties = ['monitor_counts', 'duration', 'run_number', 'run_start', 'run_end'] + + def __init__(self): + """ + Init + """ + PythonAlgorithm.__init__(self) + + def category(self): + """ Return category + """ + return "PythonAlgorithms\\MLZ\\TOFTOF;Utility" + + def name(self): + """ Return summary + """ + return "TOFTOFMergeRuns" + + def summary(self): + return "Merge runs and the sample logs." + + def PyInit(self): + """ Declare properties + """ + validator = StringArrayLengthValidator() + validator.setLengthMin(1) + self.declareProperty(StringArrayProperty(name="InputWorkspaces", direction=Direction.Input, validator=validator), + doc="Comma separated list of workspaces or groups of workspaces.") + self.declareProperty(WorkspaceProperty("OutputWorkspace", "", direction=Direction.Output), + doc="Name of the workspace that will contain the merged workspaces.") + return + + def _validate_input(self): + """ + Checks for the valid input: + all given workspaces and/or groups must exist + gets names of the grouped workspaces + """ + workspaces = self.getProperty("InputWorkspaces").value + mlzutils.ws_exist(workspaces, self.log()) + input_workspaces = [] + if len(workspaces) < 1: + message = "List of workspaces is empty. Nothing to merge." + self.log().error(message) + raise RuntimeError(message) + for wsname in workspaces: + wks = api.AnalysisDataService.retrieve(wsname) + if isinstance(wks, WorkspaceGroup): + input_workspaces.extend(wks.getNames()) + else: + input_workspaces.append(wsname) + return input_workspaces + + def _can_merge(self, wsnames): + """ + Checks whether given workspaces can be merged + """ + # mandatory properties must be identical + mlzutils.compare_mandatory(wsnames, self.mandatory_properties, self.log()) + + # timing (x-axis binning) must match + # is it possible to use WorkspaceHelpers::matchingBins from python? + self.timingsMatch(wsnames) + + # Check sample logs for must have properties + for wsname in wsnames: + wks = api.AnalysisDataService.retrieve(wsname) + run = wks.getRun() + for prop in self.must_have_properties: + if not run.hasProperty(prop): + message = "Error: Workspace " + wsname + " does not have property " + prop +\ + ". Cannot merge." + self.log().error(message) + raise RuntimeError(message) + + # warnig if optional properties are not identical must be given + ws1 = api.AnalysisDataService.retrieve(wsnames[0]) + run1 = ws1.getRun() + for wsname in wsnames[1:]: + wks = api.AnalysisDataService.retrieve(wsname) + run = wks.getRun() + mlzutils.compare_properties(run1, run, self.optional_properties, self.log(), tolerance=0.01) + return True + + def PyExec(self): + """ Main execution body + """ + # get list of input workspaces + input_workspace_list = self._validate_input() + workspaceCount = len(input_workspace_list) + self.log().information("Workspaces to merge " + str(workspaceCount)) + wsOutput = self.getPropertyValue("OutputWorkspace") + + if workspaceCount < 2: + api.CloneWorkspace(InputWorkspace=self.wsNames[0], OutputWorkspace=wsOutput) + self.log().warning("Cannot merge one workspace. Clone is produced.") + return + + # check whether given workspaces can be merged + self._can_merge(input_workspace_list) + + # delete output workspace if it exists + if api.mtd.doesExist(wsOutput): + api.DeleteWorkspace(Workspace=wsOutput) + + # Merge runs + api.MergeRuns(InputWorkspaces=input_workspace_list, OutputWorkspace=wsOutput) + + # Merge logs + # MergeRuns by default copies all logs from the first workspace + pdict = {} + for prop in self.properties_to_merge: + pdict[prop] = [] + + for wsname in input_workspace_list: + wks = api.AnalysisDataService.retrieve(wsname) + run = wks.getRun() + for prop in self.properties_to_merge: + if run.hasProperty(prop): + pdict[prop].append(run.getProperty(prop).value) + + # take average for temperatures + nentries = len(pdict['temperature']) + if nentries > 0: + temps = [float(temp) for temp in pdict['temperature']] + tmean = sum(temps)/nentries + api.AddSampleLog(Workspace=wsOutput, LogName='temperature', LogText=str(tmean), + LogType='Number', LogUnit='K') + # sum monitor counts + mcounts = [int(mco) for mco in pdict['monitor_counts']] + # check for zero monitor counts + zeros = np.where(np.array(mcounts) == 0)[0] + if len(zeros) > 0: + for index in zeros: + self.log().warning("Workspace " + self.wsNames[index] + " has zero monitor counts.") + # create sample log + api.AddSampleLog(Workspace=wsOutput, LogName='monitor_counts', LogText=str(sum(mcounts)), + LogType='Number') + # sum durations + durations = [int(dur) for dur in pdict['duration']] + api.AddSampleLog(Workspace=wsOutput, LogName='duration', LogText=str(sum(durations)), + LogType='Number', LogUnit='s') + # get minimal run_start + fmt = "%Y-%m-%dT%H:%M:%S%z" + run_start = [parse(entry) for entry in pdict['run_start']] + api.AddSampleLog(Workspace=wsOutput, LogName='run_start', + LogText=min(run_start).strftime(fmt), LogType='String') + # get maximal run_end + run_end = [parse(entry) for entry in pdict['run_end']] + api.AddSampleLog(Workspace=wsOutput, LogName='run_end', + LogText=max(run_end).strftime(fmt), LogType='String') + # list of run_numbers + api.AddSampleLog(Workspace=wsOutput, LogName='run_number', + LogText=str(pdict['run_number']), LogType='String') + + self.setProperty("OutputWorkspace", wsOutput) + + def timingsMatch(self, wsNames): + """ + :param wsNames: + :return: + """ + for i in range(len(wsNames)): + leftWorkspace = wsNames[i] + rightWorkspace = wsNames[i+1] + leftXData = api.mtd[leftWorkspace].dataX(0) + rightXData = api.mtd[rightWorkspace].dataX(0) + leftDeltaX = leftXData[0] - leftXData[1] + rightDeltaX = rightXData[0] - rightXData[1] + if abs(leftDeltaX - rightDeltaX) >= 1e-4 or abs(rightXData[0] - leftXData[0]) >= 1e-4: + raise RuntimeError("Timings don't match") + else: + return True + +# Register algorithm with Mantid. +AlgorithmFactory.subscribe(TOFTOFMergeRuns) diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DetectorFloodWeighting.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DetectorFloodWeighting.py new file mode 100644 index 0000000000000000000000000000000000000000..c929a3c23b3afe00c1ed0770e6b38ef0424e4a96 --- /dev/null +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DetectorFloodWeighting.py @@ -0,0 +1,134 @@ +from mantid.api import DataProcessorAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, WorkspaceUnitValidator, \ + Progress + +from mantid.kernel import Direction, FloatArrayProperty, FloatArrayBoundedValidator + +import numpy as np + +class DetectorFloodWeighting(DataProcessorAlgorithm): + + def __init__(self): + DataProcessorAlgorithm.__init__(self) + + def category(self): + return 'Workflow\\SANS' + + + def summary(self): + return 'Generates a Detector flood weighting, or sensitivity workspace' + + + def PyInit(self): + + self.declareProperty(MatrixWorkspaceProperty('InputWorkspace', '', + direction=Direction.Input, validator=WorkspaceUnitValidator("Wavelength")), + doc='Flood weighting measurement') + + validator = FloatArrayBoundedValidator() + validator.setLower(0.) + self.declareProperty(FloatArrayProperty('Bands', [], direction=Direction.Input, validator=validator), + doc='Wavelength bands to use. Single pair min to max.') + + self.declareProperty(MatrixWorkspaceProperty('OutputWorkspace', '', + direction=Direction.Output), + doc='Normalized flood weighting measurement') + + self.declareProperty("SolidAngleCorrection", True, direction=Direction.Input, doc="Perform final solid angle correction") + + + def validateInputs(self): + """ + Validates input ranges. + """ + issues = dict() + + bands = self.getProperty('Bands').value + + if not any(bands): + issues['Bands'] = 'Bands must be supplied' + return issues # Abort early. Do not continue + + if not len(bands)%2 == 0: + issues['Bands'] = 'Even number of Bands boundaries expected' + return issues # Abort early. Do not continue + + if len(bands) > 2: + issues['Bands'] = 'Presently this algorithm only supports one pair of bands' + + all_limits=list() + for i in range(0, len(bands), 2): + lower = bands[i] + upper = bands[i+1] + limits = np.arange(lower, upper) + unique = set(limits) + for existing_lims in all_limits: + if unique.intersection(set(existing_lims)): + issues['Bands'] = 'Bands must not intersect' + break + + all_limits.append(limits) + if lower >= upper: + issues['Bands'] = 'Bands should form lower, upper pairs' + + return issues + + def _divide(self, lhs, rhs): + divide = self.createChildAlgorithm("Divide") + divide.setProperty("LHSWorkspace", lhs) + divide.setProperty("RHSWorkspace", rhs) + divide.execute() + return divide.getProperty("OutputWorkspace").value + + + def PyExec(self): + + progress = Progress(self, 0, 1, 4) # Four coarse steps + + in_ws = self.getProperty('InputWorkspace').value + bands = self.getProperty('Bands').value + + # Formulate bands + params = list() + for i in range(0, len(bands), 2): + lower = bands[i] + upper = bands[i+1] + step = upper - lower + params.append((lower, step, upper)) + progress.report() + + accumulated_output = None + rebin = self.createChildAlgorithm("Rebin") + rebin.setProperty("Params", params[0]) + rebin.setProperty("InputWorkspace", in_ws) + rebin.execute() + accumulated_output = rebin.getProperty("OutputWorkspace").value + progress.report() + + # Determine the max across all spectra + y_values = accumulated_output.extractY() + max_val = np.amax(y_values) + + # Create a workspace from the single max value + create = self.createChildAlgorithm("CreateSingleValuedWorkspace") + create.setProperty("DataValue", max_val) + create.execute() + max_ws = create.getProperty("OutputWorkspace").value + + # Divide each entry by max + normalized = self._divide(accumulated_output, max_ws) + progress.report() + + # Perform solid angle correction. Calculate solid angle then divide through. + if self.getProperty("SolidAngleCorrection").value: + solidAngle = self.createChildAlgorithm("SolidAngle") + solidAngle.setProperty("InputWorkspace", normalized) + solidAngle.execute() + solid_angle_weighting = solidAngle.getProperty("OutputWorkspace").value + normalized = self._divide(normalized, solid_angle_weighting) + progress.report() + + self.setProperty('OutputWorkspace', normalized) + + +# Register alg +AlgorithmFactory.subscribe(DetectorFloodWeighting) diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ResNorm2.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ResNorm2.py index 93db61443b45cd5cf23a6c3b11be156408bd20a6..02de852f0963d86fd61d806772c7f34c9e6ceebf 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ResNorm2.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ResNorm2.py @@ -1,6 +1,6 @@ #pylint: disable=no-init from mantid.api import (PythonAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, - WorkspaceGroup, WorkspaceGroupProperty) + WorkspaceGroup, WorkspaceGroupProperty, Progress) from mantid.kernel import Direction from mantid.simpleapi import * @@ -99,10 +99,11 @@ class ResNorm(PythonAlgorithm): # Process resolution workspace padded_res_ws = self._process_res_ws(num_hist) - + prog_namer = Progress(self, start=0.0, end=0.02, nreports=num_hist) input_str = '' for idx in range(num_hist): input_str += '%s,i%d;' % (padded_res_ws, idx) + prog_namer.report() out_name = getWSprefix(self._res_ws) + 'ResNorm_Fit' function = 'name=TabulatedFunction,Workspace=%s,Scaling=1,Shift=0,XScaling=1,ties=(Shift=0)' % self._van_ws @@ -118,8 +119,10 @@ class ResNorm(PythonAlgorithm): params = {'XScaling':'Stretch', 'Scaling':'Intensity'} result_workspaces = [] + prog_process = Progress(self, start=0.94, end=1.0, nreports=3) for param_name, output_name in params.items(): result_workspaces.append(self._process_fit_params(fit_params, param_name, v_values, v_unit, output_name)) + prog_process.report() GroupWorkspaces(InputWorkspaces=result_workspaces, OutputWorkspace=self._out_ws) @@ -127,6 +130,7 @@ class ResNorm(PythonAlgorithm): DeleteWorkspace(van_ws) DeleteWorkspace(padded_res_ws) + prog_process.report() if not self._create_output: DeleteWorkspace(fit_params) diff --git a/Framework/PythonInterface/plugins/algorithms/mlzutils.py b/Framework/PythonInterface/plugins/algorithms/mlzutils.py index 11929ab069adf73a25a143413a867ff4127985b6..3b69302522b7ef2cd6d2eba41c946e3e548d5673 100644 --- a/Framework/PythonInterface/plugins/algorithms/mlzutils.py +++ b/Framework/PythonInterface/plugins/algorithms/mlzutils.py @@ -55,7 +55,7 @@ def ws_exist(wslist, logger): return True -def compare_properties(lhs_run, rhs_run, plist, logger): +def compare_properties(lhs_run, rhs_run, plist, logger, tolerance=5e-3): """ checks whether properties match in the given runs, produces warnings @param lhs_run Left-hand-side run @@ -65,11 +65,16 @@ def compare_properties(lhs_run, rhs_run, plist, logger): """ lhs_title = "" rhs_title = "" - if lhs_run.hasProperty('run_title'): + if lhs_run.hasProperty('run_title') and rhs_run.hasProperty('run_title'): lhs_title = lhs_run.getProperty('run_title').value - if rhs_run.hasProperty('run_title'): rhs_title = rhs_run.getProperty('run_title').value + # for TOFTOF run_titles can be identical + if lhs_title == rhs_title: + if lhs_run.hasProperty('run_number') and rhs_run.hasProperty('run_number'): + lhs_title = str(lhs_run.getProperty('run_number').value) + rhs_title = str(rhs_run.getProperty('run_number').value) + for property_name in plist: if lhs_run.hasProperty(property_name) and rhs_run.hasProperty(property_name): lhs_property = lhs_run.getProperty(property_name) @@ -81,8 +86,8 @@ def compare_properties(lhs_run, rhs_run, plist, logger): lhs_title + ": " + lhs_property.value + ", but " + \ rhs_title + ": " + rhs_property.value logger.warning(message) - if lhs_property.type == 'number': - if abs(lhs_property.value - rhs_property.value) > 5e-3: + elif lhs_property.type == 'number': + if abs(lhs_property.value - rhs_property.value) > tolerance: message = "Property " + property_name + " does not match! " + \ lhs_title + ": " + str(lhs_property.value) + ", but " + \ rhs_title + ": " + str(rhs_property.value) @@ -98,3 +103,54 @@ def compare_properties(lhs_run, rhs_run, plist, logger): lhs_title + " or " + rhs_title + " - skipping comparison." logger.warning(message) return + + +def compare_mandatory(wslist, plist, logger, tolerance=0.01): + """ + Compares properties which are required to be the same. + Produces error message and throws exception if difference is observed + or if one of the sample logs is not found. + Important: exits after the first difference is observed. No further check is performed. + @param wslist List of workspaces + @param plist List of properties to compare + @param logger Logger self.log() + @param tolerance Tolerance for comparison of the double values. + """ + # retrieve the workspaces, form dictionary {wsname: run} + runs = {} + for wsname in wslist: + wks = api.AnalysisDataService.retrieve(wsname) + runs[wsname] = wks.getRun() + + for prop in plist: + properties = [] + for wsname in wslist: + run = runs[wsname] + if not run.hasProperty(prop): + message = "Workspace " + wsname + " does not have sample log " + prop + logger.error(message) + raise RuntimeError(message) + + curprop = run.getProperty(prop) + if curprop.type == 'string': + properties.append(curprop.value) + elif curprop.type == 'number': + properties.append(int(curprop.value/tolerance)) + else: + message = "Unknown type " + str(curprop.type) + " for the sample log " +\ + prop + " in the workspace " + wsname + logger.error(message) + raise RuntimeError(message) + # this should never happen, but lets check + nprop = len(properties) + if nprop != len(wslist): + message = "Error. Number of properties " + str(nprop) + " for property " + prop +\ + " is not equal to number of workspaces " + str(len(wslist)) + logger.error(message) + raise RuntimeError(message) + pvalue = properties[0] + if properties.count(pvalue) != nprop: + message = "Sample log " + prop + " is not identical in the given list of workspaces. \n" +\ + "Workspaces: " + ", ".join(wslist) + "\n Values: " + str(properties) + logger.error(message) + raise RuntimeError(message) diff --git a/Framework/PythonInterface/test/python/mantid/SimpleAPITest.py b/Framework/PythonInterface/test/python/mantid/SimpleAPITest.py index f2bfb1f7a92b9c495c216ef9febdc821e3d550e0..cf969f16defc7d9beaa30ba65975076425974975 100644 --- a/Framework/PythonInterface/test/python/mantid/SimpleAPITest.py +++ b/Framework/PythonInterface/test/python/mantid/SimpleAPITest.py @@ -259,8 +259,8 @@ FullBinsOnly(Input) *boolean* Omit the final bin if it's width is smaller expected_child=False) def test_create_algorithm_with_version_produces_initialized_alorithm(self): - alg = simpleapi._create_algorithm_object("LoadRaw", 2) - self._is_initialized_test(alg, 2, expected_class=AlgorithmProxy, + alg = simpleapi._create_algorithm_object("LoadRaw", 3) + self._is_initialized_test(alg, 3, expected_class=AlgorithmProxy, expected_child=False) def test_create_algorithm_produces_child_inside_PyExec(self): diff --git a/Framework/PythonInterface/test/python/mantid/api/AlgorithmFactoryTest.py b/Framework/PythonInterface/test/python/mantid/api/AlgorithmFactoryTest.py index fc7dae55821697f50feb2d65330987cecadcb9f8..42fb125698f7c775d52c9f26102d67c44c18656f 100644 --- a/Framework/PythonInterface/test/python/mantid/api/AlgorithmFactoryTest.py +++ b/Framework/PythonInterface/test/python/mantid/api/AlgorithmFactoryTest.py @@ -24,9 +24,10 @@ class AlgorithmFactoryTest(unittest.TestCase): all_algs = AlgorithmFactory.getRegisteredAlgorithms(True) self.assertTrue( len(all_algs) > 0 ) self.assertTrue( 'ConvertUnits' in all_algs ) - # 3 versions of LoadRaw - self.assertEquals( len(all_algs['LoadRaw']), 3 ) - self.assertEquals( all_algs['LoadRaw'], [1,2,3] ) + self.assertTrue( 'LoadRaw' in all_algs ) + # one versions of LoadRaw + self.assertEquals( len(all_algs['LoadRaw']), 1 ) + self.assertEquals( all_algs['LoadRaw'], [3] ) def test_algorithm_subscription_with_valid_object_succeeds(self): testhelpers.assertRaisesNothing(self, AlgorithmFactory.subscribe, IsAnAlgorithm) diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt b/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt index 64c61d26428868f5d92f66d5429a8fec00236de9..c12c040cddbff6f851d86f23bfa144fc0bbeb73f 100644 --- a/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt +++ b/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt @@ -11,6 +11,7 @@ set ( TEST_PY_FILES CorrectLogTimesTest.py CreateLeBailFitInputTest.py CreateMDTest.py + DetectorFloodWeightingTest.py IndirectCalibrationTest.py CreateWorkspaceTest.py CylinderPaalmanPingsCorrectionTest.py @@ -74,6 +75,7 @@ set ( TEST_PY_FILES UpdatePeakParameterTableValueTest.py SANSSubtractTest.py TimeSliceTest.py + TOFTOFMergeRunsTest.py TOSCABankCorrectionTest.py TransformToIqtTest.py ExportSampleLogsToCSVFileTest.py diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/DetectorFloodWeightingTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/DetectorFloodWeightingTest.py new file mode 100644 index 0000000000000000000000000000000000000000..b2ca793e6254f263fb1d48b216104cfcf7f6b3fc --- /dev/null +++ b/Framework/PythonInterface/test/python/plugins/algorithms/DetectorFloodWeightingTest.py @@ -0,0 +1,94 @@ +import unittest +from mantid.api import AlgorithmManager +from mantid.simpleapi import CreateSampleWorkspace, DeleteWorkspace + + +class DetectorFloodWeightingTest(unittest.TestCase): + + def _create_ws(self, units="TOF", signal_value=2, data_x=range(0,10), n_spec=1): + data_y=[signal_value]*(len(data_x) - 1) + alg = AlgorithmManager.create("CreateWorkspace") + alg.setChild(True) + alg.initialize() + alg.setProperty("DataX", data_x) + alg.setProperty("DataY", data_y) + alg.setProperty("NSpec", n_spec) + alg.setProperty("OutputWorkspace", "temp") + alg.setProperty("UnitX", units) + alg.execute() + return alg.getProperty("OutputWorkspace").value + + def test_init(self): + alg = AlgorithmManager.create("DetectorFloodWeighting") + alg.initialize() + self.assertTrue(alg.isInitialized()) + + def test_input_must_be_wavelength(self): + tof_ws = self._create_ws(units="TOF") + alg = AlgorithmManager.create("DetectorFloodWeighting") + alg.setChild(True) + alg.initialize() + self.assertRaises(ValueError, alg.setProperty, "InputWorkspace", tof_ws) + + def test_cannot_have_negative_wavlength_boundaries_in_bands(self): + alg = AlgorithmManager.create("DetectorFloodWeighting") + alg.setChild(True) + alg.initialize() + self.assertRaises(ValueError, alg.setProperty, "Bands", [-1,10]) + + def test_bands_must_not_overlap(self): + alg = AlgorithmManager.create("DetectorFloodWeighting") + alg.setChild(True) + alg.initialize() + signal_value = 2 + in_ws = self._create_ws(units="Wavelength", signal_value=signal_value, data_x=range(0,10,1)) + alg.setProperty("InputWorkspace", in_ws) + bands = [1,3,2,4] # Overlap! + alg.setProperty("Bands", bands) # One band + alg.setPropertyValue("OutputWorkspace", "dummy") + self.assertRaises(RuntimeError, alg.execute) + + def test_execute_single_no_solid_angle(self): + alg = AlgorithmManager.create("DetectorFloodWeighting") + alg.setChild(True) + alg.initialize() + alg.setProperty("SolidAngleCorrection", False) + signal_value = 2 + in_ws = self._create_ws(units="Wavelength", signal_value=signal_value, data_x=range(0,10,1)) + alg.setProperty("InputWorkspace", in_ws) + bands = [1,10] + alg.setProperty("Bands", bands) # One band + alg.setPropertyValue("OutputWorkspace", "dummy") + alg.execute() + + out_ws = alg.getProperty("OutputWorkspace").value + self.assertEqual(1, out_ws.blocksize()) + self.assertEqual("Wavelength", out_ws.getAxis(0).getUnit().unitID()) + self.assertEqual(in_ws.getNumberHistograms(), out_ws.getNumberHistograms(), msg="Number of histograms should be unchanged.") + x_axis = out_ws.readX(0) + self.assertEquals(x_axis[0], bands[0]) + self.assertEquals(x_axis[-1], bands[-1]) + print out_ws.readY(0)[0] + self.assertEquals(out_ws.readY(0)[0], 1.0) + + def test_execute_single_with_solid_angle(self): + alg = AlgorithmManager.create("DetectorFloodWeighting") + alg.setChild(True) + alg.initialize() + alg.setProperty("SolidAngleCorrection", True) + signal_value = 2 + in_ws = CreateSampleWorkspace(NumBanks=1, XUnit="Wavelength") + alg.setProperty("InputWorkspace", in_ws) + bands = [1,10] + alg.setProperty("Bands", bands) # One band + alg.setPropertyValue("OutputWorkspace", "dummy") + alg.execute() + + out_ws = alg.getProperty("OutputWorkspace").value + self.assertEqual(1, out_ws.blocksize()) + self.assertEqual("Wavelength", out_ws.getAxis(0).getUnit().unitID()) + self.assertEqual(in_ws.getNumberHistograms(), out_ws.getNumberHistograms(), msg="Number of histograms should be unchanged.") + + +if __name__ == '__main__': + unittest.main() diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFMergeRunsTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFMergeRunsTest.py new file mode 100644 index 0000000000000000000000000000000000000000..3e0b4dac93aa19f9044bba5ab938da751a5f231c --- /dev/null +++ b/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFMergeRunsTest.py @@ -0,0 +1,93 @@ +import unittest +from mantid.simpleapi import Load, DeleteWorkspace, AddSampleLogMultiple, \ + DeleteLog +from testhelpers import run_algorithm +from mantid.api import AnalysisDataService + + +class TOFTOFMergeRunsTest(unittest.TestCase): + + def setUp(self): + input_ws = Load(Filename="TOFTOFTestdata.nxs") + self._input_ws_base = input_ws + self._input_good = input_ws + AddSampleLogMultiple(Workspace=self._input_good, LogNames=['run_number'], LogValues=[001]) + + self._input_bad_entry = input_ws+0 + # remove a compulsory entry in Logs + DeleteLog(self._input_bad_entry, 'duration') + + self._input_bad_value = input_ws+0 + AddSampleLogMultiple(Workspace=self._input_bad_value, LogNames=['wavelength'], LogValues=[0.]) + + def test_success(self): + OutputWorkspaceName = "output_ws" + Inputws = "%s, %s" % (self._input_ws_base.name(), self._input_good.name()) + + alg_test = run_algorithm("TOFTOFMergeRuns", + InputWorkspaces=Inputws, + OutputWorkspace=OutputWorkspaceName) + self.assertTrue(alg_test.isExecuted()) + + wsoutput = AnalysisDataService.retrieve(OutputWorkspaceName) + + run_out = wsoutput.getRun() + run_in = self._input_ws_base.getRun() + self.assertEqual(run_out.getLogData('wavelength').value, run_in.getLogData('wavelength').value) + self.assertEqual(run_out.getLogData('chopper_speed').value, run_in.getLogData('chopper_speed').value) + self.assertEqual(run_out.getLogData('chopper_ratio').value, run_in.getLogData('chopper_ratio').value) + self.assertEqual(run_out.getLogData('channel_width').value, run_in.getLogData('channel_width').value) + self.assertEqual(run_out.getLogData('Ei').value, run_in.getLogData('Ei').value) + self.assertEqual(run_out.getLogData('EPP').value, run_in.getLogData('EPP').value) + self.assertEqual(run_out.getLogData('proposal_number').value, run_in.getLogData('proposal_number').value) + self.assertEqual(run_out.getLogData('proposal_title').value, run_in.getLogData('proposal_title').value) + self.assertEqual(run_out.getLogData('mode').value, run_in.getLogData('mode').value) + self.assertEqual(run_out.getLogData('experiment_team').value, run_in.getLogData('experiment_team').value) + + run_in_good = self._input_good.getRun() + self.assertEqual(run_out.getLogData('run_number').value, + str([run_in.getLogData('run_number').value, run_in_good.getLogData('run_number').value])) + + self.assertEqual(run_out.getLogData('temperature').value, float(run_in.getLogData('temperature').value)) + self.assertEqual(run_out.getLogData('duration').value, + float(run_in.getLogData('duration').value) + float(run_in_good.getLogData('duration').value)) + self.assertEqual(run_out.getLogData('run_start').value, run_in.getLogData('run_start').value) + self.assertEqual(run_out.getLogData('run_end').value, run_in.getLogData('run_end').value) + self.assertEqual(run_out.getLogData('full_channels').value, run_in.getLogData('full_channels').value) + self.assertEqual(run_out.getLogData('monitor_counts').value, 2*int(run_in.getLogData('monitor_counts').value)) + # Dimension output workspace + self.assertEqual(wsoutput.getNumberHistograms(), self._input_ws_base.getNumberHistograms()) + self.assertEqual(wsoutput.blocksize(), self._input_ws_base.blocksize()) + # check instrument + self.assertEqual(wsoutput.getInstrument().getName(), "TOFTOF") + + AnalysisDataService.remove("output_ws") + + def test_failed(self): + """ + Failed tests because of missing keys or different values + """ + OutputWorkspaceName = "output_ws" + Inputws_badvalue = "%s, %s" % (self._input_ws_base.name(), self._input_bad_value.name()) + self.assertRaises(RuntimeError, + run_algorithm, 'TOFTOFMergeRuns', + InputWorkspaces=Inputws_badvalue, + OutputWorkspace=OutputWorkspaceName, + rethrow=True) + + Inputws_badentry = "%s, %s" % (self._input_ws_base.name(), self._input_bad_entry.name()) + self.assertRaises(RuntimeError, + run_algorithm, 'TOFTOFMergeRuns', + InputWorkspaces=Inputws_badentry, + OutputWorkspace=OutputWorkspaceName, + rethrow=True) + + if "output_ws" is not None: + AnalysisDataService.remove("output_ws") + + def cleanUp(self): + if self._input_ws_base is not None: + DeleteWorkspace(self._input_ws_base) + +if __name__ == "__main__": + unittest.main() diff --git a/Framework/SINQ/src/LoadFlexiNexus.cpp b/Framework/SINQ/src/LoadFlexiNexus.cpp index 2bb6ca7cd7c68e2f318925b7e6852205c334abd5..d589ce89c86d6df3055e64532ff7ba7071916091 100644 --- a/Framework/SINQ/src/LoadFlexiNexus.cpp +++ b/Framework/SINQ/src/LoadFlexiNexus.cpp @@ -5,7 +5,6 @@ #include "MantidGeometry/MDGeometry/MDTypes.h" #include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidKernel/Utils.h" -#include <iostream> #include <fstream> #include <sstream> #include <boost/algorithm/string.hpp> diff --git a/Framework/SINQ/src/MDHistoToWorkspace2D.cpp b/Framework/SINQ/src/MDHistoToWorkspace2D.cpp index 25153f13116175287ce20080935335240801e021..2433e266d31d3c8c4e2320b3d07579760c6d05f0 100644 --- a/Framework/SINQ/src/MDHistoToWorkspace2D.cpp +++ b/Framework/SINQ/src/MDHistoToWorkspace2D.cpp @@ -13,7 +13,6 @@ #include "MantidAPI/IMDHistoWorkspace.h" #include <cmath> -#include <iostream> // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(MDHistoToWorkspace2D) diff --git a/Framework/SINQ/src/SINQHMListener.cpp b/Framework/SINQ/src/SINQHMListener.cpp index d8434b56b5cb7b3ab127f952316e51dfee9aeab3..fd449cb9648dd54cadb67cea330d91aa46ed5fcd 100644 --- a/Framework/SINQ/src/SINQHMListener.cpp +++ b/Framework/SINQ/src/SINQHMListener.cpp @@ -4,7 +4,6 @@ * Created on: Nov 14, 2012 * Author: mark.koennecke@psi.ch */ -#include <iostream> #include <sstream> #include "MantidAPI/LiveListenerFactory.h" diff --git a/Framework/SINQ/test/PoldiFitPeaks1D2Test.h b/Framework/SINQ/test/PoldiFitPeaks1D2Test.h index 4ced3e46bad5c158d1d9ef7f047fa179be817d44..35fbec1cc249f38f5f47758afc1a36845b5b3002 100644 --- a/Framework/SINQ/test/PoldiFitPeaks1D2Test.h +++ b/Framework/SINQ/test/PoldiFitPeaks1D2Test.h @@ -9,8 +9,7 @@ #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/IPeakFunction.h" -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/FlatBackground.h" +#include "MantidCurveFitting/Functions/FlatBackground.h" #include "MantidSINQ/PoldiUtilities/PoldiPeak.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -21,6 +20,7 @@ using Mantid::Poldi::PoldiFitPeaks1D2; using namespace Mantid::Poldi; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::Kernel; using namespace Mantid::DataObjects; diff --git a/Framework/SINQ/test/PoldiFitPeaks1DTest.h b/Framework/SINQ/test/PoldiFitPeaks1DTest.h index a2158802104fad5391ed961eec6a2eced22c43b3..452d6472c3987e074ea2ba878042f6b2cca616c4 100644 --- a/Framework/SINQ/test/PoldiFitPeaks1DTest.h +++ b/Framework/SINQ/test/PoldiFitPeaks1DTest.h @@ -9,8 +9,7 @@ #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/IPeakFunction.h" -#include "MantidCurveFitting/Gaussian.h" -#include "MantidCurveFitting/FlatBackground.h" +#include "MantidCurveFitting/Functions/FlatBackground.h" #include "MantidSINQ/PoldiUtilities/PoldiPeak.h" @@ -18,6 +17,7 @@ using Mantid::Poldi::PoldiFitPeaks1D; using namespace Mantid::Poldi; using namespace Mantid::API; using namespace Mantid::CurveFitting; +using namespace Mantid::CurveFitting::Functions; using namespace Mantid::Kernel; class TestablePoldiFitPeaks1D : public Mantid::Poldi::PoldiFitPeaks1D { diff --git a/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h b/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h index f9eb10908965fcbc41cb3fb4ab9d8c382c5a8382..492393f6b0a8a8122190cbd8da275650fb1d74fe 100644 --- a/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h +++ b/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h @@ -12,7 +12,6 @@ #include "MantidAPI/FunctionValues.h" #include "MantidAPI/FunctionFactory.h" #include "MantidAPI/MultiDomainFunction.h" -#include "MantidCurveFitting/Gaussian.h" #include "MantidCurveFitting/FitMW.h" #include "MantidCurveFitting/Jacobian.h" diff --git a/Framework/TestHelpers/inc/MantidTestHelpers/FakeObjects.h b/Framework/TestHelpers/inc/MantidTestHelpers/FakeObjects.h index d114a1ee434bb7a670fe77d3f9a9a90af498da6d..b9c906a2804d32c3049699391f332ba19d3fa9c3 100644 --- a/Framework/TestHelpers/inc/MantidTestHelpers/FakeObjects.h +++ b/Framework/TestHelpers/inc/MantidTestHelpers/FakeObjects.h @@ -18,19 +18,19 @@ * Author: Janik Zikovsky */ +#include <fstream> +#include <map> +#include <string> + #include "MantidAPI/ISpectrum.h" #include "MantidAPI/ITableWorkspace.h" #include "MantidAPI/MatrixWorkspace.h" -#include "MantidKernel/cow_ptr.h" #include "MantidAPI/RefAxis.h" #include "MantidAPI/SpectraAxis.h" #include "MantidGeometry/Instrument.h" #include "MantidGeometry/Instrument/DetectorGroup.h" #include "MantidGeometry/Instrument/INearestNeighbours.h" -#include <iostream> -#include <fstream> -#include <map> -#include <string> +#include "MantidKernel/cow_ptr.h" using namespace Mantid::API; using namespace Mantid::Kernel; diff --git a/Framework/TestHelpers/inc/MantidTestHelpers/ScopedFileHelper.h b/Framework/TestHelpers/inc/MantidTestHelpers/ScopedFileHelper.h index e1701b8e755d30b6d97e22cd57d4cddecd5cec98..430cba7905b24eff879ea925528431386c272253 100644 --- a/Framework/TestHelpers/inc/MantidTestHelpers/ScopedFileHelper.h +++ b/Framework/TestHelpers/inc/MantidTestHelpers/ScopedFileHelper.h @@ -1,12 +1,13 @@ //------------------------------------------------------------------------------ // Includes //------------------------------------------------------------------------------ -#include <string> -#include <iostream> #include <fstream> -#include <Poco/Path.h> +#include <string> + #include "MantidKernel/ConfigService.h" +#include <Poco/Path.h> + namespace ScopedFileHelper { /** File object type. Provides exception save file creation/destruction. diff --git a/Framework/TestHelpers/src/LoggingCleaner.cpp b/Framework/TestHelpers/src/LoggingCleaner.cpp index 7e6bcdaef45e5d3d25e7872759a2e4ce215c06e8..81b7cead7dcce200d1711df3f7a0846dfd5c4231 100644 --- a/Framework/TestHelpers/src/LoggingCleaner.cpp +++ b/Framework/TestHelpers/src/LoggingCleaner.cpp @@ -1,5 +1,4 @@ #include "MantidKernel/Logger.h" -#include <iostream> class LoggingCleaner { public: diff --git a/MantidPlot/src/CanvasPicker.cpp b/MantidPlot/src/CanvasPicker.cpp index 2e918d8e064e3c9ad54900ec84662cafb6205846..96b5f6f4f3269e6226602ab49465c56be6f1709e 100644 --- a/MantidPlot/src/CanvasPicker.cpp +++ b/MantidPlot/src/CanvasPicker.cpp @@ -39,7 +39,6 @@ #include <QVector> #include <qwt_text_label.h> #include <qwt_plot_canvas.h> -//#include <iostream> CanvasPicker::CanvasPicker(Graph *graph): QObject(graph) diff --git a/MantidPlot/src/Graph.cpp b/MantidPlot/src/Graph.cpp index 4896dda0ac8f5465a4115391ded20133c46cac61..db3b3e6fcd290c43819c2df94f5f38d021aee8a4 100644 --- a/MantidPlot/src/Graph.cpp +++ b/MantidPlot/src/Graph.cpp @@ -107,7 +107,6 @@ #include <stdlib.h> #include <stdio.h> #include <stddef.h> -#include <iostream> // We can safely ignore warnings about assuming signed overflow does not occur from qvector.h // (They really should have implemented it with unsigned types! diff --git a/MantidPlot/src/ImportASCIIDialog.cpp b/MantidPlot/src/ImportASCIIDialog.cpp index c93828a254594e8a1b6f68ab3d0b7fd17e373427..44c2ff0105b2c0636fe4a8fcebce9f9dbdcb0dcd 100644 --- a/MantidPlot/src/ImportASCIIDialog.cpp +++ b/MantidPlot/src/ImportASCIIDialog.cpp @@ -46,7 +46,6 @@ #include <QHeaderView> #include <gsl/gsl_math.h> -#include<iostream> ImportASCIIDialog::ImportASCIIDialog(bool new_windows_only, QWidget * parent, bool extended, Qt::WFlags flags ) : ExtensibleFileDialog(parent, extended, flags ) diff --git a/MantidPlot/src/LegendWidget.cpp b/MantidPlot/src/LegendWidget.cpp index d17de38685353e8b345e06f214dc8afb5d20038f..b11a10f70fd5790cb42c0ce7bb97b793f9203562 100644 --- a/MantidPlot/src/LegendWidget.cpp +++ b/MantidPlot/src/LegendWidget.cpp @@ -45,7 +45,6 @@ #include <qwt_layout_metrics.h> #include <qwt_symbol.h> -#include <iostream> LegendWidget::LegendWidget(Plot *plot):QWidget(plot), d_plot(plot), diff --git a/MantidPlot/src/Mantid/AlgorithmHistoryWindow.cpp b/MantidPlot/src/Mantid/AlgorithmHistoryWindow.cpp index 3a3b77c8fd9c788f9f46b7b025966ebbf9909c42..54bd5afaec5e3c1f91ef237834b4d8d3626b8308 100644 --- a/MantidPlot/src/Mantid/AlgorithmHistoryWindow.cpp +++ b/MantidPlot/src/Mantid/AlgorithmHistoryWindow.cpp @@ -19,7 +19,6 @@ #include <QDir> #include <numeric> -#include <iostream> #include <fstream> #include <stdio.h> diff --git a/MantidPlot/src/Mantid/AlgorithmMonitor.cpp b/MantidPlot/src/Mantid/AlgorithmMonitor.cpp index 04364ef9d714cf1906b8061f77ce398dfc9a1111..5b4ffee3981e6414ebcc919bc80ebb93873f75e8 100644 --- a/MantidPlot/src/Mantid/AlgorithmMonitor.cpp +++ b/MantidPlot/src/Mantid/AlgorithmMonitor.cpp @@ -8,7 +8,6 @@ #include <QtGui> #include <QThread> -#include <iostream> #include <algorithm> using namespace std; diff --git a/MantidPlot/src/Mantid/FitParameterTie.cpp b/MantidPlot/src/Mantid/FitParameterTie.cpp index 928315ab13ef0ca142b535fe3e2db67c1a74e247..28bdb2c7bc4fbed6c23d4ed7e02c32d6ef078c71 100644 --- a/MantidPlot/src/Mantid/FitParameterTie.cpp +++ b/MantidPlot/src/Mantid/FitParameterTie.cpp @@ -2,7 +2,6 @@ #include "MantidAPI/CompositeFunction.h" #include <QRegExp> #include <stdexcept> -#include <iostream> /// Constructor FitParameterTie::FitParameterTie(boost::shared_ptr<Mantid::API::CompositeFunction> cf) diff --git a/MantidPlot/src/Mantid/InputHistory.cpp b/MantidPlot/src/Mantid/InputHistory.cpp index 9487afac9e6d080a582f193d7bd9795e4ec12187..3b0da1e014ed39f61c1bd199d0ffe0890727a769 100644 --- a/MantidPlot/src/Mantid/InputHistory.cpp +++ b/MantidPlot/src/Mantid/InputHistory.cpp @@ -3,7 +3,6 @@ #include <QSettings> #include <vector> -#include <iostream> using namespace Mantid::API; using namespace Mantid::Kernel; diff --git a/MantidPlot/src/Mantid/InstrumentWidget/CollapsiblePanel.cpp b/MantidPlot/src/Mantid/InstrumentWidget/CollapsiblePanel.cpp index 1aa71735f6e784ad9d982caf55f25155722ca9bd..6876cced0e8ccadf8e4d76c0dae2bc8f0c23eb87 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/CollapsiblePanel.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/CollapsiblePanel.cpp @@ -6,7 +6,6 @@ #include <QPolygon> #include <stdexcept> -#include <iostream> CaptionLabel::CaptionLabel(const QString& caption,QWidget* parent):QLabel(caption,parent),m_collapsed(false) { diff --git a/MantidPlot/src/Mantid/InstrumentWidget/GLActorCollection.cpp b/MantidPlot/src/Mantid/InstrumentWidget/GLActorCollection.cpp index ad3abc03981b6faef83220de41f85f927b4fa08c..b023799998cf149676534041c557d4df7a28ebd6 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/GLActorCollection.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/GLActorCollection.cpp @@ -5,7 +5,6 @@ #include "MantidKernel/Exception.h" #include <stdexcept> -#include <iostream> #include <functional> #include <algorithm> #include <float.h> diff --git a/MantidPlot/src/Mantid/InstrumentWidget/GLColor.cpp b/MantidPlot/src/Mantid/InstrumentWidget/GLColor.cpp index a7fe4c671ca1e83893816939532eab28202aa57b..2c232127ba143b343e6320f33c974a4382d256ff 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/GLColor.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/GLColor.cpp @@ -4,6 +4,8 @@ #include "GLColor.h" #include "MantidGeometry/Rendering/OpenGL_Headers.h" +#include <iostream> + /** * Default Constructor * @param red :: The red component of the RGB colour diff --git a/MantidPlot/src/Mantid/InstrumentWidget/GLColor.h b/MantidPlot/src/Mantid/InstrumentWidget/GLColor.h index 612efad0ba01a26a05abe6e403185a5dcca7832b..8bbe5681766eaff40f8c4bc03c7065535481cc13 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/GLColor.h +++ b/MantidPlot/src/Mantid/InstrumentWidget/GLColor.h @@ -1,7 +1,7 @@ #ifndef GLCOLOR_H_ #define GLCOLOR_H_ -#include <iostream> +#include <iosfwd> /** \class GLColor diff --git a/MantidPlot/src/Mantid/InstrumentWidget/GLObject.cpp b/MantidPlot/src/Mantid/InstrumentWidget/GLObject.cpp index 87815c5cf413272d650f3aab450c0300440354cf..f93d0d9e942e48c16b2795256bcaf30f9bdee588 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/GLObject.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/GLObject.cpp @@ -5,7 +5,6 @@ #include "ObjCompAssemblyActor.h" #include "MantidKernel/Exception.h" #include "MantidKernel/System.h" -#include <iostream> int icount; GLObject::GLObject(bool withDisplayList,const std::string& name):mName(name), mChanged(true) diff --git a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentTreeWidget.cpp b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentTreeWidget.cpp index d725f60827949f724eee0152ddc0578c5e16a4cd..1b9cd0ce1eafb79f97f334cfaca7f75eb6c78fe1 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentTreeWidget.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentTreeWidget.cpp @@ -12,7 +12,6 @@ #include <QMessageBox> #include <QString> #include <cfloat> -#include <iostream> InstrumentTreeWidget::InstrumentTreeWidget(QWidget *w):QTreeView(w), m_instrActor(NULL), m_treeModel(NULL) { diff --git a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.cpp b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.cpp index c90fccd9e4b72a00a4ba8e906e1f781b88bb14b8..3cce4254663201da8da378d915dc8bd0103cf735 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.cpp @@ -120,6 +120,13 @@ m_left(NULL), m_top(NULL), m_right(NULL), m_bottom(NULL) m_ring_rectangle->setToolTip("Draw a rectangular ring (Shift+Alt+R)"); m_ring_rectangle->setShortcut(QKeySequence("Shift+Alt+R")); + m_free_draw = new QPushButton(); + m_free_draw->setCheckable(true); + m_free_draw->setAutoExclusive(true); + m_free_draw->setIcon(QIcon(":/MaskTools/brush.png")); + m_free_draw->setToolTip("Draw an arbitrary shape (Shift+Alt+A)"); + m_free_draw->setShortcut(QKeySequence("Shift+Alt+A")); + QHBoxLayout* toolBox = new QHBoxLayout(); toolBox->addWidget(m_move); toolBox->addWidget(m_pointer); @@ -127,6 +134,7 @@ m_left(NULL), m_top(NULL), m_right(NULL), m_bottom(NULL) toolBox->addWidget(m_rectangle); toolBox->addWidget(m_ring_ellipse); toolBox->addWidget(m_ring_rectangle); + toolBox->addWidget(m_free_draw); toolBox->addStretch(); toolBox->setSpacing(2); toolBox->setMargin(0); @@ -137,6 +145,7 @@ m_left(NULL), m_top(NULL), m_right(NULL), m_bottom(NULL) connect(m_rectangle,SIGNAL(clicked()),this,SLOT(setActivity())); connect(m_ring_ellipse,SIGNAL(clicked()),this,SLOT(setActivity())); connect(m_ring_rectangle,SIGNAL(clicked()),this,SLOT(setActivity())); + connect(m_free_draw,SIGNAL(clicked()),this,SLOT(setActivity())); m_move->setChecked(true); QFrame* toolGroup = new QFrame(); toolGroup->setLayout(toolBox); @@ -340,6 +349,8 @@ void InstrumentWindowMaskTab::selectTool(Activity tool) break; case DrawRectangularRing: m_ring_rectangle->setChecked(true); break; + case DrawFree: m_free_draw->setChecked(true); + break; default: throw std::invalid_argument("Invalid tool type."); } setActivity(); @@ -362,37 +373,44 @@ void InstrumentWindowMaskTab::setActivity() else if (m_pointer->isChecked()) { m_activity = Select; - m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode); + m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawRegularMode); m_activeTool->setText("Tool: Shape editing"); } else if (m_ellipse->isChecked()) { m_activity = DrawEllipse; m_instrWindow->getSurface()->startCreatingShape2D("ellipse",borderColor,fillColor); - m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode); + m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawRegularMode); m_activeTool->setText("Tool: Ellipse"); } else if (m_rectangle->isChecked()) { m_activity = DrawRectangle; m_instrWindow->getSurface()->startCreatingShape2D("rectangle",borderColor,fillColor); - m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode); + m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawRegularMode); m_activeTool->setText("Tool: Rectangle"); } else if (m_ring_ellipse->isChecked()) { m_activity = DrawEllipticalRing; m_instrWindow->getSurface()->startCreatingShape2D("ring ellipse",borderColor,fillColor); - m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode); + m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawRegularMode); m_activeTool->setText("Tool: Elliptical ring"); } else if (m_ring_rectangle->isChecked()) { m_activity = DrawRectangularRing; m_instrWindow->getSurface()->startCreatingShape2D("ring rectangle",borderColor,fillColor); - m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode); + m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawRegularMode); m_activeTool->setText("Tool: Rectangular ring"); } + else if (m_free_draw->isChecked()) + { + m_activity = DrawFree; + m_instrWindow->getSurface()->startCreatingFreeShape(borderColor,fillColor); + m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawFreeMode); + m_activeTool->setText("Tool: Free draw"); + } m_instrWindow->updateInfoText(); } @@ -401,7 +419,11 @@ void InstrumentWindowMaskTab::setActivity() */ void InstrumentWindowMaskTab::shapeCreated() { - setSelectActivity(); + if (!isVisible()) return; + if (m_activity != DrawFree) + { + setSelectActivity(); + } enableApplyButtons(); } @@ -463,6 +485,7 @@ void InstrumentWindowMaskTab::shapesCleared() void InstrumentWindowMaskTab::clearShapes() { m_instrWindow->getSurface()->clearMask(); + setSelectActivity(); } void InstrumentWindowMaskTab::showEvent (QShowEvent *) diff --git a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.h b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.h index 5ef2db91bee8a2ac2946f64ce750114bdf99d62c..bb5093e1a48791a5eb84523d48743201091823c0 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.h +++ b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.h @@ -54,7 +54,7 @@ class InstrumentWindowMaskTab: public InstrumentWindowTab Q_OBJECT public: enum Mode {Mask, Group, ROI}; - enum Activity {Move,Select,DrawEllipse,DrawRectangle,DrawEllipticalRing,DrawRectangularRing}; + enum Activity {Move,Select,DrawEllipse,DrawRectangle,DrawEllipticalRing,DrawRectangularRing,DrawFree}; InstrumentWindowMaskTab(InstrumentWindow* instrWindow); void initSurface(); @@ -129,6 +129,7 @@ protected: QPushButton* m_rectangle; QPushButton* m_ring_ellipse; QPushButton* m_ring_rectangle; + QPushButton* m_free_draw; QPushButton* m_apply; QPushButton* m_apply_to_view; diff --git a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.cpp b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.cpp index 05247a3929590148097e37ed1dabe406f0a4a91c..f49c0a553dada231bfbf167e2413e54d2c64d922 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.cpp @@ -197,6 +197,12 @@ m_plotTypeCache(0) m_ring_rectangle->setIcon(QIcon(":/PickTools/selection-box-ring.png")); m_ring_rectangle->setToolTip("Draw a rectangular ring"); + m_free_draw = new QPushButton(); + m_free_draw->setCheckable(true); + m_free_draw->setAutoExclusive(true); + m_free_draw->setIcon(QIcon(":/PickTools/brush.png")); + m_free_draw->setToolTip("Draw an arbitrary shape"); + m_edit = new QPushButton(); m_edit->setCheckable(true); m_edit->setAutoExclusive(true); @@ -222,6 +228,7 @@ m_plotTypeCache(0) toolBox->addWidget(m_rectangle,0,3); toolBox->addWidget(m_ring_ellipse,0,4); toolBox->addWidget(m_ring_rectangle,0,5); + toolBox->addWidget(m_free_draw,0,6); toolBox->addWidget(m_one,1,0); toolBox->addWidget(m_tube,1,1); toolBox->addWidget(m_peak,1,2); @@ -237,6 +244,7 @@ m_plotTypeCache(0) connect(m_ellipse,SIGNAL(clicked()),this,SLOT(setSelectionType())); connect(m_ring_ellipse,SIGNAL(clicked()),this,SLOT(setSelectionType())); connect(m_ring_rectangle,SIGNAL(clicked()),this,SLOT(setSelectionType())); + connect(m_free_draw,SIGNAL(clicked()),this,SLOT(setSelectionType())); connect(m_edit,SIGNAL(clicked()),this,SLOT(setSelectionType())); // lay out the widgets @@ -404,13 +412,13 @@ void InstrumentWindowPickTab::setSelectionType() { m_selectionType = ErasePeak; m_activeTool->setText("Tool: Erase crystal peak(s)"); - surfaceMode = ProjectionSurface::EraseMode; + surfaceMode = ProjectionSurface::ErasePeakMode; } else if (m_rectangle->isChecked()) { m_selectionType = Draw; m_activeTool->setText("Tool: Rectangle"); - surfaceMode = ProjectionSurface::DrawMode; + surfaceMode = ProjectionSurface::DrawRegularMode; plotType = DetectorPlotController::Single; m_instrWindow->getSurface()->startCreatingShape2D("rectangle",Qt::green,QColor(255,255,255,80)); } @@ -418,7 +426,7 @@ void InstrumentWindowPickTab::setSelectionType() { m_selectionType = Draw; m_activeTool->setText("Tool: Ellipse"); - surfaceMode = ProjectionSurface::DrawMode; + surfaceMode = ProjectionSurface::DrawRegularMode; plotType = DetectorPlotController::Single; m_instrWindow->getSurface()->startCreatingShape2D("ellipse",Qt::green,QColor(255,255,255,80)); } @@ -426,7 +434,7 @@ void InstrumentWindowPickTab::setSelectionType() { m_selectionType = Draw; m_activeTool->setText("Tool: Elliptical ring"); - surfaceMode = ProjectionSurface::DrawMode; + surfaceMode = ProjectionSurface::DrawRegularMode; plotType = DetectorPlotController::Single; m_instrWindow->getSurface()->startCreatingShape2D("ring ellipse",Qt::green,QColor(255,255,255,80)); } @@ -434,15 +442,23 @@ void InstrumentWindowPickTab::setSelectionType() { m_selectionType = Draw; m_activeTool->setText("Tool: Rectangular ring"); - surfaceMode = ProjectionSurface::DrawMode; + surfaceMode = ProjectionSurface::DrawRegularMode; plotType = DetectorPlotController::Single; m_instrWindow->getSurface()->startCreatingShape2D("ring rectangle",Qt::green,QColor(255,255,255,80)); } + else if (m_free_draw->isChecked()) + { + m_selectionType = Draw; + m_activeTool->setText("Tool: Arbitrary shape"); + surfaceMode = ProjectionSurface::DrawFreeMode; + plotType = DetectorPlotController::Single; + m_instrWindow->getSurface()->startCreatingFreeShape(Qt::green,QColor(255,255,255,80)); + } else if (m_edit->isChecked()) { m_selectionType = Draw; m_activeTool->setText("Tool: Shape editing"); - surfaceMode = ProjectionSurface::DrawMode; + surfaceMode = ProjectionSurface::DrawRegularMode; plotType = DetectorPlotController::Single; } m_plotController->setPlotType( plotType ); @@ -451,7 +467,7 @@ void InstrumentWindowPickTab::setSelectionType() { surface->setInteractionMode( surfaceMode ); auto interactionMode = surface->getInteractionMode(); - if ( interactionMode == ProjectionSurface::DrawMode || interactionMode == ProjectionSurface::MoveMode ) + if ( interactionMode == ProjectionSurface::DrawRegularMode || interactionMode == ProjectionSurface::MoveMode ) { updatePlotMultipleDetectors(); } @@ -529,7 +545,7 @@ void InstrumentWindowPickTab::changedIntegrationRange(double,double) if ( surface ) { auto interactionMode = surface->getInteractionMode(); - if ( interactionMode == ProjectionSurface::DrawMode || interactionMode == ProjectionSurface::MoveMode ) + if ( interactionMode == ProjectionSurface::DrawRegularMode || interactionMode == ProjectionSurface::MoveMode ) { updatePlotMultipleDetectors(); } @@ -629,6 +645,8 @@ void InstrumentWindowPickTab::selectTool(const ToolType tool) break; case DrawEllipse: m_ellipse->setChecked(true); break; + case DrawFree: m_free_draw->setChecked(true); + break; case EditShape: m_edit->setChecked(true); break; default: throw std::invalid_argument("Invalid tool type."); @@ -668,7 +686,11 @@ void InstrumentWindowPickTab::updateSelectionInfoDisplay() */ void InstrumentWindowPickTab::shapeCreated() { + if ( !isVisible() ) return; + if (!m_free_draw->isChecked()) + { selectTool( EditShape ); + } } /** diff --git a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.h b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.h index ec169a6b904f917b7301cad5e29acf69816e44a8..5bcdf5c420fcbe6b22a105b1d72bd1e90bf8a399 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.h +++ b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.h @@ -47,7 +47,7 @@ public: /// SelectPeak: click on a peak marker or draw a rubber-band selector to select peak /// markers. Selected peaks can be deleted by pressing the Delete key. enum SelectionType {Single=0,AddPeak,ErasePeak,SingleDetectorSelection,Tube, Draw}; - enum ToolType {Zoom,PixelSelect,TubeSelect,PeakSelect,PeakErase, DrawEllipse, DrawRectangle, EditShape}; + enum ToolType {Zoom,PixelSelect,TubeSelect,PeakSelect,PeakErase, DrawEllipse, DrawRectangle, DrawFree, EditShape}; InstrumentWindowPickTab(InstrumentWindow* instrWindow); bool canUpdateTouchedDetector()const; @@ -91,6 +91,7 @@ private: QPushButton *m_ellipse; ///< Button switching on drawing a elliptical selection region QPushButton *m_ring_ellipse; ///< Button switching on drawing a elliptical ring selection region QPushButton *m_ring_rectangle; ///< Button switching on drawing a rectangular ring selection region + QPushButton *m_free_draw; ///< Button switching on drawing a region of arbitrary shape QPushButton *m_edit; ///< Button switching on edditing the selection region bool m_plotSum; diff --git a/MantidPlot/src/Mantid/InstrumentWidget/MantidGLWidget.cpp b/MantidPlot/src/Mantid/InstrumentWidget/MantidGLWidget.cpp index 9fea8e14de806cabe6faeb579156b03f33cb1dd3..dcd5dfc856a00b5b23900a0b88fea4af1e773d19 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/MantidGLWidget.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/MantidGLWidget.cpp @@ -15,7 +15,6 @@ #include <map> #include <string> -#include <iostream> #include <cfloat> #include <typeinfo> diff --git a/MantidPlot/src/Mantid/InstrumentWidget/OneCurvePlot.cpp b/MantidPlot/src/Mantid/InstrumentWidget/OneCurvePlot.cpp index ea8e944da9099156c470d2fd8454272e96f7891b..090cde16df102ee36381f572326b508b332454e3 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/OneCurvePlot.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/OneCurvePlot.cpp @@ -16,7 +16,6 @@ #include <QPainter> #include <QFont> -#include <iostream> #include <cmath> OneCurvePlot::OneCurvePlot(QWidget* parent): diff --git a/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.cpp b/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.cpp index e8cea2ea006df06912600df2cb708f998ce0f88f..8da241a02ea906a903b8742b08ca3c812e99e00f 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.cpp @@ -1,5 +1,4 @@ #include "OpenGLError.h" -#include <iostream> #include <sstream> #include "MantidKernel/Logger.h" #include "MantidGeometry/Rendering/OpenGL_Headers.h" diff --git a/MantidPlot/src/Mantid/InstrumentWidget/PeakMarker2D.cpp b/MantidPlot/src/Mantid/InstrumentWidget/PeakMarker2D.cpp index e7c5915aea5925c316a306b4db337360b1a3d0b2..99135d6c0b948016cac8b2109721c52eb4cb27f6 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/PeakMarker2D.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/PeakMarker2D.cpp @@ -7,7 +7,6 @@ #include <QMouseEvent> #include <QWheelEvent> -#include <iostream> #include <algorithm> #include <stdexcept> #include <cmath> diff --git a/MantidPlot/src/Mantid/InstrumentWidget/Projection3D.cpp b/MantidPlot/src/Mantid/InstrumentWidget/Projection3D.cpp index d02948d9a19c79fe9251eef460285871c14a0e53..688652c8c9e7cdaba8bafa19adc2f8fbd9e9632a 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/Projection3D.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/Projection3D.cpp @@ -23,7 +23,6 @@ #include <map> #include <string> -#include <iostream> #include <cfloat> #include <algorithm> diff --git a/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.cpp b/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.cpp index cd8e0151e575838b1d05707d676ee92dc73ba563..1c6a0052da5fb529510990d2b153790c8ae3dee3 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.cpp @@ -62,7 +62,7 @@ ProjectionSurface::ProjectionSurface(const InstrumentActor* rootActor): // create and connect the mask drawing input controller InputControllerDrawShape* drawController = new InputControllerDrawShape(this); - setInputController(DrawMode, drawController); + setInputController(DrawRegularMode, drawController); connect(drawController,SIGNAL(addShape(QString,int,int,QColor,QColor)),&m_maskShapes,SLOT(addShape(QString,int,int,QColor,QColor))); connect(this,SIGNAL(signalToStartCreatingShape2D(QString,QColor,QColor)),drawController,SLOT(startCreatingShape2D(QString,QColor,QColor))); connect(drawController,SIGNAL(moveRightBottomTo(int,int)),&m_maskShapes,SLOT(moveRightBottomTo(int,int))); @@ -70,7 +70,6 @@ ProjectionSurface::ProjectionSurface(const InstrumentActor* rootActor): connect(drawController,SIGNAL(selectCtrlAt(int,int)),&m_maskShapes,SLOT(addToSelectionShapeAt(int,int))); connect(drawController,SIGNAL(moveBy(int,int)),&m_maskShapes,SLOT(moveShapeOrControlPointBy(int,int))); connect(drawController,SIGNAL(touchPointAt(int,int)),&m_maskShapes,SLOT(touchShapeOrControlPointAt(int,int))); - connect(drawController,SIGNAL(disabled()),&m_maskShapes,SLOT(deselectAll())); connect(drawController,SIGNAL(removeSelectedShapes()),&m_maskShapes,SLOT(removeSelectedShapes())); connect(drawController,SIGNAL(deselectAll()),&m_maskShapes,SLOT(deselectAll())); connect(drawController,SIGNAL(restoreOverrideCursor()),&m_maskShapes,SLOT(restoreOverrideCursor())); @@ -78,9 +77,16 @@ ProjectionSurface::ProjectionSurface(const InstrumentActor* rootActor): connect(drawController,SIGNAL(finishSelection(QRect)),this,SLOT(selectMultipleMasks(QRect))); connect(drawController,SIGNAL(finishSelection(QRect)),this,SIGNAL(shapeChangeFinished())); + InputControllerDrawAndErase* freeDrawController = new InputControllerDrawAndErase(this); + setInputController(DrawFreeMode, freeDrawController); + connect(this,SIGNAL(signalToStartCreatingFreeShape(QColor,QColor)),freeDrawController,SLOT(startCreatingShape2D(QColor,QColor))); + connect(freeDrawController,SIGNAL(addShape(const QPolygonF&,QColor,QColor)),&m_maskShapes,SLOT(addFreeShape(const QPolygonF&,QColor,QColor))); + connect(freeDrawController,SIGNAL(draw(const QPolygonF&)),&m_maskShapes,SLOT(drawFree(const QPolygonF&))); + connect(freeDrawController,SIGNAL(erase(const QPolygonF&)),&m_maskShapes,SLOT(eraseFree(const QPolygonF&))); + // create and connect the peak eraser controller InputControllerErase* eraseController = new InputControllerErase(this); - setInputController(EraseMode, eraseController); + setInputController(ErasePeakMode, eraseController); connect(eraseController,SIGNAL(erase(QRect)),this,SLOT(erasePeaks(QRect))); } @@ -138,7 +144,7 @@ void ProjectionSurface::draw(MantidGLWidget *widget)const if ( m_viewChanged && ( m_redrawPicking || m_interactionMode == PickSingleMode || m_interactionMode == PickTubeMode - || m_interactionMode == DrawMode ) ) + || m_interactionMode == DrawRegularMode ) ) { draw(widget,true); m_redrawPicking = false; @@ -435,7 +441,7 @@ void ProjectionSurface::setInteractionMode(int mode) controller = m_inputControllers[m_interactionMode]; if ( !controller ) throw std::logic_error("Input controller doesn't exist."); controller->onEnabled(); - if ( mode != DrawMode ) + if ( mode != DrawRegularMode && mode != DrawFreeMode ) { m_maskShapes.deselectAll(); foreach(PeakOverlay* po, m_peakShapes) @@ -473,10 +479,13 @@ QString ProjectionSurface::getInfoText() const return "Move cursor over instrument to see detector information. "; case AddPeakMode: return "Click on a detector then click on the mini-plot to add a peak."; - case DrawMode: + case DrawRegularMode: return "Select a tool button to draw a new shape. " "Click on shapes to select. Click and move to edit."; - case EraseMode: + case DrawFreeMode: + return "Draw by holding the left button down. " + "Erase with the right button."; + case ErasePeakMode: return "Click and move the mouse to erase peaks. " "Rotate the wheel to resize the cursor."; } @@ -566,6 +575,11 @@ void ProjectionSurface::startCreatingShape2D(const QString& type,const QColor& b emit signalToStartCreatingShape2D(type,borderColor,fillColor); } +void ProjectionSurface::startCreatingFreeShape(const QColor& borderColor,const QColor& fillColor) +{ + emit signalToStartCreatingFreeShape(borderColor,fillColor); +} + /** * Return a combined list of peak parkers from all overlays * @param detID :: The detector ID of interest @@ -679,7 +693,7 @@ void ProjectionSurface::setShowPeakLabelsFlag(bool on) */ void ProjectionSurface::setSelectionRect(const QRect &rect) { - if ( m_interactionMode != DrawMode || !m_maskShapes.hasSelection() ) + if ( m_interactionMode != DrawRegularMode || !m_maskShapes.hasSelection() ) { m_selectRect = rect; } diff --git a/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.h b/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.h index 33b4a96a7badc9e2716a931a536476cbb9271d87..161484368e8dbf3a447f194382b48c04c4bf59c4 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.h +++ b/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.h @@ -56,7 +56,16 @@ class ProjectionSurface: public QObject { Q_OBJECT public: - enum InteractionMode {MoveMode = 0, PickSingleMode, PickTubeMode, AddPeakMode, DrawMode, EraseMode, InteractionModeSize }; + enum InteractionMode { + MoveMode = 0, + PickSingleMode, + PickTubeMode, + AddPeakMode, + DrawRegularMode, + DrawFreeMode, + ErasePeakMode, + InteractionModeSize + }; /// Constructor ProjectionSurface(const InstrumentActor* rootActor); /// Destructor @@ -140,6 +149,11 @@ public: /// @param fillColor :: The fill color. void startCreatingShape2D(const QString& type,const QColor& borderColor,const QColor& fillColor = QColor()); + /// Initialize interactive creation of a free draw shape. + /// @param borderColor :: The color of the shape outline. + /// @param fillColor :: The fill color. + void startCreatingFreeShape(const QColor& borderColor,const QColor& fillColor = QColor()); + // Properties methods which allow the mask shapes to be modified with a property browser. /// Return a list of all properties of type double of the currently selected shape. @@ -200,6 +214,7 @@ signals: // shape manipulation void signalToStartCreatingShape2D(const QString& type,const QColor& borderColor,const QColor& fillColor); + void signalToStartCreatingFreeShape(const QColor& borderColor,const QColor& fillColor); void shapeCreated(); void shapeSelected(); void shapesDeselected(); diff --git a/MantidPlot/src/Mantid/InstrumentWidget/RectF.h b/MantidPlot/src/Mantid/InstrumentWidget/RectF.h index 264fa5172962f55ee9dca3f5bad3c2683710a96a..570edc68c82538e2d404db9e8c051ce5bc9fb47a 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/RectF.h +++ b/MantidPlot/src/Mantid/InstrumentWidget/RectF.h @@ -197,4 +197,16 @@ inline std::ostream& operator << (std::ostream& ostr, const RectF& rect) return ostr; } +inline std::ostream& operator << (std::ostream& ostr, const QRectF& rect) +{ + ostr << '[' << rect.left() << ',' << rect.right() << ';' << rect.top() << ',' << rect.bottom() << ']'; + return ostr; +} + +inline std::ostream& operator << (std::ostream& ostr, const QPointF& p) +{ + ostr << '(' << p.x() << ',' << p.y() << ')'; + return ostr; +} + #endif // RECTF_H diff --git a/MantidPlot/src/Mantid/InstrumentWidget/Shape2D.cpp b/MantidPlot/src/Mantid/InstrumentWidget/Shape2D.cpp index 9543dcdaf288d31f17ef511e964d9e0d3d0def7a..bb5d301443a4fe282d1975a18a132873a43e21df 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/Shape2D.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/Shape2D.cpp @@ -5,7 +5,9 @@ #include <QMouseEvent> #include <QWheelEvent> -#include <iostream> +#include <QLine> +#include <QMap> + #include <algorithm> #include <stdexcept> #include <cmath> @@ -487,3 +489,154 @@ void Shape2DRing::setColor(const QColor &color) m_outer_shape->setColor(color); } +//------------------------------------------------------------------------------ + +/// Construct a zero-sized shape. +Shape2DFree::Shape2DFree(const QPointF& p): + m_polygon(QRectF(p,p)) +{ + resetBoundingRect(); +} + +/// The shape can be selected if it contains the point. +bool Shape2DFree::selectAt(const QPointF& p)const +{ + return contains(p); +} + +/// Check if a point is inside the shape. +bool Shape2DFree::contains(const QPointF& p)const +{ + return m_polygon.containsPoint(p,Qt::OddEvenFill); +} + +/// Add to a larger shape. +void Shape2DFree::addToPath(QPainterPath& path) const +{ + path.addPolygon(m_polygon); +} + +/// Draw. +void Shape2DFree::drawShape(QPainter& painter) const +{ + QPainterPath path; + path.addPolygon(m_polygon); + painter.fillPath(path, m_fill_color); + painter.drawPath(m_outline); +} + +/// Rescale polygon's verices to fit to the new bounding rect. +void Shape2DFree::refit() +{ + auto brOld = getPolygonBoundingRect(); + auto &brNew = m_boundingRect; + if (brNew.xSpan() < 0.0) brNew.xFlip(); + if (brNew.ySpan() < 0.0) brNew.yFlip(); + + auto xs0 = brNew.x0(); + auto x0 = brOld.x0(); + auto xScale = brNew.width() / brOld.width(); + + auto ys0 = brNew.y0(); + auto y0 = brOld.y0(); + auto yScale = brNew.height() / brOld.height(); + for(int i = 0; i < m_polygon.size(); ++i) + { + auto &p = m_polygon[i]; + p.rx() = xs0 + xScale * (p.x() - x0); + p.ry() = ys0 + yScale * (p.y() - y0); + } + resetBoundingRect(); +} + +/// Recalculate the bounding rect. +/// Also make the new border outline. +/// QPolygonF cannot have holes or disjointed parts, +/// it's a single closed line. The outline (implemented as a QPainterPath) +/// makes it look like it have holes. +void Shape2DFree::resetBoundingRect() +{ + m_boundingRect = getPolygonBoundingRect(); + // Clear the outline path. + m_outline = QPainterPath(); + if (m_polygon.isEmpty()) return; + + // If the polygon has apparent holes/discontinuities + // it will have extra pairs of edges which we don't want + // to draw. + auto n = m_polygon.size() - 1; + // Find those vertices at which we must break the polygon + // to get rid of these extra edges. + QList<int> breaks; + breaks.push_back(0); + for(int i = 1; i < m_polygon.size() - 1; ++i) + { + auto p = m_polygon[i]; + auto j = m_polygon.indexOf(p, i + 1); + if (j != -1) + { + auto i1 = i + 1; + auto j1 = j - 1; + if (m_polygon[i1] == m_polygon[j1]) + { + breaks.push_back(i); + breaks.push_back(i1); + breaks.push_back(j1); + breaks.push_back(j); + } + } + } + if (breaks.back() != n) + { + breaks.push_back(n); + } + qSort(breaks); + + m_outline.moveTo(m_polygon[0]); + int j1 = 0; + // Add contiguous portions of the polygon to the outline + // and break at points from breaks list. + for(int i = 0; i < breaks.size(); ++i) + { + auto j = breaks[i]; + if (j == j1 + 1) + { + m_outline.moveTo(m_polygon[j]); + } + else + { + for(auto k = j1; k <= j; ++k) + { + m_outline.lineTo(m_polygon[k]); + } + } + j1 = j; + } +} + +/// Convert the bounding rect computed by QPolygonF to RectF +RectF Shape2DFree::getPolygonBoundingRect() const +{ + auto br = m_polygon.boundingRect(); + auto x0 = br.left(); + auto x1 = br.right(); + if (x0 > x1) std::swap(x0, x1); + auto y0 = br.bottom(); + auto y1 = br.top(); + if (y0 > y1) std::swap(y0, y1); + return RectF(QPointF(x0,y0), QPointF(x1,y1)); +} + +/// Add a polygon to this shape. +void Shape2DFree::addPolygon(const QPolygonF& polygon) +{ + m_polygon = m_polygon.united(polygon); + resetBoundingRect(); +} + +/// Subtract a polygon from this shape. +void Shape2DFree::subtractPolygon(const QPolygonF& polygon) +{ + m_polygon = m_polygon.subtracted(polygon); + resetBoundingRect(); +} diff --git a/MantidPlot/src/Mantid/InstrumentWidget/Shape2D.h b/MantidPlot/src/Mantid/InstrumentWidget/Shape2D.h index 9ab6d058a2001d0381f6127df001f56de3594d72..d1db694c15db59ffc266130b33aa33db730608c8 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/Shape2D.h +++ b/MantidPlot/src/Mantid/InstrumentWidget/Shape2D.h @@ -147,6 +147,13 @@ protected: bool m_visible; ///< flag to show or hide the shape }; +/** + * An ellipse with the axes parallel to the x and y axes on the screen. + * + * It has a QPointF property "center" defining the centre of the ellipse + * and double properties "radius1" and "radius2" equal to distances from + * the centre to the curve along the x and y axes. + */ class Shape2DEllipse: public Shape2D { public: @@ -169,6 +176,11 @@ protected: virtual void refit(){} }; +/** + * A axis aligned rectangle. + * + * No specific properties. + */ class Shape2DRectangle: public Shape2D { public: @@ -184,6 +196,13 @@ protected: virtual void refit(){} }; +/** + * A ring: area bounded by two curves of the same shape but different size. + * + * The constructor takes a curve shape and the ring widths in the x and y + * directions. + * It has QPointF "centre" property and "xwidth" and "ywidth" double properties. + */ class Shape2DRing: public Shape2D { public: @@ -216,5 +235,31 @@ protected: double m_yWidth; }; +/** + * An arbitrary shape. Implemented as a polygon. + * It can have disjointed parts and holes. + * + * No shape specific properties. + */ +class Shape2DFree: public Shape2D +{ +public: + Shape2DFree(const QPointF& p); + virtual Shape2D* clone()const{return new Shape2DFree(*this);} + virtual bool selectAt(const QPointF& p)const; + virtual bool contains(const QPointF& p)const; + virtual void addToPath(QPainterPath& path) const; + void addPolygon(const QPolygonF& polygon); + void subtractPolygon(const QPolygonF& polygon); +protected: + virtual void drawShape(QPainter& painter) const; + virtual void refit(); + virtual void resetBoundingRect(); +private: + RectF getPolygonBoundingRect() const; + QPolygonF m_polygon; ///< Implements the shape. + QPainterPath m_outline; ///< Object to draw the shape's border. +}; + #endif /*MANTIDPLOT_SHAPE2D_H_*/ diff --git a/MantidPlot/src/Mantid/InstrumentWidget/Shape2DCollection.cpp b/MantidPlot/src/Mantid/InstrumentWidget/Shape2DCollection.cpp index 7ccdfae2720dc618b08d36661f890ae3138ae61a..f2c380116003a2f527969cd3420e481512cbdc5b 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/Shape2DCollection.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/Shape2DCollection.cpp @@ -7,7 +7,6 @@ #include <QApplication> #include <QStringList> -#include <iostream> #include <stdexcept> #include <cmath> @@ -204,6 +203,10 @@ Shape2D* Shape2DCollection::createShape(const QString& type,int x,int y) const { return new Shape2DRectangle(p,QSizeF(0,0)); } + else if (type.toLower() == "free") + { + return new Shape2DFree(p); + } QStringList complexType = type.split(' ',QString::SkipEmptyParts); @@ -735,3 +738,48 @@ void Shape2DCollection::changeBorderColor(const QColor &color) } } +/** + * Add a Shape2D object allowing free drawing. + * @param poly :: Initial shape. + * @param borderColor :: The border colour. + * @param fillColor :: The fill colour. + */ +void Shape2DCollection::addFreeShape(const QPolygonF& poly,const QColor& borderColor,const QColor& fillColor) +{ + auto freeShape = dynamic_cast<Shape2DFree*>(m_currentShape); + if (!freeShape) + { + if (poly.isEmpty()) throw std::logic_error("Cannot create a shape from empty polygon."); + auto p = m_transform.inverted().map(poly[0]); + addShape("free", static_cast<int>(p.x()), static_cast<int>(p.y()), borderColor, fillColor); + } + drawFree(poly); +} + +/** + * Draw the shape by adding a polygon to it. + */ +void Shape2DCollection::drawFree(const QPolygonF& polygon) +{ + auto freeShape = dynamic_cast<Shape2DFree*>(m_currentShape); + if (freeShape) + { + auto transform = m_transform.inverted(); + freeShape->addPolygon(transform.map(polygon)); + emit shapeChanged(); + } +} + +/** + * Erase part of the shape by subtracting a polygon from it. + */ +void Shape2DCollection::eraseFree(const QPolygonF& polygon) +{ + auto freeShape = dynamic_cast<Shape2DFree*>(m_currentShape); + if (freeShape) + { + auto transform = m_transform.inverted(); + freeShape->subtractPolygon(transform.map(polygon)); + emit shapeChanged(); + } +} diff --git a/MantidPlot/src/Mantid/InstrumentWidget/Shape2DCollection.h b/MantidPlot/src/Mantid/InstrumentWidget/Shape2DCollection.h index ed62362b346e512483106b443c0753e103618b01..53ca3567f83948faeadff5a8d4c1543f02bca995 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/Shape2DCollection.h +++ b/MantidPlot/src/Mantid/InstrumentWidget/Shape2DCollection.h @@ -88,6 +88,7 @@ signals: public slots: void addShape(const QString& type,int x,int y,const QColor& borderColor,const QColor& fillColor); + void addFreeShape(const QPolygonF&,const QColor& borderColor,const QColor& fillColor); void deselectAll(); void moveRightBottomTo(int,int); void selectShapeOrControlPointAt(int x,int y); @@ -96,6 +97,8 @@ public slots: void touchShapeOrControlPointAt(int x,int y); void removeSelectedShapes(); void restoreOverrideCursor(); + void drawFree(const QPolygonF& polygon); + void eraseFree(const QPolygonF& polygon); protected: virtual void drawShape(QPainter& ) const{} // never called diff --git a/MantidPlot/src/Mantid/InstrumentWidget/Viewport.cpp b/MantidPlot/src/Mantid/InstrumentWidget/Viewport.cpp index fe0de8deb055bc5721ab9bbc5df3eec66ff61e4d..1c1c1cce8e769f9a132a535867b0ca279c79a35f 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/Viewport.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/Viewport.cpp @@ -1,6 +1,5 @@ #include "Viewport.h" #include <math.h> -#include <iostream> #include "MantidGeometry/Rendering/OpenGL_Headers.h" #include "MantidKernel/V3D.h" #include "OpenGLError.h" diff --git a/MantidPlot/src/Mantid/MantidApplication.cpp b/MantidPlot/src/Mantid/MantidApplication.cpp index 67a264b7b77f1f1be7793be6bf5c16e7a5c5d138..00d38187960f9b55ee9851b0e879cbad491d2a97 100644 --- a/MantidPlot/src/Mantid/MantidApplication.cpp +++ b/MantidPlot/src/Mantid/MantidApplication.cpp @@ -8,6 +8,7 @@ #include <QMessageBox> #include <QPushButton> + #include <iostream> namespace diff --git a/MantidPlot/src/Mantid/MantidMatrix.cpp b/MantidPlot/src/Mantid/MantidMatrix.cpp index 1bfeabebe8f9a032becd58732e730038e2dfc296..0702315186ac550a91dc62e1b6df5826e94ac62c 100644 --- a/MantidPlot/src/Mantid/MantidMatrix.cpp +++ b/MantidPlot/src/Mantid/MantidMatrix.cpp @@ -49,7 +49,6 @@ #include <QTabWidget> #include <stdlib.h> -#include <iostream> #include <algorithm> #include <limits> diff --git a/MantidPlot/src/Mantid/MantidMatrix.h b/MantidPlot/src/Mantid/MantidMatrix.h index a26a55d01a9f14ce20ce8f56b5a0280f7c04d9d1..84aed7cef4775f634683751b6ad72c058c4e60f5 100644 --- a/MantidPlot/src/Mantid/MantidMatrix.h +++ b/MantidPlot/src/Mantid/MantidMatrix.h @@ -1,6 +1,26 @@ #ifndef MANTIDMATRIX_H #define MANTIDMATRIX_H +#include <map> +#include <math.h> +#include <string> + +#include "MantidMatrixExtensionRequest.h" +#include "MantidMatrixModel.h" +#include "MantidMatrixTabExtension.h" + +#include "Mantid/IProjectSerialisable.h" +#include "MantidAPI/AnalysisDataService.h" +#include "MantidAPI/FrameworkManager.h" +#include "MantidAPI/MatrixWorkspace_fwd.h" +#include "MantidQtAPI/WorkspaceObserver.h" +#include "../ContourLinesEditor.h" +#include "../Graph.h" +#include "../MdiSubWindow.h" +#include "../UserFunction.h" + +#include <Poco/NObserver.h> + #include <QHeaderView> #include <QTableView> #include <QPrinter> @@ -11,32 +31,9 @@ #include <QMap> #include <QPointer> -#include <Poco/NObserver.h> - -#include "MantidAPI/MatrixWorkspace_fwd.h" -#include "MantidAPI/AnalysisDataService.h" -#include "../UserFunction.h" -#include "../MdiSubWindow.h" -#include "../Graph.h" -#include "MantidQtAPI/WorkspaceObserver.h" -#include "Mantid/IProjectSerialisable.h" - #include <qwt_double_rect.h> #include <qwt_color_map.h> -#include <math.h> -#include <string> -#include <iostream> -#include <map> - -#include "MantidAPI/FrameworkManager.h" -#include "../ContourLinesEditor.h" - -#include "MantidMatrixExtensionRequest.h" -#include "MantidMatrixModel.h" -#include "MantidMatrixTabExtension.h" - - class QLabel; class QStackedWidget; class QShortcut; diff --git a/MantidPlot/src/Mantid/MantidSampleLogDialog.cpp b/MantidPlot/src/Mantid/MantidSampleLogDialog.cpp index 75d103842c8439fd2fbb44d37adcfa4b29c259b0..7e5969971fe53fce5369bf8ad52f4b959d085be1 100644 --- a/MantidPlot/src/Mantid/MantidSampleLogDialog.cpp +++ b/MantidPlot/src/Mantid/MantidSampleLogDialog.cpp @@ -20,7 +20,6 @@ #include <QRadioButton> #include <QFileInfo> #include <QMessageBox> -#include <iostream> #include <sstream> #include "MantidAPI/ExperimentInfo.h" #include "MantidAPI/MultipleExperimentInfos.h" diff --git a/MantidPlot/src/Mantid/MantidTable.cpp b/MantidPlot/src/Mantid/MantidTable.cpp index de0d7ddf84284a23f0317a2f6706c59727fff950..722da9ddc3519154666b378b65b8d86c072d0549 100644 --- a/MantidPlot/src/Mantid/MantidTable.cpp +++ b/MantidPlot/src/Mantid/MantidTable.cpp @@ -10,7 +10,6 @@ #include <QMessageBox> #include <QHash> -#include <iostream> #include <qfontmetrics.h> using namespace MantidQt::API; diff --git a/MantidPlot/src/Mantid/MantidUI.cpp b/MantidPlot/src/Mantid/MantidUI.cpp index b287de7390b7e2674564ff189d3f96f9542d53e8..d076bdf157480feeeb4f10b4ff922a8c1a7c90e4 100644 --- a/MantidPlot/src/Mantid/MantidUI.cpp +++ b/MantidPlot/src/Mantid/MantidUI.cpp @@ -68,7 +68,6 @@ #include <locale> #include <set> #include <fstream> -#include <iostream> #include <sstream> #include <boost/tokenizer.hpp> @@ -3129,7 +3128,8 @@ MultiLayer* MantidUI::plot1D(const QMultiMap<QString,int>& toPlot, bool spectrum if (ask.clickedButton() != confirmButton) return NULL; } // Force waterfall option to false if only 1 curve - if(toPlot.size() == 1) waterfallPlot = false; + if ((NULL == plotWindow || clearWindow == true) && toPlot.size() == 1) + waterfallPlot = false; QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); diff --git a/MantidPlot/src/Mantid/PeakPickerTool.cpp b/MantidPlot/src/Mantid/PeakPickerTool.cpp index 2b5f31ed2bc51a2af4b37429a6176a008c24d6e4..0e071aa584dd73b7adaa756478eaabb70c859273 100644 --- a/MantidPlot/src/Mantid/PeakPickerTool.cpp +++ b/MantidPlot/src/Mantid/PeakPickerTool.cpp @@ -22,7 +22,6 @@ #include <QInputDialog> #include <QMessageBox> -#include <iostream> namespace { diff --git a/MantidPlot/src/Mantid/UserFitFunctionDialog.cpp b/MantidPlot/src/Mantid/UserFitFunctionDialog.cpp index eee79fa5b3a03980875658b2bc2ab34e142fa100..0814da59551452e138cd5f902fd2f43905eb3a33 100644 --- a/MantidPlot/src/Mantid/UserFitFunctionDialog.cpp +++ b/MantidPlot/src/Mantid/UserFitFunctionDialog.cpp @@ -7,7 +7,6 @@ #include <qcheckbox.h> #include <qmessagebox.h> #include <qheaderview.h> -#include <iostream> //--------------------------------------- // Public member functions diff --git a/MantidPlot/src/PythonScript.cpp b/MantidPlot/src/PythonScript.cpp index 23717ada1dba6da691120c87e945f34295fce876..a83c5a096e4263f5e624afbbbed2ba2f5645a962 100644 --- a/MantidPlot/src/PythonScript.cpp +++ b/MantidPlot/src/PythonScript.cpp @@ -39,7 +39,6 @@ #include <QVariant> #include <QMessageBox> -#include <iostream> #include <stdexcept> diff --git a/MantidPlot/src/Spectrogram.cpp b/MantidPlot/src/Spectrogram.cpp index ece80d7b100332f706b13ad4a60a7d516e7de05b..db3ab2aaa13618f36329caf4fa1f9918c9e69fad 100644 --- a/MantidPlot/src/Spectrogram.cpp +++ b/MantidPlot/src/Spectrogram.cpp @@ -46,7 +46,6 @@ #include "TSVSerialiser.h" -#include <iostream> #include <numeric> Spectrogram::Spectrogram(): diff --git a/MantidPlot/src/origin/OPJFile.cpp b/MantidPlot/src/origin/OPJFile.cpp index 4a37431010cf8227260a305495d68edbddf115b8..c0eaf257564f31fb9b64b0ffd2f0ac8fb75696b6 100644 --- a/MantidPlot/src/origin/OPJFile.cpp +++ b/MantidPlot/src/origin/OPJFile.cpp @@ -51,7 +51,6 @@ #endif #include <stdio.h> -#include <iostream> #include <stdlib.h> #include <math.h> #include <cstring> diff --git a/MantidPlot/src/pixmaps.cpp b/MantidPlot/src/pixmaps.cpp index ddb37192d961e4258e27d187fe1fc5ef72ea7aa6..75faddbc7aebf93d8e47a4779b26f8ffe73fb07c 100644 --- a/MantidPlot/src/pixmaps.cpp +++ b/MantidPlot/src/pixmaps.cpp @@ -6,7 +6,6 @@ */ #include "pixmaps.h" -#include <iostream> #include <sstream> #include <stdexcept> diff --git a/MantidQt/API/inc/MantidQtAPI/Message.h b/MantidQt/API/inc/MantidQtAPI/Message.h index c14f3a1fd7adab22e8c8ca8bcb1d494179fc9b99..6ce90fd89149090e3aed2b73247b6cba9d538d10 100644 --- a/MantidQt/API/inc/MantidQtAPI/Message.h +++ b/MantidQt/API/inc/MantidQtAPI/Message.h @@ -12,8 +12,6 @@ #include <QObject> #include <QString> -#include <iostream> - //---------------------------------------------------------- // Forward declarations //---------------------------------------------------------- diff --git a/MantidQt/API/src/UserSubWindow.cpp b/MantidQt/API/src/UserSubWindow.cpp index 4c9354d8f67228ad51da3ea29e94ed5b04c76b43..6dace365d7f4fcdb8535a853873e8c3ac22c9547 100644 --- a/MantidQt/API/src/UserSubWindow.cpp +++ b/MantidQt/API/src/UserSubWindow.cpp @@ -12,8 +12,6 @@ #include <QTemporaryFile> #include <QTextStream> -#include <iostream> - using namespace MantidQt::API; //------------------------------------------------------ diff --git a/MantidQt/API/test/MantidColorMapTest.h b/MantidQt/API/test/MantidColorMapTest.h index 0c2af82d2111505cc7474e1ccc8ac09b3345be67..21cacf06e872d7fdd7a4146732f25df254882f63 100644 --- a/MantidQt/API/test/MantidColorMapTest.h +++ b/MantidQt/API/test/MantidColorMapTest.h @@ -2,8 +2,6 @@ #define MANTIDQT_API_MANTIDCOLORMAPTEST_H_ #include <cxxtest/TestSuite.h> -#include <iostream> -#include <iomanip> #include "MantidQtAPI/MantidColorMap.h" #include <limits> #include <QRgb> diff --git a/MantidQt/API/test/QwtWorkspaceSpectrumDataTest.h b/MantidQt/API/test/QwtWorkspaceSpectrumDataTest.h index d86d2e172bf10fde39a8de066bf272ec40d65018..a0a0dd32aefbbafb4fbab1362a033b5e3c0e99bc 100644 --- a/MantidQt/API/test/QwtWorkspaceSpectrumDataTest.h +++ b/MantidQt/API/test/QwtWorkspaceSpectrumDataTest.h @@ -2,8 +2,6 @@ #define MANTIDQT_API_MANTIDQWTWORKSPACESPECTRUMDATA_H_ #include <cxxtest/TestSuite.h> -#include <iostream> -#include <iomanip> #include <limits> #include <QRgb> #include "MantidAPI/MatrixWorkspace.h" diff --git a/MantidQt/CustomInterfaces/CMakeLists.txt b/MantidQt/CustomInterfaces/CMakeLists.txt index ada8021d700646e914d4bbe412a8e155037d3058..be571e64c996a33e8e2b1b6535783bbb32c3a6e6 100644 --- a/MantidQt/CustomInterfaces/CMakeLists.txt +++ b/MantidQt/CustomInterfaces/CMakeLists.txt @@ -90,7 +90,11 @@ set ( SRC_FILES src/SANSPlotSpecial.cpp src/SANSRunWindow.cpp src/StepScan.cpp + src/Tomography/ImageROIPresenter.cpp + src/Tomography/ImageROIViewQtWidget.cpp + src/Tomography/ImageStackPreParams.cpp src/Tomography/SavuConfigDialog.cpp + src/Tomography/StackOfImagesDirs.cpp src/Tomography/TomographyIfaceModel.cpp src/Tomography/TomographyIfacePresenter.cpp src/Tomography/TomographyIfaceViewQtGUI.cpp @@ -205,8 +209,14 @@ set ( INC_FILES inc/MantidQtCustomInterfaces/SANSPlotSpecial.h inc/MantidQtCustomInterfaces/SANSRunWindow.h inc/MantidQtCustomInterfaces/StepScan.h + inc/MantidQtCustomInterfaces/Tomography/IImageROIPresenter.h + inc/MantidQtCustomInterfaces/Tomography/IImageROIView.h + inc/MantidQtCustomInterfaces/Tomography/ImageROIPresenter.h + inc/MantidQtCustomInterfaces/Tomography/ImageROIViewQtWidget.h + inc/MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h inc/MantidQtCustomInterfaces/Tomography/ITomographyIfacePresenter.h inc/MantidQtCustomInterfaces/Tomography/ITomographyIfaceView.h + inc/MantidQtCustomInterfaces/Tomography/StackOfImagesDirs.h inc/MantidQtCustomInterfaces/Tomography/TomographyIfacePresenter.h inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceViewQtGUI.h inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceModel.h @@ -308,6 +318,7 @@ set ( MOC_FILES inc/MantidQtCustomInterfaces/Background.h inc/MantidQtCustomInterfaces/SANSEventSlicing.h inc/MantidQtCustomInterfaces/SANSDiagnostics.h inc/MantidQtCustomInterfaces/StepScan.h + inc/MantidQtCustomInterfaces/Tomography/ImageROIViewQtWidget.h inc/MantidQtCustomInterfaces/Tomography/TomographyIfacePresenter.h inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceViewQtGUI.h inc/MantidQtCustomInterfaces/Tomography/TomoToolConfigDialog.h @@ -370,6 +381,7 @@ set ( UI_FILES inc/MantidQtCustomInterfaces/DataComparison.ui inc/MantidQtCustomInterfaces/SANSRunWindow.ui inc/MantidQtCustomInterfaces/SANSEventSlicing.ui inc/MantidQtCustomInterfaces/StepScan.ui + inc/MantidQtCustomInterfaces/Tomography/ImageSelectCoRAndRegions.ui inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceQtGUI.ui inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceQtTabSetup.ui inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceQtTabRun.ui @@ -386,12 +398,14 @@ set ( TEST_FILES ALCPeakFittingModelTest.h ALCPeakFittingPresenterTest.h EnggDiffractionPresenterTest.h + ImageROIPresenterTest.h IO_MuonGroupingTest.h MuonAnalysisHelperTest.h ParseKeyValueStringTest.h ReflGenerateNotebookTest.h ReflLegacyTransferStrategyTest.h ReflMainViewPresenterTest.h + StackOfImagesDirsTest.h TomographyIfacePresenterTest.h UserInputValidatorTest.h ) diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.h index a6b72f65f76b91c92af1c62d53bac166a5cff6ff..fe46ceea2256ad849e8c50756ee189d2a0894087 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.h @@ -63,6 +63,7 @@ namespace CustomInterfaces SectionRow sectionRow(int row) const; SectionSelector sectionSelector(int index) const; int noOfSectionRows() const; + void emitFitRequested(); public slots: void initialize(); diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingPresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingPresenter.h index 547a57a971839b7bc5c39b0e742665ed0f7ee1c2..11ea73759178593c49edddf88f4d7e72c64ba15d 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingPresenter.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingPresenter.h @@ -60,6 +60,10 @@ namespace CustomInterfaces /// Updates the list of logs and number of periods void updateAvailableInfo(); + signals: + /// Signal emitted when data get changed + void dataChanged(); + private: /// View which the object works with IALCDataLoadingView* const m_view; diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h index d9329f7144829ae550b54e047e56440b3d27c514..d1a4d3042e628ec26e154f221037afcc1e25f6f9 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h @@ -80,9 +80,9 @@ namespace CustomInterfaces void setAvailablePeriods(const std::vector<std::string> &periods); void setTimeLimits(double tMin, double tMax); void setTimeRange (double tMin, double tMax); - void setWaitingCursor(); - void restoreCursor(); void help(); + void disableAll(); + void enableAll(); // -- End of IALCDataLoadingView interface ----------------------------------------------------- diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui index e42aeb104219368d0f519ce7ff6cef8d6a03773c..b99c1ebe7740a26e855601f7225a099e9c69852f 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui @@ -383,7 +383,7 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_2"> + <widget class="QGroupBox" name="calculationGroup"> <property name="title"> <string>Calculation</string> </property> diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCInterface.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCInterface.h index 9666c82a6418790fd9a1f62af32a50421f9350a0..6dadad3cdc24e69671ec2c5391c48b3b573b2c8b 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCInterface.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCInterface.h @@ -18,9 +18,11 @@ namespace CustomInterfaces class ALCDataLoadingPresenter; + class ALCBaselineModellingView; class ALCBaselineModellingPresenter; class ALCBaselineModellingModel; + class ALCPeakFittingView; class ALCPeakFittingPresenter; class ALCPeakFittingModel; @@ -68,11 +70,18 @@ namespace CustomInterfaces void exportResults(); void importResults(); + void updateBaselineData(); + void updatePeakData(); + private: /// UI form Ui::ALCInterface m_ui; + // Step views + ALCBaselineModellingView* m_baselineModellingView; + ALCPeakFittingView* m_peakFittingView; + // Step presenters ALCDataLoadingPresenter* m_dataLoading; ALCBaselineModellingPresenter* m_baselineModelling; diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCPeakFittingView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCPeakFittingView.h index c45d9fd91981e5b8a921b394a5104bcd4f56c067..1f3272f995ab1d410e07b8b3f15d7d3ce016d305 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCPeakFittingView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCPeakFittingView.h @@ -58,6 +58,7 @@ namespace CustomInterfaces IFunction_const_sptr function(QString index) const; boost::optional<QString> currentFunctionIndex() const; IPeakFunction_const_sptr peakPicker() const; + void emitFitRequested(); public slots: diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h index c5772cdbea8abb1c925a670eb17131d0e9741511..43c9bf2e2182991fd9f416eb280fe0c1c657127f 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h @@ -119,15 +119,15 @@ namespace CustomInterfaces /// @param tMax :: Maximum X value available virtual void setTimeRange(double tMin, double tMax) = 0; - /// Set waiting cursor for long operation - virtual void setWaitingCursor() = 0; - - /// Restore the original cursor - virtual void restoreCursor() = 0; - /// Opens the Mantid Wiki web page virtual void help() = 0; + /// Disables all the widgets + virtual void disableAll() = 0; + + /// Enables all the widgets + virtual void enableAll() = 0; + signals: /// Request to load data void loadRequested(); @@ -135,6 +135,9 @@ namespace CustomInterfaces /// User has selected the first run void firstRunSelected(); + /// New data have been loaded + void dataChanged(); + }; } // namespace CustomInterfaces diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/IImageROIPresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/IImageROIPresenter.h new file mode 100644 index 0000000000000000000000000000000000000000..581accf1509477c8aa554e2bd2d128822391906e --- /dev/null +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/IImageROIPresenter.h @@ -0,0 +1,77 @@ +#ifndef MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IIMAGEROIPRESENTER_H_ +#define MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IIMAGEROIPRESENTER_H_ + +namespace MantidQt { +namespace CustomInterfaces { + +/** +Presenter for the widget that handles the selection of the center of +rotation, region of interest, region for normalization, etc. from an +image or stack of images. This is the abstract base class / interface +for the presenter (in the sense of the MVP pattern). The name +ImageROI refers to the Center-of-Rotation, which is the most basic +parameter that users can select via this widget. This class is +QtGUI-free as it uses the interface of the view. The model is simply +the ImageStackPreParams class which holds coordinates selected by the +user. + +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 <http://www.gnu.org/licenses/>. + +File change history is stored at: <https://github.com/mantidproject/mantid> +Code Documentation is available at: <http://doxygen.mantidproject.org> +*/ +class IImageROIPresenter { + +public: + IImageROIPresenter(){}; + virtual ~IImageROIPresenter(){}; + + /// These are user actions, triggered from the (passive) view, that need + /// handling by the presenter + enum Notification { + Init, ///< interface is initing (set, defaults, etc.) + BrowseImgOrStack, ///< User browses for an image file or stack + NewImgOrStack, ///< A new image or stack needs to be loaded + UpdateImgIndex, ///< Sliding/scrolling through the stack + SelectCoR, ///< Start picking of the center of rotation + SelectROI, ///< Start selection of the region of interest + SelectNormalization, ///< Start selection of the normalization region + FinishedCoR, ///< A CoR has been picked + FinishedROI, ///< The ROI is selected + FinishedNormalization,///< The normalization region is selected + ResetCoR, ///< Reset CoR to default/none/middle + ResetROI, ///< Reset ROI to default/empty + ResetNormalization, ///< Reet the normalization region to default/empty + ShutDown ///< The widget is being closed/destroyed + }; + + /** + * Notifications sent through the presenter when something changes + * in the view. This plays the role of signals emitted by the view + * to this presenter. + * + * @param notif Type of notification to process. + */ + virtual void notify(IImageROIPresenter::Notification notif) = 0; +}; + +} // namespace CustomInterfaces +} // namespace MantidQt + +#endif // MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IIMAGEROIPRESENTER_H_ diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/IImageROIView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/IImageROIView.h new file mode 100644 index 0000000000000000000000000000000000000000..592dc79a3a1d4e828bf35f1c7c6311257c7d4bb7 --- /dev/null +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/IImageROIView.h @@ -0,0 +1,216 @@ +#ifndef MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IIMAGEROIVIEW_H_ +#define MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IIMAGEROIVIEW_H_ + +#include "MantidAPI/WorkspaceGroup_fwd.h" +#include "MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h" + +namespace MantidQt { +namespace CustomInterfaces { + +/** +Widget to handle the selection of the center of rotation, region of +interest, region for normalization, etc. from an image or stack of +images. This is the abstract base class / interface for the view of +this widget (in the sense of the MVP pattern). The name ImageROI +refers to the Center-of-Rotation, which is the most basic parameter +that users can select via this widget. This class is Qt-free. Qt +specific functionality and dependencies are added in a class derived +from this. + +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 <http://www.gnu.org/licenses/>. + +File change history is stored at: <https://github.com/mantidproject/mantid> +Code Documentation is available at: <http://doxygen.mantidproject.org> +*/ +class IImageROIView { + +public: + IImageROIView(){}; + virtual ~IImageROIView(){}; + + // Selection states + enum SelectionState { + SelectNone, ///< Init, or after any reset + SelectCoR, + SelectROIFirst, + SelectROISecond, + SelectNormAreaFirst, + SelectNormAreaSecond + }; + + /** + * Sets the user selection. This should guarantee that all widgets + * are updated (including spin boxes, image, slider through the + * image stack, etc. + * + * @param params all user-modifyable parameters (coordinates for the + * CoR, ROI and area for normalization). + * + */ + virtual void setParams(ImageStackPreParams ¶ms) = 0; + + /** + * Provides the current user selection. + * + * @return parameters as set/edited by the user. + */ + virtual ImageStackPreParams userSelection() const = 0; + + /** + * The current selection state. For example: nothin/initialized, + * selecting CoR, selecting second corner of the normalization area, + * selecting first corner of the ROI. + * + * @return current state + */ + virtual SelectionState selectionState() const = 0; + + /** + * Update to a new state (for example select CoR). + * + * @param state new state we're transitioning into. + */ + virtual void changeSelectionState(const SelectionState& state) = 0; + + /** + * Display a special case of stack of images: individual image, from + * a path to a recognized directory structure (sample/dark/white) or + * image format. Here recognized format means something that is + * supported natively by the widgets library, in practice + * Qt. Normally you can expect that .tiff and .png images are + * supported. + * + * @param path path to the stack (directory) or individual image file. + */ + virtual void showStack(const std::string &path) = 0; + + /** + * Display a stack of images (or individual image as a particular + * case), from a workspace group containing matrix workspaces. It + * assumes that the workspace contains an image in the form in which + * LoadFITS loads FITS images (or spectrum per row, all of them with + * the same number of data points (columns)). + * + * @param ws Workspace group where every workspace is a FITS or + * similar image that has been loaded with LoadFITS or similar + * algorithm. + */ + virtual void showStack(Mantid::API::WorkspaceGroup_sptr &ws) = 0; + + /** + * Get the stack of images currently being displayed (it has been + * shown using showStack()), as a workspace group. + * + * @return workspace group containing the individual images, which + * can be empty if no stack has been loaded. + */ + virtual const Mantid::API::WorkspaceGroup_sptr stack() const = 0; + + /** + * Normally one image (projection for tomography stacks) will be + * shown on a 2D display. Show there a particular projection from a + * stack contained in a workspace group. + * + * @param wsg workspace holding a stack of images + * + * @param idx index (in the group) of the image to show + * + */ + virtual void showProjection(const Mantid::API::WorkspaceGroup_sptr &wsg, + size_t idx) = 0; + + /** + * Display a warning to the user (for example as a pop-up window). + * + * @param warn warning title, should be short and would normally be + * shown as the title of the window or a big banner. + * + * @param description longer, free form description of the issue. + */ + virtual void userWarning(const std::string &warn, + const std::string &description) = 0; + + /** + * Display an error message (for example as a pop-up window). + * + * @param err Error title, should be short and would normally be + * shown as the title of the window or a big banner. + * + * @param description longer, free form description of the issue. + */ + virtual void userError(const std::string &err, + const std::string &description) = 0; + + /** + * The index of the image currently shown (from the current stack if there's + * any). + * + * @return index from 0 to the total number of images in the + * stack-1, as used for example when indexing workspaces in + * workspacegroups + */ + virtual size_t currentImgIndex() const = 0; + + /** + * Display now this image (idx) from the stack. + * + * @param idx index of the image to display. + */ + virtual void updateImgWithIndex(size_t idx) = 0; + + /** + * Get the path/location of a stack of images (or single image as a + * particular case) that the user is requesting to display. The + * path would be expected to point to a recognized directory + * structure (sample/dark/white) or image file (as a particular + * case). + * + * @return location (can be a directory, file, etc.) that needs to + * be figured out elsewhere. + */ + virtual std::string askImgOrStackPath() = 0; + + /** + * Save settings (normally when closing this widget). + */ + virtual void saveSettings() const = 0; + + /** + * Forget the current center-of-rotation selection and set to + * default. + */ + virtual void resetCoR() = 0; + + /** + * Forget the current region-of-interest selection and set to + * default (all). + */ + virtual void resetROI() = 0; + + /** + * Forget the current selection of region-for-normalization and set + * to default (none). + */ + virtual void resetNormArea() = 0; +}; + +} // namespace CustomInterfaces +} // namespace MantidQt + +#endif // MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IIMAGEROIVIEW_H_ diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfacePresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfacePresenter.h index 77f46747a077d353afc005a2a3bbe7461230e8e3..be9585bc25ee1d01ede65b98fdd416566c7aa4d4 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfacePresenter.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfacePresenter.h @@ -9,7 +9,7 @@ Interface for what the presenter of the tomography GUI needs to implement. Here the term presenter is used as in the MVP (Model-View-Presenter) pattern. The (passive) view will use this. -Copyright © 2014,205 ISIS Rutherford Appleton Laboratory, NScD +Copyright © 2014,2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfaceView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfaceView.h index 3802a4b2b8cece79b1dc96f4b9dc12c18349e24c..0130f027370db9e29626b780bc78c2029c46b804 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfaceView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfaceView.h @@ -15,7 +15,7 @@ Tomography GUI. Base class / interface for the view of the tomo GUI specific functionality/dependencies are added in a class derived from this. -Copyright © 2014,205 ISIS Rutherford Appleton Laboratory, NScD +Copyright © 2014,2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageROIPresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageROIPresenter.h new file mode 100644 index 0000000000000000000000000000000000000000..7aaeac9147ec95b82725d83a6b0bef36ccac27ae --- /dev/null +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageROIPresenter.h @@ -0,0 +1,95 @@ +#ifndef MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGEROIPRESENTER_H_ +#define MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGEROIPRESENTER_H_ + +#include "MantidAPI/WorkspaceGroup_fwd.h" +#include "MantidQtCustomInterfaces/Tomography/IImageROIPresenter.h" +#include "MantidQtCustomInterfaces/Tomography/IImageROIView.h" +#include "MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h" +#include "MantidQtCustomInterfaces/Tomography/StackOfImagesDirs.h" + +#include <boost/scoped_ptr.hpp> + +namespace MantidQt { +namespace CustomInterfaces { + +/** +Presenter for the image center of rotation (and other parameters) +selection widget. In principle, in a strict MVP setup, signals from +the model should always be handled through this presenter and never go +directly to the view, and viceversa. + +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 <http://www.gnu.org/licenses/>. + +File change history is stored at: <https://github.com/mantidproject/mantid> +Code Documentation is available at: <http://doxygen.mantidproject.org> +*/ +class DLLExport ImageROIPresenter : public IImageROIPresenter { + +public: + /// Default constructor - normally used from the concrete view + ImageROIPresenter(IImageROIView *view); + virtual ~ImageROIPresenter(); + + void notify(IImageROIPresenter::Notification notif); + +protected: + void initialize(); + + /// clean shut down of model, view, etc. + void cleanup(); + + void processInit(); + void processBrowseImg(); + void processNewStack(); + void processUpdateImgIndex(); + void processSelectCoR(); + void processSelectROI(); + void processSelectNormalization(); + void processFinishedCoR(); + void processFinishedROI(); + void processFinishedNormalization(); + void processResetCoR(); + void processResetROI(); + void processResetNormalization(); + void processShutDown(); + +private: + StackOfImagesDirs checkInputStack(const std::string &path); + + /// loads a list of images from a stack, from their individual paths + Mantid::API::WorkspaceGroup_sptr + loadFITSStack(const std::vector<std::string> &imgs); + + void loadFITSImage(const std::string &path, const std::string &wsName); + + /// path to the image stack being visualized + std::string m_stackPath; + + /// Associated view for this presenter (MVP pattern) + IImageROIView *const m_view; + + /// Associated model for this presenter (MVP pattern). This is just + /// a set of coordinates + const boost::scoped_ptr<ImageStackPreParams> m_model; +}; + +} // namespace CustomInterfaces +} // namespace MantidQt + +#endif // MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGEROIPRESENTER_H_ diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageROIViewQtWidget.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageROIViewQtWidget.h new file mode 100644 index 0000000000000000000000000000000000000000..739374aed282d5b19cf3fb1d097b4a95bc583d3e --- /dev/null +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageROIViewQtWidget.h @@ -0,0 +1,186 @@ +#ifndef MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGEROIVIEWQTWIDGET_H_ +#define MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGEROIVIEWQTWIDGET_H_ + +#include "MantidAPI/WorkspaceGroup_fwd.h" +#include "MantidKernel/System.h" +#include "MantidQtCustomInterfaces/Tomography/IImageROIPresenter.h" +#include "MantidQtCustomInterfaces/Tomography/IImageROIView.h" + +#include "ui_ImageSelectCoRAndRegions.h" + +#include <boost/scoped_ptr.hpp> + +// forward declarations for Qt +class QWidget; +class QPixmap; + +namespace MantidQt { +namespace CustomInterfaces { + +/** +Qt-based view of the widget to handle the selection of the center of +rotation, region of interest, region for normalization, etc. from an +image or stack of images. Provides a concrete view for the graphical +interface for tomography functionality in Mantid. This view is +Qt-based and it is probably the only one that will be implemented in a +foreseeable horizon. The interface of this class is given by +IImageROIView so that it fits in the MVP (Model-View-Presenter) design +of the ImageROI widget. + +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 <http://www.gnu.org/licenses/>. + +File change history is stored at: <https://github.com/mantidproject/mantid> +Code Documentation is available at: <http://doxygen.mantidproject.org> +*/ +class DLLExport ImageROIViewQtWidget : public QWidget, public IImageROIView { + Q_OBJECT + +public: + ImageROIViewQtWidget(QWidget *parent = 0); + virtual ~ImageROIViewQtWidget(){}; + + void setParams(ImageStackPreParams ¶ms); + + ImageStackPreParams userSelection() const; + + SelectionState selectionState() const { return m_selectionState; } + + void changeSelectionState(const SelectionState& state); + + /// show a stack of images given the path to the files + void showStack(const std::string &path); + + /// show a stack of images that have been loaded into a group of workspaces + void showStack(Mantid::API::WorkspaceGroup_sptr &ws); + + const Mantid::API::WorkspaceGroup_sptr stack() const { return m_stack; } + + void showProjection(const Mantid::API::WorkspaceGroup_sptr &wsg, size_t idx); + + void userWarning(const std::string &warn, const std::string &description); + + void userError(const std::string &err, const std::string &description); + + size_t currentImgIndex() const; + + void updateImgWithIndex(size_t idx); + + std::string askImgOrStackPath(); + + void saveSettings() const; + + void resetCoR(); + void resetROI(); + void resetNormArea(); + +protected: + void initLayout(); + void showImg(); + + /// update coordinates from mouse event + void mouseUpdateCoR(int x, int y); + void mouseUpdateROICorners12(int x, int y); + void mouseUpdateROICorner2(int x, int y); + void mouseFinishROI(int x, int y); + void mouseUpdateNormAreaCorners12(int x, int y); + void mouseUpdateNormAreaCorner2(int x, int y); + void mouseFinishNormArea(int x, int y); + +private slots: + void browseImgClicked(); + + void corClicked(); + void corResetClicked(); + void roiClicked(); + void roiResetClicked(); + void normAreaClicked(); + void normAreaResetClicked(); + + void updateFromImagesSlider(int current); + + void valueUpdatedCoR(int v); + void valueUpdatedROI(int v); + void valueUpdatedNormArea(int v); + +private: + void grabCoRFromWidgets(); + void grabROIFromWidgets(); + void grabNormAreaFromWidgets(); + + void grabCoRFromMousePoint(int x, int y); + void grabROICorner1FromMousePoint(int x, int y); + void grabROICorner2FromMousePoint(int x, int y); + void grabNormAreaCorner1FromMousePoint(int x, int y); + void grabNormAreaCorner2FromMousePoint(int x, int y); + + void setupConnections(); + + void readSettings(); + + // widget closing + virtual void closeEvent(QCloseEvent *ev); + + /// enable/disable the groups with spin boxes for the center and corners + void enableParamWidgets(bool enable); + /// initialize values to defaults and set max/min for the spin boxes + void initParamWidgets(size_t maxWidth, size_t maxHeight); + + /// Set coordinates in the widgets from a params object + void setParamWidgets(ImageStackPreParams ¶ms); + + // shows the image in a widget + void showProjectionImage(const Mantid::API::WorkspaceGroup_sptr &wsg, + size_t idx); + + /// repaint the image with new positions of points and rectangles + void refreshROIetAl(); + void refreshCoR(); + void refreshROI(); + void refreshNormArea(); + + bool eventFilter(QObject *obj, QEvent *event); + + Ui::ImageSelectCoRAndRegions m_ui; + + Mantid::API::WorkspaceGroup_sptr m_stack; + + /// this holds the base image on top of which rectangles and other + /// objects are drawn + boost::scoped_ptr<QPixmap> m_basePixmap; + + /// persistent settings + static const std::string m_settingsGroup; + + /// parameters currently set by the user + ImageStackPreParams m_params; + + /// max image size for the current stack + int m_imgWidth, m_imgHeight; + + /// are we picking the CoR, or the first point of the ROI, etc. + SelectionState m_selectionState; + + // presenter as in the model-view-presenter + boost::scoped_ptr<IImageROIPresenter> m_presenter; +}; + +} // namespace CustomInterfaces +} // namespace MantidQt + +#endif // MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGEROIVIEWQTWIDGET_H_ diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageSelectCoRAndRegions.ui b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageSelectCoRAndRegions.ui new file mode 100644 index 0000000000000000000000000000000000000000..c71dbfed6a89027b1f6ea39a849f4df738db4671 --- /dev/null +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageSelectCoRAndRegions.ui @@ -0,0 +1,669 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ImageSelectCoRAndRegions</class> + <widget class="QWidget" name="ImageSelectCoRAndRegions"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>800</width> + <height>600</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout_8"> + <item row="0" column="0"> + <widget class="QSplitter" name="splitter_main_horiz"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>1</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <widget class="QSplitter" name="splitter_img_vertical"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <widget class="QWidget" name="layoutWidget"> + <layout class="QGridLayout" name="gridLayout_5"> + <property name="sizeConstraint"> + <enum>QLayout::SetMinimumSize</enum> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_img_seq"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>28</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>28</height> + </size> + </property> + <property name="text"> + <string>Image:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="lineEdit_img_seq"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>28</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>28</height> + </size> + </property> + <property name="text"> + <string>0/0</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_img_name"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>28</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>28</height> + </size> + </property> + <property name="text"> + <string>none</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QPushButton" name="pushButton_browse_img"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>28</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>28</height> + </size> + </property> + <property name="text"> + <string>Browse</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="layoutWidget"> + <layout class="QGridLayout" name="gridLayout_7" rowstretch="0,1"> + <property name="sizeConstraint"> + <enum>QLayout::SetMaximumSize</enum> + </property> + <property name="spacing"> + <number>3</number> + </property> + <item row="0" column="0"> + <widget class="QScrollArea" name="scrollArea"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>2</horstretch> + <verstretch>2</verstretch> + </sizepolicy> + </property> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>510</width> + <height>402</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>2</horstretch> + <verstretch>2</verstretch> + </sizepolicy> + </property> + <layout class="QGridLayout" name="gridLayout" rowstretch="0" columnstretch="0"> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>1</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_img"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>2</horstretch> + <verstretch>2</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + <item row="1" column="0"> + <widget class="QScrollBar" name="horizontalScrollBar_img_stack"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="invertedControls"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + <widget class="QWidget" name="layoutWidget_2"> + <layout class="QGridLayout" name="gridLayout_6" columnminimumwidth="0"> + <property name="sizeConstraint"> + <enum>QLayout::SetDefaultConstraint</enum> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBox_cor"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>260</width> + <height>16777215</height> + </size> + </property> + <property name="title"> + <string>Center of rotation</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="margin"> + <number>3</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="1" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Column:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinBox_cor_x"> + <property name="maximum"> + <number>9999</number> + </property> + <property name="value"> + <number>9999</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Row:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinBox_cor_y"> + <property name="maximum"> + <number>9999</number> + </property> + <property name="value"> + <number>9999</number> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QPushButton" name="pushButton_cor"> + <property name="toolTip"> + <string>After pushing this button, click on the image to select</string> + </property> + <property name="text"> + <string>Select</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>108</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="pushButton_cor_reset"> + <property name="text"> + <string>Reset</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>78</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="pushButton"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Auto-find</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="comboBox"> + <property name="enabled"> + <bool>false</bool> + </property> + <item> + <property name="text"> + <string>Method:</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item row="1" column="0"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Minimum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="0"> + <widget class="QGroupBox" name="groupBox_roi"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>260</width> + <height>16777215</height> + </size> + </property> + <property name="title"> + <string>Region of interest:</string> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <property name="margin"> + <number>3</number> + </property> + <property name="spacing"> + <number>2</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Corner 1</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="spinBox_roi_top_x"> + <property name="maximum"> + <number>9999</number> + </property> + <property name="value"> + <number>9999</number> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QSpinBox" name="spinBox_roi_top_y"> + <property name="maximum"> + <number>9999</number> + </property> + <property name="value"> + <number>9999</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Corner 2</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="spinBox_roi_bottom_x"> + <property name="maximum"> + <number>9999</number> + </property> + <property name="value"> + <number>9999</number> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QSpinBox" name="spinBox_roi_bottom_y"> + <property name="maximum"> + <number>9999</number> + </property> + <property name="value"> + <number>9999</number> + </property> + </widget> + </item> + <item row="2" column="0" colspan="3"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QPushButton" name="pushButton_roi"> + <property name="toolTip"> + <string>After pushing this button, click and drag on the image to select</string> + </property> + <property name="text"> + <string>Select</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>155</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="pushButton_roi_reset"> + <property name="toolTip"> + <string>Reset to the whole field of view</string> + </property> + <property name="text"> + <string>Reset</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item row="3" column="0"> + <spacer name="verticalSpacer_3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Minimum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="4" column="0"> + <widget class="QGroupBox" name="groupBox_norm"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>260</width> + <height>16777215</height> + </size> + </property> + <property name="title"> + <string>Area for normalization:</string> + </property> + <layout class="QGridLayout" name="gridLayout_4"> + <property name="margin"> + <number>3</number> + </property> + <property name="spacing"> + <number>2</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>Corner 1</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="spinBox_norm_top_x"> + <property name="maximum"> + <number>9999</number> + </property> + <property name="value"> + <number>9999</number> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QSpinBox" name="spinBox_norm_top_y"> + <property name="maximum"> + <number>9999</number> + </property> + <property name="value"> + <number>9999</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Corner 2</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="spinBox_norm_bottom_x"> + <property name="maximum"> + <number>9999</number> + </property> + <property name="value"> + <number>9999</number> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QSpinBox" name="spinBox_norm_bottom_y"> + <property name="maximum"> + <number>9999</number> + </property> + <property name="value"> + <number>9999</number> + </property> + </widget> + </item> + <item row="2" column="0" colspan="3"> + <layout class="QHBoxLayout" name="horizontalLayout_8"> + <item> + <widget class="QPushButton" name="pushButton_norm_area"> + <property name="toolTip"> + <string>After pushing this button, click and drag on the image to select</string> + </property> + <property name="text"> + <string>Select</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>98</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="pushButton_norm_area_reset"> + <property name="toolTip"> + <string>Reset to empty/none</string> + </property> + <property name="text"> + <string>Reset</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item row="5" column="0"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>68</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h new file mode 100644 index 0000000000000000000000000000000000000000..164a3a475f7229f2b91fe6e9a82e15f102cb7065 --- /dev/null +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h @@ -0,0 +1,63 @@ +#ifndef MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGESTACKPREPARAMS_H_ +#define MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGESTACKPREPARAMS_H_ + +#include "MantidKernel/System.h" +#include "MantidKernel/V2D.h" + +#include <utility> + +namespace MantidQt { +namespace CustomInterfaces { + +/** +This holds parameters for pre-processing images or stacks of images +for tomographic reconstruction. These parameters are used in different +pre-processing steps in the tomographic reconstruction pipeline, and +also for the reconstruction algorithms (iternative methods, FBP, +etc.). + +The parameters include: +- center of rotation +- region of interest (clip from original or raw images) +- region for normalization (where the beam is not blocked by any sample + object throughout the stack of images) other parameters describing + the stack of images: + +Copyright © 2014,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 <http://www.gnu.org/licenses/>. + +File change history is stored at: <https://github.com/mantidproject/mantid> +Code Documentation is available at: <http://doxygen.mantidproject.org> +*/ +class ImageStackPreParams { +public: + + ImageStackPreParams(); + + typedef std::pair<Mantid::Kernel::V2D, Mantid::Kernel::V2D> Box2D; + + Mantid::Kernel::V2D cor; + Box2D roi; + Box2D normalizationRegion; //< also known as 'air' region + bool medianFilter; +}; + +} // namespace CustomInterfaces +} // namespace MantidQt + +#endif // MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGESTACKPREPARAMS_H_ diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/StackOfImagesDirs.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/StackOfImagesDirs.h new file mode 100644 index 0000000000000000000000000000000000000000..3ef122016ea93de03b22395c15ab647d62ea9324 --- /dev/null +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/StackOfImagesDirs.h @@ -0,0 +1,86 @@ +#ifndef MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_STACKOFIMAGESDIR_H_ +#define MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_STACKOFIMAGESDIR_H_ + +#include "MantidKernel/System.h" + +#include <string> +#include <vector> + +namespace MantidQt { +namespace CustomInterfaces { + +/** +Represents the structure of directories where a stack of images is +stored on disk: data/flat/dark + processed + pre_filtered, etc. + +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 <http://www.gnu.org/licenses/>. + +File change history is stored at: <https://github.com/mantidproject/mantid> +Code Documentation is available at: <http://doxygen.mantidproject.org> +*/ +class DLLExport StackOfImagesDirs { +public: + /// constructor from a path (to a directory) + StackOfImagesDirs(const std::string &path); + + /// The current (simple) concept of valid is: there at least a + /// sample/data directory with at least one file in it. + bool isValid() const { return m_valid; } + + // human readable description of the expected structure of directories + std::string description() const; + + // string that describes the status/error message about this directory + std::string status() const; + + std::string sampleImagesDir() const { return m_sampleDir; }; + std::string flatImagesDir() const { return m_flatDir; }; + std::string darkImagesDir() const { return m_darkDir; }; + + std::vector<std::string> sampleFiles() const; + std::vector<std::string> flatFiles() const; + std::vector<std::string> darkFiles() const; + +private: + /// tries to find the expected data_/dark_/flat_ directories + void findStackDirs(const std::string &path); + /// finds images in a directory + std::vector<std::string> findImgFiles(const std::string &path) const; + + /// passes basic validity checks + bool m_valid; + /// string with informative messages specially when not valid + std::string m_statusDescStr; + + std::string m_sampleDir; + std::string m_flatDir; + std::string m_darkDir; + + static const std::string g_descr; + static const std::string g_sampleNamePrefix; + static const std::string g_flatNamePrefix; + static const std::string g_darkNamePrefix; + static const std::string g_processedNamePrefix; + static const std::string g_prefilteredNamePrefix; +}; + +} // namespace CustomInterfaces +} // namespace MantidQt + +#endif // MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_STACKOFIMAGESDIR_H_ diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoPathsConfig.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoPathsConfig.h index 92400342f4a0363d6d52588065ae557fc58994c3..ee3becb0206f8910ae585ab1f4cedae98c201d29 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoPathsConfig.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoPathsConfig.h @@ -18,7 +18,7 @@ that define where the data for a particular dataset can be found, and that are normally required to run reconstruction tools but also pre- and post- processing steps. -Copyright © 2014,205 ISIS Rutherford Appleton Laboratory, NScD +Copyright © 2014,2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoRecToolConfig.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoRecToolConfig.h index 1ff91bd3933bcec2ee31c120f04e8e814e78bc12..256518618dcb17ac301ae2871bf615424cfb1f02 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoRecToolConfig.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoRecToolConfig.h @@ -12,7 +12,7 @@ is under development, and as it is not necessarily related to custom interfaces this class and some derived ones might be moved out of here. -Copyright © 2014,205 ISIS Rutherford Appleton Laboratory, NScD +Copyright © 2014,2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoReconToolsUserSettings.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoReconToolsUserSettings.h index 25857af9e1a9827251c4b52c3453429c8837cb7a..a6047a19de1292643bf844af8fa30a6357b406a6 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoReconToolsUserSettings.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoReconToolsUserSettings.h @@ -13,7 +13,7 @@ namespace CustomInterfaces { /** Settings for a set of tomographic reconstruction tools supported. -Copyright © 2014,205 ISIS Rutherford Appleton Laboratory, NScD +Copyright © 2014,2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoToolConfigDialog.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoToolConfigDialog.h index 64cfc7a36aed82bdc7e6a1585e4b6895eb15ca0b..5196ca49bef979e5268b8dc9cbd68a5e1c20aca8 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoToolConfigDialog.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoToolConfigDialog.h @@ -15,7 +15,7 @@ namespace CustomInterfaces { Third party tool configuration dialog(s) for the tomographic reconstruction GUI. -Copyright © 2014,205 ISIS Rutherford Appleton Laboratory, NScD +Copyright © 2014,2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceModel.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceModel.h index a915f0c9ed1f7e54df8fa5b8249154eaef3410f8..4bd8001060f092397a3dec2d71d888c863d8f279 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceModel.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceModel.h @@ -20,7 +20,7 @@ Tomography GUI. Model for the interface (as in the MVP signals from this model should always be handled through the presenter and never go directly to the view. -Copyright © 2014,205 ISIS Rutherford Appleton Laboratory, NScD +Copyright © 2014,2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfacePresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfacePresenter.h index f37b5569d582d5b09be32ecb775cd754c73d6b22..ec29c07091b112cb2ab2b5de01325dacdce081f0 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfacePresenter.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfacePresenter.h @@ -23,7 +23,7 @@ Tomography GUI. Presenter for the GUI (as in the MVP signals from the model should always be handled through this presenter and never go directly to the view, and viceversa. -Copyright © 2014,205 ISIS Rutherford Appleton Laboratory, NScD +Copyright © 2014,2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceQtTabRun.ui b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceQtTabRun.ui index ecfc5ff939ec2a361cae319847285f9d52c70162..ea670ee8a7158f0eb58a5f606461f3633d73f3a1 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceQtTabRun.ui +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceQtTabRun.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>462</width> - <height>460</height> + <width>671</width> + <height>451</height> </rect> </property> <layout class="QGridLayout" name="gridLayout"> @@ -74,7 +74,7 @@ <item row="1" column="0"> <widget class="QFrame" name="frame_image"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>2</horstretch> <verstretch>2</verstretch> </sizepolicy> @@ -105,10 +105,16 @@ <rect> <x>0</x> <y>0</y> - <width>151</width> - <height>180</height> + <width>231</width> + <height>175</height> </rect> </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <layout class="QGridLayout" name="gridLayout_5"> <property name="margin"> <number>0</number> @@ -118,6 +124,12 @@ </property> <item row="0" column="0"> <widget class="QLabel" name="label_image"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> <string/> </property> diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceViewQtGUI.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceViewQtGUI.h index 010abf23fbeaea0ce1a7fe1b47d4a7fe60bbecf7..3f78f8feafe18f03d52db0af5d4eab26556e76b1 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceViewQtGUI.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceViewQtGUI.h @@ -9,6 +9,8 @@ #include "MantidQtCustomInterfaces/Tomography/ITomographyIfacePresenter.h" #include "MantidQtCustomInterfaces/Tomography/ITomographyIfaceView.h" #include "MantidQtCustomInterfaces/Tomography/TomoToolConfigDialog.h" + +#include "ui_ImageSelectCoRAndRegions.h" #include "ui_TomographyIfaceQtGUI.h" #include "ui_TomographyIfaceQtTabSetup.h" #include "ui_TomographyIfaceQtTabRun.h" @@ -30,7 +32,7 @@ in a foreseeable horizon. The interface of this class is given by ITomographyIfaceView so that it fits in the MVP (Model-View-Presenter) design of the tomography GUI. -Copyright © 2014,205 ISIS Rutherford Appleton Laboratory, NScD +Copyright © 2014,2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. @@ -176,8 +178,9 @@ private: void processPathBrowseClick(QLineEdit *le, std::string &data); // Begin of Savu related functionality. This will grow and will need - // separation - + // separation. They should find a better place to live. + ///@name Savu related methods + ///@{ /// to load plugins (savu classification / API) void loadAvailablePlugins(); @@ -201,6 +204,7 @@ private: const std::string &name); std::string pluginParamValString(const Json::Value &jsonVal, const std::string &name); + ///@} static size_t g_nameSeqNo; @@ -213,6 +217,7 @@ private: // but they could be separate dialogs, widgets, etc. Ui::TomographyIfaceQtTabSetup m_uiTabSetup; Ui::TomographyIfaceQtTabRun m_uiTabRun; + Ui::ImageSelectCoRAndRegions m_uiTabCoR; /// Tool specific setup dialogs Ui::TomoToolConfigAstra m_uiAstra; diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigAstraToolbox.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigAstraToolbox.h index 80d2b62a64138bcac14062a62289bb451a62e20e..8e4b19d2f7cdac14401455f43f7fbcf0e8c5bc86 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigAstraToolbox.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigAstraToolbox.h @@ -15,7 +15,7 @@ Configuration of a third party tomographic reconstruction tool specialized for the Astra Toolbox tomographic reconstruction tool (C++, CUDA): Astra Toolbox <http://sourceforge.net/p/astra-toolbox/wiki/Home/ -Copyright © 2014,205 ISIS Rutherford Appleton Laboratory, NScD +Copyright © 2014,2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. @@ -38,7 +38,7 @@ Code Documentation is available at: <http://doxygen.mantidproject.org> */ class DLLExport ToolConfigAstraToolbox : public TomoRecToolConfig { public: - ToolConfigAstraToolbox() { } + ToolConfigAstraToolbox(); ToolConfigAstraToolbox(const std::string &runnable, double centerRot, double angleMin, double angleMax, @@ -47,7 +47,7 @@ public: const std::string &pathOpen, const std::string &pathSample); - ~ToolConfigAstraToolbox() { } + ~ToolConfigAstraToolbox() {} protected: virtual std::string makeCmdLineOptions() const; diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigCustom.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigCustom.h index fe02d914dc2a9d2db490682fa9daf8e9fdaa845d..98c947dc793a6e7fed3e9f3297e0fe1da67ea057 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigCustom.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigCustom.h @@ -18,7 +18,7 @@ custom interfaces might be moved out of here. Tools of other type might be added, and then this should not be a sublcass of TomoRecToolConfig but of a more general ToolConfig class. -Copyright © 2014,205 ISIS Rutherford Appleton Laboratory, NScD +Copyright © 2014,2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigTomoPy.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigTomoPy.h index 56eec90cbd50d02bc126f34a091192f029621a78..b3e9054938af5d0c8ecdf4a94751f6ab2628d65e 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigTomoPy.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigTomoPy.h @@ -14,7 +14,7 @@ Third party tomographic reconstruction tool configuration class specialized for TomoPy (Python + C++): https://www1.aps.anl.gov/Science/Scientific-Software/TomoPy -Copyright © 2014,205 ISIS Rutherford Appleton Laboratory, NScD +Copyright © 2014,2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. @@ -37,14 +37,14 @@ Code Documentation is available at: <http://doxygen.mantidproject.org> */ class DLLExport ToolConfigTomoPy : public TomoRecToolConfig { public: - ToolConfigTomoPy() { } + ToolConfigTomoPy(); ToolConfigTomoPy(const std::string &runnable, const std::string &pathOut, const std::string &pathDark, const std::string &pathOpen, const std::string &pathSample, double centerRot, double angleMin, double angleMax); - ~ToolConfigTomoPy() { } + ~ToolConfigTomoPy() {} protected: virtual std::string makeCmdLineOptions() const; diff --git a/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp b/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp index 379c194341bba5284c8abb7c32fe366869aeadde..c4e727187fc8084c0e25ba20eab0bc8384a87a9a 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp @@ -1316,9 +1316,17 @@ void ConvFit::hwhmUpdateRS(double val) { void ConvFit::checkBoxUpdate(QtProperty *prop, bool checked) { UNUSED_ARG(checked); - if (prop == m_properties["UseDeltaFunc"]) + if (prop == m_properties["UseDeltaFunc"]) { updatePlotOptions(); - else if (prop == m_properties["UseFABADA"]) { + if (checked == true) { + m_properties["DeltaFunction"]->addSubProperty( + m_properties["DeltaHeight"]); + m_dblManager->setValue(m_properties["DeltaHeight"], 1.0000); + } else { + m_properties["DeltaFunction"]->removeSubProperty( + m_properties["DeltaHeight"]); + } + } else if (prop == m_properties["UseFABADA"]) { if (checked) { // FABADA needs a much higher iteration limit m_dblManager->setValue(m_properties["MaxIterations"], 20000); diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCBaselineModellingView.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCBaselineModellingView.cpp index 03be4452b122836f19f757ae37bcf69382d3a89b..b1ec6576a13fb0f4df52ec856443a8bac8cbfec8 100644 --- a/MantidQt/CustomInterfaces/src/Muon/ALCBaselineModellingView.cpp +++ b/MantidQt/CustomInterfaces/src/Muon/ALCBaselineModellingView.cpp @@ -272,5 +272,9 @@ namespace CustomInterfaces MantidQt::API::HelpWindow::showCustomInterface(NULL, QString("Muon_ALC")); } + void ALCBaselineModellingView::emitFitRequested() { + emit fitRequested(); + } + } // namespace CustomInterfaces } // namespace MantidQt diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp index 4492c6f91876c40633eb1ee49b7bd44d6d9eba94..fd6b1326b51c74c93e0bb75c553d573bc568abfd 100644 --- a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp +++ b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp @@ -36,7 +36,7 @@ namespace CustomInterfaces void ALCDataLoadingPresenter::load() { - m_view->setWaitingCursor(); + m_view->disableAll(); try { @@ -108,13 +108,15 @@ namespace CustomInterfaces m_view->setDataCurve(*(ALCHelper::curveDataFromWs(m_loadedData, 0)), ALCHelper::curveErrorsFromWs(m_loadedData, 0)); + emit dataChanged(); + } catch(std::exception& e) { m_view->displayError(e.what()); } - m_view->restoreCursor(); + m_view->enableAll(); } void ALCDataLoadingPresenter::updateAvailableInfo() diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp index f2e6c9712f4cc86af3f1eea2f66670ae8ed47cac..7f1d5b578649dac18e4272bd25866676717e0341 100644 --- a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp +++ b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp @@ -40,6 +40,18 @@ namespace CustomInterfaces m_dataCurve->setSymbol(QwtSymbol(QwtSymbol::Ellipse, QBrush(), QPen(), QSize(7,7))); m_dataCurve->setRenderHint(QwtPlotItem::RenderAntialiased, true); m_dataCurve->attach(m_ui.dataPlot); + + // The following lines disable the groups' titles when the + // group is disabled + QPalette palette; + palette.setColor(QPalette::Disabled, QPalette::WindowText, + QApplication::palette().color(QPalette::Disabled, + QPalette::WindowText)); + m_ui.dataGroup->setPalette(palette); + m_ui.deadTimeGroup->setPalette(palette); + m_ui.detectorGroupingGroup->setPalette(palette); + m_ui.periodsGroup->setPalette(palette); + m_ui.calculationGroup->setPalette(palette); } std::string ALCDataLoadingView::firstRun() const @@ -221,14 +233,28 @@ namespace CustomInterfaces MantidQt::API::HelpWindow::showCustomInterface(NULL, QString("Muon_ALC")); } - void ALCDataLoadingView::setWaitingCursor() - { - QApplication::setOverrideCursor(Qt::WaitCursor); + void ALCDataLoadingView::disableAll() { + + // Disable all the widgets in the view + m_ui.dataGroup->setEnabled(false); + m_ui.deadTimeGroup->setEnabled(false); + m_ui.detectorGroupingGroup->setEnabled(false); + m_ui.periodsGroup->setEnabled(false); + m_ui.calculationGroup->setEnabled(false); + m_ui.load->setEnabled(false); + } - void ALCDataLoadingView::restoreCursor() - { - QApplication::restoreOverrideCursor(); + void ALCDataLoadingView::enableAll() { + + // Enable all the widgets in the view + m_ui.deadTimeGroup->setEnabled(true); + m_ui.dataGroup->setEnabled(true); + m_ui.detectorGroupingGroup->setEnabled(true); + m_ui.periodsGroup->setEnabled(true); + m_ui.calculationGroup->setEnabled(true); + m_ui.load->setEnabled(true); + } } // namespace CustomInterfaces diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp index 5e0703eea02248d71696be2ee0b2dfb78329222b..a52e8a9ea46656ce5503523ea3af0e8a01bf2846 100644 --- a/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp +++ b/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp @@ -49,40 +49,61 @@ namespace CustomInterfaces m_dataLoading = new ALCDataLoadingPresenter(dataLoadingView); m_dataLoading->initialize(); - auto baselineModellingView = new ALCBaselineModellingView(m_ui.baselineModellingView); - m_baselineModelling = new ALCBaselineModellingPresenter(baselineModellingView, m_baselineModellingModel); + m_baselineModellingView = new ALCBaselineModellingView(m_ui.baselineModellingView); + m_baselineModelling = new ALCBaselineModellingPresenter(m_baselineModellingView, m_baselineModellingModel); m_baselineModelling->initialize(); - auto peakFittingView = new ALCPeakFittingView(m_ui.peakFittingView); - m_peakFitting = new ALCPeakFittingPresenter(peakFittingView, m_peakFittingModel); + m_peakFittingView = new ALCPeakFittingView(m_ui.peakFittingView); + m_peakFitting = new ALCPeakFittingPresenter(m_peakFittingView, m_peakFittingModel); m_peakFitting->initialize(); + connect(m_dataLoading, SIGNAL(dataChanged()), SLOT(updateBaselineData())); + connect(m_baselineModellingModel, SIGNAL(correctedDataChanged()), SLOT(updatePeakData())); + assert(m_ui.stepView->count() == STEP_NAMES.count()); // Should have names for all steps switchStep(0); // We always start from the first step } - void ALCInterface::nextStep() - { - int next = m_ui.stepView->currentIndex() + 1; + void ALCInterface::updateBaselineData() { - auto nextWidget = m_ui.stepView->widget(next); - assert(nextWidget); + // Make sure we do have some data + if (m_dataLoading->loadedData()) { - if (nextWidget == m_ui.baselineModellingView) - { - if (m_dataLoading->loadedData()) - { - m_baselineModellingModel->setData(m_dataLoading->loadedData()); + // Send the data to BaselineModelling + m_baselineModellingModel->setData(m_dataLoading->loadedData()); + + // If we have a fitting function and a fitting range + // we can update the baseline model + if ((!m_baselineModellingView->function().isEmpty()) && + (m_baselineModellingView->noOfSectionRows() > 0)) { + + // Fit the data + m_baselineModellingView->emitFitRequested(); } } - if (nextWidget == m_ui.peakFittingView) - { - if (m_baselineModellingModel->correctedData()) - { - m_peakFittingModel->setData(m_baselineModellingModel->correctedData()); + } + + void ALCInterface::updatePeakData() { + + // Make sure we do have some data + if (m_baselineModellingModel->correctedData()) { + + // Send the data to PeakFitting + m_peakFittingModel->setData(m_baselineModellingModel->correctedData()); + + // If we have a fitting function + if (m_peakFittingView->function("")) { + + // Fit the data + m_peakFittingView->emitFitRequested(); } } + } + + void ALCInterface::nextStep() + { + int next = m_ui.stepView->currentIndex() + 1; switchStep(next); } diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCPeakFittingView.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCPeakFittingView.cpp index 9388240c13adbbcad1072ad4864196b9a25b37da..0049ec3e2f2a902e7c16d9923591772433b08e21 100644 --- a/MantidQt/CustomInterfaces/src/Muon/ALCPeakFittingView.cpp +++ b/MantidQt/CustomInterfaces/src/Muon/ALCPeakFittingView.cpp @@ -147,6 +147,10 @@ void ALCPeakFittingView::displayError(const QString& message) QMessageBox::critical(m_widget, "Error", message); } +void ALCPeakFittingView::emitFitRequested() { + emit fitRequested(); +} + } // namespace CustomInterfaces } // namespace Mantid diff --git a/MantidQt/CustomInterfaces/src/Tomography/ImageROIPresenter.cpp b/MantidQt/CustomInterfaces/src/Tomography/ImageROIPresenter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5f411515c231575349bb8e05fc40899892918a63 --- /dev/null +++ b/MantidQt/CustomInterfaces/src/Tomography/ImageROIPresenter.cpp @@ -0,0 +1,305 @@ +#include "MantidAPI/AlgorithmManager.h" +#include "MantidAPI/AnalysisDataService.h" +#include "MantidAPI/MatrixWorkspace.h" +#include "MantidAPI/WorkspaceGroup.h" +#include "MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h" +#include "MantidQtCustomInterfaces/Tomography/ImageROIPresenter.h" +#include "MantidQtCustomInterfaces/Tomography/IImageROIView.h" + +using namespace MantidQt::CustomInterfaces; + +namespace MantidQt { +namespace CustomInterfaces { + +ImageROIPresenter::ImageROIPresenter(IImageROIView *view) + : m_view(view), m_model(new ImageStackPreParams()) { + if (!m_view) { + throw std::runtime_error("Severe inconsistency found. Presenter created " + "with an empty/null view (tomography interface). " + "Cannot continue."); + } +} + +ImageROIPresenter::~ImageROIPresenter() { cleanup(); } + +void ImageROIPresenter::cleanup() {} + +void ImageROIPresenter::notify(Notification notif) { + + switch (notif) { + + case IImageROIPresenter::Init: + processInit(); + break; + + case IImageROIPresenter::BrowseImgOrStack: + processBrowseImg(); + break; + + case IImageROIPresenter::NewImgOrStack: + processNewStack(); + break; + + case IImageROIPresenter::UpdateImgIndex: + processUpdateImgIndex(); + break; + + case IImageROIPresenter::SelectCoR: + processSelectCoR(); + break; + + case IImageROIPresenter::SelectROI: + processSelectROI(); + break; + + case IImageROIPresenter::SelectNormalization: + processSelectNormalization(); + break; + + case IImageROIPresenter::FinishedCoR: + processFinishedCoR(); + break; + + case IImageROIPresenter::FinishedROI: + processFinishedROI(); + break; + + case IImageROIPresenter::FinishedNormalization: + processFinishedNormalization(); + break; + + case IImageROIPresenter::ResetCoR: + processResetCoR(); + break; + + case IImageROIPresenter::ResetROI: + processResetROI(); + break; + + case IImageROIPresenter::ResetNormalization: + processResetNormalization(); + break; + + case IImageROIPresenter::ShutDown: + processShutDown(); + break; + } +} + +void ImageROIPresenter::processInit() { + ImageStackPreParams p; + m_view->setParams(p); +} + +void ImageROIPresenter::processBrowseImg() { + const std::string path = m_view->askImgOrStackPath(); + + if (path.empty()) + return; + + m_stackPath = path; + processNewStack(); +} + +/** + * Validates the input stack of images (directories and files), and + * shows warning/error messages as needed. The outocome of the + * validation can be checkec via isValid() on the returned stack of + * images object. + * + * @param path user provided path to the stack of images + * + * @return a stack of images built from the path passed, not + * necessarily correct (check with isValid()) + */ +StackOfImagesDirs ImageROIPresenter::checkInputStack(const std::string &path) { + StackOfImagesDirs soid(path); + + const std::string soiPath = soid.sampleImagesDir(); + if (soiPath.empty()) { + m_view->userWarning("Error trying to find a stack of images", + "Could not find the sample images directory. The stack " + "of images is expected as: \n\n" + + soid.description()); + } else if (!soid.isValid()) { + m_view->userWarning("Error while checking/validating the stack of images", + "The stack of images could not be loaded correctly. " + + soid.status()); + } + + return soid; +} + +void ImageROIPresenter::processNewStack() { + + StackOfImagesDirs soid(""); + try { + soid = checkInputStack(m_stackPath); + } catch (std::exception &e) { + // Poco::FileNotFoundException: this should never happen, unless + // the open dir dialog misbehaves unexpectedly, or in tests + m_view->userWarning("Error trying to open directories/files", + "The path selected via the dialog cannot be openend or " + "there was a problem while trying to access it. This " + "is an unexpected inconsistency. Error details: " + + std::string(e.what())); + } + + if (!soid.isValid()) + return; + + std::vector<std::string> imgs = soid.sampleFiles(); + if (0 >= imgs.size()) { + m_view->userWarning( + "Error trying to find image/projection files in the stack directories", + "Could not find any image file in the samples subdirectory: " + + soid.sampleImagesDir()); + return; + } + + Mantid::API::WorkspaceGroup_sptr wsg = loadFITSStack(imgs); + if (!wsg) + return; + + size_t imgCount = wsg->size(); + if (0 == imgCount) { + m_view->userWarning( + "Failed to load any FITS images - directory structure issue", + "Even though a directory apparently holding a stack of images was " + "found, " + "it was not possible to load any image file correctly from: " + + m_stackPath); + return; + } + + m_view->showStack(wsg); + + // clean-up container group workspace? Not for now + if (false && wsg) + Mantid::API::AnalysisDataService::Instance().remove(wsg->getName()); +} + +void ImageROIPresenter::processUpdateImgIndex() { + m_view->updateImgWithIndex(m_view->currentImgIndex()); +} + +void ImageROIPresenter::processSelectCoR() { + m_view->changeSelectionState(IImageROIView::SelectCoR); +} + +void ImageROIPresenter::processSelectROI() { + m_view->changeSelectionState(IImageROIView::SelectROIFirst); +} + +void ImageROIPresenter::processSelectNormalization() { + m_view->changeSelectionState(IImageROIView::SelectNormAreaFirst); +} + +void ImageROIPresenter::processFinishedCoR() { + m_view->changeSelectionState(IImageROIView::SelectNone); +} + +void ImageROIPresenter::processFinishedROI() { + m_view->changeSelectionState(IImageROIView::SelectNone); +} + +void ImageROIPresenter::processFinishedNormalization() { + m_view->changeSelectionState(IImageROIView::SelectNone); +} + +void ImageROIPresenter::processResetCoR() { + m_view->resetCoR(); + m_view->changeSelectionState(IImageROIView::SelectNone); +} + +void ImageROIPresenter::processResetROI() { + m_view->resetROI(); + m_view->changeSelectionState(IImageROIView::SelectNone); +} + +void ImageROIPresenter::processResetNormalization() { + m_view->resetNormArea(); + m_view->changeSelectionState(IImageROIView::SelectNone); +} + +void ImageROIPresenter::processShutDown() { m_view->saveSettings(); } + +Mantid::API::WorkspaceGroup_sptr +ImageROIPresenter::loadFITSStack(const std::vector<std::string> &imgs) { + const std::string wsName = "__stack_fits_viewer_tomography_gui"; + auto &ads = Mantid::API::AnalysisDataService::Instance(); + if (ads.doesExist(wsName)) { + ads.remove(wsName); + } + for (size_t i = 0; i < imgs.size(); ++i) { + loadFITSImage(imgs[i], wsName); + } + + Mantid::API::WorkspaceGroup_sptr wsg; + try { + wsg = ads.retrieveWS<Mantid::API::WorkspaceGroup>(wsName); + } catch (std::exception &e) { + throw std::runtime_error( + "Could not produce a workspace group for the stack images. Cannot " + "display it. Error details: " + + std::string(e.what())); + } + + if (wsg && + Mantid::API::AnalysisDataService::Instance().doesExist(wsg->name()) && + imgs.size() == wsg->size()) { + return wsg; + } else { + return Mantid::API::WorkspaceGroup_sptr(); + } +} + +void ImageROIPresenter::loadFITSImage(const std::string &path, + const std::string &wsName) { + // get fits file into workspace and retrieve it from the ADS + auto alg = Mantid::API::AlgorithmManager::Instance().create("LoadFITS"); + try { + alg->initialize(); + alg->setPropertyValue("Filename", path); + alg->setProperty("OutputWorkspace", wsName); + // this is way faster when loading into a MatrixWorkspace + alg->setProperty("LoadAsRectImg", true); + } catch (std::exception &e) { + throw std::runtime_error("Failed to initialize the mantid algorithm to " + "load images. Error description: " + + std::string(e.what())); + } + + try { + alg->execute(); + } catch (std::exception &e) { + throw std::runtime_error( + "Failed to load image. Could not load this file as a " + "FITS image: " + + std::string(e.what())); + } + + if (!alg->isExecuted()) { + throw std::runtime_error( + "Failed to load image correctly. Note that even though " + "the image file has been loaded it seems to contain errors."); + } + + try { + Mantid::API::WorkspaceGroup_sptr wsg; + Mantid::API::MatrixWorkspace_sptr ws; + const auto &ads = Mantid::API::AnalysisDataService::Instance(); + wsg = ads.retrieveWS<Mantid::API::WorkspaceGroup>(wsName); + ws = ads.retrieveWS<Mantid::API::MatrixWorkspace>(wsg->getNames()[0]); + } catch (std::exception &e) { + throw std::runtime_error( + "Could not load image contents for file '" + path + + "'. An unrecoverable error " + "happened when trying to load the image contents. Cannot " + "display it. Error details: " + + std::string(e.what())); + } +} + +} // namespace CustomInterfaces +} // namespace MantidQt diff --git a/MantidQt/CustomInterfaces/src/Tomography/ImageROIViewQtWidget.cpp b/MantidQt/CustomInterfaces/src/Tomography/ImageROIViewQtWidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..51d23189b5cc869314dadd5affa48158f7b373b0 --- /dev/null +++ b/MantidQt/CustomInterfaces/src/Tomography/ImageROIViewQtWidget.cpp @@ -0,0 +1,830 @@ +#include "MantidAPI/MatrixWorkspace.h" +#include "MantidAPI/WorkspaceGroup.h" +#include "MantidQtAPI/AlgorithmInputHistory.h" +#include "MantidQtAPI/AlgorithmRunner.h" + +#include "MantidQtCustomInterfaces/Tomography/ImageROIViewQtWidget.h" +#include "MantidQtCustomInterfaces/Tomography/ImageROIPresenter.h" + +using namespace Mantid::API; +using namespace MantidQt::CustomInterfaces; + +#include <QCloseEvent> +#include <QFileDialog> +#include <QMessageBox> +#include <QPainter> +#include <QSettings> + +namespace MantidQt { +namespace CustomInterfaces { + +// this would be more like a CustomWidget if it's eventually moved there +const std::string ImageROIViewQtWidget::m_settingsGroup = + "CustomInterfaces/ImageROIView"; + +ImageROIViewQtWidget::ImageROIViewQtWidget(QWidget *parent) + : QWidget(parent), IImageROIView(), m_imgWidth(0), m_imgHeight(0), + m_selectionState(SelectNone), m_presenter(NULL) { + initLayout(); + + // using an event filter. might be worth refactoring into a specific + // QLabel + selection of ROI+NormArea+CoR class + // not using Qwt Pickers to avoid Qwt version issues.. + m_ui.label_img->installEventFilter(this); +} + +void ImageROIViewQtWidget::setParams(ImageStackPreParams ¶ms) { + m_params = params; + setParamWidgets(m_params); +} + +ImageStackPreParams ImageROIViewQtWidget::userSelection() const { + return m_params; +} + +void ImageROIViewQtWidget::changeSelectionState( + const IImageROIView::SelectionState &state) { + m_selectionState = state; +} + +void ImageROIViewQtWidget::showStack(const std::string & /*path*/) { + // TODO: + // a) load as proper stack of images workspace - this can only be done when + // we have a firt working version of the "lean MD workspace". This method + // would then load into one workspace of such type. + // b) load as workspace group - this is done in the overloaded method below + + // enableParamWidgets(true); +} + +void ImageROIViewQtWidget::showStack(Mantid::API::WorkspaceGroup_sptr &wsg) { + if (0 == wsg->size()) + return; + + m_stack = wsg; + + m_ui.horizontalScrollBar_img_stack->setEnabled(true); + m_ui.horizontalScrollBar_img_stack->setMinimum(0); + m_ui.horizontalScrollBar_img_stack->setMaximum( + static_cast<int>(m_stack->size() - 1)); + + size_t width = 0, height = 0; + try { + MatrixWorkspace_sptr ws = + boost::dynamic_pointer_cast<MatrixWorkspace>(wsg->getItem(0)); + if (!ws) + return; + width = ws->blocksize(); + height = ws->getNumberHistograms(); + } catch (std::exception &e) { + QMessageBox::warning(this, "Cannot load image information", + "There was a problem while " + " trying to find the size of the image: " + + QString::fromStdString(e.what())); + } + + showProjection(m_stack, 0); + initParamWidgets(width, height); + refreshROIetAl(); + enableParamWidgets(true); +} + +void ImageROIViewQtWidget::showProjection( + const Mantid::API::WorkspaceGroup_sptr &wsg, size_t idx) { + + showProjectionImage(wsg, idx); + refreshROIetAl(); + + // give name, set up scroll/slider + std::string name; + try { + MatrixWorkspace_sptr ws = + boost::dynamic_pointer_cast<MatrixWorkspace>(wsg->getItem(idx)); + if (!ws) + return; + name = ws->run().getLogData("run_title")->value(); + } catch (std::exception &e) { + QMessageBox::warning(this, "Cannot load image information", + "There was a problem while " + " trying to find the name of the image: " + + QString::fromStdString(e.what())); + } + m_ui.label_img_name->setText(QString::fromStdString(name)); + + const size_t numPics = wsg->size(); + m_ui.lineEdit_img_seq->setText( + QString::fromStdString("1/" + boost::lexical_cast<std::string>(numPics))); + m_ui.horizontalScrollBar_img_stack->setValue(static_cast<int>(idx)); +} + +void ImageROIViewQtWidget::userWarning(const std::string &err, + const std::string &description) { + QMessageBox::warning(this, QString::fromStdString(err), + QString::fromStdString(description), QMessageBox::Ok, + QMessageBox::Ok); +} + +void ImageROIViewQtWidget::userError(const std::string &err, + const std::string &description) { + QMessageBox::critical(this, QString::fromStdString(err), + QString::fromStdString(description), QMessageBox::Ok, + QMessageBox::Ok); +} + +std::string ImageROIViewQtWidget::askImgOrStackPath() { + // get path + QString fitsStr = QString("Supported formats: FITS, TIFF and PNG " + "(*.fits *.fit *.tiff *.tif *.png);;" + "FITS, Flexible Image Transport System images " + "(*.fits *.fit);;" + "TIFF, Tagged Image File Format " + "(*.tif *.tiff);;" + "PNG, Portable Network Graphics " + "(*.png);;" + "Other extensions/all files (*.*)"); + QString prevPath = + MantidQt::API::AlgorithmInputHistory::Instance().getPreviousDirectory(); + QString path(QFileDialog::getExistingDirectory( + this, tr("Open stack of images"), prevPath, QFileDialog::ShowDirsOnly)); + if (!path.isEmpty()) { + MantidQt::API::AlgorithmInputHistory::Instance().setPreviousDirectory(path); + } + + return path.toStdString(); +} + +void ImageROIViewQtWidget::saveSettings() const { + QSettings qs; + qs.beginGroup(QString::fromStdString(m_settingsGroup)); + + qs.setValue("interface-win-geometry", saveGeometry()); + qs.endGroup(); +} + +void ImageROIViewQtWidget::resetCoR() { + int midx = + (m_ui.spinBox_cor_x->minimum() + m_ui.spinBox_cor_x->maximum()) / 2; + m_ui.spinBox_cor_x->setValue(midx); + int midy = + (m_ui.spinBox_cor_y->minimum() + m_ui.spinBox_cor_y->maximum()) / 2; + m_ui.spinBox_cor_y->setValue(midy); +} + +void ImageROIViewQtWidget::resetROI() { + m_ui.spinBox_roi_top_x->setValue(0); + m_ui.spinBox_roi_top_y->setValue(0); + m_ui.spinBox_roi_bottom_x->setValue(m_ui.spinBox_roi_bottom_x->maximum()); + m_ui.spinBox_roi_bottom_y->setValue(m_ui.spinBox_roi_bottom_y->maximum()); +} + +void ImageROIViewQtWidget::resetNormArea() { + m_ui.spinBox_norm_top_x->setValue(0); + m_ui.spinBox_norm_top_y->setValue(0); + m_ui.spinBox_norm_bottom_x->setValue(0); + m_ui.spinBox_norm_bottom_y->setValue(0); +} + +void ImageROIViewQtWidget::initLayout() { + // setup container ui + m_ui.setupUi(this); + + QList<int> sizes; + sizes.push_back(1000); + sizes.push_back(100); + m_ui.splitter_main_horiz->setSizes(sizes); + + sizes.clear(); + sizes.push_back(10); + sizes.push_back(1000); + m_ui.splitter_img_vertical->setSizes(sizes); + m_ui.horizontalScrollBar_img_stack->setEnabled(false); + m_ui.lineEdit_img_seq->setText("---"); + + enableParamWidgets(false); + + setupConnections(); + + initParamWidgets(1, 1); + grabCoRFromWidgets(); + grabROIFromWidgets(); + grabNormAreaFromWidgets(); + + // presenter that knows how to handle a IImageROIView should take care + // of all the logic. Note the view needs to now the concrete presenter here + m_presenter.reset(new ImageROIPresenter(this)); + + // it will know what compute resources and tools we have available: + // This view doesn't even know the names of compute resources, etc. + m_presenter->notify(ImageROIPresenter::Init); +} + +void ImageROIViewQtWidget::setupConnections() { + + // 'browse' buttons + connect(m_ui.pushButton_browse_img, SIGNAL(released()), this, + SLOT(browseImgClicked())); + + connect(m_ui.pushButton_cor, SIGNAL(released()), this, SLOT(corClicked())); + connect(m_ui.pushButton_cor_reset, SIGNAL(released()), this, + SLOT(corResetClicked())); + + connect(m_ui.pushButton_roi, SIGNAL(released()), this, SLOT(roiClicked())); + connect(m_ui.pushButton_roi_reset, SIGNAL(released()), this, + SLOT(roiResetClicked())); + + connect(m_ui.pushButton_norm_area, SIGNAL(released()), this, + SLOT(normAreaClicked())); + connect(m_ui.pushButton_norm_area_reset, SIGNAL(released()), this, + SLOT(normAreaResetClicked())); + + // image sequence scroll/slide: + connect(m_ui.horizontalScrollBar_img_stack, SIGNAL(valueChanged(int)), this, + SLOT(updateFromImagesSlider(int))); + + // parameter (points) widgets + connect(m_ui.spinBox_cor_x, SIGNAL(valueChanged(int)), this, + SLOT(valueUpdatedCoR(int))); + connect(m_ui.spinBox_cor_y, SIGNAL(valueChanged(int)), this, + SLOT(valueUpdatedCoR(int))); + + connect(m_ui.spinBox_roi_top_x, SIGNAL(valueChanged(int)), this, + SLOT(valueUpdatedROI(int))); + connect(m_ui.spinBox_roi_top_y, SIGNAL(valueChanged(int)), this, + SLOT(valueUpdatedROI(int))); + connect(m_ui.spinBox_roi_bottom_x, SIGNAL(valueChanged(int)), this, + SLOT(valueUpdatedROI(int))); + connect(m_ui.spinBox_roi_bottom_y, SIGNAL(valueChanged(int)), this, + SLOT(valueUpdatedROI(int))); + + connect(m_ui.spinBox_norm_top_x, SIGNAL(valueChanged(int)), this, + SLOT(valueUpdatedNormArea(int))); + connect(m_ui.spinBox_norm_top_y, SIGNAL(valueChanged(int)), this, + SLOT(valueUpdatedNormArea(int))); + connect(m_ui.spinBox_norm_bottom_x, SIGNAL(valueChanged(int)), this, + SLOT(valueUpdatedNormArea(int))); + connect(m_ui.spinBox_norm_bottom_y, SIGNAL(valueChanged(int)), this, + SLOT(valueUpdatedNormArea(int))); +} + +void ImageROIViewQtWidget::valueUpdatedCoR(int) { + grabCoRFromWidgets(); + refreshROIetAl(); +} + +void ImageROIViewQtWidget::valueUpdatedROI(int) { + grabROIFromWidgets(); + refreshROIetAl(); +} + +void ImageROIViewQtWidget::valueUpdatedNormArea(int) { + grabNormAreaFromWidgets(); + refreshROIetAl(); +} + +/** + * Parameter values from spin box widgets => coordinate parameters + * data member + */ +void ImageROIViewQtWidget::grabCoRFromWidgets() { + m_params.cor = Mantid::Kernel::V2D(m_ui.spinBox_cor_x->value(), + m_ui.spinBox_cor_y->value()); +} + +void ImageROIViewQtWidget::grabROIFromWidgets() { + m_params.roi = + std::make_pair(Mantid::Kernel::V2D(m_ui.spinBox_roi_top_x->value(), + m_ui.spinBox_roi_top_y->value()), + Mantid::Kernel::V2D(m_ui.spinBox_roi_bottom_x->value(), + m_ui.spinBox_roi_bottom_y->value())); +} + +void ImageROIViewQtWidget::grabNormAreaFromWidgets() { + m_params.normalizationRegion = + std::make_pair(Mantid::Kernel::V2D(m_ui.spinBox_norm_top_x->value(), + m_ui.spinBox_norm_top_y->value()), + Mantid::Kernel::V2D(m_ui.spinBox_norm_bottom_x->value(), + m_ui.spinBox_norm_bottom_y->value())); +} + +/** + * Updates the image view with the current image index and selection + * of parameters (ROI, normalization area, CoR). This needs to be used + * for every event that modifies the current image and/or selection of + * parameters. + */ +void ImageROIViewQtWidget::refreshROIetAl() { + + const QPixmap *pp = m_ui.label_img->pixmap(); + if (!pp) + return; + + QPixmap toDisplay(*m_basePixmap.get()); + QPainter painter(&toDisplay); + + // TODO: display settings / nicer symbol? + + QPen penCoR(Qt::red); + painter.setPen(penCoR); + painter.drawLine(static_cast<int>(m_params.cor.X() - 5), + static_cast<int>(m_params.cor.Y()), + static_cast<int>(m_params.cor.X() + 5), + static_cast<int>(m_params.cor.Y())); + painter.drawLine(static_cast<int>(m_params.cor.X()), + static_cast<int>(m_params.cor.Y() - 5), + static_cast<int>(m_params.cor.X()), + static_cast<int>(m_params.cor.Y() + 5)); + + QPen penROI(Qt::green); + painter.setPen(penROI); + painter.drawRect( + static_cast<int>(m_params.roi.first.X()), + static_cast<int>(m_params.roi.first.Y()), + static_cast<int>(m_params.roi.second.X() - m_params.roi.first.X()), + static_cast<int>(m_params.roi.second.Y() - m_params.roi.first.Y())); + + QPen penNA(Qt::yellow); + painter.setPen(penNA); + painter.drawRect(static_cast<int>(m_params.normalizationRegion.first.X()), + static_cast<int>(m_params.normalizationRegion.first.Y()), + static_cast<int>(m_params.normalizationRegion.second.X() - + m_params.normalizationRegion.first.X()), + static_cast<int>(m_params.normalizationRegion.second.Y() - + m_params.normalizationRegion.first.Y())); + + m_ui.label_img->setPixmap(toDisplay); +} + +void ImageROIViewQtWidget::refreshCoR() { + const QPixmap *pp = m_ui.label_img->pixmap(); + if (!pp) + return; + + grabCoRFromWidgets(); + + QPixmap toDisplay(*m_basePixmap.get()); + QPainter painter(&toDisplay); + QPen pen(Qt::red); + painter.setPen(pen); + painter.drawLine(static_cast<int>(m_params.cor.X() - 5), + static_cast<int>(m_params.cor.Y()), + static_cast<int>(m_params.cor.X() + 5), + static_cast<int>(m_params.cor.Y())); + painter.drawLine(static_cast<int>(m_params.cor.X()), + static_cast<int>(m_params.cor.Y() - 5), + static_cast<int>(m_params.cor.X()), + static_cast<int>(m_params.cor.Y() + 5)); + m_ui.label_img->setPixmap(toDisplay); +} + +void ImageROIViewQtWidget::refreshROI() { + const QPixmap *pp = m_ui.label_img->pixmap(); + if (!pp) + return; + + grabROIFromWidgets(); + // TODO: display proper symbol + + // QPixmap const *pm = m_ui.label_img->pixmap(); + QPixmap toDisplay(*m_basePixmap.get()); + QPainter painter(&toDisplay); + QPen pen(Qt::green); + painter.setPen(pen); + painter.drawRect( + static_cast<int>(m_params.roi.first.X()), + static_cast<int>(m_params.roi.first.Y()), + static_cast<int>(m_params.roi.second.X() - m_params.roi.first.X()), + static_cast<int>(m_params.roi.second.Y() - m_params.roi.first.Y())); + m_ui.label_img->setPixmap(toDisplay); +} + +void ImageROIViewQtWidget::refreshNormArea() { + // TODO: display proper symbol + const QPixmap *pp = m_ui.label_img->pixmap(); + if (!pp) + return; + + grabNormAreaFromWidgets(); + + // QPixmap const *pm = m_ui.label_img->pixmap(); + QPixmap toDisplay(*m_basePixmap.get()); + QPainter painter(&toDisplay); + QPen pen(Qt::yellow); + painter.setPen(pen); + painter.drawRect(static_cast<int>(m_params.normalizationRegion.first.X()), + static_cast<int>(m_params.normalizationRegion.first.Y()), + static_cast<int>(m_params.normalizationRegion.second.X() - + m_params.normalizationRegion.first.X()), + static_cast<int>(m_params.normalizationRegion.second.Y() - + m_params.normalizationRegion.first.Y())); + m_ui.label_img->setPixmap(toDisplay); +} + +void ImageROIViewQtWidget::enableParamWidgets(bool enable) { + m_ui.groupBox_cor->setEnabled(enable); + m_ui.groupBox_roi->setEnabled(enable); + m_ui.groupBox_norm->setEnabled(enable); +} + +void ImageROIViewQtWidget::initParamWidgets(size_t maxWidth, size_t maxHeight) { + m_imgWidth = static_cast<int>(maxWidth); + m_imgHeight = static_cast<int>(maxHeight); + + m_ui.spinBox_cor_x->setMinimum(0); + m_ui.spinBox_cor_x->setMaximum(m_imgWidth - 1); + m_ui.spinBox_cor_y->setMinimum(0); + m_ui.spinBox_cor_y->setMaximum(m_imgHeight - 1); + resetCoR(); + + m_ui.spinBox_roi_top_x->setMinimum(0); + m_ui.spinBox_roi_top_x->setMaximum(m_imgWidth - 1); + m_ui.spinBox_roi_top_y->setMinimum(0); + m_ui.spinBox_roi_top_y->setMaximum(m_imgHeight - 1); + + m_ui.spinBox_roi_bottom_x->setMinimum(0); + m_ui.spinBox_roi_bottom_x->setMaximum(m_imgWidth - 1); + m_ui.spinBox_roi_bottom_y->setMinimum(0); + m_ui.spinBox_roi_bottom_y->setMaximum(m_imgHeight - 1); + + resetROI(); + + m_ui.spinBox_norm_top_x->setMinimum(0); + m_ui.spinBox_norm_top_x->setMaximum(m_imgWidth - 1); + m_ui.spinBox_norm_top_y->setMinimum(0); + m_ui.spinBox_norm_top_y->setMaximum(m_imgHeight - 1); + + m_ui.spinBox_norm_bottom_x->setMinimum(0); + m_ui.spinBox_norm_bottom_x->setMaximum(m_imgWidth - 1); + m_ui.spinBox_norm_bottom_y->setMinimum(0); + m_ui.spinBox_norm_bottom_y->setMaximum(m_imgHeight - 1); + + resetNormArea(); +} + +void ImageROIViewQtWidget::setParamWidgets(ImageStackPreParams ¶ms) { + m_ui.spinBox_cor_x->setValue(static_cast<int>(params.cor.X())); + m_ui.spinBox_cor_y->setValue(static_cast<int>(params.cor.Y())); + + m_ui.spinBox_roi_top_x->setValue(static_cast<int>(params.roi.first.X())); + m_ui.spinBox_roi_top_y->setValue(static_cast<int>(params.roi.first.Y())); + + m_ui.spinBox_roi_bottom_x->setValue(static_cast<int>(params.roi.second.X())); + m_ui.spinBox_roi_bottom_y->setValue(static_cast<int>(params.roi.second.Y())); + + m_ui.spinBox_norm_top_x->setValue( + static_cast<int>(params.normalizationRegion.first.X())); + m_ui.spinBox_norm_top_y->setValue( + static_cast<int>(params.normalizationRegion.first.Y())); + + m_ui.spinBox_norm_bottom_x->setValue( + static_cast<int>(params.normalizationRegion.second.X())); + m_ui.spinBox_norm_bottom_y->setValue( + static_cast<int>(params.normalizationRegion.second.Y())); +} + +void ImageROIViewQtWidget::corClicked() { + m_presenter->notify(IImageROIPresenter::SelectCoR); +} + +void ImageROIViewQtWidget::corResetClicked() { + m_presenter->notify(IImageROIPresenter::ResetCoR); + refreshROIetAl(); +} + +void ImageROIViewQtWidget::roiClicked() { + m_presenter->notify(IImageROIPresenter::SelectROI); +} + +void ImageROIViewQtWidget::roiResetClicked() { + m_presenter->notify(IImageROIPresenter::ResetROI); + refreshROIetAl(); +} + +void ImageROIViewQtWidget::normAreaClicked() { + m_presenter->notify(IImageROIPresenter::SelectNormalization); +} + +void ImageROIViewQtWidget::normAreaResetClicked() { + m_presenter->notify(IImageROIPresenter::ResetNormalization); + refreshROIetAl(); +} + +void ImageROIViewQtWidget::browseImgClicked() { + m_presenter->notify(IImageROIPresenter::BrowseImgOrStack); +} + +void ImageROIViewQtWidget::updateFromImagesSlider(int /* current */) { + m_presenter->notify(IImageROIPresenter::UpdateImgIndex); +} + +size_t ImageROIViewQtWidget::currentImgIndex() const { + return m_ui.horizontalScrollBar_img_stack->value(); +} + +void ImageROIViewQtWidget::updateImgWithIndex(size_t idx) { + int max = m_ui.horizontalScrollBar_img_stack->maximum(); + int current = m_ui.horizontalScrollBar_img_stack->value(); + + showProjection(m_stack, idx); + m_ui.lineEdit_img_seq->setText( + QString::fromStdString(boost::lexical_cast<std::string>(current + 1) + + "/" + boost::lexical_cast<std::string>(max + 1))); +} + +void ImageROIViewQtWidget::showProjectionImage( + const Mantid::API::WorkspaceGroup_sptr &wsg, size_t idx) { + + MatrixWorkspace_sptr ws; + try { + ws = boost::dynamic_pointer_cast<MatrixWorkspace>(wsg->getItem(idx)); + if (!ws) + return; + } catch (std::exception &e) { + QMessageBox::warning( + this, "Cannot load image", + "There was a problem while trying to find the image data: " + + QString::fromStdString(e.what())); + } + + const size_t MAXDIM = 2048 * 16; + size_t width; + try { + width = boost::lexical_cast<size_t>(ws->run().getLogData("Axis1")->value()); + // TODO: add a settings option for this (like max mem allocation for + // images)? + if (width >= MAXDIM) + width = MAXDIM; + } catch (std::exception &e) { + QMessageBox::critical(this, "Cannot load image", + "There was a problem while trying to " + "find the width of the image: " + + QString::fromStdString(e.what())); + return; + } + + size_t height; + try { + height = + boost::lexical_cast<size_t>(ws->run().getLogData("Axis2")->value()); + if (height >= MAXDIM) + height = MAXDIM; + } catch (std::exception &e) { + QMessageBox::critical(this, "Cannot load image", + "There was a problem while trying to " + "find the height of the image: " + + QString::fromStdString(e.what())); + return; + } + + // images are loaded as 1 histogram == 1 pixel (1 bin per histogram): + if (height != ws->getNumberHistograms() || width != ws->blocksize()) { + QMessageBox::critical( + this, "Image dimensions do not match in the input image workspace", + "Could not load the expected " + "number of rows and columns."); + return; + } + // find min and max to scale pixel values + double min = std::numeric_limits<double>::max(), + max = std::numeric_limits<double>::min(); + for (size_t i = 0; i < ws->getNumberHistograms(); ++i) { + for (size_t j = 0; j < ws->blocksize(); ++j) { + const double &v = ws->readY(i)[j]; + if (v < min) + min = v; + if (v > max) + max = v; + } + } + if (min >= max) { + QMessageBox::warning( + this, "Empty image!", + "The image could be loaded but it contains " + "effectively no information, all pixels have the same value."); + // black picture + QPixmap pix(static_cast<int>(width), static_cast<int>(height)); + pix.fill(QColor(0, 0, 0)); + m_ui.label_img->setPixmap(pix); + m_ui.label_img->show(); + m_basePixmap.reset(new QPixmap(pix)); + return; + } + + // load / transfer image into a QImage + QImage rawImg(QSize(static_cast<int>(width), static_cast<int>(height)), + QImage::Format_RGB32); + const double max_min = max - min; + const double scaleFactor = 255.0 / max_min; + for (size_t yi = 0; yi < width; ++yi) { + for (size_t xi = 0; xi < width; ++xi) { + const double &v = ws->readY(yi)[xi]; + // color the range min-max in gray scale. To apply different color + // maps you'd need to use rawImg.setColorTable() or similar. + const int scaled = static_cast<int>(scaleFactor * (v - min)); + QRgb vRgb = qRgb(scaled, scaled, scaled); + rawImg.setPixel(static_cast<int>(xi), static_cast<int>(yi), vRgb); + } + } + + // paint and show image + // direct from image + QPixmap pix = QPixmap::fromImage(rawImg); + m_ui.label_img->setPixmap(pix); + m_ui.label_img->show(); + m_basePixmap.reset(new QPixmap(pix)); + // Alternative, drawing with a painter: + // QPixmap pix(static_cast<int>(width), static_cast<int>(height)); + // QPainter painter; + // painter.begin(&pix); + // painter.drawImage(0, 0, rawImg); + // painter.end(); + // m_ui.label_img->setPixmap(pix); + // m_ui.label_img->show(); + // m_basePixmap.reset(new QPixmap(pix)); +} + +/** + * Qt events filter for the mouse click and click&drag events that are + * used to select points and rectangles. Part of the logic of the + * selection is handled here. The test on the presenter can only test + * the begin and end of the selection. For full testability (including + * the mouse interaction), this method should be implemented fully in + * terms of notifications to the presenter. This would require a bunch + * of new notifications in IImageROIPresenter, and making at least all + * the mouseUpdateCoR, mouseUpdateROICorners12, mouseXXX methods + * public in this view interface. This can be considered at a later + * stage. + * + * @param obj object concerned by the event + * @param event event received (mouse click, release, move, etc.) + **/ +bool ImageROIViewQtWidget::eventFilter(QObject *obj, QEvent *event) { + // quick ignore + if (IImageROIView::SelectNone == m_selectionState) + return false; + + if (m_ui.label_img == obj) { + + QPoint p = m_ui.label_img->mapFromGlobal(QCursor::pos()); + int x = p.x(); + int y = p.y(); + // ignore potential clicks outside of the image + if (x >= m_imgWidth || y >= m_imgHeight || x < 0 || y < 0) + return false; + + auto type = event->type(); + if (type == QEvent::MouseButtonPress) { + + if (IImageROIView::SelectCoR == m_selectionState) { + mouseUpdateCoR(x, y); + } else if (IImageROIView::SelectROIFirst == m_selectionState) { + mouseUpdateROICorners12(x, y); + } else if (IImageROIView::SelectNormAreaFirst == m_selectionState) { + mouseUpdateNormAreaCorners12(x, y); + } + } else if (type == QEvent::MouseMove) { + + if (IImageROIView::SelectROISecond == m_selectionState) { + mouseUpdateROICorner2(x, y); + } else if (IImageROIView::SelectNormAreaSecond == m_selectionState) { + mouseUpdateNormAreaCorner2(x, y); + } + } else if (type == QEvent::MouseButtonRelease) { + + if (IImageROIView::SelectROISecond == m_selectionState) { + mouseFinishROI(x, y); + } else if (IImageROIView::SelectNormAreaSecond == m_selectionState) { + mouseFinishNormArea(x, y); + } + } + } + // pass on the event up to the parent class + return false; +} + +/** + * Parameter values from mouse position (at a relevant event like + * first click, or last release) => spin box widgets, AND coordinate + * parameters data member. This grabs the Center of Rotation (CoR) + * + * @param x position on x axis (local to the image) + * @param y position on y axis (local to the image) + */ +void ImageROIViewQtWidget::grabCoRFromMousePoint(int x, int y) { + m_params.cor = Mantid::Kernel::V2D(x, y); + m_ui.spinBox_cor_x->setValue(x); + m_ui.spinBox_cor_y->setValue(y); +} + +void ImageROIViewQtWidget::grabROICorner1FromMousePoint(int x, int y) { + m_params.roi.first = Mantid::Kernel::V2D(x, y); + m_ui.spinBox_roi_top_x->setValue(x); + m_ui.spinBox_roi_top_y->setValue(y); +} + +void ImageROIViewQtWidget::grabROICorner2FromMousePoint(int x, int y) { + m_params.roi.second = Mantid::Kernel::V2D(x, y); + m_ui.spinBox_roi_bottom_x->setValue(x); + m_ui.spinBox_roi_bottom_y->setValue(y); +} + +void ImageROIViewQtWidget::grabNormAreaCorner1FromMousePoint(int x, int y) { + m_params.normalizationRegion.first = Mantid::Kernel::V2D(x, y); + m_ui.spinBox_norm_top_x->setValue(x); + m_ui.spinBox_norm_top_y->setValue(y); +} + +void ImageROIViewQtWidget::grabNormAreaCorner2FromMousePoint(int x, int y) { + m_params.normalizationRegion.second = Mantid::Kernel::V2D(x, y); + m_ui.spinBox_norm_bottom_x->setValue(x); + m_ui.spinBox_norm_bottom_y->setValue(y); +} + +/** + * This is an update and implicity a finish, as there's only one + * update for the CoR (single point-click). The coordinates count as + * usual in Qt widgets. Top-left is (0,0). + * + * @param x position on x axis (local to the image) + * @param y position on y axis (local to the image) + */ +void ImageROIViewQtWidget::mouseUpdateCoR(int x, int y) { + grabCoRFromMousePoint(x, y); + refreshROIetAl(); + + m_presenter->notify(IImageROIPresenter::FinishedCoR); +} + +/** + * Start of ROI selection (or first click after pushing "select + * ROI". The rectangle starts as a point from the mouse click. + * + * @param x position on x axis (local to the image) + * @param y position on y axis (local to the image) + */ +void ImageROIViewQtWidget::mouseUpdateROICorners12(int x, int y) { + grabROICorner1FromMousePoint(x, y); + grabROICorner2FromMousePoint(x, y); + refreshROIetAl(); + m_selectionState = IImageROIView::SelectROISecond; +} + +/** + * Change the rectangle while pressing the mouse button. The first + * corner stays at the first click, now only the second corner changes + * to the new mouse position. On release of the mouse button we'll get + * to mouseFinishROICorner2() and end the selection of the ROI. + * + * @param x position on x axis (local to the image) + * @param y position on y axis (local to the image) + */ +void ImageROIViewQtWidget::mouseUpdateROICorner2(int x, int y) { + grabROICorner2FromMousePoint(x, y); + refreshROIetAl(); +} + +/** + * End of ROI selection (or mouse button release after clicking once + * and move, all after pushing "select ROI". The second corner of the + * rectangle is set at the current position. + * + * @param x position on x axis (local to the image) + * @param y position on y axis (local to the image) + */ +void ImageROIViewQtWidget::mouseFinishROI(int x, int y) { + grabROICorner2FromMousePoint(x, y); + refreshROIetAl(); + m_presenter->notify(IImageROIPresenter::FinishedROI); +} + +void ImageROIViewQtWidget::mouseUpdateNormAreaCorners12(int x, int y) { + grabNormAreaCorner1FromMousePoint(x, y); + grabNormAreaCorner2FromMousePoint(x, y); + refreshROIetAl(); + m_selectionState = IImageROIView::SelectNormAreaSecond; +} + +void ImageROIViewQtWidget::mouseUpdateNormAreaCorner2(int x, int y) { + grabNormAreaCorner2FromMousePoint(x, y); + refreshROIetAl(); +} + +void ImageROIViewQtWidget::mouseFinishNormArea(int x, int y) { + grabNormAreaCorner2FromMousePoint(x, y); + refreshROIetAl(); + m_presenter->notify(IImageROIPresenter::FinishedNormalization); +} + +void ImageROIViewQtWidget::readSettings() { + QSettings qs; + qs.beginGroup(QString::fromStdString(m_settingsGroup)); + restoreGeometry(qs.value("interface-win-geometry").toByteArray()); + qs.endGroup(); +} + +void ImageROIViewQtWidget::closeEvent(QCloseEvent *event) { + m_presenter->notify(IImageROIPresenter::ShutDown); + event->accept(); +} + +} // namespace CustomInterfaces +} // namespace MantidQt diff --git a/MantidQt/CustomInterfaces/src/Tomography/ImageStackPreParams.cpp b/MantidQt/CustomInterfaces/src/Tomography/ImageStackPreParams.cpp new file mode 100644 index 0000000000000000000000000000000000000000..60d8a1e2bd0dbc8a26e01cb9dcae0898e0a27395 --- /dev/null +++ b/MantidQt/CustomInterfaces/src/Tomography/ImageStackPreParams.cpp @@ -0,0 +1,13 @@ +#include "MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h" + +using namespace MantidQt::CustomInterfaces; + +namespace MantidQt { +namespace CustomInterfaces { + +ImageStackPreParams::ImageStackPreParams() +{ + +} +} // namespace CustomInterfaces +} // namespace MantidQt diff --git a/MantidQt/CustomInterfaces/src/Tomography/StackOfImagesDirs.cpp b/MantidQt/CustomInterfaces/src/Tomography/StackOfImagesDirs.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d8be84c4a5db207fb1285d9888532c6e30c86fe3 --- /dev/null +++ b/MantidQt/CustomInterfaces/src/Tomography/StackOfImagesDirs.cpp @@ -0,0 +1,129 @@ +#include "MantidQtCustomInterfaces/Tomography/StackOfImagesDirs.h" + +#include <boost/algorithm/string.hpp> + +#include <Poco/DirectoryIterator.h> +#include <Poco/Path.h> + +namespace MantidQt { +namespace CustomInterfaces { + +const std::string StackOfImagesDirs::g_descr = + "A directory (folder) that contains subdirectories with names " + "starting with:\n- 'Data' (for sample images),\n- 'Flat' (for white " + "bean images),\n- 'Dark' (for dark images)\nThe first one is " + "mandatory whereas the other two are optional."; + +const std::string StackOfImagesDirs::g_sampleNamePrefix = "data"; +const std::string StackOfImagesDirs::g_flatNamePrefix = "flat"; +const std::string StackOfImagesDirs::g_darkNamePrefix = "dark"; +const std::string StackOfImagesDirs::g_processedNamePrefix = "processed"; +const std::string StackOfImagesDirs::g_prefilteredNamePrefix = "pre_filtered"; + +StackOfImagesDirs::StackOfImagesDirs(const std::string &path) + : m_valid(false), m_statusDescStr("Constructed, no checks done yet.") { + findStackDirs(path); +} + +std::string StackOfImagesDirs::description() const { return g_descr; } + +std::string StackOfImagesDirs::status() const { + if (m_valid) + return "Stack of images is correct"; + else + return "There are errors in the directories and/or files. " + + m_statusDescStr; +} + +std::vector<std::string> StackOfImagesDirs::sampleFiles() const { + return findImgFiles(m_sampleDir); +} +std::vector<std::string> StackOfImagesDirs::flatFiles() const { + return findImgFiles(m_flatDir); +} +std::vector<std::string> StackOfImagesDirs::darkFiles() const { + return findImgFiles(m_darkDir); +} + +void StackOfImagesDirs::findStackDirs(const std::string &path) { + if (path.empty()) + return; + + Poco::File dir(path); + if (!dir.isDirectory() || !dir.exists()) + return; + + Poco::DirectoryIterator end; + for (Poco::DirectoryIterator it(dir); it != end; ++it) { + if (!it->isDirectory()) { + continue; + } + + const std::string name = it.name(); + + // case insensitive comparison against expected pattersn: data_*, flat_*, + // dark_*, etc. + if (boost::iequals(name.substr(0, g_sampleNamePrefix.length()), + g_sampleNamePrefix)) { + m_sampleDir = it.path().toString(); + } else if (boost::iequals(name.substr(0, g_flatNamePrefix.length()), + g_flatNamePrefix)) { + m_flatDir = name; + } else if (boost::iequals(name.substr(0, g_darkNamePrefix.length()), + g_darkNamePrefix)) { + m_darkDir = name; + } + } + + if (m_sampleDir.empty()) { + m_statusDescStr = "The the sample images directory (" + g_sampleNamePrefix + + "...) has not been found."; + return; + } + + // can be valid only if we get here. There must be at least one entry that is + // a file + Poco::Path samplesPath(m_sampleDir); + for (Poco::DirectoryIterator it(samplesPath); it != end; ++it) { + if (it->isFile()) { + m_valid = true; + break; + } + } + + if (m_valid) { + m_statusDescStr = "all checks passed"; + } else { + m_statusDescStr = "No files were found in the sample images directory (" + + g_sampleNamePrefix + "...)."; + } +} + +std::vector<std::string> +StackOfImagesDirs::findImgFiles(const std::string &path) const { + std::vector<std::string> fnames; + Poco::File dir(path); + if (!dir.isDirectory() || !dir.exists()) + return fnames; + + // as an alternative could also use Poco::Glob to find the files + Poco::DirectoryIterator it(dir); + Poco::DirectoryIterator end; + while (it != end) { + // TODO: filter names by extension? + // const std::string name = it.name(); + if (it->isFile()) { + fnames.push_back(it.path().toString()); + } + + ++it; + } + + // this assumes the usual sorting of images of a stack (directory): a prefix, + // and a sequence number (with a fixed number of digits). + std::sort(fnames.begin(), fnames.end()); + return fnames; +} + +} // namespace CustomInterfaces +} // namespace MantidQt diff --git a/MantidQt/CustomInterfaces/src/Tomography/TomographyIfacePresenter.cpp b/MantidQt/CustomInterfaces/src/Tomography/TomographyIfacePresenter.cpp index 59ae96f3caed1ffa8f76c7fbb143fcdb94a95c34..ef2cad5f09bddc06fd38dd9c798e60f91e150e41 100644 --- a/MantidQt/CustomInterfaces/src/Tomography/TomographyIfacePresenter.cpp +++ b/MantidQt/CustomInterfaces/src/Tomography/TomographyIfacePresenter.cpp @@ -310,7 +310,6 @@ void TomographyIfacePresenter::processLogMsg() { std::vector<std::string> msgs = m_view->logMsgs(); for (size_t i = 0; i < msgs.size(); i++) { m_model->logMsg(msgs[i]); - break; } } diff --git a/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceViewQtGUI.cpp b/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceViewQtGUI.cpp index c280ce58fce36a8d851ee1ad68804b38bf4fdd47..48fef5a235172ab657810b05bc0b1f4314753bc7 100644 --- a/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceViewQtGUI.cpp +++ b/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceViewQtGUI.cpp @@ -3,6 +3,7 @@ #include "MantidQtAPI/AlgorithmInputHistory.h" #include "MantidQtAPI/AlgorithmRunner.h" #include "MantidQtAPI/HelpWindow.h" +#include "MantidQtCustomInterfaces/Tomography/ImageROIViewQtWidget.h" #include "MantidQtCustomInterfaces/Tomography/TomographyIfaceViewQtGUI.h" #include "MantidQtCustomInterfaces/Tomography/TomographyIfacePresenter.h" #include "MantidQtCustomInterfaces/Tomography/ToolConfigAstraToolbox.h" @@ -65,12 +66,27 @@ void TomographyIfaceViewQtGUI::initLayout() { // setup container ui m_ui.setupUi(this); // add tab contents and set up their ui's - QWidget *tab1w = new QWidget(m_ui.tabMain); - m_uiTabRun.setupUi(tab1w); - m_ui.tabMain->addTab(tab1w, QString("Run")); - QWidget *tab2w = new QWidget(m_ui.tabMain); - m_uiTabSetup.setupUi(tab2w); - m_ui.tabMain->addTab(tab2w, QString("Setup")); + QWidget *tabRunW = new QWidget(m_ui.tabMain); + m_uiTabRun.setupUi(tabRunW); + m_ui.tabMain->addTab(tabRunW, QString("Run")); + QWidget *tabSetupW = new QWidget(m_ui.tabMain); + m_uiTabSetup.setupUi(tabSetupW); + m_ui.tabMain->addTab(tabSetupW, QString("Setup")); + + ImageROIViewQtWidget *tabROIW = new ImageROIViewQtWidget(m_ui.tabMain); + m_ui.tabMain->addTab(tabROIW, QString("ROI etc.")); + + QWidget *tabFiltersW = new QWidget(); + m_ui.tabMain->addTab(tabFiltersW, QString("Filters")); + + QWidget *tabVizW = new QWidget(); + m_ui.tabMain->addTab(tabVizW, QString("Visualize")); + + QWidget *tabConvertW = new QWidget(); + m_ui.tabMain->addTab(tabConvertW, QString("Convert")); + + QWidget *tabEBandsW = new QWidget(); + m_ui.tabMain->addTab(tabEBandsW, QString("Energy bands")); readSettings(); diff --git a/MantidQt/CustomInterfaces/src/Tomography/ToolConfig.cpp b/MantidQt/CustomInterfaces/src/Tomography/ToolConfig.cpp index 08391894c2eca282554ed2106c4db5f3a7f05a86..feb959472f6907482fb64850c5e862ecd2cb79cb 100644 --- a/MantidQt/CustomInterfaces/src/Tomography/ToolConfig.cpp +++ b/MantidQt/CustomInterfaces/src/Tomography/ToolConfig.cpp @@ -2,12 +2,15 @@ #include "MantidQtCustomInterfaces/Tomography/ToolConfigCustom.h" #include "MantidQtCustomInterfaces/Tomography/ToolConfigTomoPy.h" - #include <boost/lexical_cast.hpp> namespace MantidQt { namespace CustomInterfaces { +ToolConfigTomoPy::ToolConfigTomoPy() + : TomoRecToolConfig(""), m_pathOut(""), m_pathDark(""), m_pathOpen(""), + m_pathSample(""), m_centerRot(.0), m_angleMin(.0), m_angleMax(180.0) {} + ToolConfigTomoPy::ToolConfigTomoPy(const std::string &runnable, const std::string &pathOut, const std::string &pathDark, @@ -28,6 +31,10 @@ std::string ToolConfigTomoPy::makeCmdLineOptions() const { boost::lexical_cast<std::string>(m_centerRot); } +ToolConfigAstraToolbox::ToolConfigAstraToolbox() + : TomoRecToolConfig(""), m_centerRot(.0), m_angleMin(.0), m_angleMax(180.0), + m_pathOut(""), m_pathDark(""), m_pathOpen(""), m_pathSample("") {} + ToolConfigAstraToolbox::ToolConfigAstraToolbox( const std::string &runnable, double centerRot, double angleMin, double angleMax, const std::string &pathOut, const std::string &pathDark, diff --git a/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h b/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h index 86e42f3506fdad1ff4d89b1275cabaa82ce0b8a3..ff393f001040ee9c575bd02765bea5c3457bebce 100644 --- a/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h +++ b/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h @@ -51,8 +51,8 @@ public: MOCK_METHOD1(setAvailablePeriods, void(const std::vector<std::string>&)); MOCK_METHOD2(setTimeLimits, void(double,double)); MOCK_METHOD2(setTimeRange, void(double,double)); - MOCK_METHOD0(setWaitingCursor, void()); - MOCK_METHOD0(restoreCursor, void()); + MOCK_METHOD0(disableAll, void()); + MOCK_METHOD0(enableAll, void()); MOCK_METHOD0(help, void()); void requestLoading() { emit loadRequested(); } @@ -116,7 +116,7 @@ public: void test_defaultLoad() { InSequence s; - EXPECT_CALL(*m_view, setWaitingCursor()); + EXPECT_CALL(*m_view, disableAll()); EXPECT_CALL(*m_view, setDataCurve(AllOf(Property(&QwtData::size,3), QwtDataX(0, 1350, 1E-8), @@ -130,7 +130,7 @@ public: VectorValue(1,1.284E-3,1E-6), VectorValue(2,1.280E-3,1E-6)))); - EXPECT_CALL(*m_view, restoreCursor()); + EXPECT_CALL(*m_view, enableAll()); m_view->requestLoading(); } @@ -232,7 +232,7 @@ public: ON_CALL(*m_view, deadTimeType()).WillByDefault(Return("FromRunData")); EXPECT_CALL(*m_view, deadTimeType()).Times(2); EXPECT_CALL(*m_view, deadTimeFile()).Times(0); - EXPECT_CALL(*m_view, restoreCursor()).Times(1); + EXPECT_CALL(*m_view, enableAll()).Times(1); EXPECT_CALL(*m_view, setDataCurve(AllOf(Property(&QwtData::size,3), QwtDataY(0, 0.150616, 1E-3), QwtDataY(1, 0.143444, 1E-3), @@ -251,7 +251,7 @@ public: ON_CALL(*m_view, deadTimeType()).WillByDefault(Return("FromSpecifiedFile")); EXPECT_CALL(*m_view, deadTimeType()).Times(2); EXPECT_CALL(*m_view, deadTimeFile()).Times(1); - EXPECT_CALL(*m_view, restoreCursor()).Times(1); + EXPECT_CALL(*m_view, enableAll()).Times(1); m_view->requestLoading(); } @@ -264,7 +264,7 @@ public: ON_CALL(*m_view, getBackwardGrouping()).WillByDefault(Return("1-32")); EXPECT_CALL(*m_view, getForwardGrouping()).Times(1); EXPECT_CALL(*m_view, getBackwardGrouping()).Times(1); - EXPECT_CALL(*m_view, restoreCursor()).Times(1); + EXPECT_CALL(*m_view, enableAll()).Times(1); EXPECT_CALL(*m_view, setDataCurve(AllOf(Property(&QwtData::size, 3), QwtDataX(0, 1350, 1E-8), QwtDataX(1, 1360, 1E-8), diff --git a/MantidQt/CustomInterfaces/test/ImageROIPresenterTest.h b/MantidQt/CustomInterfaces/test/ImageROIPresenterTest.h new file mode 100644 index 0000000000000000000000000000000000000000..56cb937e2c3046ab444d0fe1540a5c5601d4600d --- /dev/null +++ b/MantidQt/CustomInterfaces/test/ImageROIPresenterTest.h @@ -0,0 +1,320 @@ +#ifndef MANTID_CUSTOMINTERFACES_IMAGEROIPRESENTERTEST_H +#define MANTID_CUSTOMINTERFACES_IMAGEROIPRESENTERTEST_H + +#include "MantidAPI/FrameworkManager.h" +#include "MantidAPI/MatrixWorkspace.h" +#include "MantidQtCustomInterfaces/Tomography/ImageROIPresenter.h" + +#include <cxxtest/TestSuite.h> + +#include <Poco/File.h> + +#include "ImageROIViewMock.h" + +using namespace MantidQt::CustomInterfaces; +using testing::TypedEq; +using testing::Return; + +class ImageROIPresenterTest : 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 ImageROIPresenterTest *createSuite() { + return new ImageROIPresenterTest(); + } + + static void destroySuite(ImageROIPresenterTest *suite) { delete suite; } + + ImageROIPresenterTest() { + Mantid::API::FrameworkManager::Instance(); // make sure the framework is + // initialized + } + + void setUp() { + m_view.reset(new testing::NiceMock<MockImageROIView>()); + m_presenter.reset( + new MantidQt::CustomInterfaces::ImageROIPresenter(m_view.get())); + } + + void tearDown() { + TS_ASSERT(testing::Mock::VerifyAndClearExpectations(m_view.get())); + } + + void test_initOK() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + EXPECT_CALL(mockView, setParams(testing::_)).Times(1); + + // No errors/warnings + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0); + + pres.notify(ImageROIPresenter::Init); + } + + void test_initWithWrongParams() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + EXPECT_CALL(mockView, setParams(testing::_)).Times(1); + + // One error, no warnings + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0); + + pres.notify(ImageROIPresenter::Init); + } + + void xxtest_browseImg_EmptyPath() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + EXPECT_CALL(mockView, askImgOrStackPath()).Times(1).WillOnce(Return("")); + + // No error, no warnings, just ignored + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0); + + // should not get there: + EXPECT_CALL(mockView, showStack(testing::An<const std::string &>())) + .Times(0); + EXPECT_CALL(mockView, + showStack(testing::An<Mantid::API::WorkspaceGroup_sptr &>())) + .Times(0); + EXPECT_CALL(mockView, updateImgWithIndex(testing::_)).Times(0); + + pres.notify(IImageROIPresenter::BrowseImgOrStack); + } + + void xxtest_newImg_EmptyPath() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + EXPECT_CALL(mockView, askImgOrStackPath()).Times(0); + + // No error, one warning pop-up because a stack is not found + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(1); + + // should not get there because there's no stack/img - it's just ignored: + EXPECT_CALL(mockView, showStack(testing::An<const std::string &>())) + .Times(0); + EXPECT_CALL(mockView, + showStack(testing::An<Mantid::API::WorkspaceGroup_sptr &>())) + .Times(0); + EXPECT_CALL(mockView, updateImgWithIndex(testing::_)).Times(0); + + pres.notify(IImageROIPresenter::NewImgOrStack); + } + + void test_browseImg_WrongPath() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + EXPECT_CALL(mockView, askImgOrStackPath()) + .Times(1) + .WillOnce(Return("dont_look_for_me_i_dont_exist")); + + // A warning + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(1); + + // should not get there because there's no stack/img + EXPECT_CALL(mockView, showStack(testing::An<const std::string &>())) + .Times(0); + EXPECT_CALL(mockView, + showStack(testing::An<Mantid::API::WorkspaceGroup_sptr &>())) + .Times(0); + EXPECT_CALL(mockView, updateImgWithIndex(testing::_)).Times(0); + + // this exception is currently handled, and a warning given + //TSM_ASSERT_THROWS("There should be an exception if there is an unexpected " + // "error with the images path", + // pres.notify(IImageROIPresenter::BrowseImgOrStack), + // Poco::FileNotFoundException); + pres.notify(IImageROIPresenter::BrowseImgOrStack); + } + + void test_updateImgIndex() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + int idx = 0; + EXPECT_CALL(mockView, currentImgIndex()).Times(1).WillOnce(Return(idx)); + + EXPECT_CALL(mockView, updateImgWithIndex(idx)).Times(1); + + // No errors, no warnings + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0); + + pres.notify(IImageROIPresenter::UpdateImgIndex); + } + + void test_selectCoR() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + EXPECT_CALL(mockView, changeSelectionState(IImageROIView::SelectCoR)) + .Times(1); + + // No errors, no warnings + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0); + + pres.notify(IImageROIPresenter::SelectCoR); + } + + void test_resetCoR() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + EXPECT_CALL(mockView, resetCoR()).Times(1); + EXPECT_CALL(mockView, changeSelectionState(IImageROIView::SelectNone)) + .Times(1); + + // just a few calls that should not happen + EXPECT_CALL(mockView, resetROI()).Times(0); + EXPECT_CALL(mockView, showStack(testing::An<const std::string &>())) + .Times(0); + EXPECT_CALL(mockView, + showStack(testing::An<Mantid::API::WorkspaceGroup_sptr &>())) + .Times(0); + EXPECT_CALL(mockView, updateImgWithIndex(testing::_)).Times(0); + + // No errors, no warnings + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0); + + pres.notify(IImageROIPresenter::ResetCoR); + } + + void test_selectROI() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + EXPECT_CALL(mockView, changeSelectionState(IImageROIView::SelectROIFirst)) + .Times(1); + + // No errors, no warnings + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0); + + pres.notify(IImageROIPresenter::SelectROI); + } + + void test_finishROI() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + EXPECT_CALL(mockView, changeSelectionState(IImageROIView::SelectNone)) + .Times(1); + + // No errors, no warnings + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0); + + pres.notify(IImageROIPresenter::FinishedROI); + } + + void test_resetROI() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + EXPECT_CALL(mockView, resetROI()).Times(1); + EXPECT_CALL(mockView, changeSelectionState(IImageROIView::SelectNone)) + .Times(1); + + // just a few calls that should not happen + EXPECT_CALL(mockView, resetCoR()).Times(0); + EXPECT_CALL(mockView, showStack(testing::An<const std::string &>())) + .Times(0); + EXPECT_CALL(mockView, + showStack(testing::An<Mantid::API::WorkspaceGroup_sptr &>())) + .Times(0); + EXPECT_CALL(mockView, updateImgWithIndex(testing::_)).Times(0); + + // No errors, no warnings + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0); + + pres.notify(IImageROIPresenter::ResetROI); + } + + void test_selectNormalization() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + EXPECT_CALL(mockView, changeSelectionState( + IImageROIView::SelectNormAreaFirst)).Times(1); + + // No errors, no warnings + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0); + + pres.notify(IImageROIPresenter::SelectNormalization); + } + + void test_finishNormalization() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + EXPECT_CALL(mockView, changeSelectionState(IImageROIView::SelectNone)) + .Times(1); + + // No errors, no warnings + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0); + + pres.notify(IImageROIPresenter::FinishedNormalization); + } + + void test_resetNormalization() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + EXPECT_CALL(mockView, resetNormArea()).Times(1); + EXPECT_CALL(mockView, changeSelectionState(IImageROIView::SelectNone)) + .Times(1); + + // just a few calls that should not happen + EXPECT_CALL(mockView, resetCoR()).Times(0); + EXPECT_CALL(mockView, resetROI()).Times(0); + EXPECT_CALL(mockView, showStack(testing::An<const std::string &>())) + .Times(0); + EXPECT_CALL(mockView, + showStack(testing::An<Mantid::API::WorkspaceGroup_sptr &>())) + .Times(0); + EXPECT_CALL(mockView, updateImgWithIndex(testing::_)).Times(0); + + // No errors, no warnings + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0); + + pres.notify(IImageROIPresenter::ResetNormalization); + } + + void test_shutDown() { + testing::NiceMock<MockImageROIView> mockView; + MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView); + + EXPECT_CALL(mockView, saveSettings()).Times(1); + // No errors, no warnings + EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0); + EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0); + + pres.notify(ImageROIPresenter::ShutDown); + } + +private: + // boost::shared_ptr + boost::scoped_ptr<testing::NiceMock<MockImageROIView>> m_view; + boost::scoped_ptr<MantidQt::CustomInterfaces::ImageROIPresenter> m_presenter; + + // To have one FITS, etc. + Mantid::API::MatrixWorkspace_sptr m_ws; +}; + +#endif // MANTID_CUSTOMINTERFACES_IMAGEROIPRESENTERTEST_H diff --git a/MantidQt/CustomInterfaces/test/ImageROIViewMock.h b/MantidQt/CustomInterfaces/test/ImageROIViewMock.h new file mode 100644 index 0000000000000000000000000000000000000000..6ba7ebca13e036ac6569eb64b51857e61ae79e44 --- /dev/null +++ b/MantidQt/CustomInterfaces/test/ImageROIViewMock.h @@ -0,0 +1,66 @@ +#ifndef MANTID_CUSTOMINTERFACES_IMAGEROIVIEWMOCK_H +#define MANTID_CUSTOMINTERFACES_IMAGEROIVIEWMOCK_H + +#include "MantidQtCustomInterfaces/Tomography/ITomographyIfaceView.h" + +#include <gmock/gmock.h> + +class MockImageROIView : public MantidQt::CustomInterfaces::IImageROIView { +public: + // void initParams(ImageStackPreParams ¶ms) + MOCK_METHOD1(setParams, + void(MantidQt::CustomInterfaces::ImageStackPreParams &)); + + // ImageStackPreParams userSelection() const; + MOCK_CONST_METHOD0(userSelection, + MantidQt::CustomInterfaces::ImageStackPreParams()); + + // SelectionState selectionState() const; + MOCK_CONST_METHOD0(selectionState, SelectionState()); + + // void changeSelectionState(const SelectionState state); + MOCK_METHOD1(changeSelectionState, void(const IImageROIView::SelectionState&)); + + // void showStack(const std::string &path); + MOCK_METHOD1(showStack, void(const std::string &)); + + // void showStack(const Mantid::API::WorkspaceGroup_sptr &ws); + MOCK_METHOD1(showStack, void(Mantid::API::WorkspaceGroup_sptr &)); + + // const Mantid::API::WorkspaceGroup_sptr stack() const; + MOCK_CONST_METHOD0(stack, const Mantid::API::WorkspaceGroup_sptr()); + + // void showProjection(const Mantid::API::WorkspaceGroup_sptr &wsg, size_t idx); + MOCK_METHOD2(showProjection, void(const Mantid::API::WorkspaceGroup_sptr &wsg, size_t idx)); + + // void userWarning(const std::string &warn, const std::string &description) + MOCK_METHOD2(userWarning, + void(const std::string &warn, const std::string &description)); + + // void userError(const std::string &err, const std::string &description) + MOCK_METHOD2(userError, + void(const std::string &err, const std::string &description)); + + // size_t currentImgIndex() const; + MOCK_CONST_METHOD0(currentImgIndex, size_t()); + + // void updateImgWithIndex(size_t idx) + MOCK_METHOD1(updateImgWithIndex, void(size_t)); + + // std::string askImgOrStackPath(); + MOCK_METHOD0(askImgOrStackPath, std::string()); + + // void saveSettings() const {} + MOCK_CONST_METHOD0(saveSettings, void()); + + // void resetCoR() + MOCK_METHOD0(resetCoR, void()); + + // void resetROI() + MOCK_METHOD0(resetROI, void()); + + // void resetNormArea() + MOCK_METHOD0(resetNormArea, void()); +}; + +#endif // MANTID_CUSTOMINTERFACES_IMAGEROIVIEWMOCK_H diff --git a/MantidQt/CustomInterfaces/test/StackOfImagesDirsTest.h b/MantidQt/CustomInterfaces/test/StackOfImagesDirsTest.h new file mode 100644 index 0000000000000000000000000000000000000000..641dd70eb5d6e709690c04aa1560be5b0d8a9eb6 --- /dev/null +++ b/MantidQt/CustomInterfaces/test/StackOfImagesDirsTest.h @@ -0,0 +1,111 @@ +#ifndef MANTID_CUSTOMINTERFACES_STACKOFIMAGESDIRSTEST_H +#define MANTID_CUSTOMINTERFACES_STACKOFIMAGESDIRSTEST_H + +#include "MantidAPI/FrameworkManager.h" +#include "MantidQtCustomInterfaces/Tomography/StackOfImagesDirs.h" + +#include <boost/scoped_ptr.hpp> + +#include <cxxtest/TestSuite.h> + +using namespace MantidQt::CustomInterfaces; + +class StackOfImagesDirsTest : 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 StackOfImagesDirsTest *createSuite() { + return new StackOfImagesDirsTest(); + } + + static void destroySuite(StackOfImagesDirsTest *suite) { delete suite; } + + StackOfImagesDirsTest() { + Mantid::API::FrameworkManager::Instance(); // make sure the framework is + // initialized + } + + void setUp() { + // just to test more dynamic allocation + m_soid.reset(new StackOfImagesDirs("")); + } + + void tearDown() {} + + void test_construct() { + StackOfImagesDirs obj(""); + + TSM_ASSERT("A stack just constructed with an empty path string should not " + "be valid", + !obj.isValid()); + } + + void test_description() { + StackOfImagesDirs obj(""); + + TS_ASSERT_THROWS_NOTHING(obj.description()); + TSM_ASSERT("A description string should be produced", + "" != obj.description()); + } + + void test_status() { + StackOfImagesDirs obj(""); + + TS_ASSERT_THROWS_NOTHING(obj.description()); + TSM_ASSERT("A status string should be produced", "" != obj.status()); + } + + void test_sampleImagesDir() { + StackOfImagesDirs obj(""); + + TS_ASSERT_THROWS_NOTHING(obj.description()); + TSM_ASSERT("The sample images directory of an empty stack should be empty", + "" == obj.sampleImagesDir()); + } + + void test_flatImagesDir() { + StackOfImagesDirs obj(""); + + TS_ASSERT_THROWS_NOTHING(obj.description()); + TSM_ASSERT("The flat images directory of an empty stack should be empty", + "" == obj.flatImagesDir()); + } + + void test_darkImagesDir() { + StackOfImagesDirs obj(""); + + TS_ASSERT_THROWS_NOTHING(obj.description()); + TSM_ASSERT("The dark images directory of an empty stack should be empty", + "" == obj.flatImagesDir()); + } + + void test_sampleFiles() { + StackOfImagesDirs obj(""); + + TS_ASSERT_THROWS_NOTHING(obj.description()); + TSM_ASSERT("There should not be any sample files in an empty stack", + 0 == obj.sampleImagesDir().size()); + } + + void test_flatFiles() { + StackOfImagesDirs obj(""); + + TS_ASSERT_THROWS_NOTHING(obj.description()); + TSM_ASSERT("There should not be any flat image files in an empty stack", + 0 == obj.flatImagesDir().size()); + } + + void test_darkFiles() { + StackOfImagesDirs obj(""); + + TS_ASSERT_THROWS_NOTHING(obj.description()); + TSM_ASSERT("There should not be any dark image files in an empty stack", + 0 == obj.darkImagesDir().size()); + } + +private: + boost::scoped_ptr<StackOfImagesDirs> m_soid; +}; + +#endif /* MANTID_CUSTOMINTERFACES_STACKOFIMAGESDIRSTEST_H */ diff --git a/MantidQt/Factory/test/WidgetFactoryTest.h b/MantidQt/Factory/test/WidgetFactoryTest.h index c1c0ba1a3b2cf56e972b3fb63b33bee18c07d904..c71fdc3eb2f0b2adcb22296c1022943e81b60e05 100644 --- a/MantidQt/Factory/test/WidgetFactoryTest.h +++ b/MantidQt/Factory/test/WidgetFactoryTest.h @@ -4,8 +4,6 @@ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include "MantidFactory/WidgetFactory.h" diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/InputController.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/InputController.h index 6c2b3ab4330b8d0449a41efd133838c1cdd18e17..7d9e9547ac954f6f44286ed5227efabd958fe6d9 100644 --- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/InputController.h +++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/InputController.h @@ -5,6 +5,7 @@ #include <QObject> #include <QRect> #include <QColor> +#include <QPolygonF> class QMouseEvent; class QWheelEvent; @@ -31,6 +32,7 @@ class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS InputController : public QObject { Q_OBJECT public: explicit InputController(QObject *parent, bool contextAllowed = true); + virtual ~InputController(){} virtual void mousePressEvent(QMouseEvent *) {} virtual void mouseMoveEvent(QMouseEvent *) {} @@ -197,37 +199,100 @@ private: }; /** - Controller for moving the instrument on an unwrapped surface. + Controller for free drawing on an unwrapped surface. */ -class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS InputControllerErase : public InputController { +class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS InputControllerDraw : public InputController { Q_OBJECT public: - InputControllerErase(QObject *parent); - ~InputControllerErase(); + InputControllerDraw(QObject *parent); + ~InputControllerDraw(); virtual void mousePressEvent(QMouseEvent *); virtual void mouseMoveEvent(QMouseEvent *); virtual void mouseReleaseEvent(QMouseEvent *); virtual void wheelEvent(QWheelEvent *); - virtual void onPaint(QPainter &); virtual void enterEvent(QEvent *); virtual void leaveEvent(QEvent *); -signals: - void erase(const QRect &); +protected: + int cursorSize() const {return m_size;} + bool isLeftButtonPressed() const {return m_isLeftButtonPressed;} + bool isRightButtonPressed() const {return m_isRightButtonPressed;} + bool isActive() const {return m_isActive;} private: - void drawCursor(); + void redrawCursor(); + virtual void signalLeftClick() = 0; + virtual void signalRightClick(); + virtual void drawCursor(QPixmap *cursor) = 0; + virtual void setPosition(const QPoint &pos) = 0; + virtual void resize() = 0; const int m_max_size; - int m_size; ///< Size of the eraser - bool m_isButtonPressed; + int m_size; ///< Size of the cursor + bool m_isLeftButtonPressed; + bool m_isRightButtonPressed; bool m_isActive; - QRect m_rect; QPixmap *m_cursor; +}; + +/** + Controller for erasing peaks on an unwrapped surface. + */ +class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS InputControllerErase : public InputControllerDraw { + Q_OBJECT + +public: + InputControllerErase(QObject *parent); + ~InputControllerErase(); + void onPaint(QPainter &); + +signals: + void erase(const QRect &); + +private: + void drawCursor(QPixmap *cursor); + void signalLeftClick(); + void setPosition(const QPoint &pos); + void resize(); + + QRect m_rect; QPixmap *m_image; }; + +/** + Controller for drawing and erasing arbitrary shapes on an unwrapped surface. + */ +class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS InputControllerDrawAndErase : public InputControllerDraw { + Q_OBJECT + +public: + InputControllerDrawAndErase(QObject *parent); + +signals: + void draw(const QPolygonF &); + void erase(const QPolygonF &); + void addShape(const QPolygonF &poly, const QColor &borderColor, + const QColor &fillColor); + +public slots: + void startCreatingShape2D(const QColor &borderColor, const QColor &fillColor); + +private: + void drawCursor(QPixmap *cursor); + void signalLeftClick(); + void signalRightClick(); + void setPosition(const QPoint &pos); + void resize(); + void makePolygon(); + + QPoint m_pos; + QPolygonF m_rect; + QColor m_borderColor, m_fillColor; + bool m_creating; +}; + } } diff --git a/MantidQt/MantidWidgets/src/InputController.cpp b/MantidQt/MantidWidgets/src/InputController.cpp index b707dea7b2dd8c6e402b5d0c3b5745f80c846bec..afc5d3d445b33e9739ee4fc1cb6b667c42e17455 100644 --- a/MantidQt/MantidWidgets/src/InputController.cpp +++ b/MantidQt/MantidWidgets/src/InputController.cpp @@ -6,7 +6,7 @@ #include <QCursor> #include <QApplication> -#include <iostream> +#include <cmath> namespace MantidQt { namespace MantidWidgets { @@ -315,112 +315,250 @@ void InputControllerMoveUnwrapped::mouseReleaseEvent(QMouseEvent *) /** * Constructor. */ -InputControllerErase::InputControllerErase(QObject *parent): +InputControllerDraw::InputControllerDraw(QObject *parent): InputController(parent), m_max_size(32), m_size(30), -m_isButtonPressed(false), +m_isLeftButtonPressed(false), +m_isRightButtonPressed(false), m_isActive(false), -m_rect( 0, 0, m_size, m_size ) +m_cursor(NULL) { - m_cursor = new QPixmap(m_max_size,m_max_size); - drawCursor(); - m_image = new QPixmap(":/PickTools/eraser.png"); } -InputControllerErase::~InputControllerErase() +InputControllerDraw::~InputControllerDraw() { delete m_cursor; - delete m_image; } /** * Process the mouse press event. */ -void InputControllerErase::mousePressEvent(QMouseEvent *event) +void InputControllerDraw::mousePressEvent(QMouseEvent *event) { m_isActive = true; - m_rect.moveTopLeft(QPoint(event->x(),event->y())); + setPosition(QPoint(event->x(),event->y())); if (event->button() == Qt::LeftButton) { - m_isButtonPressed = true; - emit erase( m_rect ); + m_isLeftButtonPressed = true; + signalLeftClick(); + } + else if (event->button() == Qt::RightButton) + { + m_isRightButtonPressed = true; + signalRightClick(); } } /** * Process the mouse move event. */ -void InputControllerErase::mouseMoveEvent(QMouseEvent *event) +void InputControllerDraw::mouseMoveEvent(QMouseEvent *event) { m_isActive = true; - m_rect.moveTopLeft(QPoint(event->x(),event->y())); - if ( m_isButtonPressed ) + setPosition(QPoint(event->x(),event->y())); + if ( m_isLeftButtonPressed ) + { + signalLeftClick(); + } + else if ( m_isRightButtonPressed ) { - emit erase( m_rect ); + signalRightClick(); } } /** * Process the mouse button release event. */ -void InputControllerErase::mouseReleaseEvent(QMouseEvent *) +void InputControllerDraw::mouseReleaseEvent(QMouseEvent *event) { - m_isButtonPressed = false; + if (event->button() == Qt::LeftButton) + { + m_isLeftButtonPressed = false; + } + else if (event->button() == Qt::RightButton) + { + m_isRightButtonPressed = false; + } } -void InputControllerErase::wheelEvent(QWheelEvent *event) +void InputControllerDraw::wheelEvent(QWheelEvent *event) { int d = m_size + ( event->delta() > 0 ? 4 : -4 ); if ( d > 2 && d < m_max_size ) { m_size = d; - drawCursor(); + resize(); + redrawCursor(); QApplication::restoreOverrideCursor(); QApplication::setOverrideCursor(QCursor( *m_cursor, 0, 0 )); } } +void InputControllerDraw::enterEvent(QEvent *) +{ + redrawCursor(); + QApplication::setOverrideCursor(QCursor( *m_cursor, 0, 0 )); + m_isActive = true; +} + +void InputControllerDraw::leaveEvent(QEvent *) +{ + QApplication::restoreOverrideCursor(); + m_isActive = false; +} + +void InputControllerDraw::redrawCursor() +{ + if (!m_cursor) + { + m_cursor = new QPixmap(m_max_size,m_max_size); + } + drawCursor(m_cursor); +} + +void InputControllerDraw::signalRightClick() +{ +} + +//-------------------------------------------------------------------------------- + +InputControllerErase::InputControllerErase(QObject *parent): InputControllerDraw(parent), + m_rect( 0, 0, cursorSize(), cursorSize() ) +{ + m_image = new QPixmap(":/PickTools/eraser.png"); +} + +InputControllerErase::~InputControllerErase() +{ + delete m_image; +} + +void InputControllerErase::signalLeftClick() +{ + emit erase(m_rect); +} + void InputControllerErase::onPaint(QPainter& painter) { - if ( m_isActive && !m_isButtonPressed ) + if ( isActive() && !isLeftButtonPressed() ) { painter.drawPixmap(m_rect.bottomRight(),*m_image); } } -void InputControllerErase::enterEvent(QEvent *) +void InputControllerErase::drawCursor(QPixmap *cursor) { - QApplication::setOverrideCursor(QCursor( *m_cursor, 0, 0 )); - m_isActive = true; + cursor->fill(QColor(255,255,255,0)); + QPainter painter( cursor ); + auto size = cursorSize(); + + auto pen = QPen(Qt::DashLine); + QVector<qreal> dashPattern; + dashPattern << 4 << 4; + pen.setDashPattern(dashPattern); + pen.setColor(QColor(0,0,0)); + painter.setPen(pen); + painter.drawRect( QRect( 0, 0, size, size ) ); + + pen.setColor(QColor(255,255,255)); + pen.setDashOffset(4); + painter.setPen(pen); + painter.drawRect( QRect( 0, 0, size, size ) ); } -void InputControllerErase::leaveEvent(QEvent *) +void InputControllerErase::setPosition(const QPoint &pos) { - QApplication::restoreOverrideCursor(); - m_isActive = false; + m_rect.moveTopLeft(pos); +} + +void InputControllerErase::resize() +{ + auto size = cursorSize(); + m_rect.setSize( QSize(size, size) ); +} + +//-------------------------------------------------------------------------------- + +InputControllerDrawAndErase::InputControllerDrawAndErase(QObject *parent): InputControllerDraw(parent), + m_pos(0,0), m_rect(8), m_creating(false) +{ + makePolygon(); +} + +void InputControllerDrawAndErase::makePolygon() +{ + auto r = double(cursorSize()) / 2.0; + double a = 2.0 * M_PI / double(m_rect.size()); + for(int i = 0; i < m_rect.size(); ++i) + { + double ia = double(i) * a; + auto x = r + static_cast<int>(r * cos(ia)); + auto y = r + static_cast<int>(r * sin(ia)); + m_rect[i] = QPointF(x, y); + } +} + +void InputControllerDrawAndErase::signalLeftClick() +{ + auto poly = m_rect.translated(m_pos); + if (m_creating) + { + m_creating = false; + emit addShape(poly, m_borderColor, m_fillColor); + } + else + { + emit draw(poly); + } +} + +void InputControllerDrawAndErase::signalRightClick() +{ + auto poly = m_rect.translated(m_pos); + emit erase(poly); } -void InputControllerErase::drawCursor() +void InputControllerDrawAndErase::drawCursor(QPixmap *cursor) { - m_cursor->fill(QColor(255,255,255,0)); - QPainter painter( m_cursor ); + cursor->fill(QColor(255,255,255,0)); + QPainter painter( cursor ); + + auto bRect = m_rect.boundingRect(); + auto poly = m_rect.translated(-bRect.topLeft()); auto pen = QPen(Qt::DashLine); QVector<qreal> dashPattern; - dashPattern << 4 << 4; + qreal dashLength = cursorSize() < 10 ? 1 : 2; + dashPattern << dashLength << dashLength; pen.setDashPattern(dashPattern); pen.setColor(QColor(0,0,0)); painter.setPen(pen); - painter.drawRect( QRect( 0, 0, m_size, m_size ) ); + painter.drawPolygon(poly); pen.setColor(QColor(255,255,255)); - pen.setDashOffset(4); + pen.setDashOffset(dashLength); painter.setPen(pen); - painter.drawRect( QRect( 0, 0, m_size, m_size ) ); + painter.drawPolygon(poly); +} - m_rect.setSize( QSize(m_size,m_size) ); +void InputControllerDrawAndErase::setPosition(const QPoint &pos) +{ + m_pos = pos; +} + +void InputControllerDrawAndErase::resize() +{ + makePolygon(); } + +void InputControllerDrawAndErase::startCreatingShape2D(const QColor &borderColor, const QColor &fillColor) +{ + m_borderColor = borderColor; + m_fillColor = fillColor; + m_creating = true; +} + } } diff --git a/MantidQt/MantidWidgets/src/MantidHelpWindow.cpp b/MantidQt/MantidWidgets/src/MantidHelpWindow.cpp index 110d04a7ce3b306156982e09c7d770337e3c11f1..c599d37c08ed9c471329b6815bba7326ea8d541c 100644 --- a/MantidQt/MantidWidgets/src/MantidHelpWindow.cpp +++ b/MantidQt/MantidWidgets/src/MantidHelpWindow.cpp @@ -6,7 +6,6 @@ #include "MantidKernel/RegistrationHelper.h" #include <boost/make_shared.hpp> #include <boost/lexical_cast.hpp> -#include <iostream> #include <Poco/File.h> #include <Poco/Path.h> #include <QDesktopServices> diff --git a/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp b/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp index 49ba9501a901953737b28baed4496415ab89b8c3..2169429a18df8d1b89d87677a524940365dd3ffe 100644 --- a/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp +++ b/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp @@ -368,28 +368,23 @@ namespace MantidWidgets MatrixWorkspace_sptr ws; - auto load = boost::dynamic_pointer_cast<AlgorithmProxy>( AlgorithmManager::Instance().create("MuonLoad") ); - load->setChild(true); - load->setRethrows(true); - load->copyPropertiesFrom(*m_loadAlg); - - try - { + try { + auto load = AlgorithmManager::Instance().create("MuonLoad"); load->initialize(); - - load->setPropertyValue( "Filename", fileIt->toStdString() ); - load->setPropertyValue( "OutputWorkspace", "__YouDontSeeMeIAmNinja" ); // Is not used - - if ( m_fitPropBrowser->rawData() ) // TODO: or vice verca? - load->setPropertyValue( "RebinParams", "" ); + load->setChild(true); + load->setRethrows(true); + load->updatePropertyValues(*m_loadAlg); + load->setPropertyValue("Filename", fileIt->toStdString()); + load->setPropertyValue("OutputWorkspace", "__YouDontSeeMeIAmNinja"); + if (m_fitPropBrowser->rawData()) // TODO: or vice verca? + load->setPropertyValue("RebinParams", ""); load->execute(); ws = load->getProperty("OutputWorkspace"); - } - catch(...) - { - QMessageBox::critical(this, "Loading failed", + } catch (...) { + QMessageBox::critical( + this, "Loading failed", "Unable to load one of the files.\n\nCheck log for details"); break; } diff --git a/MantidQt/MantidWidgets/src/ScriptEditor.cpp b/MantidQt/MantidWidgets/src/ScriptEditor.cpp index 5e4c2bdfdc1e08b8674f9fe6e1656ad1400032d5..c43f2cfbb1a1d9c4097ab94b1005affc319fd729 100644 --- a/MantidQt/MantidWidgets/src/ScriptEditor.cpp +++ b/MantidQt/MantidWidgets/src/ScriptEditor.cpp @@ -33,7 +33,6 @@ // std #include <cmath> -#include <iostream> #include <stdexcept> //*************************************************************************** diff --git a/MantidQt/MantidWidgets/src/StringDialogEditor.cpp b/MantidQt/MantidWidgets/src/StringDialogEditor.cpp index e84f62ba44425c25dad7ad366840415801fea769..ade129f78b7cec64e1695fcdae8387ba1a1ba1c2 100644 --- a/MantidQt/MantidWidgets/src/StringDialogEditor.cpp +++ b/MantidQt/MantidWidgets/src/StringDialogEditor.cpp @@ -8,7 +8,6 @@ #include <QDialog> #include <QSettings> -#include <iostream> /** * Do nothing to connect a manager. diff --git a/MantidQt/RefDetectorViewer/src/RefDetectorViewDemo.cpp b/MantidQt/RefDetectorViewer/src/RefDetectorViewDemo.cpp index e2ea0e8b756fe4cea00cad7c259f1c9b67ca2e74..1b1e345cf845a06d583b199a8a3cdaa859bdde2b 100644 --- a/MantidQt/RefDetectorViewer/src/RefDetectorViewDemo.cpp +++ b/MantidQt/RefDetectorViewer/src/RefDetectorViewDemo.cpp @@ -1,5 +1,4 @@ -#include <iostream> #include <qapplication.h> #include <QMainWindow> diff --git a/MantidQt/RefDetectorViewer/src/RefIVConnections.cpp b/MantidQt/RefDetectorViewer/src/RefIVConnections.cpp index 42109cf39cb741c66532ba2f48175657f912c1f1..fede037dfe08d334af22b6e2ac84e3a69c6ce4ab 100644 --- a/MantidQt/RefDetectorViewer/src/RefIVConnections.cpp +++ b/MantidQt/RefDetectorViewer/src/RefIVConnections.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <QLineEdit> #include <qwt_plot_canvas.h> diff --git a/MantidQt/RefDetectorViewer/src/RefImageView.cpp b/MantidQt/RefDetectorViewer/src/RefImageView.cpp index d5385cb4dfabf1705b33836cfad1a80b317c0b04..6c35c6eca90f9310165abb98770d2187e8b33ac9 100644 --- a/MantidQt/RefDetectorViewer/src/RefImageView.cpp +++ b/MantidQt/RefDetectorViewer/src/RefImageView.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include "MantidQtRefDetectorViewer/RefImageView.h" #include "MantidQtSpectrumViewer/ColorMaps.h" diff --git a/MantidQt/RefDetectorViewer/src/RefMatrixWSImageView.cpp b/MantidQt/RefDetectorViewer/src/RefMatrixWSImageView.cpp index 91e32036086d49609005d0d6a88c4c2bc5b425cb..f63397e1da6a002c61af56b0009f4e82f0e7347d 100644 --- a/MantidQt/RefDetectorViewer/src/RefMatrixWSImageView.cpp +++ b/MantidQt/RefDetectorViewer/src/RefMatrixWSImageView.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include "MantidQtRefDetectorViewer/RefMatrixWSImageView.h" #include "MantidQtSpectrumViewer/ArrayDataSource.h" #include "MantidQtRefDetectorViewer/RefIVConnections.h" diff --git a/MantidQt/RefDetectorViewer/src/RefRangeHandler.cpp b/MantidQt/RefDetectorViewer/src/RefRangeHandler.cpp index 437a3cc7efab6c8ff53384b2bb074d8bc1ecceb7..a2f7d1d8b70fe1c2a2c23a6b0b45742bd0783a0b 100644 --- a/MantidQt/RefDetectorViewer/src/RefRangeHandler.cpp +++ b/MantidQt/RefDetectorViewer/src/RefRangeHandler.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <QLineEdit> #include "MantidQtRefDetectorViewer/RefRangeHandler.h" diff --git a/MantidQt/RefDetectorViewer/src/RefSliderHandler.cpp b/MantidQt/RefDetectorViewer/src/RefSliderHandler.cpp index 2fc6a2faef46f94b33b14e63c443c04e88a27983..e11b1cbf4651ad74ecfed24339d28e2f569de825 100644 --- a/MantidQt/RefDetectorViewer/src/RefSliderHandler.cpp +++ b/MantidQt/RefDetectorViewer/src/RefSliderHandler.cpp @@ -1,5 +1,4 @@ -#include <iostream> #include <QScrollBar> #include "MantidQtRefDetectorViewer/RefSliderHandler.h" diff --git a/MantidQt/SliceViewer/inc/MantidQtSliceViewer/ColorBarWidget.h b/MantidQt/SliceViewer/inc/MantidQtSliceViewer/ColorBarWidget.h index a6b08722eeee9f4a95503a74710bb2ba8d442f32..c2f95a52d1608a637176d0ed8cd988b66ccf34d2 100644 --- a/MantidQt/SliceViewer/inc/MantidQtSliceViewer/ColorBarWidget.h +++ b/MantidQt/SliceViewer/inc/MantidQtSliceViewer/ColorBarWidget.h @@ -6,7 +6,6 @@ #include <qwt_color_map.h> #include <qwt_scale_widget.h> #include "MantidQtAPI/MantidColorMap.h" -#include <iostream> #include <QKeyEvent> #include <QtGui> #include "DllOption.h" diff --git a/MantidQt/SliceViewer/src/ColorBarWidget.cpp b/MantidQt/SliceViewer/src/ColorBarWidget.cpp index 0f3c72044c8c09bbe04904e703fb789d0e477169..0d07267f6758ba5d21e982224e0d161bbf40ce69 100644 --- a/MantidQt/SliceViewer/src/ColorBarWidget.cpp +++ b/MantidQt/SliceViewer/src/ColorBarWidget.cpp @@ -4,7 +4,6 @@ #include "qwt_scale_div.h" #include "MantidQtAPI/PowerScaleEngine.h" #include <iosfwd> -#include <iostream> #include <qwt_scale_map.h> #include <qwt_scale_widget.h> #include <QKeyEvent> diff --git a/MantidQt/SliceViewer/src/CustomTools.cpp b/MantidQt/SliceViewer/src/CustomTools.cpp index 34439d2e5dce221ff7dc0492d684240de0cfd454..f0a8f6ca9a73528e657fb7715094bfe700e17d03 100644 --- a/MantidQt/SliceViewer/src/CustomTools.cpp +++ b/MantidQt/SliceViewer/src/CustomTools.cpp @@ -1,7 +1,5 @@ #include "MantidQtSliceViewer/CustomTools.h" -#include <iomanip> #include <iosfwd> -#include <iostream> namespace MantidQt { diff --git a/MantidQt/SliceViewer/src/DimensionSliceWidget.cpp b/MantidQt/SliceViewer/src/DimensionSliceWidget.cpp index 7d2892969e789160b0fa17b9d92cfc4b37f306ee..9572cd4842eb5ff001fe9849a8321fed75d67e13 100644 --- a/MantidQt/SliceViewer/src/DimensionSliceWidget.cpp +++ b/MantidQt/SliceViewer/src/DimensionSliceWidget.cpp @@ -1,8 +1,6 @@ #include "MantidQtSliceViewer/DimensionSliceWidget.h" #include "MantidKernel/UnitLabel.h" #include <iosfwd> -#include <iostream> -#include <iomanip> #include <qlayout.h> namespace MantidQt diff --git a/MantidQt/SliceViewer/src/LineOverlay.cpp b/MantidQt/SliceViewer/src/LineOverlay.cpp index b68d0a89adb8c7a8fb8409041db2bb6178765fa8..4a172e3a2b9abaf003ac506deb8d8d4bb82aef08 100644 --- a/MantidQt/SliceViewer/src/LineOverlay.cpp +++ b/MantidQt/SliceViewer/src/LineOverlay.cpp @@ -1,7 +1,6 @@ #include "MantidQtSliceViewer/LineOverlay.h" #include <qwt_plot.h> #include <qwt_plot_canvas.h> -#include <iostream> #include <qpainter.h> #include <QRect> #include <QShowEvent> diff --git a/MantidQt/SliceViewer/src/PeaksTableColumnsDialog.cpp b/MantidQt/SliceViewer/src/PeaksTableColumnsDialog.cpp index 1de3e15906ed4a4ec91005183d2ad4ac03338d36..bde8b1a41bd512e6db1f627a7af807d8becad7f5 100644 --- a/MantidQt/SliceViewer/src/PeaksTableColumnsDialog.cpp +++ b/MantidQt/SliceViewer/src/PeaksTableColumnsDialog.cpp @@ -3,7 +3,6 @@ #include "ui_PeaksTableColumnsDialog.h" // REMOVE -#include <iostream> namespace MantidQt { diff --git a/MantidQt/SliceViewer/src/SliceViewer.cpp b/MantidQt/SliceViewer/src/SliceViewer.cpp index 003b774d559d147bd58d8499864d82b2bd81c4b3..f251baaf4445e9f32142a3d54ea3d16ef6fe62a6 100644 --- a/MantidQt/SliceViewer/src/SliceViewer.cpp +++ b/MantidQt/SliceViewer/src/SliceViewer.cpp @@ -1,6 +1,4 @@ -#include <iomanip> #include <iosfwd> -#include <iostream> #include <limits> #include <sstream> #include <vector> diff --git a/MantidQt/SliceViewer/src/main_ColorBarWidgetDemo.cpp b/MantidQt/SliceViewer/src/main_ColorBarWidgetDemo.cpp index a0fb09e4c9b4bb58d0ddee2733d3effd3be311fe..e15a843addf5892282fac9202ba3da551bc98cf3 100644 --- a/MantidQt/SliceViewer/src/main_ColorBarWidgetDemo.cpp +++ b/MantidQt/SliceViewer/src/main_ColorBarWidgetDemo.cpp @@ -1,6 +1,5 @@ #include "MantidQtSliceViewer/ColorBarWidget.h" #include "qmainwindow.h" -#include <iostream> #include <QApplication> #include <QDir> #include <QMessageBox> diff --git a/MantidQt/SliceViewer/src/main_LineViewerDemo.cpp b/MantidQt/SliceViewer/src/main_LineViewerDemo.cpp index ab70ae54f0271fe4bf4c37cfa2405b75a5aeff61..cd15090523f4ee85b23614b04c3b795b40e11b72 100644 --- a/MantidQt/SliceViewer/src/main_LineViewerDemo.cpp +++ b/MantidQt/SliceViewer/src/main_LineViewerDemo.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <QApplication> #include <QSplashScreen> #include <QMessageBox> diff --git a/MantidQt/SliceViewer/src/main_SliceViewerDemo.cpp b/MantidQt/SliceViewer/src/main_SliceViewerDemo.cpp index cb76eb2a00ba7dcc091b2380be3c8fa129947142..37ce5d6153da9efdc8fd18557ff2fa19f4d6b181 100644 --- a/MantidQt/SliceViewer/src/main_SliceViewerDemo.cpp +++ b/MantidQt/SliceViewer/src/main_SliceViewerDemo.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <QApplication> #include <QSplashScreen> #include <QMessageBox> diff --git a/MantidQt/SliceViewer/src/main_SliceViewerWindowDemo.cpp b/MantidQt/SliceViewer/src/main_SliceViewerWindowDemo.cpp index 0167bc47a4bc670947ec60b07d1b7fb3cb9de8d5..41db0d8e18dc94191842f2690d089868d87bb850 100644 --- a/MantidQt/SliceViewer/src/main_SliceViewerWindowDemo.cpp +++ b/MantidQt/SliceViewer/src/main_SliceViewerWindowDemo.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <QApplication> #include <QSplashScreen> #include <QMessageBox> diff --git a/MantidQt/SpectrumViewer/src/ArrayDataSource.cpp b/MantidQt/SpectrumViewer/src/ArrayDataSource.cpp index f07a4d1fff274132afedc075123d55301a0956df..30953f04ffdcde5c30572b985a691b892834a208 100644 --- a/MantidQt/SpectrumViewer/src/ArrayDataSource.cpp +++ b/MantidQt/SpectrumViewer/src/ArrayDataSource.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <math.h> diff --git a/MantidQt/SpectrumViewer/src/ColorMaps.cpp b/MantidQt/SpectrumViewer/src/ColorMaps.cpp index 9b09dc5da6ff87ffbf88eb1e6993e5262301410e..b140b53c22bafb0599af6efc2fb638afae0b8783 100644 --- a/MantidQt/SpectrumViewer/src/ColorMaps.cpp +++ b/MantidQt/SpectrumViewer/src/ColorMaps.cpp @@ -1,5 +1,4 @@ -#include <iostream> #include <sstream> #include <math.h> diff --git a/MantidQt/SpectrumViewer/src/DataArray.cpp b/MantidQt/SpectrumViewer/src/DataArray.cpp index b18fa1015585a98773ed6764dc13755cb4fb2902..e3c58c8b73203f83d7f76378c28678db3bd9b482 100644 --- a/MantidQt/SpectrumViewer/src/DataArray.cpp +++ b/MantidQt/SpectrumViewer/src/DataArray.cpp @@ -2,7 +2,6 @@ * File DataArray.cpp */ -#include <iostream> #include <math.h> #include "MantidQtSpectrumViewer/DataArray.h" diff --git a/MantidQt/SpectrumViewer/src/EModeHandler.cpp b/MantidQt/SpectrumViewer/src/EModeHandler.cpp index 6176600a7cfde795a86f65d6ce8425e016a9eb7f..3ec420a5f46b67074a5dc8bb45ff47fbdc32b121 100644 --- a/MantidQt/SpectrumViewer/src/EModeHandler.cpp +++ b/MantidQt/SpectrumViewer/src/EModeHandler.cpp @@ -1,10 +1,10 @@ #include <iostream> -#include <QLineEdit> #include "MantidQtSpectrumViewer/EModeHandler.h" #include "MantidQtSpectrumViewer/QtUtils.h" #include "MantidKernel/Logger.h" +#include <QLineEdit> namespace { diff --git a/MantidQt/SpectrumViewer/src/GraphDisplay.cpp b/MantidQt/SpectrumViewer/src/GraphDisplay.cpp index 2cf6a0fdb433a816e7fef527d354594f7128de58..fb458c40088478e07a1b3a7bc941514268b022d4 100644 --- a/MantidQt/SpectrumViewer/src/GraphDisplay.cpp +++ b/MantidQt/SpectrumViewer/src/GraphDisplay.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <QtGui> #include <QVector> #include <QString> diff --git a/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp b/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp index 583079fd990ea83b10b122b2e1ae4ac438dd1a90..4992d41c67bab03a64312e6eb7eb3383f293ab59 100644 --- a/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp +++ b/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp @@ -3,7 +3,6 @@ */ #include <boost/lexical_cast.hpp> -#include <iostream> #include <sstream> #include <math.h> diff --git a/MantidQt/SpectrumViewer/src/MatrixWSSpectrumView.cpp b/MantidQt/SpectrumViewer/src/MatrixWSSpectrumView.cpp index a7622cd74bf117470e53961d4d91e7b9bea8e99c..07f3aa6ea64f2560069afb4caaa5ef794c3086ef 100644 --- a/MantidQt/SpectrumViewer/src/MatrixWSSpectrumView.cpp +++ b/MantidQt/SpectrumViewer/src/MatrixWSSpectrumView.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include "MantidQtSpectrumViewer/MatrixWSSpectrumView.h" #include "MantidAPI/MatrixWorkspace.h" diff --git a/MantidQt/SpectrumViewer/src/RangeHandler.cpp b/MantidQt/SpectrumViewer/src/RangeHandler.cpp index 416b7f2a44461e84f48fb5d5c8ee0d156090ab5d..5f48eb5654681b3bafb2f370b28ab07f6b979d4a 100644 --- a/MantidQt/SpectrumViewer/src/RangeHandler.cpp +++ b/MantidQt/SpectrumViewer/src/RangeHandler.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <QLineEdit> #include "MantidQtSpectrumViewer/RangeHandler.h" diff --git a/MantidQt/SpectrumViewer/src/SVConnections.cpp b/MantidQt/SpectrumViewer/src/SVConnections.cpp index ca5442b9f602b98fb662cc00490f4fd71ce93d79..1d01bd1363492d1c408689f1fb80582408feb90f 100644 --- a/MantidQt/SpectrumViewer/src/SVConnections.cpp +++ b/MantidQt/SpectrumViewer/src/SVConnections.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <qwt_plot_canvas.h> #include <QDesktopServices> diff --git a/MantidQt/SpectrumViewer/src/SliderHandler.cpp b/MantidQt/SpectrumViewer/src/SliderHandler.cpp index d5fec750d75f7ff095511da02ab005be42f79d6c..715029998eacdf4deb8abc781b9b2b9414a24471 100644 --- a/MantidQt/SpectrumViewer/src/SliderHandler.cpp +++ b/MantidQt/SpectrumViewer/src/SliderHandler.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <QScrollBar> #include "MantidQtSpectrumViewer/SliderHandler.h" diff --git a/MantidQt/SpectrumViewer/src/SpectrumDataSource.cpp b/MantidQt/SpectrumViewer/src/SpectrumDataSource.cpp index 510b583f2d4b6993a18de0e986ce017ae024d9d8..680ceb0a500e665e692aa6cb7f7903391db09e9c 100644 --- a/MantidQt/SpectrumViewer/src/SpectrumDataSource.cpp +++ b/MantidQt/SpectrumViewer/src/SpectrumDataSource.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <math.h> diff --git a/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp b/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp index f66bb0b012b50251e8f6ef3d33016b7ce23fa132..408c6d7f79c21773f60b97ea9bcc0078001c5f8b 100644 --- a/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp +++ b/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <sstream> #include <cfloat> diff --git a/MantidQt/SpectrumViewer/src/SpectrumPlotItem.cpp b/MantidQt/SpectrumViewer/src/SpectrumPlotItem.cpp index 1ae3028c5dee447cd2f9ab02dea924b17d3c52ce..84b355b43ed59c8981e4a351feaabd81c9a42d5b 100644 --- a/MantidQt/SpectrumViewer/src/SpectrumPlotItem.cpp +++ b/MantidQt/SpectrumViewer/src/SpectrumPlotItem.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <QThread> #include "MantidQtSpectrumViewer/SpectrumPlotItem.h" diff --git a/MantidQt/SpectrumViewer/src/SpectrumView.cpp b/MantidQt/SpectrumViewer/src/SpectrumView.cpp index 9b01297abec173f4261802af8a946c3693ef28b5..272a637544fa05f57351c722db3fca4a8be882fe 100644 --- a/MantidQt/SpectrumViewer/src/SpectrumView.cpp +++ b/MantidQt/SpectrumViewer/src/SpectrumView.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include "MantidQtSpectrumViewer/SpectrumView.h" #include "MantidAPI/MatrixWorkspace.h" diff --git a/QtPropertyBrowser/src/DoubleEditorFactory.cpp b/QtPropertyBrowser/src/DoubleEditorFactory.cpp index 666130ec533e86688c3390288d89edcd15564f9b..6e93ddb27ccc28408af51011f62f5405f61b7e68 100644 --- a/QtPropertyBrowser/src/DoubleEditorFactory.cpp +++ b/QtPropertyBrowser/src/DoubleEditorFactory.cpp @@ -4,7 +4,6 @@ #include <QDoubleValidator> -#include <iostream> #include <cfloat> #include <sstream> #include <cmath> diff --git a/QtPropertyBrowser/src/qttreepropertybrowser.cpp b/QtPropertyBrowser/src/qttreepropertybrowser.cpp index 53f493d7bee8d791a84e17494c4fdab5350c34ff..63b6b13a9ace25a0f4f8a7199204b4fa24376f9e 100644 --- a/QtPropertyBrowser/src/qttreepropertybrowser.cpp +++ b/QtPropertyBrowser/src/qttreepropertybrowser.cpp @@ -100,7 +100,6 @@ #include <QtGui/qcheckbox.h> #include <QtGui/qlineedit.h> -#include <iostream> #if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE diff --git a/Testing/Data/DocTest/HB3A_exp0406_scan0298.dat.md5 b/Testing/Data/DocTest/HB3A_exp0406_scan0298.dat.md5 new file mode 100644 index 0000000000000000000000000000000000000000..1d23995b3815a9e8457c03d0277dbe8457626dbe --- /dev/null +++ b/Testing/Data/DocTest/HB3A_exp0406_scan0298.dat.md5 @@ -0,0 +1 @@ +82a989552a9d6b41fb0d477b3e26b57a diff --git a/Testing/Data/DocTest/HB3A_exp406_scan0298_0022.xml.md5 b/Testing/Data/DocTest/HB3A_exp406_scan0298_0022.xml.md5 new file mode 100644 index 0000000000000000000000000000000000000000..b02a2cacffa806501e5c08426083152fa419e1f8 --- /dev/null +++ b/Testing/Data/DocTest/HB3A_exp406_scan0298_0022.xml.md5 @@ -0,0 +1 @@ +9891ad8c3a37213308ccb8ba9500989f diff --git a/Vates/VatesAPI/inc/MantidVatesAPI/BoxInfo.h b/Vates/VatesAPI/inc/MantidVatesAPI/BoxInfo.h index b2f5520e9d5c55ec514ab270c3caf020b51200c1..dec4eabbd7d3cd7c9aec07346fcfcada4775bcf6 100644 --- a/Vates/VatesAPI/inc/MantidVatesAPI/BoxInfo.h +++ b/Vates/VatesAPI/inc/MantidVatesAPI/BoxInfo.h @@ -2,7 +2,6 @@ #define MANTID_VATESAPI_BOXINFO_H #include "MantidKernel/System.h" -#include <iostream> #include <boost/optional.hpp> namespace Mantid diff --git a/Vates/VatesAPI/src/vtkNullStructuredGrid.cpp b/Vates/VatesAPI/src/vtkNullStructuredGrid.cpp index a246ffbe36d9d1b3524688f9db95f96e5a657ca9..7947450b22da6c73d4ee8252a95eea5457b8fc21 100644 --- a/Vates/VatesAPI/src/vtkNullStructuredGrid.cpp +++ b/Vates/VatesAPI/src/vtkNullStructuredGrid.cpp @@ -7,7 +7,7 @@ #include <vtkFloatArray.h> #include <vtkSmartPointer.h> #include <vtkStructuredGrid.h> -#include <iostream> + namespace Mantid { namespace VATES { diff --git a/Vates/VatesAPI/test/vtkNullStructuredGridTest.h b/Vates/VatesAPI/test/vtkNullStructuredGridTest.h index b8ecc47ac82ccdb3aed0b4811e5c066c033085af..64a31dfec1469d20dff5306a94db7d4f0529d546 100644 --- a/Vates/VatesAPI/test/vtkNullStructuredGridTest.h +++ b/Vates/VatesAPI/test/vtkNullStructuredGridTest.h @@ -9,7 +9,6 @@ #include <vtkStructuredGrid.h> #include <vtkPoints.h> -#include <iostream> using namespace Mantid::VATES; diff --git a/Vates/VatesSimpleGui/QtWidgets/src/GeometryParser.cpp b/Vates/VatesSimpleGui/QtWidgets/src/GeometryParser.cpp index e8aa4715613c8895ac59bf79898ef0fd591db0f6..28f88d9e6f24210e44346d13a18b719cf9c25a0c 100644 --- a/Vates/VatesSimpleGui/QtWidgets/src/GeometryParser.cpp +++ b/Vates/VatesSimpleGui/QtWidgets/src/GeometryParser.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <sstream> #include "MantidVatesSimpleGuiQtWidgets/GeometryParser.h" diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp index 2a56dae548867a9dd3969297b3b24ad199812192..d215e3aaa5365be30bc86a45144a951818488879 100644 --- a/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp +++ b/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp @@ -1,5 +1,4 @@ #include <cfloat> -#include <iostream> #include "MantidVatesSimpleGuiViewWidgets/ColorSelectionWidget.h" #include "MantidKernel/ConfigService.h" diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp index d5cc40e9793a1ac9ce2792379dbbc078d7068e10..dbf6fd817431f0591b7576ca4777a10e31aa9b97 100644 --- a/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp +++ b/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <vector> #include <set> #include <string> diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp index 65311bdb14ca17768bbf9381059f61cbcf0af138..00e3995b05cd779744b32d892e331ea96c1bbdc3 100644 --- a/Vates/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp +++ b/Vates/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp @@ -36,7 +36,6 @@ #include <QString> -#include <iostream> using namespace Mantid::Geometry; using namespace MantidQt::SliceViewer; diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/ThreesliceView.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/ThreesliceView.cpp index b56216a22074ec3fec22343aef92b3741bf73436..962a116fc526c277ffadd1f32643bdb7623737f4 100644 --- a/Vates/VatesSimpleGui/ViewWidgets/src/ThreesliceView.cpp +++ b/Vates/VatesSimpleGui/ViewWidgets/src/ThreesliceView.cpp @@ -27,9 +27,6 @@ #include <QMessageBox> -#include <iostream> -#include <string> - namespace Mantid { namespace Vates diff --git a/buildconfig/CMake/FindOpenCascade.cmake b/buildconfig/CMake/FindOpenCascade.cmake index 4a32f023d327ce7a4958c2581a073373e1a79d40..a2675606a997fe5ee1ce4e4f43f7e6611f3dae4c 100644 --- a/buildconfig/CMake/FindOpenCascade.cmake +++ b/buildconfig/CMake/FindOpenCascade.cmake @@ -18,7 +18,8 @@ if ( WIN32 ) add_definitions ( -DWNT ) endif ( WIN32 ) -find_path ( OPENCASCADE_LIBRARY_DIR libTKernel.so PATHS +find_path ( OPENCASCADE_LIBRARY_DIR NAMES libTKernel.so libTKernel.dylib PATHS + /usr/local/lib /opt/OpenCASCADE/lib64 $ENV{CASROOT}/lib64 /opt/OpenCASCADE/lib diff --git a/buildconfig/move_class.py b/buildconfig/move_class.py index e51e53c45c28785f805f69b2f99f707b9d2a239b..09b62d51fee7a4296d2b399b93a97d5dfda56511 100755 --- a/buildconfig/move_class.py +++ b/buildconfig/move_class.py @@ -15,32 +15,36 @@ def move_one(subproject, classname, newproject, newclassname, oldfilename, newfi """Move one file """ # Move the file - cmd = "mv " + oldfilename + " " + newfilename - if not args.no_vcs: - cmd = "git " + cmd - print "Running:", cmd - retval = os.system(cmd) - if retval != 0: - raise RuntimeError("Error executing cmd '%s'" % cmd) - - f = open(newfilename, 'r') - text = f.read() - f.close() - - # Replace any includes of it - text = text.replace("Mantid" + subproject + "/" + args.source_subfolder + classname + ".h", - "Mantid" + newproject + "/" + args.dest_subfolder + newclassname + ".h") - - #Replace the guard - old_guard = "MANTID_%s_%s_H_" % (subproject.upper(), classname.upper()) - new_guard = "MANTID_%s_%s_H_" % (newproject.upper(), newclassname.upper()) - text = text.replace(old_guard, new_guard) - - # Replace the namespace declaration - text = text.replace("namespace " + subproject, "namespace " + newproject) - # Replace the conents - f = open(newfilename, 'w') - f.write(text) + try: + cmd = "mv " + oldfilename + " " + newfilename + cmd = cmd.replace("\\","/") + if not args.no_vcs: + cmd = "git " + cmd + print "Running:", cmd + retval = os.system(cmd) + if retval != 0: + raise RuntimeError("Error executing cmd '%s'" % cmd) + + f = open(newfilename, 'r') + text = f.read() + f.close() + + # Replace any includes of it + text = text.replace("Mantid" + subproject + "/" + args.source_subfolder + classname + ".h", + "Mantid" + newproject + "/" + args.dest_subfolder + newclassname + ".h") + + #Replace the guard + old_guard = "MANTID_%s_%s_H_" % (subproject.upper(), classname.upper()) + new_guard = "MANTID_%s_%s_H_" % (newproject.upper(), newclassname.upper()) + text = text.replace(old_guard, new_guard) + + # Replace the namespace declaration + text = text.replace("namespace " + subproject, "namespace " + newproject) + # Replace the conents + f = open(newfilename, 'w') + f.write(text) + except RuntimeError as err: + print err @@ -57,7 +61,7 @@ def move_all(subproject, classname, newproject, newclassname, args): newheaderfile = os.path.join(newbasedir, "inc/" + new_header_folder + "/" + args.dest_subfolder + newclassname + ".h") newsourcefile = os.path.join(newbasedir, "src/" + args.dest_subfolder + newclassname + ".cpp") - newtestfile = os.path.join(newbasedir, "test/" + newclassname + "Test.h") + newtestfile = os.path.join(newbasedir, "test/" + args.dest_subfolder + newclassname + "Test.h") if args.header and not overwrite and os.path.exists(newheaderfile): print "\nError! Header file %s already exists. Use --force to overwrite.\n" % newheaderfile diff --git a/docs/source/algorithms/ConvertCWSDMDtoHKL-v1.rst b/docs/source/algorithms/ConvertCWSDMDtoHKL-v1.rst new file mode 100644 index 0000000000000000000000000000000000000000..9c0672885f008b441c70c8aad1285801ff1aa9e5 --- /dev/null +++ b/docs/source/algorithms/ConvertCWSDMDtoHKL-v1.rst @@ -0,0 +1,108 @@ +.. algorithm:: + +.. summary:: + +.. alias:: + +.. properties:: + +Description +----------- + +This algorithms is to convert an MDEventWorkspace in Q-sample coordinate +to HKL coordindate for a reactor-based four-circle single crystal diffractometer. +Meanwhile, the algorithm is able to export the MDEvents to file. + +Outline of algorithm +#################### + +1. Convert MDEvent's coordinate system + +2. Export MDEvent in Q-sample coordinate and HKL coordinate. + + +Inputs +###### + +**InputWorkspace** is an MDEventWorkspace ???. + +**PeakWorkspace** is an optional input as in many cases especially after calculating UB matrix, ... + +**UBMatrix** is ???. + + +Outputs +####### + +The output is an MDEventWorkspace that... .. + +MDEvent ++++++++ + +Each MDEvent in output MDEventWorkspace contain +* *H* +* *K* +* *L* +* Signal +* Error +* Detector ID +* Run Number + +Compare with ConvertMD +====================== + +Comparing with ???? + +Usage +----- + +**Example - Convert detector counts of an HB3A's measurement to HKL.** + +.. testcode:: ExConvertHB3AToHKL + + # Create input table workspaces for experiment information and virtual instrument parameters + CollectHB3AExperimentInfo(ExperimentNumber='406', ScanList='298', PtLists='-1,22', + DataDirectory='', + GenerateVirtualInstrument=False, + OutputWorkspace='ExpInfoTable', DetectorTableWorkspace='VirtualInstrumentTable') + + # Convert to MDWorkspace + ConvertCWSDExpToMomentum(InputWorkspace='ExpInfoTable', CreateVirtualInstrument=False, + OutputWorkspace='QSampleMD', + Directory='') + + ConvertCWSDMDtoHKL(InputWorkspace='QSampleMD', + UBMatrix='0.13329061, 0.07152342, -0.04215966, 0.01084569, -0.1620849, 0.0007607, -0.14018499, -0.07841385, -0.04002737', + OutputWorkspace='HKLMD') + + + # Examine + mdws = mtd['QSampleMD'] + print 'Output MDEventWorkspace has %d events.'%(mdws.getNEvents()) + + hklws = mtd['HKLMD'] + print 'H: range from %.5f to %.5f.' % (hklws.getXDimension().getMinimum(), hklws.getXDimension().getMaximum()) + print 'K: range from %.5f to %.5f.' % (hklws.getYDimension().getMinimum(), hklws.getYDimension().getMaximum()) + print 'L: range from %.5f to %.5f.' % (hklws.getZDimension().getMinimum(), hklws.getZDimension().getMaximum()) + +.. testcleanup:: ExConvertHB3AToHKL + + DeleteWorkspace(Workspace='QSampleMD') + DeleteWorkspace(Workspace='ExpInfoTable') + DeleteWorkspace(Workspace='VirtualInstrumentTable') + DeleteWorkspace(Workspace='HKLMD') + DeleteWorkspace(Workspace='HB3A_exp0406_scan0298') + DeleteWorkspace(Workspace='spicematrixws') + +Output: + +.. testoutput:: ExConvertHB3AToHKL + + Output MDEventWorkspace has 1631 events. + H: range from -0.24012 to 0.29856. + K: range from -0.41417 to 0.42250. + L: range from 4.83863 to 7.23861. + +.. categories:: + +.. sourcelink:: diff --git a/docs/source/algorithms/DetectorFloodWeighting-v1.rst b/docs/source/algorithms/DetectorFloodWeighting-v1.rst new file mode 100644 index 0000000000000000000000000000000000000000..b248c4b9d900d79aff5dd5ec4825d7438e445d8b --- /dev/null +++ b/docs/source/algorithms/DetectorFloodWeighting-v1.rst @@ -0,0 +1,65 @@ +.. algorithm:: + +.. summary:: + +.. alias:: + +.. properties:: + +Description +----------- +This algorithm is used to calculate the detector flood weighting workspace use for pixel flood corrections. It was originally developed for the ANSTO Bilby instrument. + +This algorithm crops the data over the specified wavelength region, then normalizes each spectrum to the workspace spectrum maxima. The algorithm will then +perform a solid angle correction on each spectra via :ref:`algm-SolidAngle`. + +Usage +----- + +**Example - Simple Generation ** + +.. testcode:: DetectorFloodWeightingExample + + import numpy as np + # create histogram workspace + dataX = range(0,10) # or use dataX=range(0,10) + dataY = [1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2] # or use dataY=[1]*9 + ws = CreateWorkspace(dataX, dataY, NSpec=2, UnitX="Wavelength") + + out_ws = DetectorFloodWeighting(InputWorkspace=ws, Bands=[0,10], SolidAngleCorrection=False) + + print 'Number Histograms',out_ws.getNumberHistograms() + print 'Min X:', out_ws.readX(0)[0], 'Max X:', out_ws.readX(0)[1] + y_data = out_ws.extractY() + print 'Min Y:', np.amin(y_data), 'Max Y:', np.amax(y_data) + +Output: + +.. testoutput:: DetectorFloodWeightingExample + + Number Histograms 2 + Min X: 0.0 Max X: 10.0 + Min Y: 0.5 Max Y: 1.0 + +**Example - With Solid Angle Correction ** + +.. testcode:: DetectorFloodWeightingExampleWithCorrection + + ws = CreateSimulationWorkspace(Instrument='LOQ', BinParams=[1,1,10], UnitX="Wavelength") + out_ws = DetectorFloodWeighting(InputWorkspace=ws, Bands=[0,10], SolidAngleCorrection=True) + + print 'Number Histograms',out_ws.getNumberHistograms() + print 'Number of Bins', out_ws.blocksize() + print 'X units', out_ws.getAxis(0).getUnit().unitID() + +Output: + +.. testoutput:: DetectorFloodWeightingExampleWithCorrection + + Number Histograms 17776 + Number of Bins 1 + X units Wavelength + +.. categories:: + +.. sourcelink:: diff --git a/docs/source/algorithms/Fit-v1.rst b/docs/source/algorithms/Fit-v1.rst index 55baf7dfbf7fbf9ae2af351d8b9afc0e82a8af2a..691219743c2e8a3c20358c1cb28e1cc099dbd908 100644 --- a/docs/source/algorithms/Fit-v1.rst +++ b/docs/source/algorithms/Fit-v1.rst @@ -355,5 +355,5 @@ Output: .. categories:: .. sourcelink:: - :h: Framework/CurveFitting/inc/MantidCurveFitting/Fit.h - :cpp: Framework/CurveFitting/src/Fit.cpp \ No newline at end of file + :h: Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit.h + :cpp: Framework/CurveFitting/src/Algorithms/Fit.cpp \ No newline at end of file diff --git a/docs/source/algorithms/TOFTOFMergeRuns-v1.rst b/docs/source/algorithms/TOFTOFMergeRuns-v1.rst new file mode 100644 index 0000000000000000000000000000000000000000..25aec61d5f1324450adf5eb51a07564d619897ff --- /dev/null +++ b/docs/source/algorithms/TOFTOFMergeRuns-v1.rst @@ -0,0 +1,150 @@ +.. algorithm:: + +.. summary:: + +.. alias:: + +.. properties:: + +Description +----------- + +Merges workspaces from a given list using :ref:`algm-MergeRuns` algorithm. Sample logs are merged in the following way. + ++---------++-------------------------------+ +| Type of || Parameter | +| merging || | ++=========++===============================+ +| Average || temperature | ++---------++-------------------------------+ +| Minimum || run_start | ++---------++-------------------------------+ +| Maximum || run_end | ++---------++-------------------------------+ +| Summed || duration, monitor_counts | ++---------++-------------------------------+ +| Listed || run_number | ++---------++-------------------------------+ + +Other sample logs are copied from the first workspace. + +**Valid input workspaces** + +Algorithm accepts both, matrix workspaces and groups of matrix workspaces. Valid input workspaces + +- must have following sample logs: *channel_width*, *chopper_ratio*, *chopper_speed*, *Ei*, *wavelength*, *full_channels*, *EPP*, *monitor_counts*, *duration*, *run_number*, *run_start*, *run_end* +- must have identical following sample logs: *channel_width*, *chopper_ratio*, *chopper_speed*, *Ei*, *wavelength*, *full_channels*, *EPP*. Tolerance for double comparison is 0.01. +- must have common binning for all its spectra for each input workspace. + +If these conditions are not fulfilled, algorithm terminates with an error message. + +Sample log *temperature* is optional. If it is present in some of input workspaces, mean value will be calculated. Otherwise, no *temperature* sample log will be created in the output workspace. + +Algorithm will produce warning if +- *temperature* and *run_title* sample logs are not present or different, +- some of input workspaces have zero monitor counts. + +Usage +----- + +**Example - Merge list of workspaces** + +.. testcode:: ExTOFTOFMergeRuns2ws + + ws1 = LoadMLZ(Filename='TOFTOFTestdata.nxs') + ws2 = LoadMLZ(Filename='TOFTOFTestdata.nxs') + + # change sample logs for a second workspace, not needed for real workspaces + lognames = 'temperature,run_start,run_end,monitor_counts,run_number' + logvalues = '296.15,2013-07-28T11:32:19+0053,2013-07-28T12:32:19+0053,145145,TOFTOFTestdata2' + AddSampleLogMultiple(ws2, lognames, logvalues) + + # Input = list of workspaces + ws3 = TOFTOFMergeRuns('ws1,ws2') + + # Temperature + print "Temperature of experiment for 1st workspace (in K): ", ws1.getRun().getLogData('temperature').value + print "Temperature of experiment for 2nd workspace (in K): ", ws2.getRun().getLogData('temperature').value + print "Temperature of experiment for merged workspaces = average over workspaces (in K): ", ws3.getRun().getLogData('temperature').value + + # Duration + print "Duration of experiment for 1st workspace (in s): ", ws1.getRun().getLogData('duration').value + print "Duration of experiment for 2nd workspace (in s): ", ws2.getRun().getLogData('duration').value + print "Duration of experiment for merged workspaces = sum of all durations (in s): ", ws3.getRun().getLogData('duration').value + + # Run start + print "Start of experiment for 1st workspace: ", ws1.getRun().getLogData('run_start').value + print "Start of experiment for 2nd workspace: ", ws2.getRun().getLogData('run_start').value + print "Start of experiment for merged workspaces = miminum of all workspaces: ", ws3.getRun().getLogData('run_start').value + + # Run end + print "End of experiment for 1st workspace: ", ws1.getRun().getLogData('run_end').value + print "End of experiment for 2nd workspace: ", ws2.getRun().getLogData('run_end').value + print "End of experiment for merged workspaces = maximum of all workspaces: ", ws3.getRun().getLogData('run_end').value + + # Run number + print "Run number for 1st workspace: ", ws1.getRun().getLogData('run_number').value + print "Run number for 2nd workspace: ", ws2.getRun().getLogData('run_number').value + print "Run number for merged workspaces = list of all workspaces: ", ws3.getRun().getLogData('run_number').value + + # Monitor counts + print "Monitor counts for 1st workspace: ", ws1.getRun().getLogData('monitor_counts').value + print "Monitor counts for 2nd workspace: ", ws2.getRun().getLogData('monitor_counts').value + print "Monitor counts for merged workspaces = sum over all workspaces: ", ws3.getRun().getLogData('monitor_counts').value + + +Output: + +.. testoutput:: ExTOFTOFMergeRuns2ws + + Temperature of experiment for 1st workspace (in K): 294.149414 + Temperature of experiment for 2nd workspace (in K): 296.15 + Temperature of experiment for merged workspaces = average over workspaces (in K): 295.149707 + Duration of experiment for 1st workspace (in s): 3601 + Duration of experiment for 2nd workspace (in s): 3601 + Duration of experiment for merged workspaces = sum of all durations (in s): 7202 + Start of experiment for 1st workspace: 2013-07-28T10:32:19+0053 + Start of experiment for 2nd workspace: 2013-07-28T11:32:19+0053 + Start of experiment for merged workspaces = miminum of all workspaces: 2013-07-28T10:32:19+0053 + End of experiment for 1st workspace: 2013-07-28T11:32:20+0053 + End of experiment for 2nd workspace: 2013-07-28T12:32:19+0053 + End of experiment for merged workspaces = maximum of all workspaces: 2013-07-28T12:32:19+0053 + Run number for 1st workspace: TOFTOFTestdata + Run number for 2nd workspace: TOFTOFTestdata2 + Run number for merged workspaces = list of all workspaces: ['TOFTOFTestdata', 'TOFTOFTestdata2'] + Monitor counts for 1st workspace: 136935 + Monitor counts for 2nd workspace: 145145 + Monitor counts for merged workspaces = sum over all workspaces: 282080 + +**Example - Merge group of workspaces** + +.. testcode:: ExTOFTOFMergeRunsGroup + + ws1 = LoadMLZ(Filename='TOFTOFTestdata.nxs') + ws2 = LoadMLZ(Filename='TOFTOFTestdata.nxs') + + # change sample logs for a second workspace, not needed for real workspaces + lognames = 'temperature,run_start,run_end,monitor_counts,run_number' + logvalues = '296.15,2013-07-28T11:32:19+0053,2013-07-28T12:32:19+0053,145145,TOFTOFTestdata2' + AddSampleLogMultiple(ws2, lognames, logvalues) + + group=GroupWorkspaces('ws1,ws2') + groupmerged=TOFTOFMergeRuns(group) + print "Monitor counts for 1st workspace: ", ws1.getRun().getLogData('monitor_counts').value + print "Monitor counts for 2nd workspace: ", ws2.getRun().getLogData('monitor_counts').value + print "Monitor counts for merged workspaces = sum over all workspaces: ", groupmerged.getRun().getLogData('monitor_counts').value + +Output: + +.. testoutput:: ExTOFTOFMergeRunsGroup + + Monitor counts for 1st workspace: 136935 + Monitor counts for 2nd workspace: 145145 + Monitor counts for merged workspaces = sum over all workspaces: 282080 + +.. categories:: + +.. sourcelink:: + + + diff --git a/docs/source/fitfunctions/Convolution.rst b/docs/source/fitfunctions/Convolution.rst index 4131d38a6c02f0a7699718f67a20c12abd0adb33..2d1effda494a58834752a49bd3c7ab410c77c1ce 100644 --- a/docs/source/fitfunctions/Convolution.rst +++ b/docs/source/fitfunctions/Convolution.rst @@ -45,5 +45,5 @@ Note that the box function is defined on interval [-5, 5]: .. categories:: .. sourcelink:: - :h: Framework/CurveFitting/inc/MantidCurveFitting/Convolution.h - :cpp: Framework/CurveFitting/src/Convolution.cpp \ No newline at end of file + :h: Framework/CurveFitting/inc/MantidCurveFitting/Functions/Convolution.h + :cpp: Framework/CurveFitting/src/Functions/Convolution.cpp \ No newline at end of file diff --git a/docs/source/fitfunctions/Quadratic.rst b/docs/source/fitfunctions/Quadratic.rst index ec969de22b9b6177cdc4299d1f9a2d8f8cfcc9c0..8ff860a418240b00e5bc2f381b9f03c666f4c98e 100644 --- a/docs/source/fitfunctions/Quadratic.rst +++ b/docs/source/fitfunctions/Quadratic.rst @@ -26,5 +26,5 @@ where .. categories:: .. sourcelink:: - :h: Framework/CurveFitting/inc/MantidCurveFitting/Quadratic.h - :cpp: Framework/CurveFitting/src/Quadratic.cpp \ No newline at end of file + :h: Framework/CurveFitting/inc/MantidCurveFitting/Functions/Quadratic.h + :cpp: Framework/CurveFitting/src/Functions/Quadratic.cpp \ No newline at end of file diff --git a/docs/source/fitfunctions/UserFunction.rst b/docs/source/fitfunctions/UserFunction.rst index 9cda7f413fdb76f7d3bbc3a30e82de60e69f4a32..9a8201cec132e63b0bd6cfd040011538f6b8b9b7 100644 --- a/docs/source/fitfunctions/UserFunction.rst +++ b/docs/source/fitfunctions/UserFunction.rst @@ -25,5 +25,5 @@ go first in UserFunction definition. .. categories:: .. sourcelink:: - :h: Framework/CurveFitting/inc/MantidCurveFitting/UserFunction.h - :cpp: Framework/CurveFitting/src/UserFunction.cpp \ No newline at end of file + :h: Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction.h + :cpp: Framework/CurveFitting/src/Functions/UserFunction.cpp \ No newline at end of file diff --git a/docs/source/interfaces/Tomographic_Reconstruction.rst b/docs/source/interfaces/Tomographic_Reconstruction.rst index d31f16f6ad90f25f598f33de0f037bcb527bc861..10218297b0180cf65a005cfe5af11202a362303f 100644 --- a/docs/source/interfaces/Tomographic_Reconstruction.rst +++ b/docs/source/interfaces/Tomographic_Reconstruction.rst @@ -140,6 +140,43 @@ To be able to run jobs on a remote compute resource (cluster, supercomputer, etc You can monitor the status of the jobs currently running (and recently run) on remote compute resources in the same tab. +Setting common parameters for the reconstruction jobs +----------------------------------------------------- + +Several parameters can be set in the "ROI etc." section or tab. These +parameters will be used for all the reconstruction jobs, regardless of +the tool and/or reconstruction method used. + +* Region of interest (ROI) for the analysis +* Area for normalization (open beam, not blocked by sample) +* Center of rotation, for tomographic reconstruction + +At any stage during the process of selecting the regions it is also +possible to see how the selections fit different images by sliding +through the images of the stack (using the slider or scroll bar). + +The center of rotation can be selected interactively by clicking on +the select button and then clicking on an image pixel. To select the +regions of interest or the area of normalization, just click on the +respective "select" button and then click and drag with the mouse to +select a rectangle. The precise coordinates of the center and regions +can be set via the boxes of the right panel as well. + +Once you have selected or set one of the regions, or the center, they +can be selected again by pushing the respective "Select" buttons +and/or editing their coordinates manually. + +The default values, set in principle when a new stack of images is +loaded, is as follows. The region of intererest is set to cover all +the images. The regions of normalization is not set (empty), and the +center of rotation is set to the center of the image. The option to +find the center of rotation automatically is disabled at present. + +If when selection a region the mouse is moved outside of the images, +it is possible to continue the selection of the region (second corner) +by clicking again inside the image. Alternatively, any selection can +be reset at any point by using the "reset" buttons. + Running jobs locally -------------------- diff --git a/images/brush.png b/images/brush.png new file mode 100644 index 0000000000000000000000000000000000000000..328d01196160c1bc534ac5bada51431445c612e6 Binary files /dev/null and b/images/brush.png differ diff --git a/images/images.qrc b/images/images.qrc index d68c46cd1be169a22d4f1458ecf80e0c6898c893..f574b14d849722bdb4ae85bdc201873be4d0d521 100644 --- a/images/images.qrc +++ b/images/images.qrc @@ -67,6 +67,7 @@ <file>eraser.png</file> <file>selection-box-ring.png</file> <file>selection-circle-ring.png</file> + <file>brush.png</file> </qresource> <qresource prefix="/MaskTools"> <file>selection-circle.png</file> @@ -74,5 +75,6 @@ <file>selection-box-ring.png</file> <file>selection-circle-ring.png</file> <file>selection-edit.png</file> + <file>brush.png</file> </qresource> </RCC> diff --git a/instrument/Bilby_Definition.xml b/instrument/Bilby_Definition.xml new file mode 100644 index 0000000000000000000000000000000000000000..81029ac258ae427777382b1c5f79f82a6478b94b --- /dev/null +++ b/instrument/Bilby_Definition.xml @@ -0,0 +1,506 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- For help on the notation used to specify an Instrument Definition File + see http://www.mantidproject.org/IDF --> +<instrument xmlns="http://www.mantidproject.org/IDF/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.mantidproject.org/IDF/1.0 http://schema.mantidproject.org/IDF/1.0/IDFSchema.xsd" + name="Bilby" valid-from ="1901-01-01 00:00:00" + valid-to ="2100-01-01 00:00:00" + last-modified="2100-01-01 00:00:00"> + + <defaults> + <length unit="meter"/> + <angle unit="degree"/> + <reference-frame> + <!-- The z-axis is set parallel to and in the direction of the beam. the + y-axis points up and the coordinate system is right handed. --> + <along-beam axis="z"/> + <pointing-up axis="y"/> + <handedness val="right"/> + </reference-frame> + <default-view axis-view="z-"/> + </defaults> + + + <!-- source and sample-position components --> + <component name="Source" type="source"> + <location x="0.0" y="0.0" /> + <parameter name="z"> + <logfile id="L1_chopper_value" eq="1*value"/> + </parameter> + </component> + <type name="source" is="Source" /> + + <component name="Sample-Holder" type="some-sample-holder"> + <location z="0.0" x="0.0" y="0.0"/> + </component> + <type name="some-sample-holder" is="SamplePos" /> + + <type name="pixel" is="detector"> + <cylinder id="cyl-approx"> + <centre-of-bottom-base r="0.0" t="0.0" p="0.0" /> + <axis x="0.0" y="1.0" z="0.0" /> + <radius val="0.004" /> + <height val="0.0025" /> <!-- height 0.64m/256 --> + </cylinder> + <algebra val="cyl-approx" /> + </type> + + <component name="CurtainLeft" type="bank01" idlist="bank01"> + <location/> + </component> + <type name="bank01"> + <component type="IdealBilbyPanel"> + <location y="0.0"> + <!-- Rotate the panel 10 degrees --> + <rot val="10" axis-x="0" axis-y="1" axis-z="0"> + </rot> + </location> + <parameter name="z"> + <logfile id="L2_curtainl_value" eq="1*value - ( sin(10 * _pi / 180.0) * 0.0084 * 40 / 2 )"/> <!-- front l panel position --> + </parameter> + <parameter name="x"> + <!-- from beam center 0.1678 = ( (0.008*40) + (0.0004 * 39) ) / 2 --> + <logfile id="D_curtainl_value" eq="0.1678 + value"/> <!-- from beam center --> + </parameter> + </component> + </type> + +<component name="CurtainTop" type="bank03" idlist="bank03"> + <location/> +</component> +<type name="bank03"> + <component type="IdealBilbyPanel"> + <location x="0.0"> + <rot val="90" axis-x="0" axis-y="0" axis-z="1"> + <!-- Rotate the panel 10 degrees --> + <rot val="10" axis-x="0" axis-y="1" axis-z="0" /> + </rot> + </location> + <parameter name="z"> + <logfile id="L2_curtainu_value" eq="1*value - ( sin(10 * _pi / 180.0) * 0.0084 * 40 / 2 )"/> <!-- front t panel z position --> + </parameter> + <parameter name="y"> + <!-- from beam center 0.1678 = ( (0.008*40) + (0.0004 * 39) ) / 2 --> + <logfile id="D_curtainu_value" eq="0.1678 + value"/> <!-- from beam center --> + </parameter> + </component> +</type> + + <component name="CurtainRight" type="bank02" idlist="bank02"> + <location/> + </component> + <type name="bank02"> + <component type="IdealBilbyPanel"> + <location y="0.0" > + <rot val="180" axis-x="0" axis-y="0" axis-z="1"> + <!-- Rotate the panel 10 degrees --> + <rot val="10" axis-x="0" axis-y="1" axis-z="0" /> + </rot> + </location> + <parameter name="z"> + <logfile id="L2_curtainr_value" eq="1*value - ( sin(10 * _pi / 180.0) * 0.0084 * 40 / 2 )"/> <!-- front r panel z position --> + </parameter> + <parameter name="x"> + <!-- from beam center 0.1678 = ( (0.008*40) + (0.0004 * 39) ) / 2 --> + <logfile id="D_curtainr_value" eq="-0.1678 - value"/> <!-- from beam center --> + </parameter> + </component> + </type> + + <component name="CurtainBottom" type="bank04" idlist="bank04"> + <location/> + </component> + <type name="bank04"> + <component type="IdealBilbyPanel"> + <location x="0.0" > + <rot val="270" axis-x="0" axis-y="0" axis-z="1"> + <!-- Rotate the panel 10 degrees --> + <rot val="10" axis-x="0" axis-y="1" axis-z="0" /> + </rot> + </location> + <parameter name="z"> + <logfile id="L2_curtaind_value" eq="1*value - ( sin(10 * _pi / 180.0) * 0.0084 * 40 / 2 )"/> <!-- front b panel z position --> + </parameter> + <parameter name="y"> + <!-- from beam center 0.1678 = ( (0.008*40) + (0.0004 * 39) ) / 2 --> + <logfile id="D_curtaind_value" eq="-0.1678 - value"/> <!-- from beam center --> + </parameter> + </component> + </type> + + <component name="BackDetectorLeft" type="bank05" idlist="bank05"> + <location/> + </component> + <type name="bank05"> + <component type="EastBilbyPanel"> + <location y="0.0" > + </location> + <parameter name="z"> + <logfile id="L2_det_value"/> <!-- back panel z position --> + </parameter> + <parameter name="x"> + <!-- from beam center 0.1678 = ( (0.008*40) + (0.0004 * 39) ) / 2 --> + <logfile id="D_det_value" eq="0.1678 + value"/> <!-- x pos --> + </parameter> + </component> + </type> + + <component name="BackDetectorRight" type="bank06" idlist="bank06"> + <location/> + </component> + <type name="bank06"> + <component type="WestBilbyPanel"> + <location x="-0.168" y="0.0" > + <rot val="180" axis-x="0" axis-y="0" axis-z="1" /> + </location> + <parameter name="z"> + <logfile id="L2_det_value"/> <!-- back panel z position --> + </parameter> + <parameter name="x"> + <!-- from beam center 0.1678 = ( (0.008*40) + (0.0004 * 39) ) / 2 --> + <logfile id="D_det_value" eq="-0.1678 - value"/> <!-- x pos --> + </parameter> + </component> + </type> + + <!--- Bilby's 6 panels are 0.64m high, and 0.336m wide. Each panel has 40 tubes each made from 256 pixels. --> + + <!-- Grouping by eight-packs would really be unnecessary. All tubes equally spaced. --> + <type name="IdealBilbyPanel"> + <component type="eight_pack"> +<location x="-0.168000" name="eight_pack1" /> +<location x="-0.100800" name="eight_pack2" /> +<location x="-0.033600" name="eight_pack3" /> +<location x="0.033600" name="eight_pack4" /> +<location x="0.100800" name="eight_pack5" /> + </component> + </type> + + <!-- eight-packs not equally separated. --> + <type name="EastBilbyPanel"> + <!-- Grouping by eight-packs would really be unnecessary. All tubes equally spaced. --> + <component type="eight_pack"> +<location x="-0.167000" name="eight_pack1" /> +<location x="-0.099200" name="eight_pack2" /> +<location x="-0.031600" name="eight_pack3" /> +<location x="0.036200" name="eight_pack4" /> +<location x="0.104000" name="eight_pack5" /> + </component> + </type> + + <!-- eight-packs not equally separated. --> + <type name="WestBilbyPanel"> + <!-- Grouping by eight-packs would really be unnecessary. All tubes equally spaced. --> + <component type="eight_pack"> +<location x="-0.167000" name="eight_pack1" /> +<location x="-0.099200" name="eight_pack2" /> +<location x="-0.031600" name="eight_pack3" /> +<location x="0.035700" name="eight_pack4" /> +<location x="0.103900" name="eight_pack5" /> + </component> + </type> + +<type name="eight_pack"> +<component type="tube"> +<!-- tubes in each eight_pack are 0.0004 m separated --> +<location x="0.000000" name="tube1" /> +<location x="0.008400" name="tube2" /> +<location x="0.016800" name="tube3" /> +<location x="0.025200" name="tube4" /> +<location x="0.033600" name="tube5" /> +<location x="0.042000" name="tube6" /> +<location x="0.050400" name="tube7" /> +<location x="0.058800" name="tube8" /> +</component> +</type> + + + <type name="tube" outline="yes"> + <component type="pixel"> +<location y="-0.320000" name="pixel1"/> +<location y="-0.317500" name="pixel2"/> +<location y="-0.315000" name="pixel3"/> +<location y="-0.312500" name="pixel4"/> +<location y="-0.310000" name="pixel5"/> +<location y="-0.307500" name="pixel6"/> +<location y="-0.305000" name="pixel7"/> +<location y="-0.302500" name="pixel8"/> +<location y="-0.300000" name="pixel9"/> +<location y="-0.297500" name="pixel10"/> +<location y="-0.295000" name="pixel11"/> +<location y="-0.292500" name="pixel12"/> +<location y="-0.290000" name="pixel13"/> +<location y="-0.287500" name="pixel14"/> +<location y="-0.285000" name="pixel15"/> +<location y="-0.282500" name="pixel16"/> +<location y="-0.280000" name="pixel17"/> +<location y="-0.277500" name="pixel18"/> +<location y="-0.275000" name="pixel19"/> +<location y="-0.272500" name="pixel20"/> +<location y="-0.270000" name="pixel21"/> +<location y="-0.267500" name="pixel22"/> +<location y="-0.265000" name="pixel23"/> +<location y="-0.262500" name="pixel24"/> +<location y="-0.260000" name="pixel25"/> +<location y="-0.257500" name="pixel26"/> +<location y="-0.255000" name="pixel27"/> +<location y="-0.252500" name="pixel28"/> +<location y="-0.250000" name="pixel29"/> +<location y="-0.247500" name="pixel30"/> +<location y="-0.245000" name="pixel31"/> +<location y="-0.242500" name="pixel32"/> +<location y="-0.240000" name="pixel33"/> +<location y="-0.237500" name="pixel34"/> +<location y="-0.235000" name="pixel35"/> +<location y="-0.232500" name="pixel36"/> +<location y="-0.230000" name="pixel37"/> +<location y="-0.227500" name="pixel38"/> +<location y="-0.225000" name="pixel39"/> +<location y="-0.222500" name="pixel40"/> +<location y="-0.220000" name="pixel41"/> +<location y="-0.217500" name="pixel42"/> +<location y="-0.215000" name="pixel43"/> +<location y="-0.212500" name="pixel44"/> +<location y="-0.210000" name="pixel45"/> +<location y="-0.207500" name="pixel46"/> +<location y="-0.205000" name="pixel47"/> +<location y="-0.202500" name="pixel48"/> +<location y="-0.200000" name="pixel49"/> +<location y="-0.197500" name="pixel50"/> +<location y="-0.195000" name="pixel51"/> +<location y="-0.192500" name="pixel52"/> +<location y="-0.190000" name="pixel53"/> +<location y="-0.187500" name="pixel54"/> +<location y="-0.185000" name="pixel55"/> +<location y="-0.182500" name="pixel56"/> +<location y="-0.180000" name="pixel57"/> +<location y="-0.177500" name="pixel58"/> +<location y="-0.175000" name="pixel59"/> +<location y="-0.172500" name="pixel60"/> +<location y="-0.170000" name="pixel61"/> +<location y="-0.167500" name="pixel62"/> +<location y="-0.165000" name="pixel63"/> +<location y="-0.162500" name="pixel64"/> +<location y="-0.160000" name="pixel65"/> +<location y="-0.157500" name="pixel66"/> +<location y="-0.155000" name="pixel67"/> +<location y="-0.152500" name="pixel68"/> +<location y="-0.150000" name="pixel69"/> +<location y="-0.147500" name="pixel70"/> +<location y="-0.145000" name="pixel71"/> +<location y="-0.142500" name="pixel72"/> +<location y="-0.140000" name="pixel73"/> +<location y="-0.137500" name="pixel74"/> +<location y="-0.135000" name="pixel75"/> +<location y="-0.132500" name="pixel76"/> +<location y="-0.130000" name="pixel77"/> +<location y="-0.127500" name="pixel78"/> +<location y="-0.125000" name="pixel79"/> +<location y="-0.122500" name="pixel80"/> +<location y="-0.120000" name="pixel81"/> +<location y="-0.117500" name="pixel82"/> +<location y="-0.115000" name="pixel83"/> +<location y="-0.112500" name="pixel84"/> +<location y="-0.110000" name="pixel85"/> +<location y="-0.107500" name="pixel86"/> +<location y="-0.105000" name="pixel87"/> +<location y="-0.102500" name="pixel88"/> +<location y="-0.100000" name="pixel89"/> +<location y="-0.097500" name="pixel90"/> +<location y="-0.095000" name="pixel91"/> +<location y="-0.092500" name="pixel92"/> +<location y="-0.090000" name="pixel93"/> +<location y="-0.087500" name="pixel94"/> +<location y="-0.085000" name="pixel95"/> +<location y="-0.082500" name="pixel96"/> +<location y="-0.080000" name="pixel97"/> +<location y="-0.077500" name="pixel98"/> +<location y="-0.075000" name="pixel99"/> +<location y="-0.072500" name="pixel100"/> +<location y="-0.070000" name="pixel101"/> +<location y="-0.067500" name="pixel102"/> +<location y="-0.065000" name="pixel103"/> +<location y="-0.062500" name="pixel104"/> +<location y="-0.060000" name="pixel105"/> +<location y="-0.057500" name="pixel106"/> +<location y="-0.055000" name="pixel107"/> +<location y="-0.052500" name="pixel108"/> +<location y="-0.050000" name="pixel109"/> +<location y="-0.047500" name="pixel110"/> +<location y="-0.045000" name="pixel111"/> +<location y="-0.042500" name="pixel112"/> +<location y="-0.040000" name="pixel113"/> +<location y="-0.037500" name="pixel114"/> +<location y="-0.035000" name="pixel115"/> +<location y="-0.032500" name="pixel116"/> +<location y="-0.030000" name="pixel117"/> +<location y="-0.027500" name="pixel118"/> +<location y="-0.025000" name="pixel119"/> +<location y="-0.022500" name="pixel120"/> +<location y="-0.020000" name="pixel121"/> +<location y="-0.017500" name="pixel122"/> +<location y="-0.015000" name="pixel123"/> +<location y="-0.012500" name="pixel124"/> +<location y="-0.010000" name="pixel125"/> +<location y="-0.007500" name="pixel126"/> +<location y="-0.005000" name="pixel127"/> +<location y="-0.002500" name="pixel128"/> +<location y="0.000000" name="pixel129"/> +<location y="0.002500" name="pixel130"/> +<location y="0.005000" name="pixel131"/> +<location y="0.007500" name="pixel132"/> +<location y="0.010000" name="pixel133"/> +<location y="0.012500" name="pixel134"/> +<location y="0.015000" name="pixel135"/> +<location y="0.017500" name="pixel136"/> +<location y="0.020000" name="pixel137"/> +<location y="0.022500" name="pixel138"/> +<location y="0.025000" name="pixel139"/> +<location y="0.027500" name="pixel140"/> +<location y="0.030000" name="pixel141"/> +<location y="0.032500" name="pixel142"/> +<location y="0.035000" name="pixel143"/> +<location y="0.037500" name="pixel144"/> +<location y="0.040000" name="pixel145"/> +<location y="0.042500" name="pixel146"/> +<location y="0.045000" name="pixel147"/> +<location y="0.047500" name="pixel148"/> +<location y="0.050000" name="pixel149"/> +<location y="0.052500" name="pixel150"/> +<location y="0.055000" name="pixel151"/> +<location y="0.057500" name="pixel152"/> +<location y="0.060000" name="pixel153"/> +<location y="0.062500" name="pixel154"/> +<location y="0.065000" name="pixel155"/> +<location y="0.067500" name="pixel156"/> +<location y="0.070000" name="pixel157"/> +<location y="0.072500" name="pixel158"/> +<location y="0.075000" name="pixel159"/> +<location y="0.077500" name="pixel160"/> +<location y="0.080000" name="pixel161"/> +<location y="0.082500" name="pixel162"/> +<location y="0.085000" name="pixel163"/> +<location y="0.087500" name="pixel164"/> +<location y="0.090000" name="pixel165"/> +<location y="0.092500" name="pixel166"/> +<location y="0.095000" name="pixel167"/> +<location y="0.097500" name="pixel168"/> +<location y="0.100000" name="pixel169"/> +<location y="0.102500" name="pixel170"/> +<location y="0.105000" name="pixel171"/> +<location y="0.107500" name="pixel172"/> +<location y="0.110000" name="pixel173"/> +<location y="0.112500" name="pixel174"/> +<location y="0.115000" name="pixel175"/> +<location y="0.117500" name="pixel176"/> +<location y="0.120000" name="pixel177"/> +<location y="0.122500" name="pixel178"/> +<location y="0.125000" name="pixel179"/> +<location y="0.127500" name="pixel180"/> +<location y="0.130000" name="pixel181"/> +<location y="0.132500" name="pixel182"/> +<location y="0.135000" name="pixel183"/> +<location y="0.137500" name="pixel184"/> +<location y="0.140000" name="pixel185"/> +<location y="0.142500" name="pixel186"/> +<location y="0.145000" name="pixel187"/> +<location y="0.147500" name="pixel188"/> +<location y="0.150000" name="pixel189"/> +<location y="0.152500" name="pixel190"/> +<location y="0.155000" name="pixel191"/> +<location y="0.157500" name="pixel192"/> +<location y="0.160000" name="pixel193"/> +<location y="0.162500" name="pixel194"/> +<location y="0.165000" name="pixel195"/> +<location y="0.167500" name="pixel196"/> +<location y="0.170000" name="pixel197"/> +<location y="0.172500" name="pixel198"/> +<location y="0.175000" name="pixel199"/> +<location y="0.177500" name="pixel200"/> +<location y="0.180000" name="pixel201"/> +<location y="0.182500" name="pixel202"/> +<location y="0.185000" name="pixel203"/> +<location y="0.187500" name="pixel204"/> +<location y="0.190000" name="pixel205"/> +<location y="0.192500" name="pixel206"/> +<location y="0.195000" name="pixel207"/> +<location y="0.197500" name="pixel208"/> +<location y="0.200000" name="pixel209"/> +<location y="0.202500" name="pixel210"/> +<location y="0.205000" name="pixel211"/> +<location y="0.207500" name="pixel212"/> +<location y="0.210000" name="pixel213"/> +<location y="0.212500" name="pixel214"/> +<location y="0.215000" name="pixel215"/> +<location y="0.217500" name="pixel216"/> +<location y="0.220000" name="pixel217"/> +<location y="0.222500" name="pixel218"/> +<location y="0.225000" name="pixel219"/> +<location y="0.227500" name="pixel220"/> +<location y="0.230000" name="pixel221"/> +<location y="0.232500" name="pixel222"/> +<location y="0.235000" name="pixel223"/> +<location y="0.237500" name="pixel224"/> +<location y="0.240000" name="pixel225"/> +<location y="0.242500" name="pixel226"/> +<location y="0.245000" name="pixel227"/> +<location y="0.247500" name="pixel228"/> +<location y="0.250000" name="pixel229"/> +<location y="0.252500" name="pixel230"/> +<location y="0.255000" name="pixel231"/> +<location y="0.257500" name="pixel232"/> +<location y="0.260000" name="pixel233"/> +<location y="0.262500" name="pixel234"/> +<location y="0.265000" name="pixel235"/> +<location y="0.267500" name="pixel236"/> +<location y="0.270000" name="pixel237"/> +<location y="0.272500" name="pixel238"/> +<location y="0.275000" name="pixel239"/> +<location y="0.277500" name="pixel240"/> +<location y="0.280000" name="pixel241"/> +<location y="0.282500" name="pixel242"/> +<location y="0.285000" name="pixel243"/> +<location y="0.287500" name="pixel244"/> +<location y="0.290000" name="pixel245"/> +<location y="0.292500" name="pixel246"/> +<location y="0.295000" name="pixel247"/> +<location y="0.297500" name="pixel248"/> +<location y="0.300000" name="pixel249"/> +<location y="0.302500" name="pixel250"/> +<location y="0.305000" name="pixel251"/> +<location y="0.307500" name="pixel252"/> +<location y="0.310000" name="pixel253"/> +<location y="0.312500" name="pixel254"/> +<location y="0.315000" name="pixel255"/> +<location y="0.317500" name="pixel256"/> + </component> + </type> + + <idlist idname="bank01"> + <id start="0" end="10239" /> + </idlist> + + <idlist idname="bank02"> + <id start="10240" end="20479" /> + </idlist> + + <idlist idname="bank03"> + <id start="20480" end="30719" /> + </idlist> + + <idlist idname="bank04"> + <id start="30720" end="40959" /> + </idlist> + + <idlist idname="bank05"> + <id start="40960" end="51199" /> + </idlist> + + <idlist idname="bank06"> + <id start="51200" end="61439" /> + </idlist> + + +</instrument> + \ No newline at end of file diff --git a/instrument/Facilities.xml b/instrument/Facilities.xml index 320fe4089c44e25783ca9b5cb6ece153a632f096..e83d54feffb20fac7ab30c92b6d0ade40679e106 100644 --- a/instrument/Facilities.xml +++ b/instrument/Facilities.xml @@ -640,6 +640,13 @@ </instrument> </facility> +<!-- ANSTO --> +<facility name="ANSTO" FileExtensions=".nxs,.tar"> + <instrument name="Bilby"> + <technique>Small Angle Scattering</technique> + </instrument> +</facility> + <!-- Test Facility to allow example usage of Live listeners against "Fake" instrument sources --> <facility name="TEST_LIVE" FileExtensions=".nxs,.raw"> <instrument name="ISIS_Histogram"> diff --git a/tools/DAEserv/DAEserv/isisds_command.cpp b/tools/DAEserv/DAEserv/isisds_command.cpp index 131c03ade6e7f6eb2eb5305ea564ecab6bfb421c..b354735c73272a643e4cd6d5e4e83a4756458797 100644 --- a/tools/DAEserv/DAEserv/isisds_command.cpp +++ b/tools/DAEserv/DAEserv/isisds_command.cpp @@ -20,8 +20,6 @@ #include <stdio.h> #include "isisds_command.h" -#include <iostream> - using namespace std; /* diff --git a/tools/reports/facility-code-changes.py b/tools/reports/facility-code-changes.py index 645589a536805d782c620654aac14159d6a5863f..9233650ef8185ed9ed41966af314de8365b1dde4 100644 --- a/tools/reports/facility-code-changes.py +++ b/tools/reports/facility-code-changes.py @@ -87,6 +87,7 @@ if __name__ == '__main__': domains = {} domains = {'stfc.ac.uk': 'STFC', 'clrc.ac.uk': 'STFC', + 'tessella.com': 'STFC', 'ornl.gov': 'ORNL', 'sns.gov': 'ORNL', 'esss.se': 'ESS', @@ -123,7 +124,8 @@ if __name__ == '__main__': 'matd10@yahoo.com': 'OTHERS', 'diegomon93@gmail.com': 'OTHERS', 'mgt110@ic.ac.uk': 'OTHERS', - 'granrothge@users.noreply.github.com': 'ORNL' + 'granrothge@users.noreply.github.com': 'ORNL', + 'tom.g.r.brooks@gmail.com': 'STFC' } days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] @@ -297,4 +299,4 @@ if __name__ == '__main__': f.write(str(datetime.datetime.now())) f.close() - print("All done!\n") \ No newline at end of file + print("All done!\n")