diff --git a/Code/Mantid/Build/CMake/CommonVatesSetup.cmake b/Code/Mantid/Build/CMake/CommonVatesSetup.cmake index 7e39c2dd688ca50b94ea00e41da5b9882578c61b..013b2baf9fe653e7c70438a9bd1bb4ff24c4b1ee 100644 --- a/Code/Mantid/Build/CMake/CommonVatesSetup.cmake +++ b/Code/Mantid/Build/CMake/CommonVatesSetup.cmake @@ -7,7 +7,6 @@ Framework/API Framework/Geometry Framework/Kernel Framework/DataObjects -Framework/MDEvents ) set ( COMMONVATES_SETUP_DONE TRUE ) diff --git a/Code/Mantid/Build/Jenkins/buildscript b/Code/Mantid/Build/Jenkins/buildscript index bf9df07b22372756d094a2184f3d54b6f09eda26..3a8cefa43ff4ae41be2228307a31ba31296e2c68 100755 --- a/Code/Mantid/Build/Jenkins/buildscript +++ b/Code/Mantid/Build/Jenkins/buildscript @@ -19,6 +19,46 @@ BUILDPKG=true cmake --version echo "SHA1=${sha1}" +############################################################################### +# Check job requirements from the name +############################################################################### +if [[ ${JOB_NAME} == *clean* ]]; then + CLEANBUILD=true +fi + +if [[ ${JOB_NAME} == *debug* ]]; then + BUILD_CONFIG="Debug" +elif [[ ${JOB_NAME} == *relwithdbg* ]]; then + BUILD_CONFIG="RelWithDbg" +else + BUILD_CONFIG="Release" +fi + +############################################################################### +# Setup the build directory +# For a clean build the entire thing is removed to guarantee it is clean. All +# other build types are assumed to be incremental and the following items +# are removed to ensure stale build objects don't interfere with each other: +# - build/bin/**: if libraries are removed from cmake they are not deleted +# from bin and can cause random failures +# - build/ExternalData/**: data files will change over time and removing +# the links helps keep it fresh +############################################################################### +BUILD_DIR=$WORKSPACE/build +if [ -z "$BUILD_DIR" ]; then + echo "Build directory not set. Cannot continue" + exit 1 +fi + +if [[ "$CLEANBUILD" == true ]]; then + rm -rf $BUILD_DIR +fi +if [ -d $BUILD_DIR ]; then + rm -rf $BUILD_DIR/bin $BUILD_DIR/ExternalData +else + mkdir $BUILD_DIR +fi + ############################################################################### # Setup clang ############################################################################### @@ -38,11 +78,11 @@ if [[ $USE_CLANG ]]; then export CXX=clang++ #check if CMakeCache.txt exists and if so that the cxx compiler is clang++ #only needed with incremental builds. Clean builds delete this directory in a later step. - if [[ -e $WORKSPACE/build/CMakeCache.txt ]] && [[ ${JOB_NAME} != *clean* ]]; then - COMPILERFILEPATH=`grep 'CMAKE_CXX_COMPILER:FILEPATH' $WORKSPACE/build/CMakeCache.txt` + if [[ -e $BUILD_DIR/CMakeCache.txt ]] && [[ ${JOB_NAME} != *clean* ]]; then + COMPILERFILEPATH=`grep 'CMAKE_CXX_COMPILER:FILEPATH' $BUILD_DIR/CMakeCache.txt` if [[ $COMPILERFILEPATH != *clang++* ]]; then # Removing the build directory entirely guarantees clang is used. - rm -rf $WORKSPACE/build + rm -rf $BUILD_DIR fi fi fi @@ -89,21 +129,6 @@ if [[ ${NODE_LABELS} == *rhel7* ]]; then ON_RHEL7=true fi -############################################################################### -# Check job requirements from the name -############################################################################### -if [[ ${JOB_NAME} == *clean* ]]; then - CLEANBUILD=true -fi - -if [[ -e $WORKSPACE/build/CMakeCache.txt ]]; then - # Temporary while the builds flick between old & new TestingTools locations - TESTINGTOOLS_DIR=$(grep 'Code/Mantid/TestingTools/cxxtest' $WORKSPACE/build/CMakeCache.txt || true) - if [ ! -z "$TESTINGTOOLS_DIR" ]; then - rm -fr $WORKSPACE/build - fi -fi - ############################################################################### # Packaging options ############################################################################### @@ -125,13 +150,9 @@ if [[ "$BUILDPKG" == true ]]; then fi ############################################################################### -# Setup the build directory +# Work in the build directory ############################################################################### -if [[ "$CLEANBUILD" == true ]]; then - rm -rf $WORKSPACE/build -fi -[ -d $WORKSPACE/build ] || mkdir $WORKSPACE/build -cd $WORKSPACE/build +cd $BUILD_DIR ############################################################################### # Clean up any artifacts from last build so that if it fails @@ -139,17 +160,6 @@ cd $WORKSPACE/build ############################################################################### rm -f *.dmg *.rpm *.deb *.tar.gz -############################################################################### -## Check the required build configuration -############################################################################### -if [[ ${JOB_NAME} == *debug* ]]; then - BUILD_CONFIG="Debug" -elif [[ ${JOB_NAME} == *relwithdbg* ]]; then - BUILD_CONFIG="RelWithDbg" -else - BUILD_CONFIG="Release" -fi - ############################################################################### # CMake configuration ############################################################################### diff --git a/Code/Mantid/Build/Jenkins/buildscript.bat b/Code/Mantid/Build/Jenkins/buildscript.bat index cda8a6cb7d61c4189aaa12233f29907bd068db90..36552dbb9a40fc5bd22f2c2f7a1e02f4a306adc9 100755 --- a/Code/Mantid/Build/Jenkins/buildscript.bat +++ b/Code/Mantid/Build/Jenkins/buildscript.bat @@ -39,16 +39,31 @@ if not "%JOB_NAME%" == "%JOB_NAME:clean=%" ( set BUILDPKG=yes ) -if EXIST %WORKSPACE%\build\CMakeCache.txt ( - FINDSTR "Code/Mantid/TestingTools/cxxtest" %WORKSPACE%\build\CMakeCache.txt && ( - rmdir /S /Q %WORKSPACE%\build - ) -) - if not "%JOB_NAME%" == "%JOB_NAME:pull_requests=%" ( set BUILDPKG=yes ) +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: Setup the build directory +:: For a clean build the entire thing is removed to guarantee it is clean. All +:: other build types are assumed to be incremental and the following items +:: are removed to ensure stale build objects don't interfere with each other: +:: - build/bin: if libraries are removed from cmake they are not deleted +:: from bin and can cause random failures +:: - build/ExternalData/**: data files will change over time and removing +:: the links helps keep it fresh +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +set BUILD_DIR=%WORKSPACE%\build +if "%CLEANBUILD%" == "yes" ( + rmdir /S /Q %BUILD_DIR% +) + +if EXIST %BUILD_DIR% ( + rmdir /S /Q %BUILD_DIR%\bin %BUILD_DIR%\ExternalData +) else ( + md %BUILD_DIR% +) + ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Packaging options ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @@ -57,14 +72,7 @@ if "%BUILDPKG%" == "yes" ( set PACKAGE_DOCS=-DPACKAGE_DOCS=ON ) -::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: Setup the build directory -::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -if "%CLEANBUILD%" == "yes" ( - rmdir /S /Q %WORKSPACE%\build -) -md %WORKSPACE%\build -cd %WORKSPACE%\build +cd %BUILD_DIR% ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Clean up any artifacts from last build so that if it fails @@ -132,7 +140,7 @@ if "%BUILDPKG%" == "yes" ( if not "%JOB_NAME%"=="%JOB_NAME:pull_requests=%" ( :: Install package set SYSTEMTESTS_DIR=%WORKSPACE%\Code\Mantid\Testing\SystemTests - python !SYSTEMTESTS_DIR!\scripts\mantidinstaller.py install %WORKSPACE%\build + python !SYSTEMTESTS_DIR!\scripts\mantidinstaller.py install %BUILD_DIR% ::Remove user properties, disable instrument updating & usage reports and add data paths del /Q C:\MantidInstall\bin\Mantid.user.properties @@ -144,13 +152,13 @@ if not "%JOB_NAME%"=="%JOB_NAME:pull_requests=%" ( echo datasearch.directories = !DATA_ROOT!/UnitTest;!DATA_ROOT!/DocTest;!WORKSPACE_UNIX_STYLE!/Code/Mantid/instrument >> C:\MantidInstall\bin\Mantid.user.properties :: Run tests - cd %WORKSPACE%\build\docs + cd %BUILD_DIR%\docs C:\MantidInstall\bin\MantidPlot.exe -xq runsphinx_doctest.py set RETCODE=!ERRORLEVEL! :: Remove Mantid - cd %WORKSPACE%\build - python !SYSTEMTESTS_DIR!\scripts\mantidinstaller.py uninstall %WORKSPACE%\build + cd %BUILD_DIR% + python !SYSTEMTESTS_DIR!\scripts\mantidinstaller.py uninstall %BUILD_DIR% if !RETCODE! NEQ 0 exit /B 1 ) diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/IMDNode.h b/Code/Mantid/Framework/API/inc/MantidAPI/IMDNode.h index 0bbbfe1f7f89aaadf424289751bc88b7e62a5166..1d8579b35fae7800f8e6a3aa2e34f44e64e1d290 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/IMDNode.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/IMDNode.h @@ -53,7 +53,7 @@ class IMDNode { */ public: - virtual ~IMDNode(){}; + virtual ~IMDNode(){} //---------------- ISAVABLE /**Return the pointer to the structure responsible for saving the box on disk * if the workspace occupies too much memory */ diff --git a/Code/Mantid/Framework/Algorithms/CMakeLists.txt b/Code/Mantid/Framework/Algorithms/CMakeLists.txt index a8dc4e85564ae800c6afaa4e80579bfe7a54f31e..d7ddd3c179cc5e94ee82375c415e9cec96eae9b6 100644 --- a/Code/Mantid/Framework/Algorithms/CMakeLists.txt +++ b/Code/Mantid/Framework/Algorithms/CMakeLists.txt @@ -43,7 +43,6 @@ set ( SRC_FILES src/ConvertAxisByFormula.cpp src/ConvertEmptyToTof.cpp src/ConvertFromDistribution.cpp - src/ConvertMDHistoToMatrixWorkspace.cpp src/ConvertSpectrumAxis.cpp src/ConvertSpectrumAxis2.cpp src/ConvertTableToMatrixWorkspace.cpp @@ -300,7 +299,6 @@ set ( INC_FILES inc/MantidAlgorithms/ConvertAxisByFormula.h inc/MantidAlgorithms/ConvertEmptyToTof.h inc/MantidAlgorithms/ConvertFromDistribution.h - inc/MantidAlgorithms/ConvertMDHistoToMatrixWorkspace.h inc/MantidAlgorithms/ConvertSpectrumAxis.h inc/MantidAlgorithms/ConvertSpectrumAxis2.h inc/MantidAlgorithms/ConvertTableToMatrixWorkspace.h @@ -568,7 +566,6 @@ set ( TEST_FILES ConvertAxisByFormulaTest.h ConvertEmptyToTofTest.h ConvertFromDistributionTest.h - ConvertMDHistoToMatrixWorkspaceTest.h ConvertSpectrumAxis2Test.h ConvertSpectrumAxisTest.h ConvertTableToMatrixWorkspaceTest.h diff --git a/Code/Mantid/Framework/Algorithms/test/CMakeLists.txt b/Code/Mantid/Framework/Algorithms/test/CMakeLists.txt index 7059335495bf4bcf2999ebd4d1fe4b8d8265b1cd..3a8a67ccd44f546ebc6429ff8ebcde49ddf7214e 100644 --- a/Code/Mantid/Framework/Algorithms/test/CMakeLists.txt +++ b/Code/Mantid/Framework/Algorithms/test/CMakeLists.txt @@ -27,19 +27,19 @@ if ( CXXTEST_FOUND ) configure_file ( PlusMinusTest.in.h ${CMAKE_CURRENT_SOURCE_DIR}/MinusTest.h) # Make the rest of the tests - include_directories ( ../../CurveFitting/inc ../../DataHandling/inc ../../Nexus/inc ../../TestHelpers/inc ../../MDEvents/inc) + include_directories ( ../../CurveFitting/inc ../../DataHandling/inc ../../Nexus/inc ../../TestHelpers/inc ) # This variable is used within the cxxtest_add_test macro to build these helper classes into the test executable. # It will go out of scope at the end of this file so doesn't need un-setting set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp ../../TestHelpers/src/ComponentCreationHelper.cpp ../../TestHelpers/src/WorkspaceCreationHelper.cpp ../../TestHelpers/src/SANSInstrumentCreationHelper.cpp - ../../TestHelpers/src/MDEventsTestHelper.cpp + ../../TestHelpers/src/MDEventsTestHelper.cpp ../../TestHelpers/src/ScopedFileHelper.cpp ) cxxtest_add_test ( AlgorithmsTest ${TEST_FILES} ) - target_link_libraries ( AlgorithmsTest Algorithms DataHandling MDEvents ${GMOCK_LIBRARIES} ) - add_dependencies ( AlgorithmsTest Crystal CurveFitting MDAlgorithms ) + target_link_libraries ( AlgorithmsTest Algorithms DataHandling ${GMOCK_LIBRARIES} ) + add_dependencies ( AlgorithmsTest Crystal CurveFitting ) add_dependencies ( FrameworkTests AlgorithmsTest ) # Test data add_dependencies ( AlgorithmsTest StandardTestData ) diff --git a/Code/Mantid/Framework/Algorithms/test/CheckWorkspacesMatchTest.h b/Code/Mantid/Framework/Algorithms/test/CheckWorkspacesMatchTest.h index ff1fda80316396c0507f51354d5843f665e9723a..e43422e8c7fc50a75cac599723b983c65f28936a 100644 --- a/Code/Mantid/Framework/Algorithms/test/CheckWorkspacesMatchTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CheckWorkspacesMatchTest.h @@ -8,21 +8,20 @@ #include "MantidKernel/UnitFactory.h" #include "MantidDataObjects/EventWorkspace.h" #include "MantidDataObjects/PeaksWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidAlgorithms/CreatePeaksWorkspace.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidGeometry/Instrument.h" -#include "MantidMDEvents/MDBoxBase.h" +#include "MantidDataObjects/MDBoxBase.h" #include "MantidKernel/V3D.h" using namespace Mantid::Algorithms; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; class CheckWorkspacesMatchTest : public CxxTest::TestSuite { @@ -218,8 +217,8 @@ public: void testMDEvents_matches() { if ( !checker.isInitialized() ) checker.initialize(); - MDEventWorkspace3Lean::sptr mdews1 = MDEventsTestHelper::makeFileBackedMDEW("mdev1", false); - MDEventWorkspace3Lean::sptr mdews2 = MDEventsTestHelper::makeFileBackedMDEW("mdev2", false); + MDEventWorkspace3Lean::sptr mdews1 = MDEventsTestHelper::makeFakeMDEventWorkspace("mdev1"); + MDEventWorkspace3Lean::sptr mdews2 = MDEventsTestHelper::makeFakeMDEventWorkspace("mdev2"); TS_ASSERT_THROWS_NOTHING( checker.setProperty("Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdews1)) ); TS_ASSERT_THROWS_NOTHING( checker.setProperty("Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdews2)) ); TS_ASSERT( checker.execute() ); diff --git a/Code/Mantid/Framework/Algorithms/test/CloneWorkspaceTest.h b/Code/Mantid/Framework/Algorithms/test/CloneWorkspaceTest.h index 55ccf6f2b7d7f49ffdbf1566fe93931ddc4c8ee7..759ee3e4ca54ec48cfcc9ec7576221c6d056365e 100644 --- a/Code/Mantid/Framework/Algorithms/test/CloneWorkspaceTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CloneWorkspaceTest.h @@ -10,7 +10,7 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidAPI/AnalysisDataService.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidGeometry/Instrument.h" #include "MantidDataObjects/PeaksWorkspace.h" @@ -19,8 +19,7 @@ using namespace Mantid; using namespace Mantid::Geometry; using namespace Mantid::API; using namespace Mantid::DataObjects; -using namespace Mantid::MDEvents; -using Mantid::MDEvents::MDEventsTestHelper::makeMDEW; +using Mantid::DataObjects::MDEventsTestHelper::makeMDEW; class CloneWorkspaceTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/Algorithms/test/ConvertEmptyToTofTest.h b/Code/Mantid/Framework/Algorithms/test/ConvertEmptyToTofTest.h index 940a7b6d8e7fb2b1426b25cbf5eafadcdbaee5e1..38fe372a479b82e72d7accb5f73c42698edc7181 100644 --- a/Code/Mantid/Framework/Algorithms/test/ConvertEmptyToTofTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ConvertEmptyToTofTest.h @@ -6,6 +6,7 @@ #include "MantidAlgorithms/ConvertEmptyToTof.h" #include "MantidAPI/AnalysisDataService.h" +#include "MantidAPI/FrameworkManager.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidGeometry/Instrument/ComponentHelper.h" @@ -25,6 +26,10 @@ public: delete suite; } + ConvertEmptyToTofTest() { + FrameworkManager::Instance(); + } + void test_Init() { ConvertEmptyToTof alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()) diff --git a/Code/Mantid/Framework/Algorithms/test/CopySampleTest.h b/Code/Mantid/Framework/Algorithms/test/CopySampleTest.h index 3c5c3403f3de256a87e70bb51df5ff843d612d1b..0c960094ea507f0005af573201e454ffc04e66cf 100644 --- a/Code/Mantid/Framework/Algorithms/test/CopySampleTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CopySampleTest.h @@ -2,9 +2,6 @@ #define MANTID_ALGORITHMS_COPYSAMPLETEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include <iostream> -#include <iomanip> #include "MantidAlgorithms/CopySample.h" #include "MantidDataObjects/WorkspaceSingleValue.h" @@ -16,9 +13,9 @@ #include "MantidGeometry/Instrument/ObjComponent.h" #include "MantidGeometry/Objects/Object.h" -#include "MantidMDEvents/MDEvent.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEvent.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidTestHelpers/ComponentCreationHelper.h" using namespace Mantid; @@ -27,7 +24,6 @@ using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::Geometry; using namespace Mantid::Kernel; -using namespace Mantid::MDEvents; class CopySampleTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/Algorithms/test/CreateSampleWorkspaceTest.h b/Code/Mantid/Framework/Algorithms/test/CreateSampleWorkspaceTest.h index 8096886acef7f46d597f3a39266aa18c493c549f..f39fe7824974146d27eaa696e1392199d057b7ef 100644 --- a/Code/Mantid/Framework/Algorithms/test/CreateSampleWorkspaceTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CreateSampleWorkspaceTest.h @@ -3,6 +3,7 @@ #include <cxxtest/TestSuite.h> +#include "MantidAPI/FrameworkManager.h" #include "MantidGeometry/Instrument.h" #include "MantidGeometry/IComponent.h" #include "MantidGeometry/Instrument/ReferenceFrame.h" @@ -25,6 +26,9 @@ public: static CreateSampleWorkspaceTest *createSuite() { return new CreateSampleWorkspaceTest(); } static void destroySuite( CreateSampleWorkspaceTest *suite ) { delete suite; } + CreateSampleWorkspaceTest() { + FrameworkManager::Instance(); + } void test_Init() { diff --git a/Code/Mantid/Framework/Algorithms/test/ElasticWindowTest.h b/Code/Mantid/Framework/Algorithms/test/ElasticWindowTest.h index 9c0104fb8b98354cd41363a5f735414b30fb5246..1016424c8a8419857ff67645c5182d470a7d4464 100644 --- a/Code/Mantid/Framework/Algorithms/test/ElasticWindowTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ElasticWindowTest.h @@ -5,7 +5,7 @@ #include <iostream> #include <iomanip> - +#include "MantidAPI/FrameworkManager.h" #include "MantidKernel/System.h" #include "MantidAlgorithms/ConvertUnits.h" @@ -24,6 +24,14 @@ using namespace Mantid::Kernel::Units; class ElasticWindowTest : 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 ElasticWindowTest *createSuite() { return new ElasticWindowTest(); } + static void destroySuite( ElasticWindowTest *suite ) { delete suite; } + + ElasticWindowTest() { + FrameworkManager::Instance(); + } void setUp() { diff --git a/Code/Mantid/Framework/Algorithms/test/ReflectometryReductionOneTest.h b/Code/Mantid/Framework/Algorithms/test/ReflectometryReductionOneTest.h index 2d76b3f7150bebb86cef84edd73e0015791ddce0..541989906a9f1248548765efac1dafb1cf61d84b 100644 --- a/Code/Mantid/Framework/Algorithms/test/ReflectometryReductionOneTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ReflectometryReductionOneTest.h @@ -5,6 +5,7 @@ #include <algorithm> #include "MantidAlgorithms/ReflectometryReductionOne.h" #include "MantidAPI/AlgorithmManager.h" +#include "MantidAPI/FrameworkManager.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidGeometry/Instrument/ReferenceFrame.h" @@ -36,6 +37,7 @@ public: ReflectometryReductionOneTest() { + FrameworkManager::Instance(); m_tinyReflWS = create2DWorkspaceWithReflectometryInstrument(); } diff --git a/Code/Mantid/Framework/Algorithms/test/RemoveExpDecayTest.h b/Code/Mantid/Framework/Algorithms/test/RemoveExpDecayTest.h index c8a27eb888e36c60ff7b57055e03f142c346dc74..f64aa6e7736b2d9e775bac74d6bd17efa29dba9b 100644 --- a/Code/Mantid/Framework/Algorithms/test/RemoveExpDecayTest.h +++ b/Code/Mantid/Framework/Algorithms/test/RemoveExpDecayTest.h @@ -2,7 +2,7 @@ #define MUONREMOVEEXPDECAYTEST_H_ #include <cxxtest/TestSuite.h> - +#include "MantidAPI/FrameworkManager.h" #include "MantidAlgorithms/RemoveExpDecay.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -14,6 +14,15 @@ const std::string outputName = "MuonRemoveExpDecay_Output"; class RemoveExpDecayTest : 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 RemoveExpDecayTest *createSuite() { return new RemoveExpDecayTest(); } + static void destroySuite( RemoveExpDecayTest *suite ) { delete suite; } + + RemoveExpDecayTest() { + FrameworkManager::Instance(); + } + void testInit() { diff --git a/Code/Mantid/Framework/Algorithms/test/StripPeaksTest.h b/Code/Mantid/Framework/Algorithms/test/StripPeaksTest.h index 2708f2bc0a3ba3ae9ae8a4f66327f2ffd6568d3f..8e3614fa09699e5f226ed53da78356a2d50c9bc9 100644 --- a/Code/Mantid/Framework/Algorithms/test/StripPeaksTest.h +++ b/Code/Mantid/Framework/Algorithms/test/StripPeaksTest.h @@ -6,6 +6,7 @@ #include "MantidAlgorithms/StripPeaks.h" #include "MantidAPI/AnalysisDataService.h" +#include "MantidAPI/FrameworkManager.h" #include "MantidKernel/UnitFactory.h" using namespace Mantid::API; @@ -20,6 +21,7 @@ public: StripPeaksTest() { + FrameworkManager::Instance(); MatrixWorkspace_sptr WS = WorkspaceCreationHelper::Create2DWorkspaceBinned(2,200,0.5,0.02); WS->getAxis(0)->unit() = Mantid::Kernel::UnitFactory::Instance().create("dSpacing"); diff --git a/Code/Mantid/Framework/Algorithms/test/WienerSmoothTest.h b/Code/Mantid/Framework/Algorithms/test/WienerSmoothTest.h index d09279b89bb34c798393ce14a2647424dd783e6e..8a5f20a99bd3675a0b02e80127126e6304b8cecb 100644 --- a/Code/Mantid/Framework/Algorithms/test/WienerSmoothTest.h +++ b/Code/Mantid/Framework/Algorithms/test/WienerSmoothTest.h @@ -4,6 +4,7 @@ #include <cxxtest/TestSuite.h> #include "MantidAlgorithms/WienerSmooth.h" +#include "MantidAPI/FrameworkManager.h" #include "MantidAPI/WorkspaceFactory.h" #include <algorithm> @@ -19,6 +20,10 @@ public: static WienerSmoothTest *createSuite() { return new WienerSmoothTest(); } static void destroySuite( WienerSmoothTest *suite ) { delete suite; } + WienerSmoothTest() { + FrameworkManager::Instance(); + } + void test_Init() { @@ -261,4 +266,4 @@ private: }; -#endif /* MANTID_ALGORITHMS_WIENERSMOOTHTEST_H_ */ \ No newline at end of file +#endif /* MANTID_ALGORITHMS_WIENERSMOOTHTEST_H_ */ diff --git a/Code/Mantid/Framework/CMakeLists.txt b/Code/Mantid/Framework/CMakeLists.txt index aa04d1bd087c4aa50a83a394afed4af255fae65d..9f4e6691c8f19db3a2757e7a2d49109db90a7408 100644 --- a/Code/Mantid/Framework/CMakeLists.txt +++ b/Code/Mantid/Framework/CMakeLists.txt @@ -125,7 +125,6 @@ if ( CXXTEST_FOUND ) endif () add_subdirectory (MDAlgorithms) -add_subdirectory (MDEvents) add_subdirectory (Doxygen) add_subdirectory (ScriptRepository) add_subdirectory (ISISLiveData) @@ -137,7 +136,7 @@ add_subdirectory (ISISLiveData) set ( FRAMEWORK_LIBS Kernel Geometry API PythonKernelModule PythonGeometryModule PythonAPIModule DataObjects DataHandling Nexus Algorithms CurveFitting ICat - Crystal MDAlgorithms MDEvents WorkflowAlgorithms + Crystal MDAlgorithms WorkflowAlgorithms LiveData ISISLiveData RemoteAlgorithms SINQ ) diff --git a/Code/Mantid/Framework/Crystal/test/CMakeLists.txt b/Code/Mantid/Framework/Crystal/test/CMakeLists.txt index 63573d93cd72f402c75d59c826772220ba84ef64..05c8a2ae8219d1f81f068ff46cd20c84473f1a7b 100644 --- a/Code/Mantid/Framework/Crystal/test/CMakeLists.txt +++ b/Code/Mantid/Framework/Crystal/test/CMakeLists.txt @@ -1,7 +1,7 @@ if ( CXXTEST_FOUND ) include_directories ( SYSTEM ${CXXTEST_INCLUDE_DIR} ${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR} ) - include_directories ( ../../DataHandling/inc ../../MDEvents/inc ../../TestHelpers/inc ) + include_directories ( ../../DataHandling/inc ../../TestHelpers/inc ) # This variable is used within the cxxtest_add_test macro to build these helper classes into the test executable. # It will go out of scope at the end of this file so doesn't need un-setting set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp @@ -9,7 +9,7 @@ if ( CXXTEST_FOUND ) ../../TestHelpers/src/WorkspaceCreationHelper.cpp ../../TestHelpers/src/MDEventsTestHelper.cpp ) cxxtest_add_test ( CrystalTest ${TEST_FILES} ) - target_link_libraries ( CrystalTest Crystal DataHandling MDEvents MDAlgorithms ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES}) + target_link_libraries ( CrystalTest Crystal DataHandling MDAlgorithms ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES}) add_dependencies ( CrystalTest Algorithms CurveFitting ) add_dependencies ( FrameworkTests CrystalTest ) # Test data diff --git a/Code/Mantid/Framework/Crystal/test/ClearUBTest.h b/Code/Mantid/Framework/Crystal/test/ClearUBTest.h index ae1189b6a6125fdc7353fce75ffe3fa08f0b325c..246be755ec94fd67de59adff90fde4fff83afdf5 100644 --- a/Code/Mantid/Framework/Crystal/test/ClearUBTest.h +++ b/Code/Mantid/Framework/Crystal/test/ClearUBTest.h @@ -10,8 +10,8 @@ #include "MantidDataObjects/TableWorkspace.h" using Mantid::Crystal::ClearUB; -using namespace Mantid::MDEvents; using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; class ClearUBTest : public CxxTest::TestSuite diff --git a/Code/Mantid/Framework/Crystal/test/ClusterIntegrationBaseTest.h b/Code/Mantid/Framework/Crystal/test/ClusterIntegrationBaseTest.h index dbe2d8792c52571e0392f9d016f7921915783fb9..afe0e9438fda42be1e94a63c306ff0cf4737e4fc 100644 --- a/Code/Mantid/Framework/Crystal/test/ClusterIntegrationBaseTest.h +++ b/Code/Mantid/Framework/Crystal/test/ClusterIntegrationBaseTest.h @@ -12,7 +12,6 @@ #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidTestHelpers/ComponentCreationHelper.h" -#include "MantidAPI/FrameworkManager.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/Workspace.h" #include "MantidKernel/V3D.h" @@ -24,9 +23,8 @@ using namespace Mantid::API; using namespace Mantid::Kernel; -using namespace Mantid::MDEvents; -using namespace Mantid::Geometry; using namespace Mantid::DataObjects; +using namespace Mantid::Geometry; // Helper typedef typedef boost::tuple<IMDHistoWorkspace_sptr, IPeaksWorkspace_sptr> MDHistoPeaksWSTuple; diff --git a/Code/Mantid/Framework/Crystal/test/ClusterTest.h b/Code/Mantid/Framework/Crystal/test/ClusterTest.h index a1beed4799991f95e03e097d5d8b1acb80a54901..76dca09b3bdde0f288f04b3b666d2f4ff24a139f 100644 --- a/Code/Mantid/Framework/Crystal/test/ClusterTest.h +++ b/Code/Mantid/Framework/Crystal/test/ClusterTest.h @@ -8,7 +8,7 @@ using Mantid::Crystal::Cluster; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; class ClusterTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/Crystal/test/ConnectedComponentLabelingTest.h b/Code/Mantid/Framework/Crystal/test/ConnectedComponentLabelingTest.h index cbc38165bac5c644a6b0fc24177b9a5e8eb40682..e31c7fd5cd9f294571d34af8fca15e6a22f345bc 100644 --- a/Code/Mantid/Framework/Crystal/test/ConnectedComponentLabelingTest.h +++ b/Code/Mantid/Framework/Crystal/test/ConnectedComponentLabelingTest.h @@ -20,7 +20,7 @@ using namespace Mantid::Crystal; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace testing; namespace diff --git a/Code/Mantid/Framework/Crystal/test/FindClusterFacesTest.h b/Code/Mantid/Framework/Crystal/test/FindClusterFacesTest.h index a009c35ea4b3328ee756d50cf05dade20bdca335..bec6cae16b07675a18f604c1bd4000eaf2ad7dcf 100644 --- a/Code/Mantid/Framework/Crystal/test/FindClusterFacesTest.h +++ b/Code/Mantid/Framework/Crystal/test/FindClusterFacesTest.h @@ -5,18 +5,17 @@ #include "MantidCrystal/FindClusterFaces.h" -#include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/FrameworkManager.h" #include "MantidDataObjects/PeaksWorkspace.h" -#include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidGeometry/Instrument.h" +#include "MantidTestHelpers/ComponentCreationHelper.h" +#include "MantidTestHelpers/MDEventsTestHelper.h" #include <boost/assign/list_of.hpp> using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid::DataObjects; -using namespace Mantid::MDEvents; using Mantid::Crystal::FindClusterFaces; namespace @@ -147,11 +146,6 @@ public: TS_ASSERT( alg.isInitialized()) } - FindClusterFacesTest() - { - Mantid::API::FrameworkManager::Instance(); - } - void test_throws_with_non_cluster_mdhistoworkspace() { const double nonIntegerSignalValue = 1.2; diff --git a/Code/Mantid/Framework/Crystal/test/HardThresholdBackgroundTest.h b/Code/Mantid/Framework/Crystal/test/HardThresholdBackgroundTest.h index 6d7a301414a3aa52c117db2e2cfc17abc01732c7..e172fa96448292b1268b250fcfe9416e3b05dac8 100644 --- a/Code/Mantid/Framework/Crystal/test/HardThresholdBackgroundTest.h +++ b/Code/Mantid/Framework/Crystal/test/HardThresholdBackgroundTest.h @@ -8,8 +8,8 @@ using namespace Mantid::Crystal; using namespace Mantid::API; -using namespace Mantid::MDEvents; -using namespace Mantid::MDEvents::MDEventsTestHelper; +using namespace Mantid::DataObjects; +using namespace Mantid::DataObjects::MDEventsTestHelper; class HardThresholdBackgroundTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/Crystal/test/HasUBTest.h b/Code/Mantid/Framework/Crystal/test/HasUBTest.h index d5e6628792d36c8bc32307c090c56641a3687bf8..b0541442f2a0b0b40331cc441a46215f79326926 100644 --- a/Code/Mantid/Framework/Crystal/test/HasUBTest.h +++ b/Code/Mantid/Framework/Crystal/test/HasUBTest.h @@ -11,7 +11,7 @@ #include "MantidDataObjects/TableWorkspace.h" using namespace Mantid::Crystal; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::API; using namespace Mantid::Geometry; diff --git a/Code/Mantid/Framework/Crystal/test/IntegratePeaksHybridTest.h b/Code/Mantid/Framework/Crystal/test/IntegratePeaksHybridTest.h index ae70954094ec21990255fa60f9bd7cae28600b45..e1c1846f56cd62313c2814a5603f7f1c2a7cfc3c 100644 --- a/Code/Mantid/Framework/Crystal/test/IntegratePeaksHybridTest.h +++ b/Code/Mantid/Framework/Crystal/test/IntegratePeaksHybridTest.h @@ -4,6 +4,7 @@ #include <cxxtest/TestSuite.h> #include "ClusterIntegrationBaseTest.h" +#include "MantidAPI/FrameworkManager.h" #include "MantidCrystal/IntegratePeaksHybrid.h" #include "MantidTestHelpers/MDEventsTestHelper.h" @@ -14,7 +15,7 @@ #include <boost/tuple/tuple.hpp> using namespace Mantid::Crystal; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::API; namespace diff --git a/Code/Mantid/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h b/Code/Mantid/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h index e6889939b74ae1e5dcee79e977a480fa5d3849a9..929a51b287ffc16237aeebdb2754557a4ef6e9af 100644 --- a/Code/Mantid/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h +++ b/Code/Mantid/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h @@ -3,6 +3,7 @@ #include <cxxtest/TestSuite.h> #include "ClusterIntegrationBaseTest.h" +#include "MantidAPI/FrameworkManager.h" #include "MantidCrystal/IntegratePeaksUsingClusters.h" using namespace Mantid::Crystal; diff --git a/Code/Mantid/Framework/Crystal/test/MaskPeaksWorkspaceTest.h b/Code/Mantid/Framework/Crystal/test/MaskPeaksWorkspaceTest.h index 04b3c7b9aa55ab78d37f60f2eae928bfd30e61a6..a3d14f129ebb5e1c0ff2add0f09bd5bac6067a29 100644 --- a/Code/Mantid/Framework/Crystal/test/MaskPeaksWorkspaceTest.h +++ b/Code/Mantid/Framework/Crystal/test/MaskPeaksWorkspaceTest.h @@ -5,15 +5,11 @@ #include "MantidCrystal/MaskPeaksWorkspace.h" #include "MantidDataObjects/EventWorkspace.h" #include "MantidDataObjects/PeaksWorkspace.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidDataObjects/EventList.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Crystal; @@ -39,7 +35,7 @@ public: { int numEventsPer = 100; - EventWorkspace_sptr inputW = Mantid::MDEvents::MDEventsTestHelper::createDiffractionEventWorkspace(numEventsPer,10000,1600); + EventWorkspace_sptr inputW = Mantid::DataObjects::MDEventsTestHelper::createDiffractionEventWorkspace(numEventsPer,10000,1600); AnalysisDataService::Instance().addOrReplace("testInEW", inputW); if (type == WEIGHTED) inputW *= 2.0; @@ -99,7 +95,7 @@ public: { int numEventsPer = 100; - EventWorkspace_sptr inputW = Mantid::MDEvents::MDEventsTestHelper::createDiffractionEventWorkspace(numEventsPer,10000,1600); + EventWorkspace_sptr inputW = Mantid::DataObjects::MDEventsTestHelper::createDiffractionEventWorkspace(numEventsPer,10000,1600); AnalysisDataService::Instance().addOrReplace("testInEW", inputW); if (type == WEIGHTED) { diff --git a/Code/Mantid/Framework/Crystal/test/PeakClusterProjectionTest.h b/Code/Mantid/Framework/Crystal/test/PeakClusterProjectionTest.h index 999e7d5e20751dd7ae7238e9cbf57f49a3a19901..1225e3b1469395a6b1bda1ffa6151547bb583d81 100644 --- a/Code/Mantid/Framework/Crystal/test/PeakClusterProjectionTest.h +++ b/Code/Mantid/Framework/Crystal/test/PeakClusterProjectionTest.h @@ -4,12 +4,11 @@ #include <cxxtest/TestSuite.h> #include "MantidCrystal/PeakClusterProjection.h" - +#include "MantidAPI/AlgorithmManager.h" +#include "MantidAPI/FrameworkManager.h" #include "MantidAPI/IMDHistoWorkspace.h" #include "MantidAPI/IPeaksWorkspace.h" #include "MantidAPI/IPeak.h" -#include "MantidAPI/FrameworkManager.h" -#include "MantidAPI/AlgorithmManager.h" #include "MantidDataObjects/PeaksWorkspace.h" #include "MantidTestHelpers/MDEventsTestHelper.h" @@ -21,7 +20,6 @@ using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid::Crystal; -using namespace Mantid::MDEvents; using namespace Mantid::DataObjects; class PeakClusterProjectionTest: public CxxTest::TestSuite @@ -90,8 +88,7 @@ public: delete suite; } - PeakClusterProjectionTest() - { + PeakClusterProjectionTest() { FrameworkManager::Instance(); } diff --git a/Code/Mantid/Framework/Crystal/test/SetSpecialCoordinatesTest.h b/Code/Mantid/Framework/Crystal/test/SetSpecialCoordinatesTest.h index 5f459b72303e134909b00011a0f12197f3655984..c9508eea019b6711b39f875c461a25537374318a 100644 --- a/Code/Mantid/Framework/Crystal/test/SetSpecialCoordinatesTest.h +++ b/Code/Mantid/Framework/Crystal/test/SetSpecialCoordinatesTest.h @@ -84,7 +84,7 @@ public: void test_ModifyMDEventWorkspace() { - IMDEventWorkspace_sptr inWS = Mantid::MDEvents::MDEventsTestHelper::makeMDEW<1>(1, 0, 1, 1); + IMDEventWorkspace_sptr inWS = Mantid::DataObjects::MDEventsTestHelper::makeMDEW<1>(1, 0, 1, 1); AnalysisDataService::Instance().add("inWS", inWS); SetSpecialCoordinates alg; @@ -101,7 +101,7 @@ public: void test_ModifyMDHistoWorkspace() { - IMDHistoWorkspace_sptr inWS = Mantid::MDEvents::MDEventsTestHelper::makeFakeMDHistoWorkspace(1, 1); + IMDHistoWorkspace_sptr inWS = Mantid::DataObjects::MDEventsTestHelper::makeFakeMDHistoWorkspace(1, 1); AnalysisDataService::Instance().add("inWS", inWS); SetSpecialCoordinates alg; diff --git a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadFITS.h b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadFITS.h index f22452fabd9ea914788f816653977a21060090dc..474446b003ca01542ab1f1f8a38aba38bf33f20e 100644 --- a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadFITS.h +++ b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadFITS.h @@ -15,7 +15,7 @@ using namespace std; struct FITSInfo { vector<string> headerItems; - map<string, string> headerKeys; + std::map<string, string> headerKeys; int bitsPerPixel; int numberOfAxis; int offset; @@ -24,54 +24,44 @@ struct FITSInfo { double tof; double timeBin; double scale; - int imageKey; + std::string imageKey; long int countsInImage; long int numberOfTriggers; - string extension; - string filePath; + std::string extension; + std::string filePath; bool isFloat; }; namespace Mantid { namespace DataHandling { /** - LoadFITS : Load a number of FITS files into a histogram Workspace +LoadFITS: Load one or more of FITS files into a Workspace2D. The FITS +format, normally used for images, is described for example here: +http://www.fileformat.info/format/fits/egff.htm - File format is described here: http://www.fileformat.info/format/fits/egff.htm - This loader doesn't support the full specification, caveats are: - Support for unsigned 8, 16, 32 bit values only - Support only for 2 data axis - No support for format extensions +At the moment this algorithm only supports 2 data axis and the +following data types: unsigned 8, 16, 32 bits per pixel. - Loader is designed to work with multiple files, loading into a single - workspace. - At points there are assumptions that all files in a batch use the same number - of bits per pixel, - and that the number of spectra in each file are the same. +Copyright © 2014,2015 ISIS Rutherford Appleton Laboratory, NScD +Oak Ridge National Laboratory & European Spallation Source - @author John R Hill, RAL - @date 29/08/2014 +This file is part of Mantid. - Copyright © 2014 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge - National Laboratory & European Spallation Source +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. - This file is part of Mantid. +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. - 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. +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. - 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> +File change history is stored at: <https://github.com/mantidproject/mantid> +Code Documentation is available at: <http://doxygen.mantidproject.org> */ class DLLExport LoadFITS : public API::IFileLoader<Kernel::FileDescriptor> { @@ -84,7 +74,7 @@ public: /// Summary of algorithms purpose virtual const std::string summary() const { - return "Load data from FITS files."; + return "Load FITS files into workspaces of type Workspace2D."; } /// Algorithm's version for identification overriding a virtual method @@ -105,51 +95,80 @@ private: void init(); /// Execution code void exec(); - /// Parses the header values for the FITS file - bool parseHeader(FITSInfo &headerInfo); - /// Creates a vector of all rotations from a file - std::vector<double> readRotations(std::string rotFilePath, size_t fileCount); + /// Loads files into workspace(s) + void doLoadFiles(const std::vector<std::string> &paths); + + /// Loads the FITS header(s) into a struct + void doLoadHeaders(const std::vector<std::string> &paths, + std::vector<FITSInfo> &headers); + + /// Parses the header values for the FITS file + void parseHeader(FITSInfo &headerInfo); /// Initialises a workspace with IDF and fills it with data DataObjects::Workspace2D_sptr - addWorkspace(const FITSInfo &fileInfo, size_t &newFileNumber, - void *&bufferAny, API::MantidImage &imageY, - API::MantidImage &imageE, double rotation, - const DataObjects::Workspace2D_sptr parent); + makeWorkspace(const FITSInfo &fileInfo, size_t &newFileNumber, + std::vector<char> &buffer, API::MantidImage &imageY, + API::MantidImage &imageE, + const DataObjects::Workspace2D_sptr parent); + + // Reads the data from a single FITS file into a workspace + void readDataToWorkspace2D(DataObjects::Workspace2D_sptr ws, + const FITSInfo &fileInfo, API::MantidImage &imageY, + API::MantidImage &imageE, + std::vector<char> &buffer); + + /// Once loaded, check against standard and limitations of this algorithm + void headerSanityCheck(const FITSInfo &hdr, const FITSInfo &hdrFirst); + + void setupDefaultKeywordNames(); /// Returns the trailing number from a string minus leading 0's (so 25 from /// workspace_00025) - size_t fetchNumber(std::string name); + size_t fetchNumber(const std::string &name); // Adds a number of leading 0's to another number up to the totalDigitCount. - std::string padZeros(size_t number, size_t totalDigitCount); - - // Reads the data from a single FITS file into a workspace - void readFileToWorkspace(DataObjects::Workspace2D_sptr ws, - const FITSInfo &fileInfo, API::MantidImage &imageY, - API::MantidImage &imageE, void *&bufferAny); + std::string padZeros(const size_t number, const size_t totalDigitCount); // Maps the header keys to specified values void mapHeaderKeys(); // Strings used to map header keys - string m_headerScaleKey; - string m_headerOffsetKey; - string m_headerBitDepthKey; - string m_headerRotationKey; - string m_headerImageKeyKey; - string m_mapFile; + std::string m_headerScaleKey; + std::string m_headerOffsetKey; + std::string m_headerBitDepthKey; + std::string m_headerRotationKey; + std::string m_headerImageKeyKey; + std::string m_headerNAxisNameKey; std::vector<std::string> m_headerAxisNameKeys; + std::string m_mapFile; - string m_baseName; + static const std::string m_defaultImgType; + + // names of extension headers + std::string m_sampleRotation; + std::string m_imageType; + + std::string m_baseName; size_t m_spectraCount; API::Progress *m_progress; - // Number of digits which will be appended to a workspace name, i.e. 4 = - // workspace_0001 - static const size_t DIGIT_SIZE_APPEND = 4; + // Number of digits for the fixed width appendix number added to + // workspace names, i.e. 3=> workspace_001; 5 => workspace_00001 + static const size_t DIGIT_SIZE_APPEND = 5; + /// size of a FITS header block (room for 36 entries, of 80 + /// characters each), in bytes. A FITS header always comes in + /// multiples of this block. static const int BASE_HEADER_SIZE = 2880; + + // names for several options that can be given in a "FITS" header + // setup file + static const std::string m_BIT_DEPTH_NAME; + static const std::string m_AXIS_NAMES_NAME; + static const std::string m_ROTATION_NAME; + static const std::string m_IMAGE_KEY_NAME; + static const std::string m_HEADER_MAP_NAME; }; } // namespace DataHandling diff --git a/Code/Mantid/Framework/DataHandling/src/LoadFITS.cpp b/Code/Mantid/Framework/DataHandling/src/LoadFITS.cpp index c147984dc309b96d04e74125cca22c1dd1bf87b3..f8c6571370091b98e9640f6f84fe2905b468c9b8 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadFITS.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadFITS.cpp @@ -1,12 +1,14 @@ -#include "MantidDataHandling/LoadFITS.h" #include "MantidAPI/MultipleFileProperty.h" #include "MantidAPI/FileProperty.h" #include "MantidAPI/RegisterFileLoader.h" +#include "MantidDataHandling/LoadFITS.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidKernel/UnitFactory.h" + #include <boost/algorithm/string.hpp> #include <Poco/BinaryReader.h> -#include <fstream> +#include <Poco/FileStream.h> + using namespace Mantid::DataHandling; using namespace Mantid::DataObjects; @@ -14,40 +16,30 @@ using namespace Mantid::API; using namespace Mantid::Kernel; using namespace std; using namespace boost; -using Poco::BinaryReader; -namespace { -static const std::string BIT_DEPTH_NAME = "BitDepthName"; -static const std::string ROTATION_NAME = "RotationName"; -static const std::string AXIS_NAMES_NAME = "AxisNames"; -static const std::string IMAGE_KEY_NAME = "ImageKeyName"; -static const std::string HEADER_MAP_NAME = "HeaderMapFile"; - -/** -* Used with find_if to check a string isn't a fits file (by checking extension) -* @param s string to check for extension -* @returns bool Value indicating if the string ends with .fits or not -*/ -bool IsNotFits(std::string s) { - std::string tmp = s; - to_lower(tmp); - return !ends_with(tmp, ".fits"); -} -} +namespace {} namespace Mantid { namespace DataHandling { // Register the algorithm into the AlgorithmFactory DECLARE_FILELOADER_ALGORITHM(LoadFITS) +const std::string LoadFITS::m_BIT_DEPTH_NAME = "BitDepthName"; +const std::string LoadFITS::m_ROTATION_NAME = "RotationName"; +const std::string LoadFITS::m_AXIS_NAMES_NAME = "AxisNames"; +const std::string LoadFITS::m_IMAGE_KEY_NAME = "ImageKeyName"; +const std::string LoadFITS::m_HEADER_MAP_NAME = "HeaderMapFile"; + +const std::string LoadFITS::m_defaultImgType = "SAMPLE"; + /** * Constructor. Just initialize everything to prevent issues. */ -LoadFITS::LoadFITS(): m_headerScaleKey(), m_headerOffsetKey(), - m_headerBitDepthKey(), m_headerRotationKey(), - m_headerImageKeyKey(), m_mapFile(), - m_headerAxisNameKeys(), m_baseName(), - m_spectraCount(0), m_progress(NULL) { +LoadFITS::LoadFITS() + : m_headerScaleKey(), m_headerOffsetKey(), m_headerBitDepthKey(), + m_headerRotationKey(), m_headerImageKeyKey(), m_headerAxisNameKeys(), + m_mapFile(), m_baseName(), m_spectraCount(0), m_progress(NULL) { + setupDefaultKeywordNames(); } /** @@ -64,6 +56,31 @@ int LoadFITS::confidence(Kernel::FileDescriptor &descriptor) const { : 0; } +/** + * Sets several keyword names with default (and standard) values. You + * don't want to change these unless you want to break compatibility + * with the FITS standard. + */ +void LoadFITS::setupDefaultKeywordNames() { + // Inits all the absolutely necessary keywords + // standard headers (If SIMPLE=T) + m_headerScaleKey = "BSCALE"; + m_headerOffsetKey = "BZERO"; + m_headerBitDepthKey = "BITPIX"; + m_headerImageKeyKey = "IMAGE_TYPE"; // This is a "HIERARCH Image/Type= " + m_headerRotationKey = "ROTATION"; + + m_headerNAxisNameKey = "NAXIS"; + m_headerAxisNameKeys.push_back("NAXIS1"); + m_headerAxisNameKeys.push_back("NAXIS2"); + + m_mapFile = ""; + + // extensions + m_sampleRotation = "HIERARCH Sample/Tomo_Angle"; + m_imageType = "HIERARCH Image/Type"; +} + /** * Initialise the algorithm. Declare properties which can be set before execution * (input) or @@ -82,308 +99,325 @@ void LoadFITS::init() { exts2.push_back(".*"); declareProperty(new MultipleFileProperty("Filename", exts), - "The input filename of the stored data"); + "The name of the input file (you can give " + "multiple file names separated by commas)."); declareProperty(new API::WorkspaceProperty<API::Workspace>( "OutputWorkspace", "", Kernel::Direction::Output)); declareProperty( - new PropertyWithValue<int>("ImageKey", 0, Kernel::Direction::Input), - "Image type to set these files as. 0=data image, 1=flat field, 2=open " - "field, -1=use the value from FITS header. At present, if this is not " - "specified and an IMAGEKEY entry is not found in the FITS header, the " - "loader will show an error message and stop."); - - declareProperty(new PropertyWithValue<string>(BIT_DEPTH_NAME, "BITPIX", - Kernel::Direction::Input), - "Name for the pixel bit depth header key."); - declareProperty(new PropertyWithValue<string>(ROTATION_NAME, "ROTATION", - Kernel::Direction::Input), - "Name for the rotation header key."); - declareProperty( - new PropertyWithValue<string>(AXIS_NAMES_NAME, "NAXIS1,NAXIS2", - Kernel::Direction::Input), - "Names for the axis header keys, comma separated string of all axis."); - declareProperty(new PropertyWithValue<string>(IMAGE_KEY_NAME, "IMAGEKEY", - Kernel::Direction::Input), - "Names for the image type, key."); - - declareProperty( - new FileProperty(HEADER_MAP_NAME, "", FileProperty::OptionalDirectory, "", - Kernel::Direction::Input), - "A file mapping header keys to the ones used by ISIS [line separated " - "values in the format KEY=VALUE, e.g. BitDepthName=BITPIX "); + new FileProperty(m_HEADER_MAP_NAME, "", FileProperty::OptionalDirectory, + "", Kernel::Direction::Input), + "A file mapping header key names to non-standard names [line separated " + "values in the format KEY=VALUE, e.g. BitDepthName=BITPIX] - do not use " + "this if you want to keep compatibility with standard FITS files."); } /** -* Execute the algorithm. -*/ + * Execute the algorithm. + */ void LoadFITS::exec() { - // Init header info - setup some defaults just in case - m_headerScaleKey = "BSCALE"; - m_headerOffsetKey = "BZERO"; - m_headerBitDepthKey = "BITPIX"; - m_headerImageKeyKey = "IMAGEKEY"; - m_headerRotationKey = "ROTATION"; - m_mapFile = ""; - m_headerAxisNameKeys.push_back("NAXIS1"); - m_headerAxisNameKeys.push_back("NAXIS2"); - + // for non-standard headers, by default won't do anything mapHeaderKeys(); - // Create FITS file information for each file selected - std::vector<std::string> paths; string fName = getPropertyValue("Filename"); - boost::split(paths, fName, boost::is_any_of(",")); - // If paths contains a non fits file, assume (for now) that it contains - // information about the rotations - std::string rotFilePath = ""; - std::vector<std::string>::iterator it = - std::find_if(paths.begin(), paths.end(), IsNotFits); - if (it != paths.end()) { - rotFilePath = *it; - paths.erase(it); - } - vector<FITSInfo> allHeaderInfo; - allHeaderInfo.resize(paths.size()); - - // Check each header is valid for this loader, - standard (no extension to - // FITS), and has two axis - bool headerValid = true; + std::vector<std::string> paths; + boost::split(paths, fName, boost::is_any_of(",")); + doLoadFiles(paths); +} - for (size_t i = 0; i < paths.size(); ++i) { - allHeaderInfo[i].extension = ""; - allHeaderInfo[i].filePath = paths[i]; - // Get various pieces of information from the file header which are used to - // create the workspace - if (parseHeader(allHeaderInfo[i])) { - // Get and convert specific standard header values which will help when - // parsing the data - // BITPIX, NAXIS, NAXISi (where i = 1..NAXIS, e.g. NAXIS2 for two axis), - // TOF, TIMEBIN, N_COUNTS, N_TRIGS - try { - string tmpBitPix = allHeaderInfo[i].headerKeys[m_headerBitDepthKey]; - if (boost::contains(tmpBitPix, "-")) { - boost::erase_all(tmpBitPix, "-"); - allHeaderInfo[i].isFloat = true; - } else { - allHeaderInfo[i].isFloat = false; - } +/** + * Create FITS file information for each file selected. Loads headers + * and data from the files and fills the output workspace(s). + * + * @param paths File names as given in the algorithm input property + */ +void LoadFITS::doLoadFiles(const std::vector<std::string> &paths) { + std::vector<FITSInfo> headers; - // Add the image key, use the property if it's not -1, otherwise use the - // header value - allHeaderInfo[i].imageKey = - boost::lexical_cast<int>(getPropertyValue("ImageKey")); - if (allHeaderInfo[i].imageKey == -1) { - allHeaderInfo[i].imageKey = boost::lexical_cast<int>( - allHeaderInfo[i].headerKeys[m_headerImageKeyKey]); - } + doLoadHeaders(paths, headers); - allHeaderInfo[i].bitsPerPixel = lexical_cast<int>(tmpBitPix); - allHeaderInfo[i].numberOfAxis = - static_cast<int>(m_headerAxisNameKeys.size()); + // No extension is set -> it's the standard format which we can parse. + if (headers[0].numberOfAxis > 0) + m_spectraCount += headers[0].axisPixelLengths[0]; - for (int j = 0; - allHeaderInfo.size() > i && j < allHeaderInfo[i].numberOfAxis; - ++j) { - allHeaderInfo[i].axisPixelLengths.push_back(lexical_cast<size_t>( - allHeaderInfo[i].headerKeys[m_headerAxisNameKeys[j]])); - } + // Presumably 2 axis, but futureproofing. + for (int i = 1; i < headers[0].numberOfAxis; ++i) { + m_spectraCount *= headers[0].axisPixelLengths[i]; + } - // m_allHeaderInfo[i].tof = - // lexical_cast<double>(m_allHeaderInfo[i].headerKeys["TOF"]); - // m_allHeaderInfo[i].timeBin = - // lexical_cast<double>(m_allHeaderInfo[i].headerKeys["TIMEBIN"]); - // m_allHeaderInfo[i].countsInImage = lexical_cast<long - // int>(m_allHeaderInfo[i].headerKeys["N_COUNTS"]); - // m_allHeaderInfo[i].numberOfTriggers = lexical_cast<long - // int>(m_allHeaderInfo[i].headerKeys["N_TRIGS"]); - allHeaderInfo[i].extension = - allHeaderInfo[i].headerKeys["XTENSION"]; // Various extensions are - // available to the FITS - // format, and must be - // parsed differently if - // this is present. Loader - // doesn't support this. - - } catch (std::exception &) { - // todo write error and fail this load with invalid data in file. - throw std::runtime_error("Unable to locate one or more valid BITPIX, " - "NAXIS or IMAGEKEY values in the FITS file " - "header."); - } + MantidImage imageY(headers[0].axisPixelLengths[0], + vector<double>(headers[0].axisPixelLengths[1])); + MantidImage imageE(headers[0].axisPixelLengths[0], + vector<double>(headers[0].axisPixelLengths[1])); - allHeaderInfo[i].scale = - (allHeaderInfo[i].headerKeys[m_headerScaleKey] == "") - ? 1 - : lexical_cast<double>( - allHeaderInfo[i].headerKeys[m_headerScaleKey]); - allHeaderInfo[i].offset = - (allHeaderInfo[i].headerKeys[m_headerOffsetKey] == "") - ? 0 - : lexical_cast<int>( - allHeaderInfo[i].headerKeys[m_headerOffsetKey]); - - if (allHeaderInfo[i].extension != "") - headerValid = false; - if (allHeaderInfo[i].numberOfAxis != 2) - headerValid = false; - - // Test current item has same axis values as first item. - if (allHeaderInfo[0].axisPixelLengths[0] != - allHeaderInfo[i].axisPixelLengths[0]) - headerValid = false; - if (allHeaderInfo[0].axisPixelLengths[1] != - allHeaderInfo[i].axisPixelLengths[1]) - headerValid = false; - } else { - // Unable to parse the header, throw. - throw std::runtime_error("Unable to open the FITS file."); - } + size_t bytes = (headers[0].bitsPerPixel / 8) * m_spectraCount; + std::vector<char> buffer; + try { + buffer.resize(bytes); + } catch (std::exception &) { + throw std::runtime_error( + "Could not allocate enough memory to run when trying to allocate " + + boost::lexical_cast<std::string>(bytes) + " bytes."); } - // Check that the files use bit depths of either 8, 16 or 32 - if (allHeaderInfo[0].bitsPerPixel != 8 && - allHeaderInfo[0].bitsPerPixel != 16 && - allHeaderInfo[0].bitsPerPixel != 32 && - allHeaderInfo[0].bitsPerPixel != 64) - throw std::runtime_error( - "FITS loader only supports 8, 16, 32 or 64 bits per pixel."); + // Create a group for these new workspaces, if the group already exists, add + // to it. + string groupName = getPropertyValue("OutputWorkspace"); - // Check the format is correct and create the Workspace - if (headerValid) { - // No extension is set, therefore it's the standard format which we can - // parse. + // This forms the name of the group + m_baseName = getPropertyValue("OutputWorkspace") + "_"; - if (allHeaderInfo[0].numberOfAxis > 0) - m_spectraCount += allHeaderInfo[0].axisPixelLengths[0]; + size_t fileNumberInGroup = 0; + WorkspaceGroup_sptr wsGroup; - // Presumably 2 axis, but futureproofing. - for (int i = 1; i < allHeaderInfo[0].numberOfAxis; ++i) { - m_spectraCount *= allHeaderInfo[0].axisPixelLengths[i]; - } + if (!AnalysisDataService::Instance().doesExist(groupName)) { + wsGroup = WorkspaceGroup_sptr(new WorkspaceGroup); + wsGroup->setTitle(groupName); + } else { + // Get the name of the latest file in group to start numbering from + if (AnalysisDataService::Instance().doesExist(groupName)) + wsGroup = + AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>(groupName); + + std::string latestName = wsGroup->getNames().back(); + // Set next file number + fileNumberInGroup = fetchNumber(latestName) + 1; + } - MantidImage imageY(allHeaderInfo[0].axisPixelLengths[0], - vector<double>(allHeaderInfo[0].axisPixelLengths[1])); - MantidImage imageE(allHeaderInfo[0].axisPixelLengths[0], - vector<double>(allHeaderInfo[0].axisPixelLengths[1])); - ; + // Create a progress reporting object + m_progress = new Progress(this, 0, 1, headers.size() + 1); - void *bufferAny = NULL; - bufferAny = malloc((allHeaderInfo[0].bitsPerPixel / 8) * m_spectraCount); - if (bufferAny == NULL) { - throw std::runtime_error( - "FITS loader couldn't allocate enough memory to run."); - } + // Create first workspace (with instrument definition). This is also used as + // a template for creating others + Workspace2D_sptr latestWS; + latestWS = makeWorkspace(headers[0], fileNumberInGroup, buffer, imageY, + imageE, latestWS); - // Set info in WS log to hold rotational information - vector<double> rotations; - if (rotFilePath != "") - rotations = readRotations(rotFilePath, paths.size()); + map<size_t, Workspace2D_sptr> wsOrdered; + wsOrdered[0] = latestWS; + try { + IAlgorithm_sptr loadInst = createChildAlgorithm("LoadInstrument"); + std::string directoryName = + Kernel::ConfigService::Instance().getInstrumentDirectory(); + directoryName = directoryName + "/IMAT_Definition.xml"; + loadInst->setPropertyValue("Filename", directoryName); + loadInst->setProperty<MatrixWorkspace_sptr>( + "Workspace", dynamic_pointer_cast<MatrixWorkspace>(latestWS)); + loadInst->execute(); + } catch (std::exception &ex) { + g_log.information("Cannot load the instrument definition. " + + string(ex.what())); + } - // Create a group for these new workspaces, if the group already exists, add - // to it. - string groupName = getPropertyValue("OutputWorkspace"); + PARALLEL_FOR_NO_WSP_CHECK() + for (int64_t i = 1; i < static_cast<int64_t>(headers.size()); ++i) { + latestWS = makeWorkspace(headers[i], fileNumberInGroup, buffer, imageY, + imageE, latestWS); + wsOrdered[i] = latestWS; + } - // This forms the name of the group - m_baseName = getPropertyValue("OutputWorkspace") + "_"; + // Add to group - done here to maintain sequence + for (auto it = wsOrdered.begin(); it != wsOrdered.end(); ++it) { + wsGroup->addWorkspace(it->second); + } - size_t fileNumberInGroup = 0; - WorkspaceGroup_sptr wsGroup; + setProperty("OutputWorkspace", wsGroup); +} - if (!AnalysisDataService::Instance().doesExist(groupName)) { - wsGroup = WorkspaceGroup_sptr(new WorkspaceGroup); - wsGroup->setTitle(groupName); - } else { - // Get the name of the latest file in group to start numbering from - if (AnalysisDataService::Instance().doesExist(groupName)) - wsGroup = AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>( - groupName); - - std::string latestName = wsGroup->getNames().back(); - // Set next file number - fileNumberInGroup = fetchNumber(latestName) + 1; - } +/** + * Load header(s) from FITS file(s) into FITSInfo header + * struct(s). This is usually the first step when loading FITS files + * into workspaces or anything else. In the simplest case, paths has + * only one string and only one header struct is added in headers. + * + * @param paths File name(s) + * @param headers Vector where to store the header struct(s) + * + * @throws std::runtime_error if issues are found in the headers + */ +void LoadFITS::doLoadHeaders(const std::vector<std::string> &paths, + std::vector<FITSInfo> &headers) { + headers.resize(paths.size()); - // Create a progress reporting object - m_progress = new Progress(this, 0, 1, allHeaderInfo.size() + 1); + for (size_t i = 0; i < paths.size(); ++i) { + headers[i].extension = ""; + headers[i].filePath = paths[i]; + // Get various pieces of information from the file header which are used to + // create the workspace + try { + parseHeader(headers[i]); + } catch (std::exception &e) { + // Unable to parse the header, throw. + throw std::runtime_error( + "Severe problem found while parsing the header of " + "this FITS file (" + + paths[i] + + "). This file may not be standard FITS. Error description: " + + e.what()); + } - // Create First workspace with instrument definition, also used as a - // template for creating others - Workspace2D_sptr latestWS; - double rot = (rotations.size() > 0) ? rotations[0] : -1; - map<size_t, Workspace2D_sptr> wsOrdered; + // Get and convert specific standard header values which will are + // needed to know how to load the data: BITPIX, NAXIS, NAXISi (where i = + // 1..NAXIS, e.g. NAXIS2 for two axis). + try { + string tmpBitPix = headers[i].headerKeys[m_headerBitDepthKey]; + if (boost::contains(tmpBitPix, "-")) { + boost::erase_all(tmpBitPix, "-"); + headers[i].isFloat = true; + } else { + headers[i].isFloat = false; + } - latestWS = addWorkspace(allHeaderInfo[0], fileNumberInGroup, bufferAny, - imageY, imageE, rot, latestWS); - wsOrdered[0] = latestWS; + headers[i].bitsPerPixel = lexical_cast<int>(tmpBitPix); + // Check that the files use bit depths of either 8, 16 or 32 + if (headers[i].bitsPerPixel != 8 && headers[i].bitsPerPixel != 16 && + headers[i].bitsPerPixel != 32 && headers[i].bitsPerPixel != 64) + throw std::runtime_error( + "This algorithm only supports 8, 16, 32 or 64 " + "bits per pixel. The header of file '" + + paths[i] + "' says that its bit depth is: " + + boost::lexical_cast<std::string>(headers[i].bitsPerPixel)); + } catch (std::exception &e) { + throw std::runtime_error( + "Failed to process the '" + m_headerBitDepthKey + + "' entry (bits per pixel) in the header of this file: " + paths[i] + + ". Error description: " + e.what()); + } try { - IAlgorithm_sptr loadInst = createChildAlgorithm("LoadInstrument"); - std::string directoryName = - Kernel::ConfigService::Instance().getInstrumentDirectory(); - directoryName = directoryName + "/IMAT_Definition.xml"; - loadInst->setPropertyValue("Filename", directoryName); - loadInst->setProperty<MatrixWorkspace_sptr>( - "Workspace", dynamic_pointer_cast<MatrixWorkspace>(latestWS)); - loadInst->execute(); - } catch (std::exception &ex) { - g_log.information("Cannot load the instrument definition. " + - string(ex.what())); + // Add the image key, use the value in the FITS header if found, + // otherwise default (to SAMPLE). + auto it = headers[i].headerKeys.find(m_headerImageKeyKey); + if (headers[i].headerKeys.end() != it) { + headers[i].imageKey = it->second; + } else { + headers[i].imageKey = m_defaultImgType; + } + } catch (std::exception &e) { + throw std::runtime_error("Failed to process the '" + m_headerImageKeyKey + + "' entry (type of image: sample, dark, open) in " + "the header of this file: " + + paths[i] + ". Error description: " + e.what()); } - PARALLEL_FOR_NO_WSP_CHECK() - for (int64_t i = 1; i < static_cast<int64_t>(allHeaderInfo.size()); ++i) { - double rot = - (static_cast<int64_t>(rotations.size()) > i) ? rotations[i] : -1; - latestWS = addWorkspace(allHeaderInfo[i], fileNumberInGroup, bufferAny, - imageY, imageE, rot, latestWS); - wsOrdered[i] = latestWS; - } + try { + headers[i].numberOfAxis = static_cast<int>(m_headerAxisNameKeys.size()); + + for (int j = 0; headers.size() > i && j < headers[i].numberOfAxis; ++j) { + headers[i].axisPixelLengths.push_back(lexical_cast<size_t>( + headers[i].headerKeys[m_headerAxisNameKeys[j]])); + } - // Add to group - Done here to maintain order - for (auto it = wsOrdered.begin(); it != wsOrdered.end(); ++it) { - wsGroup->addWorkspace(it->second); + // Various extensions to the FITS format are used elsewhere, and + // must be parsed differently if used. This loader Loader + // doesn't support this. + headers[i].extension = headers[i].headerKeys["XTENSION"]; + } catch (std::exception &e) { + throw std::runtime_error( + "Failed to process the '" + m_headerNAxisNameKey + + "' entries (dimensions) in the header of this file: " + paths[i] + + ". Error description: " + e.what()); } - free(bufferAny); + headers[i].scale = + (headers[i].headerKeys[m_headerScaleKey] == "") + ? 1 + : lexical_cast<double>(headers[i].headerKeys[m_headerScaleKey]); + headers[i].offset = + (headers[i].headerKeys[m_headerOffsetKey] == "") + ? 0 + : lexical_cast<int>(headers[i].headerKeys[m_headerOffsetKey]); + + // Check each header is valid/supported: standard (no extension to + // FITS), and has two axis + headerSanityCheck(headers[i], headers[0]); + } +} - setProperty("OutputWorkspace", wsGroup); - } else { - // Invalid files, record error - throw std::runtime_error("Loader currently doesn't support FITS files with " - "non-standard extensions, greater than two axis " - "of data, or has detected that all the files are " - "not similar."); +/** + * Read a single files header and populate an object with the information. + * + * @param headerInfo A FITSInfo file object to parse header + * information into. This object must have its field filePath set to + * the input file + * + * @throws various std::runtime_error etc. on read failure +*/ +void LoadFITS::parseHeader(FITSInfo &headerInfo) { + headerInfo.headerSizeMultiplier = 0; + ifstream istr(headerInfo.filePath.c_str(), ios::binary); + Poco::BinaryReader reader(istr); + + // Iterate 80 bytes at a time until header is parsed | 2880 bytes is the + // fixed header length of FITS + // 2880/80 = 36 iterations required + bool endFound = false; + while (!endFound) { + headerInfo.headerSizeMultiplier++; + for (int i = 0; i < 36; ++i) { + // Keep vect of each header item, including comments, and also keep a + // map of individual keys. + string part; + reader.readRaw(80, part); + headerInfo.headerItems.push_back(part); + + // Add key/values - these are separated by the = symbol. + // If it doesn't have an = it's a comment to ignore. All keys should be + // unique + auto eqPos = part.find('='); + if (eqPos > 0) { + string key = part.substr(0, eqPos); + string value = part.substr(eqPos + 1); + + // Comments are added after the value separated by a / symbol. Remove. + auto slashPos = value.find('/'); + if (slashPos > 0) + value = value.substr(0, slashPos); + + boost::trim(key); + boost::trim(value); + + if (key == "END") + endFound = true; + + if (key != "") + headerInfo.headerKeys[key] = value; + } + } } + + istr.close(); } /** - * Initialises a workspace with IDF and fills it with data + * Creates and initialises a workspace with instrument definition and fills it + * with data + * * @param fileInfo information for the current file * @param newFileNumber number for the new file when added into ws group - * @param bufferAny Presized buffer to contain data values + * @param buffer pre-allocated buffer to contain data values * @param imageY Object to set the Y data values in * @param imageE Object to set the E data values in - * @param rotation Value for the rotation of the current file * @param parent A workspace which can be used to copy initialisation * information from (size/instrument def etc) - * @returns A pointer to the workspace created + * + * @returns A newly created Workspace2D, as a shared pointer */ -Workspace2D_sptr LoadFITS::addWorkspace(const FITSInfo &fileInfo, - size_t &newFileNumber, void *&bufferAny, - MantidImage &imageY, - MantidImage &imageE, double rotation, - const Workspace2D_sptr parent) { +Workspace2D_sptr +LoadFITS::makeWorkspace(const FITSInfo &fileInfo, size_t &newFileNumber, + std::vector<char> &buffer, MantidImage &imageY, + MantidImage &imageE, const Workspace2D_sptr parent) { // Create ws Workspace2D_sptr ws; - if (!parent) + if (!parent) { ws = dynamic_pointer_cast<Workspace2D>(WorkspaceFactory::Instance().create( "Workspace2D", m_spectraCount, 2, 1)); - else + } else { ws = dynamic_pointer_cast<Workspace2D>( WorkspaceFactory::Instance().create(parent)); + } string currNumberS = padZeros(newFileNumber, DIGIT_SIZE_APPEND); ++newFileNumber; @@ -393,21 +427,26 @@ Workspace2D_sptr LoadFITS::addWorkspace(const FITSInfo &fileInfo, ws->setTitle(baseName); // set data - readFileToWorkspace(ws, fileInfo, imageY, imageE, bufferAny); + readDataToWorkspace2D(ws, fileInfo, imageY, imageE, buffer); // Add all header info to log. for (auto it = fileInfo.headerKeys.begin(); it != fileInfo.headerKeys.end(); ++it) { - ws->mutableRun().removeLogData("_" + it->first, true); + ws->mutableRun().removeLogData(it->first, true); ws->mutableRun().addLogData( - new PropertyWithValue<string>("_" + it->first, it->second)); + new PropertyWithValue<string>(it->first, it->second)); } // Add rotational data to log. Clear first from copied WS + auto it = fileInfo.headerKeys.find(m_sampleRotation); ws->mutableRun().removeLogData("Rotation", true); - if (rotation != -1) - ws->mutableRun().addLogData( - new PropertyWithValue<double>("Rotation", rotation)); + if (fileInfo.headerKeys.end() != it) { + double rot = boost::lexical_cast<double>(it->second); + if (rot >= 0) { + ws->mutableRun().addLogData( + new PropertyWithValue<double>("Rotation", rot)); + } + } // Add axis information to log. Clear first from copied WS ws->mutableRun().removeLogData("Axis1", true); @@ -419,8 +458,8 @@ Workspace2D_sptr LoadFITS::addWorkspace(const FITSInfo &fileInfo, // Add image key data to log. Clear first from copied WS ws->mutableRun().removeLogData("ImageKey", true); - ws->mutableRun().addLogData(new PropertyWithValue<int>( - "ImageKey", static_cast<int>(fileInfo.imageKey))); + ws->mutableRun().addLogData( + new PropertyWithValue<std::string>("ImageKey", fileInfo.imageKey)); m_progress->report(); @@ -428,84 +467,58 @@ Workspace2D_sptr LoadFITS::addWorkspace(const FITSInfo &fileInfo, } /** - * Returns the trailing number from a string minus leading 0's (so 25 from - * workspace_00025)the confidence with with this algorithm can load the file - * @param name string with a numerical suffix - * @returns A numerical representation of the string minus leading characters - * and leading 0's - */ -size_t LoadFITS::fetchNumber(std::string name) { - string tmpStr = ""; - for (auto it = name.end() - 1; isdigit(*it); --it) { - tmpStr.insert(0, 1, *it); - } - while (tmpStr.length() > 0 && tmpStr[0] == '0') { - tmpStr.erase(tmpStr.begin()); - } - return (tmpStr.length() > 0) ? lexical_cast<size_t>(tmpStr) : 0; -} - -// Adds 0's to the front of a number to create a string of size totalDigitCount -// including number -std::string LoadFITS::padZeros(size_t number, size_t totalDigitCount) { - std::ostringstream ss; - ss << std::setw(static_cast<int>(totalDigitCount)) << std::setfill('0') - << static_cast<int>(number); - - return ss.str(); -} - -/** - * Reads the data from a single FITS file into a workspace + * Reads the data (matrix) from a single FITS file into a workspace + * * @param ws Workspace to populate with the data * @param fileInfo information pertaining to the FITS file to load * @param imageY Object to set the Y data values in * @param imageE Object to set the E data values in - * @param bufferAny Presized buffer to contain data values + * @param buffer pre-allocated buffer to contain data values + * + * @throws std::runtime_error if there are file input issues */ -void LoadFITS::readFileToWorkspace(Workspace2D_sptr ws, - const FITSInfo &fileInfo, - MantidImage &imageY, MantidImage &imageE, - void *&bufferAny) { - uint8_t *buffer8 = NULL; - - // create pointer of correct data type to void pointer of the buffer: - buffer8 = static_cast<uint8_t *>(bufferAny); - - // Read Data - bool fileErr = false; - FILE *currFile = fopen(fileInfo.filePath.c_str(), "rb"); - if (currFile == NULL) - fileErr = true; - - size_t result = 0; - if (!fileErr) { - if (fseek(currFile, BASE_HEADER_SIZE * fileInfo.headerSizeMultiplier, - SEEK_CUR) == 0) - result = fread(buffer8, 1, m_spectraCount * (fileInfo.bitsPerPixel / 8), - currFile); +void LoadFITS::readDataToWorkspace2D(Workspace2D_sptr ws, + const FITSInfo &fileInfo, + MantidImage &imageY, MantidImage &imageE, + std::vector<char> &buffer) { + std::string filename = fileInfo.filePath; + Poco::FileStream file(filename, std::ios::in); + + size_t bytespp = (fileInfo.bitsPerPixel / 8); + size_t len = m_spectraCount * bytespp; + file.seekg(BASE_HEADER_SIZE * fileInfo.headerSizeMultiplier); + file.read(&buffer[0], len); + if (!file) { + throw std::runtime_error( + "Error while reading file: " + filename + ". Tried to read " + + boost::lexical_cast<std::string>(len) + " bytes but got " + + boost::lexical_cast<std::string>(file.gcount()) + + " bytes. The file and/or its headers may be wrong."); } + // all is loaded + file.close(); - if (result != m_spectraCount * (fileInfo.bitsPerPixel / 8)) - fileErr = true; - - if (fileErr) - throw std::runtime_error("Error reading file; possibly invalid data."); - - std::vector<char> buf(fileInfo.bitsPerPixel / 8); - char* tmp = &buf.front(); + // create pointer of correct data type to void pointer of the buffer: + uint8_t *buffer8 = reinterpret_cast<uint8_t *>(&buffer[0]); + std::vector<char> buf(bytespp); + char *tmp = &buf.front(); + size_t start = 0; for (size_t i = 0; i < fileInfo.axisPixelLengths[0]; ++i) { for (size_t j = 0; j < fileInfo.axisPixelLengths[1]; ++j) { - double val = 0; - size_t start = - ((i * (fileInfo.bitsPerPixel / 8)) * fileInfo.axisPixelLengths[1]) + - (j * (fileInfo.bitsPerPixel / 8)); + // If you wanted to PARALLEL_...ize these loops (which doesn't + // seem to provide any speed up, you cannot use the + // start+=bytespp at the end of this loop. You'd need something + // like this: + // + // size_t start = + // ((i * (bytespp)) * fileInfo.axisPixelLengths[1]) + + // (j * (bytespp)); // Reverse byte order of current value - std::reverse_copy(buffer8 + start, - buffer8 + start + (fileInfo.bitsPerPixel / 8), tmp); + std::reverse_copy(buffer8 + start, buffer8 + start + bytespp, tmp); + double val = 0; if (fileInfo.bitsPerPixel == 8) val = static_cast<double>(*reinterpret_cast<uint8_t *>(tmp)); if (fileInfo.bitsPerPixel == 16) @@ -529,187 +542,160 @@ void LoadFITS::readFileToWorkspace(Workspace2D_sptr ws, imageY[i][j] = val; imageE[i][j] = sqrt(val); + + start += bytespp; } } // Set in WS ws->setImageYAndE(imageY, imageE, 0, false); - - // Clear memory associated with the file load - fclose(currFile); } /** -* Read a single files header and populate an object with the information -* @param headerInfo A FITSInfo file object to parse header information into -* @returns A bool specifying succes of the operation -*/ -bool LoadFITS::parseHeader(FITSInfo &headerInfo) { - bool ranSuccessfully = true; - headerInfo.headerSizeMultiplier = 0; - try { - ifstream istr(headerInfo.filePath.c_str(), ios::binary); - Poco::BinaryReader reader(istr); - - // Iterate 80 bytes at a time until header is parsed | 2880 bytes is the - // fixed header length of FITS - // 2880/80 = 36 iterations required - bool endFound = false; - while (!endFound) { - headerInfo.headerSizeMultiplier++; - for (int i = 0; i < 36; ++i) { - // Keep vect of each header item, including comments, and also keep a - // map of individual keys. - string part; - reader.readRaw(80, part); - headerInfo.headerItems.push_back(part); - - // Add key/values - these are separated by the = symbol. - // If it doesn't have an = it's a comment to ignore. All keys should be - // unique - auto eqPos = part.find('='); - if (eqPos > 0) { - string key = part.substr(0, eqPos); - string value = part.substr(eqPos + 1); - - // Comments are added after the value separated by a / symbol. Remove. - auto slashPos = value.find('/'); - if (slashPos > 0) - value = value.substr(0, slashPos); - - boost::trim(key); - boost::trim(value); - - if (key == "END") - endFound = true; - - if (key != "") - headerInfo.headerKeys[key] = value; - } - } - } + * Checks that a FITS header (once loaded) is valid/supported: + * standard (no extension to FITS), and has two axis with the expected + * dimensions. + * + * @param hdr FITS header struct loaded from a file - to check + * + * @param hdr FITS header struct loaded from a (first) reference file - to + * compare against + * + * @throws std::exception if there's any issue or unsupported entry in the + * header + */ +void LoadFITS::headerSanityCheck(const FITSInfo &hdr, + const FITSInfo &hdrFirst) { + bool valid = true; + if (hdr.extension != "") { + valid = false; + g_log.error() << "File " << hdr.filePath + << ": extensions found in the header." << std::endl; + } + if (hdr.numberOfAxis != 2) { + valid = false; + g_log.error() << "File " << hdr.filePath + << ": the number of axes is not 2 but: " << hdr.numberOfAxis + << std::endl; + } - istr.close(); - } catch (...) { - // Unable to read the file - ranSuccessfully = false; + // Test current item has same axis values as first item. + if (hdr.axisPixelLengths[0] != hdrFirst.axisPixelLengths[0]) { + valid = false; + g_log.error() << "File " << hdr.filePath + << ": the number of pixels in the first dimension differs " + "from the first file loaded (" << hdrFirst.filePath + << "): " << hdr.axisPixelLengths[0] + << " != " << hdrFirst.axisPixelLengths[0] << std::endl; + } + if (hdr.axisPixelLengths[1] != hdrFirst.axisPixelLengths[1]) { + valid = false; + g_log.error() << "File " << hdr.filePath + << ": the number of pixels in the second dimension differs" + "from the first file loaded (" << hdrFirst.filePath + << "): " << hdr.axisPixelLengths[0] + << " != " << hdrFirst.axisPixelLengths[0] << std::endl; } - return ranSuccessfully; + // Check the format is correct and create the Workspace + if (!valid) { + // Invalid files, record error + throw std::runtime_error( + "An issue has been found in the header of this FITS file: " + + hdr.filePath + + ". This algorithm currently doesn't support FITS files with " + "non-standard extensions, more than two axis " + "of data, or has detected that all the files are " + "not similar."); + } } /** - * Reads a file containing rotation values for each image into a vector of - *doubles - * @param rotFilePath The path to a file containing rotation values - * @param fileCount number of images which should have corresponding rotation - *values in the file + * Returns the trailing number from a string minus leading 0's (so 25 from + * workspace_00025)the confidence with with this algorithm can load the file + * + * @param name string with a numerical suffix * - * @returns vector<double> A vector of all the rotation values + * @returns A numerical representation of the string minus leading characters + * and leading 0's */ -std::vector<double> LoadFITS::readRotations(std::string rotFilePath, - size_t fileCount) { - std::vector<double> allRotations; - ifstream fStream(rotFilePath.c_str()); - - try { - // Ensure valid file - if (fStream.good()) { - // Get lines, split words, verify and add to map. - string line; - vector<string> lineSplit; - size_t ind = -1; - while (getline(fStream, line)) { - ind++; - boost::split(lineSplit, line, boost::is_any_of("\t")); - - if (ind == 0 || lineSplit[0] == "") - continue; // Skip first iteration or where rotation value is empty - - allRotations.push_back(lexical_cast<double>(lineSplit[1])); - } - - // Check the number of rotations in file matches number of files - if (ind != fileCount) - throw std::runtime_error("File error, throw higher up."); - - fStream.close(); - } else { - throw std::runtime_error("File error, throw higher up."); - } - } catch (...) { - throw std::runtime_error("Invalid file path or file format: Expected a " - "file with a line separated list of rotations " - "with the same number of entries as other files."); +size_t LoadFITS::fetchNumber(const std::string &name) { + string tmpStr = ""; + for (auto it = name.end() - 1; isdigit(*it); --it) { + tmpStr.insert(0, 1, *it); + } + while (tmpStr.length() > 0 && tmpStr[0] == '0') { + tmpStr.erase(tmpStr.begin()); } + return (tmpStr.length() > 0) ? lexical_cast<size_t>(tmpStr) : 0; +} - return allRotations; +/** + * Adds 0's to the front of a number to create a string of size totalDigitCount + * including number + * + * @param number input number to add padding to + * @parm totalDigitCount width of the resulting string with 0s followed by + * number + * + * @return A string with the 0-padded number + */ +std::string LoadFITS::padZeros(const size_t number, + const size_t totalDigitCount) { + std::ostringstream ss; + ss << std::setw(static_cast<int>(totalDigitCount)) << std::setfill('0') + << static_cast<int>(number); + + return ss.str(); } /** * Maps the header keys to specified values */ void LoadFITS::mapHeaderKeys() { - bool useProperties = true; + if ("" == getPropertyValue(m_HEADER_MAP_NAME)) + return; // If a map file is selected, use that. - if (getPropertyValue(HEADER_MAP_NAME) != "") { - // std::vector<double> allRotations; - ifstream fStream(getPropertyValue(HEADER_MAP_NAME).c_str()); + std::string name = getPropertyValue(m_HEADER_MAP_NAME); + ifstream fStream(name.c_str()); - try { - // Ensure valid file - if (fStream.good()) { - // Get lines, split words, verify and add to map. - string line; - vector<string> lineSplit; - while (getline(fStream, line)) { - boost::split(lineSplit, line, boost::is_any_of("=")); - - if (lineSplit[0] == ROTATION_NAME && lineSplit[1] != "") - m_headerRotationKey = lineSplit[1]; - - if (lineSplit[0] == BIT_DEPTH_NAME && lineSplit[1] != "") - m_headerBitDepthKey = lineSplit[1]; - - if (lineSplit[0] == AXIS_NAMES_NAME && lineSplit[1] != "") { - m_headerAxisNameKeys.clear(); - std::string propVal = getProperty(AXIS_NAMES_NAME); - boost::split(m_headerAxisNameKeys, propVal, boost::is_any_of(",")); - } - - if (lineSplit[0] == IMAGE_KEY_NAME && lineSplit[1] != "") { - m_headerImageKeyKey = lineSplit[1]; - } + try { + // Ensure valid file + if (fStream.good()) { + // Get lines, split words, verify and add to map. + std::string line; + vector<std::string> lineSplit; + while (getline(fStream, line)) { + boost::split(lineSplit, line, boost::is_any_of("=")); + + if (lineSplit[0] == m_ROTATION_NAME && lineSplit[1] != "") + m_headerRotationKey = lineSplit[1]; + + if (lineSplit[0] == m_BIT_DEPTH_NAME && lineSplit[1] != "") + m_headerBitDepthKey = lineSplit[1]; + + if (lineSplit[0] == m_AXIS_NAMES_NAME && lineSplit[1] != "") { + m_headerAxisNameKeys.clear(); + boost::split(m_headerAxisNameKeys, lineSplit[1], + boost::is_any_of(",")); } - fStream.close(); - useProperties = false; - } else { - throw std::runtime_error("File error, throw higher up."); + if (lineSplit[0] == m_IMAGE_KEY_NAME && lineSplit[1] != "") { + m_headerImageKeyKey = lineSplit[1]; + } } - } catch (...) { - g_log.information("Cannot load specified map file, using property values " - "and/or defaults."); - useProperties = true; - } - } - if (useProperties) { - // Try and set from the loader properties if present and didn't load map - // file - if (getPropertyValue(BIT_DEPTH_NAME) != "") - m_headerBitDepthKey = getPropertyValue(BIT_DEPTH_NAME); - if (getPropertyValue(ROTATION_NAME) != "") - m_headerRotationKey = getPropertyValue(ROTATION_NAME); - if (getPropertyValue(AXIS_NAMES_NAME) != "") { - m_headerAxisNameKeys.clear(); - std::string propVal = getProperty(AXIS_NAMES_NAME); - boost::split(m_headerAxisNameKeys, propVal, boost::is_any_of(",")); + fStream.close(); + } else { + throw std::runtime_error( + "Error while trying to read header keys mapping file: " + name); } - if (getPropertyValue(IMAGE_KEY_NAME) != "") - m_headerImageKeyKey = getPropertyValue(IMAGE_KEY_NAME); + } catch (...) { + g_log.error("Cannot load specified map file, using property values " + "and/or defaults."); } } -} -} + +} // namespace DataHandling +} // namespace Mantid diff --git a/Code/Mantid/Framework/DataHandling/test/LoadFITSTest.h b/Code/Mantid/Framework/DataHandling/test/LoadFITSTest.h index 01cd6d92e88d84d328fad2818251bcfbaa42d8f0..95ff18df83794367f217b95328e8b6de93e03882 100644 --- a/Code/Mantid/Framework/DataHandling/test/LoadFITSTest.h +++ b/Code/Mantid/Framework/DataHandling/test/LoadFITSTest.h @@ -1,61 +1,178 @@ -#ifndef LOADFITSTEST_H_ -#define LOADFITSTEST_H_ +#ifndef MANTID_DATAHANDLING_LOADFITSTEST_H_ +#define MANTID_DATAHANDLING_LOADFITSTEST_H_ #include <cxxtest/TestSuite.h> + +#include "MantidAPI/AlgorithmManager.h" +#include "MantidAPI/AnalysisDataService.h" #include "MantidDataHandling/LoadFITS.h" using namespace Mantid::API; using namespace Mantid::DataHandling; -using namespace Mantid::Kernel; -class LoadFITSTest : public CxxTest::TestSuite -{ -public: - void testInit() - { +class LoadFITSTest : 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 LoadFITSTest *createSuite() { return new LoadFITSTest(); } + static void destroySuite(LoadFITSTest *suite) { delete suite; } + + void test_algorithm() { + std::string name = "LoadFITS"; + int version = 1; + testAlg = + Mantid::API::AlgorithmManager::Instance().create(name /*, version*/); + TS_ASSERT(testAlg); + TS_ASSERT_EQUALS(testAlg->name(), name); + TS_ASSERT_EQUALS(testAlg->version(), version); + } + + void test_castAlgorithm() { + // can create + boost::shared_ptr<LoadFITS> a; + TS_ASSERT(a = boost::make_shared<LoadFITS>()); + // can cast to inherited interfaces and base classes + + TS_ASSERT(dynamic_cast<Mantid::DataHandling::LoadFITS *>(a.get())); + TS_ASSERT(dynamic_cast<Mantid::API::Algorithm *>(a.get())); + TS_ASSERT(dynamic_cast<Mantid::Kernel::PropertyManagerOwner *>(a.get())); + TS_ASSERT(dynamic_cast<Mantid::API::IAlgorithm *>(a.get())); + TS_ASSERT(dynamic_cast<Mantid::Kernel::IPropertyManager *>(a.get())); + } + + void test_initAlgorithm() { + LoadFITS lf; + TS_ASSERT_THROWS_NOTHING(lf.initialize()); + } + + void test_propertiesMissing() { + LoadFITS lf; + TS_ASSERT_THROWS_NOTHING(lf.initialize()); + TS_ASSERT_THROWS_NOTHING(lf.setPropertyValue("Filename", smallFname1)); + TS_ASSERT_THROWS(lf.execute(), std::runtime_error); + TS_ASSERT(!lf.isExecuted()); + + LoadFITS lf2; + TS_ASSERT_THROWS_NOTHING(lf2.initialize()); + TS_ASSERT_THROWS_NOTHING( + lf2.setPropertyValue("OutputWorkspace", "out_ws_name")); + TS_ASSERT_THROWS(lf2.execute(), std::runtime_error); + TS_ASSERT(!lf2.isExecuted()); + } + + void test_wrongProp() { + LoadFITS lf; + TS_ASSERT_THROWS_NOTHING(lf.initialize()); + TS_ASSERT_THROWS(lf.setPropertyValue("file", "anything"), + std::runtime_error); + TS_ASSERT_THROWS(lf.setPropertyValue("output", "anything"), + std::runtime_error); + TS_ASSERT_THROWS(lf.setPropertyValue("FITS", "anything"), + std::runtime_error); + + TS_ASSERT_THROWS(lf.setPropertyValue("ImageKey", "anything"), + Mantid::Kernel::Exception::NotFoundError); + TS_ASSERT_THROWS(lf.setPropertyValue("BITPIX", "anything"), + std::runtime_error); + TS_ASSERT_THROWS(lf.setPropertyValue("NAXIS", "anything"), + std::runtime_error); + TS_ASSERT_THROWS(lf.setPropertyValue("NAXIS1", "anything"), + std::runtime_error); + } + + void test_init() { TS_ASSERT_THROWS_NOTHING(algToBeTested.initialize()); - TS_ASSERT( algToBeTested.isInitialized() ); - - if ( !algToBeTested.isInitialized() ) algToBeTested.initialize(); - - outputSpace="LoadFITSTest"; - algToBeTested.setPropertyValue("OutputWorkspace", outputSpace); - + TS_ASSERT(algToBeTested.isInitialized()); + + if (!algToBeTested.isInitialized()) + algToBeTested.initialize(); + + outputSpace = "LoadFITSTest"; + algToBeTested.setPropertyValue("OutputWorkspace", outputSpace); + // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(algToBeTested.execute(),std::runtime_error); - - inputFile = "FITS_small_01.fits,FITS_small_02.fits"; - algToBeTested.setPropertyValue("Filename", inputFile); - - // Set the ImageKey to be 0 (as it is missing from the test file and is required); - algToBeTested.setProperty<int>("ImageKey", 0); - } - - void testPerformAssertions() - { - TS_ASSERT_THROWS_NOTHING(algToBeTested.execute()); - TS_ASSERT( algToBeTested.isExecuted() ); + TS_ASSERT_THROWS(algToBeTested.execute(), std::runtime_error); + + inputFile = smallFname1 + ", " + smallFname2; + algToBeTested.setPropertyValue("Filename", inputFile); + + // Set the ImageKey to be 0 (this used to be required, but the key + // should not be there any longer); + TS_ASSERT_THROWS( algToBeTested.setProperty<int>("ImageKey", 0), + Mantid::Kernel::Exception::NotFoundError); + } + + void test_performAssertions() { + TS_ASSERT_THROWS_NOTHING(algToBeTested.execute()); + TS_ASSERT(algToBeTested.isExecuted()); // get workspace generated - WorkspaceGroup_sptr output = AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>(outputSpace); - TS_ASSERT_EQUALS( output->getNumberOfEntries(), 2); // Number of time bins should equal number of files - MatrixWorkspace_sptr ws1 = boost::dynamic_pointer_cast<MatrixWorkspace>(output->getItem(0)); - MatrixWorkspace_sptr ws2 = boost::dynamic_pointer_cast<MatrixWorkspace>(output->getItem(1)); - - TS_ASSERT_EQUALS(ws1->getNumberHistograms(), SPECTRA_COUNT); // Number of spectra + WorkspaceGroup_sptr out; + TS_ASSERT(AnalysisDataService::Instance().doesExist(outputSpace)); + TS_ASSERT_THROWS_NOTHING( + out = AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>( + outputSpace)); + TS_ASSERT_EQUALS(out->getNumberOfEntries(), + 2); // Number of time bins should equal number of files + MatrixWorkspace_sptr ws1; + TS_ASSERT_THROWS_NOTHING( + ws1 = boost::dynamic_pointer_cast<MatrixWorkspace>(out->getItem(0))); + MatrixWorkspace_sptr ws2; + TS_ASSERT_THROWS_NOTHING( + ws2 = boost::dynamic_pointer_cast<MatrixWorkspace>(out->getItem(1))); + + // basic FITS headers + const auto run = ws1->run(); + TS_ASSERT_EQUALS(run.getLogData("SIMPLE")->value(), hdrSIMPLE); + TS_ASSERT_EQUALS(run.getLogData("BITPIX")->value(), hdrBITPIX); + TS_ASSERT_EQUALS(run.getLogData("NAXIS")->value(), hdrNAXIS); + TS_ASSERT_EQUALS(run.getLogData("NAXIS1")->value(), hdrNAXIS1); + TS_ASSERT_EQUALS(run.getLogData("NAXIS2")->value(), hdrNAXIS2); + + // Number of spectra + TS_ASSERT_EQUALS(ws1->getNumberHistograms(), SPECTRA_COUNT); + TS_ASSERT_EQUALS(ws2->getNumberHistograms(), SPECTRA_COUNT); + // Sum the two bins from the last spectra - should be 70400 - double sumY = ws1->readY(SPECTRA_COUNT-1)[0] + ws2->readY(SPECTRA_COUNT-1)[0]; - TS_ASSERT_EQUALS(sumY, 275); - // Check the sum of the error values for the last spectra in each file - should be 375.183 - double sumE = ws1->readE(SPECTRA_COUNT-1)[0] + ws2->readE(SPECTRA_COUNT-1)[0]; - TS_ASSERT_LESS_THAN(abs(sumE-23.4489), 0.0001); // Include a small tolerance check with the assert - not exactly 375.183 + double sumY = + ws1->readY(SPECTRA_COUNT - 1)[0] + ws2->readY(SPECTRA_COUNT - 1)[0]; + TS_ASSERT_EQUALS(sumY, 275); + // Check the sum of the error values for the last spectra in each file - + // should be 375.183 + double sumE = + ws1->readE(SPECTRA_COUNT - 1)[0] + ws2->readE(SPECTRA_COUNT - 1)[0]; + TS_ASSERT_LESS_THAN(abs(sumE - 23.4489), 0.0001); // Include a small + // tolerance check with + // the assert - not + // exactly 375.183 } private: + Mantid::API::IAlgorithm_sptr testAlg; LoadFITS algToBeTested; + std::string inputFile; std::string outputSpace; - const static size_t SPECTRA_COUNT = 262144; // Based on the 512*512 test image + static const std::string smallFname1; + static const std::string smallFname2; + + const static size_t xdim = 512; + const static size_t ydim = 512; + const static size_t SPECTRA_COUNT = xdim * ydim; + // FITS headers + const static std::string hdrSIMPLE; + const static std::string hdrBITPIX; + const static std::string hdrNAXIS; + const static std::string hdrNAXIS1; + const static std::string hdrNAXIS2; }; +const std::string LoadFITSTest::smallFname1 = "FITS_small_01.fits"; +const std::string LoadFITSTest::smallFname2 = "FITS_small_02.fits"; + +const std::string LoadFITSTest::hdrSIMPLE = "T"; +const std::string LoadFITSTest::hdrBITPIX = "16"; +const std::string LoadFITSTest::hdrNAXIS = "2"; +const std::string LoadFITSTest::hdrNAXIS1 = "512"; +const std::string LoadFITSTest::hdrNAXIS2 = "512"; -#endif \ No newline at end of file +#endif // MANTID_DATAHANDLING_LOADFITSTEST_H_ diff --git a/Code/Mantid/Framework/DataHandling/test/LoadFullprofResolutionTest.h b/Code/Mantid/Framework/DataHandling/test/LoadFullprofResolutionTest.h index 878ab8807fecc309c1adb50c1062dad5cbca615e..b8d36d13bb2420598394a4f053662b4e913beeea 100644 --- a/Code/Mantid/Framework/DataHandling/test/LoadFullprofResolutionTest.h +++ b/Code/Mantid/Framework/DataHandling/test/LoadFullprofResolutionTest.h @@ -328,7 +328,7 @@ public: void test_workspace() { // Generate file - string filename("TestWorskpace.irf"); + string filename("FullprofResolutionTest_TestWorkspace.irf"); generate1BankIrfFile(filename); // Load workspace group wsName with one workspace @@ -412,7 +412,7 @@ public: } // Clean - Poco::File("TestWorskpace.irf").remove(); + Poco::File(filename).remove(); } //---------------------------------------------------------------------------------------------- diff --git a/Code/Mantid/Framework/DataHandling/test/LoadGSASInstrumentFileTest.h b/Code/Mantid/Framework/DataHandling/test/LoadGSASInstrumentFileTest.h index 0ae94946fa50e830bd34562a0b1203b50a0b03e0..65d102d5c492aaeff5f8d6524b98a18d7c23e500 100644 --- a/Code/Mantid/Framework/DataHandling/test/LoadGSASInstrumentFileTest.h +++ b/Code/Mantid/Framework/DataHandling/test/LoadGSASInstrumentFileTest.h @@ -208,7 +208,7 @@ public: void test_workspace() { // Generate file with two banks - string filename("TestWorskpace.irf"); + string filename("GSASInstrumentFileTest_TestWorkspace.irf"); generate2BankPrmFile(filename); // Create workspace group to put parameters into @@ -308,7 +308,7 @@ public: TS_ASSERT_EQUALS( fitParam.getValue( 0.0 ), 0.0); // Clean - Poco::File("TestWorskpace.irf").remove(); + Poco::File(filename).remove(); AnalysisDataService::Instance().remove("loadGSASInstrumentFileWorkspace"); } diff --git a/Code/Mantid/Framework/DataObjects/CMakeLists.txt b/Code/Mantid/Framework/DataObjects/CMakeLists.txt index 59e0ba72866da741144f2a5527e65237622d90d5..aad4ee2f7abfd8b8431c1829fd4581eed916587a 100644 --- a/Code/Mantid/Framework/DataObjects/CMakeLists.txt +++ b/Code/Mantid/Framework/DataObjects/CMakeLists.txt @@ -1,11 +1,32 @@ set ( SRC_FILES + src/AffineMatrixParameter.cpp + src/AffineMatrixParameterParser.cpp + src/BoxControllerNeXusIO.cpp + src/CoordTransformAffine.cpp + src/CoordTransformAffineParser.cpp + src/CoordTransformAligned.cpp + src/CoordTransformDistance.cpp + src/CoordTransformDistanceParser.cpp src/EventList.cpp src/EventWorkspace.cpp src/EventWorkspaceHelpers.cpp src/EventWorkspaceMRU.cpp src/Events.cpp + src/FakeMD.cpp src/GroupingWorkspace.cpp src/Histogram1D.cpp + src/MDBin.cpp + src/MDBox.cpp + src/MDBoxBase.cpp + src/MDBoxFlatTree.cpp + src/MDBoxIterator.cpp + src/MDBoxSaveable.cpp + src/MDEventFactory.cpp + src/MDEventWorkspace.cpp + src/MDGridBox.cpp + src/MDHistoWorkspace.cpp + src/MDHistoWorkspaceIterator.cpp + src/MDLeanEvent.cpp src/MaskWorkspace.cpp src/MementoTableWorkspace.cpp src/NoShape.cpp @@ -36,14 +57,37 @@ set ( SRC_UNITY_IGNORE_FILES ) set ( INC_FILES + inc/MantidDataObjects/AffineMatrixParameter.h + inc/MantidDataObjects/AffineMatrixParameterParser.h + inc/MantidDataObjects/BoxControllerNeXusIO.h + inc/MantidDataObjects/CoordTransformAffine.h + inc/MantidDataObjects/CoordTransformAffineParser.h + inc/MantidDataObjects/CoordTransformAligned.h + inc/MantidDataObjects/CoordTransformDistance.h + inc/MantidDataObjects/CoordTransformDistanceParser.h inc/MantidDataObjects/DllConfig.h inc/MantidDataObjects/EventList.h inc/MantidDataObjects/EventWorkspace.h inc/MantidDataObjects/EventWorkspaceHelpers.h inc/MantidDataObjects/EventWorkspaceMRU.h inc/MantidDataObjects/Events.h + inc/MantidDataObjects/FakeMD.h inc/MantidDataObjects/GroupingWorkspace.h inc/MantidDataObjects/Histogram1D.h + inc/MantidDataObjects/MDBin.h + inc/MantidDataObjects/MDBox.h + inc/MantidDataObjects/MDBoxBase.h + inc/MantidDataObjects/MDBoxFlatTree.h + inc/MantidDataObjects/MDBoxIterator.h + inc/MantidDataObjects/MDBoxSaveable.h + inc/MantidDataObjects/MDDimensionStats.h + inc/MantidDataObjects/MDEventFactory.h + inc/MantidDataObjects/MDEventInserter.h + inc/MantidDataObjects/MDEventWorkspace.h + inc/MantidDataObjects/MDGridBox.h + inc/MantidDataObjects/MDHistoWorkspace.h + inc/MantidDataObjects/MDHistoWorkspaceIterator.h + inc/MantidDataObjects/MDLeanEvent.h inc/MantidDataObjects/MaskWorkspace.h inc/MantidDataObjects/MementoTableWorkspace.h inc/MantidDataObjects/NoShape.h @@ -69,13 +113,37 @@ set ( INC_FILES ) set ( TEST_FILES + AffineMatrixParameterParserTest.h + AffineMatrixParameterTest.h + BoxControllerNeXusIOTest.h + CoordTransformAffineParserTest.h + CoordTransformAffineTest.h + CoordTransformAlignedTest.h + CoordTransformDistanceParserTest.h + CoordTransformDistanceTest.h EventListTest.h EventWorkspaceMRUTest.h EventWorkspaceTest.h EventsTest.h + FakeMDTest.h GroupingWorkspaceTest.h Histogram1DTest.h LibraryManagerTest.h + MDBinTest.h + MDBoxBaseTest.h + MDBoxFlatTreeTest.h + MDBoxIteratorTest.h + MDBoxSaveableTest.h + MDBoxTest.h + MDDimensionStatsTest.h + MDEventFactoryTest.h + MDEventInserterTest.h + MDEventTest.h + MDEventWorkspaceTest.h + MDGridBoxTest.h + MDHistoWorkspaceIteratorTest.h + MDHistoWorkspaceTest.h + MDLeanEventTest.h MaskWorkspaceTest.h MementoTableWorkspaceTest.h NoShapeTest.h @@ -90,6 +158,7 @@ set ( TEST_FILES PeaksWorkspaceTest.h RebinnedOutputTest.h RefAxisTest.h + SkippingPolicyTest.h SpecialWorkspace2DTest.h SplittersWorkspaceTest.h TableColumnTest.h @@ -120,7 +189,13 @@ set_target_properties ( DataObjects PROPERTIES OUTPUT_NAME MantidDataObjects if (OSX_VERSION VERSION_GREATER 10.8) set_target_properties ( DataObjects PROPERTIES INSTALL_RPATH "@loader_path/../MacOS") endif () - + +# Intensive use of templated libaries can cause large objects to be generated. These require +# an additional flag in MSVC. +if ( MSVC ) + set_target_properties ( DataObjects PROPERTIES COMPILE_FLAGS "/bigobj" ) +endif () + # Add to the 'Framework' group in VS set_property ( TARGET DataObjects PROPERTY FOLDER "MantidFramework" ) diff --git a/Code/Mantid/Framework/MDEvents/doc/BinMD_Coordinate_Transforms.odg b/Code/Mantid/Framework/DataObjects/doc/BinMD_Coordinate_Transforms.odg similarity index 100% rename from Code/Mantid/Framework/MDEvents/doc/BinMD_Coordinate_Transforms.odg rename to Code/Mantid/Framework/DataObjects/doc/BinMD_Coordinate_Transforms.odg diff --git a/Code/Mantid/Framework/MDEvents/doc/BinMD_Coordinate_Transforms.png b/Code/Mantid/Framework/DataObjects/doc/BinMD_Coordinate_Transforms.png similarity index 100% rename from Code/Mantid/Framework/MDEvents/doc/BinMD_Coordinate_Transforms.png rename to Code/Mantid/Framework/DataObjects/doc/BinMD_Coordinate_Transforms.png diff --git a/Code/Mantid/Framework/MDEvents/doc/BinMD_Coordinate_Transforms_withLine.png b/Code/Mantid/Framework/DataObjects/doc/BinMD_Coordinate_Transforms_withLine.png similarity index 100% rename from Code/Mantid/Framework/MDEvents/doc/BinMD_Coordinate_Transforms_withLine.png rename to Code/Mantid/Framework/DataObjects/doc/BinMD_Coordinate_Transforms_withLine.png diff --git a/Code/Mantid/Framework/MDEvents/doc/IntegrateEllipsoids.png b/Code/Mantid/Framework/DataObjects/doc/IntegrateEllipsoids.png similarity index 100% rename from Code/Mantid/Framework/MDEvents/doc/IntegrateEllipsoids.png rename to Code/Mantid/Framework/DataObjects/doc/IntegrateEllipsoids.png diff --git a/Code/Mantid/Framework/MDEvents/doc/IntegratePeaksMD_graph1.odg b/Code/Mantid/Framework/DataObjects/doc/IntegratePeaksMD_graph1.odg similarity index 100% rename from Code/Mantid/Framework/MDEvents/doc/IntegratePeaksMD_graph1.odg rename to Code/Mantid/Framework/DataObjects/doc/IntegratePeaksMD_graph1.odg diff --git a/Code/Mantid/Framework/MDEvents/doc/IntegratePeaksMD_graph1.png b/Code/Mantid/Framework/DataObjects/doc/IntegratePeaksMD_graph1.png similarity index 100% rename from Code/Mantid/Framework/MDEvents/doc/IntegratePeaksMD_graph1.png rename to Code/Mantid/Framework/DataObjects/doc/IntegratePeaksMD_graph1.png diff --git a/Code/Mantid/Framework/MDEvents/doc/IntegratePeaksMD_graph2.odg b/Code/Mantid/Framework/DataObjects/doc/IntegratePeaksMD_graph2.odg similarity index 100% rename from Code/Mantid/Framework/MDEvents/doc/IntegratePeaksMD_graph2.odg rename to Code/Mantid/Framework/DataObjects/doc/IntegratePeaksMD_graph2.odg diff --git a/Code/Mantid/Framework/MDEvents/doc/IntegratePeaksMD_graph2.png b/Code/Mantid/Framework/DataObjects/doc/IntegratePeaksMD_graph2.png similarity index 100% rename from Code/Mantid/Framework/MDEvents/doc/IntegratePeaksMD_graph2.png rename to Code/Mantid/Framework/DataObjects/doc/IntegratePeaksMD_graph2.png diff --git a/Code/Mantid/Framework/MDEvents/doc/MDWorkspace_structure.odg b/Code/Mantid/Framework/DataObjects/doc/MDWorkspace_structure.odg similarity index 100% rename from Code/Mantid/Framework/MDEvents/doc/MDWorkspace_structure.odg rename to Code/Mantid/Framework/DataObjects/doc/MDWorkspace_structure.odg diff --git a/Code/Mantid/Framework/MDEvents/doc/MDWorkspace_structure.png b/Code/Mantid/Framework/DataObjects/doc/MDWorkspace_structure.png similarity index 100% rename from Code/Mantid/Framework/MDEvents/doc/MDWorkspace_structure.png rename to Code/Mantid/Framework/DataObjects/doc/MDWorkspace_structure.png diff --git a/Code/Mantid/Framework/MDEvents/doc/PeakIntensityVsRadius_fig.png b/Code/Mantid/Framework/DataObjects/doc/PeakIntensityVsRadius_fig.png similarity index 100% rename from Code/Mantid/Framework/MDEvents/doc/PeakIntensityVsRadius_fig.png rename to Code/Mantid/Framework/DataObjects/doc/PeakIntensityVsRadius_fig.png diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/AffineMatrixParameter.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/AffineMatrixParameter.h similarity index 92% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/AffineMatrixParameter.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/AffineMatrixParameter.h index 5b748bfefccf2e62e73168577260d6357bb84918..170b73950c46e0e1490db8e52bea2e6bb93f84d0 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/AffineMatrixParameter.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/AffineMatrixParameter.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_AFFINE_MATRIX_PARAMETER -#define MANTID_MDEVENTS_AFFINE_MATRIX_PARAMETER +#ifndef MANTID_DATAOBJECTS_AFFINE_MATRIX_PARAMETER +#define MANTID_DATAOBJECTS_AFFINE_MATRIX_PARAMETER #include "MantidKernel/System.h" #include "MantidAPI/ImplicitFunctionParameter.h" @@ -7,7 +7,7 @@ #include "MantidGeometry/MDGeometry/MDTypes.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { /// Convenience typedef for a specific matrix type. typedef Mantid::Kernel::Matrix<coord_t> AffineMatrixType; diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/AffineMatrixParameterParser.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/AffineMatrixParameterParser.h similarity index 84% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/AffineMatrixParameterParser.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/AffineMatrixParameterParser.h index dfecb2a6010fcbdeaff4fee110b7e76bfa8b2295..b8ffc66f4ae2390bc94bda96f06445d51453aa05 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/AffineMatrixParameterParser.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/AffineMatrixParameterParser.h @@ -1,12 +1,12 @@ -#ifndef MANTID_MDEVENTS_AFFINE_MATRIX_PARAMETER_PARSER -#define MANTID_MDEVENTS_AFFINE_MATRIX_PARAMETER_PARSER +#ifndef MANTID_DATAOBJECTS_AFFINE_MATRIX_PARAMETER_PARSER +#define MANTID_DATAOBJECTS_AFFINE_MATRIX_PARAMETER_PARSER #include "MantidKernel/System.h" #include "MantidAPI/ImplicitFunctionParameterParser.h" -#include "MantidMDEvents/AffineMatrixParameter.h" +#include "MantidDataObjects/AffineMatrixParameter.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { /** Parser for a parameter of type affinematrixparameter * * @author Owen Arnold diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/BoxControllerNeXusIO.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/BoxControllerNeXusIO.h similarity index 97% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/BoxControllerNeXusIO.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/BoxControllerNeXusIO.h index 025bc089fd6798dfcd630924bf041eac88d7f7c2..71ee97597bb926fb66ed7dae6e77a1e092caf0a2 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/BoxControllerNeXusIO.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/BoxControllerNeXusIO.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_BOXCONTROLLER_NEXUSS_IO_H -#define MANTID_MDEVENTS_BOXCONTROLLER_NEXUSS_IO_H +#ifndef MANTID_DATAOBJECTS_BOXCONTROLLER_NEXUSS_IO_H +#define MANTID_DATAOBJECTS_BOXCONTROLLER_NEXUSS_IO_H #include "MantidAPI/IBoxControllerIO.h" #include "MantidAPI/BoxController.h" @@ -8,7 +8,7 @@ #include <nexus/NeXusFile.hpp> namespace Mantid { -namespace MDEvents { +namespace DataObjects { //=============================================================================================== /** The class responsible for saving events into nexus file using generic box @@ -121,7 +121,7 @@ private: /// with. ) } m_EventType; - /// The version of the MDEvents data block + /// The version of the md events data block std::string m_EventsVersion; /// the symblolic description of the event types currently supported by the /// class @@ -164,4 +164,4 @@ private: }; } } -#endif \ No newline at end of file +#endif diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformAffine.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformAffine.h similarity index 90% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformAffine.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformAffine.h index 8c138de70d8fe23ee1708419e2af133d346f5a36..17e4d6f398597e84b9c1348df21edc4c82783028 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformAffine.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformAffine.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_COORDTRANSFORMAFFINE_H_ -#define MANTID_MDEVENTS_COORDTRANSFORMAFFINE_H_ +#ifndef MANTID_DATAOBJECTS_COORDTRANSFORMAFFINE_H_ +#define MANTID_DATAOBJECTS_COORDTRANSFORMAFFINE_H_ #include "MantidAPI/CoordTransform.h" #include "MantidAPI/SingleValueParameter.h" @@ -8,10 +8,10 @@ #include "MantidKernel/Matrix.h" #include "MantidKernel/System.h" #include "MantidKernel/VMD.h" -#include "MantidMDEvents/AffineMatrixParameter.h" +#include "MantidDataObjects/AffineMatrixParameter.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { /** Generic class to transform from M input dimensions to N output dimensions. * @@ -66,6 +66,6 @@ protected: }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_COORDTRANSFORMAFFINE_H_ */ +#endif /* MANTID_DATAOBJECTS_COORDTRANSFORMAFFINE_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformAffineParser.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformAffineParser.h similarity index 89% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformAffineParser.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformAffineParser.h index c316cc5edd28addda2477e114f602340bb659afe..80a76325ec76117620a324a102a92f13f81297d0 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformAffineParser.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformAffineParser.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_COORDTRANSFORMPARSER_H_ -#define MANTID_MDEVENTS_COORDTRANSFORMPARSER_H_ +#ifndef MANTID_DATAOBJECTS_COORDTRANSFORMPARSER_H_ +#define MANTID_DATAOBJECTS_COORDTRANSFORMPARSER_H_ #include "MantidKernel/System.h" #include <boost/shared_ptr.hpp> @@ -17,7 +17,7 @@ namespace API { class CoordTransform; } -namespace MDEvents { +namespace DataObjects { /** A parser for processing coordinate transform xml * diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformAligned.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformAligned.h similarity index 93% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformAligned.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformAligned.h index 5dd40ca97fbfbc1cd362577b33e4f8e0535edbaf..59903ca16b65cfdacaad2b5e00c561264714e459 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformAligned.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformAligned.h @@ -1,12 +1,12 @@ -#ifndef MANTID_MDEVENTS_COORDTRANSFORMALIGNED_H_ -#define MANTID_MDEVENTS_COORDTRANSFORMALIGNED_H_ +#ifndef MANTID_DATAOBJECTS_COORDTRANSFORMALIGNED_H_ +#define MANTID_DATAOBJECTS_COORDTRANSFORMALIGNED_H_ #include "MantidAPI/CoordTransform.h" #include "MantidAPI/VectorParameter.h" #include "MantidKernel/System.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { /// Unique type declaration for which dimensions are used in the input workspace DECLARE_VECTOR_PARAMETER(DimensionsToBinFromParam, size_t) @@ -78,7 +78,7 @@ protected: coord_t *m_scaling; }; -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid -#endif /* MANTID_MDEVENTS_COORDTRANSFORMALIGNED_H_ */ +#endif /* MANTID_DATAOBJECTS_COORDTRANSFORMALIGNED_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformDistance.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformDistance.h similarity index 89% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformDistance.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformDistance.h index 4da70fdac7e0f109657aff9ca68104bce711e27f..beec61ac08f3e4bc1421aff6cc0d12afd487632f 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformDistance.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformDistance.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_COORDTRANSFORMDISTANCE_H_ -#define MANTID_MDEVENTS_COORDTRANSFORMDISTANCE_H_ +#ifndef MANTID_DATAOBJECTS_COORDTRANSFORMDISTANCE_H_ +#define MANTID_DATAOBJECTS_COORDTRANSFORMDISTANCE_H_ #include "MantidAPI/CoordTransform.h" #include "MantidAPI/VectorParameter.h" @@ -9,7 +9,7 @@ #include <boost/scoped_ptr.hpp> namespace Mantid { -namespace MDEvents { +namespace DataObjects { /// Unique CoordCenterVectorParam type declaration for ndimensional coordinate /// centers DECLARE_VECTOR_PARAMETER(CoordCenterVectorParam, coord_t) @@ -59,6 +59,6 @@ protected: }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_COORDTRANSFORMDISTANCE_H_ */ +#endif /* MANTID_DATAOBJECTS_COORDTRANSFORMDISTANCE_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformDistanceParser.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformDistanceParser.h similarity index 77% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformDistanceParser.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformDistanceParser.h index 51e87ba615a1641616649976cb87f4b5b68f3d87..1715a94c871ecb15c115d441f4ca2f04f2015e59 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CoordTransformDistanceParser.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/CoordTransformDistanceParser.h @@ -1,12 +1,12 @@ -#ifndef MANTID_MDEVENTS_COORDTRANSFORMDISTANCEPARSER_H_ -#define MANTID_MDEVENTS_COORDTRANSFORMDISTANCEPARSER_H_ +#ifndef MANTID_DATAOBJECTS_COORDTRANSFORMDISTANCEPARSER_H_ +#define MANTID_DATAOBJECTS_COORDTRANSFORMDISTANCEPARSER_H_ #include "MantidKernel/System.h" #include <boost/shared_ptr.hpp> -#include "MantidMDEvents/CoordTransformAffineParser.h" +#include "MantidDataObjects/CoordTransformAffineParser.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { /// Forward declaration class CoordTransformDistance; diff --git a/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/FakeMD.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/FakeMD.h new file mode 100644 index 0000000000000000000000000000000000000000..0084d7784b0372f120cdbc087b8bd52e3a4ce931 --- /dev/null +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/FakeMD.h @@ -0,0 +1,79 @@ +#ifndef MANTID_DATAOBJECTS_FAKEMD_H_ +#define MANTID_DATAOBJECTS_FAKEMD_H_ +#include <vector> + +#include "MantidAPI/IMDEventWorkspace.h" +#include "MantidDataObjects/DllConfig.h" +#include "MantidDataObjects/MDEventWorkspace.h" + +#include <boost/random/mersenne_twister.hpp> +#include <boost/random/uniform_int.hpp> +#include <boost/random/variate_generator.hpp> + +namespace Mantid { +namespace DataObjects { + +/** + Provides a helper class to add fake data to an MD workspace + + + 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_DATAOBJECTS_DLL FakeMD { +public: + FakeMD(const std::vector<double> &uniformParams, + const std::vector<double> &peakParams, const int randomSeed, + const bool randomizeSignal); + + void fill(API::IMDEventWorkspace_sptr workspace); + +private: + void setupDetectorCache(const API::IMDEventWorkspace &workspace); + + template <typename MDE, size_t nd> + void addFakePeak(typename MDEventWorkspace<MDE, nd>::sptr ws); + template <typename MDE, size_t nd> + void addFakeUniformData(typename MDEventWorkspace<MDE, nd>::sptr ws); + + template <typename MDE, size_t nd> + void addFakeRandomData(const std::vector<double> ¶ms, + typename MDEventWorkspace<MDE, nd>::sptr ws); + template <typename MDE, size_t nd> + void addFakeRegularData(const std::vector<double> ¶ms, + typename MDEventWorkspace<MDE, nd>::sptr ws); + + detid_t pickDetectorID(); + + //------------------ Member variables ------------------------------------ + std::vector<double> m_uniformParams; + std::vector<double> m_peakParams; + const int m_randomSeed; + const bool m_randomizeSignal; + mutable std::vector<detid_t> m_detIDs; + boost::mt19937 m_randGen; + boost::uniform_int<size_t> m_uniformDist; +}; + +} // namespace DataObjects +} // namespace Mantid + +#endif /* MANTID_DATAOBJECTS_FAKEMD_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBin.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBin.h similarity index 87% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBin.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBin.h index 1feaec4db436e15e11927ff2d0ed911873462c61..4d47833269f901bb073de1e2144865bf7fcbadc1 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBin.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBin.h @@ -1,12 +1,12 @@ -#ifndef MANTID_MDEVENTS_MDBIN_H_ -#define MANTID_MDEVENTS_MDBIN_H_ +#ifndef MANTID_DATAOBJECTS_MDBIN_H_ +#define MANTID_DATAOBJECTS_MDBIN_H_ #include "MantidKernel/System.h" #include "MantidGeometry/MDGeometry/IMDDimension.h" -#include "MantidMDEvents/MDLeanEvent.h" +#include "MantidDataObjects/MDLeanEvent.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { /** MDBin : Class describing a single bin in a dense, Multidimensional *histogram. * This object will get passed around by MDBox'es and accumulate the total @@ -53,6 +53,6 @@ public: }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_MDBIN_H_ */ +#endif /* MANTID_DATAOBJECTS_MDBIN_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBox.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBox.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBox.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBox.h index e1981e9609ec533cb58ac7aa71b2a9d908bfcc12..b0e9731b1786dca5e0f6879654cda2d2e5f10b7c 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBox.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBox.h @@ -7,12 +7,12 @@ #include "MantidGeometry/MDGeometry/MDDimensionExtents.h" #include "MantidGeometry/MDGeometry/MDTypes.h" #include "MantidAPI/IMDWorkspace.h" -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/MDDimensionStats.h" -#include "MantidMDEvents/MDLeanEvent.h" +#include "MantidDataObjects/MDBoxBase.h" +#include "MantidDataObjects/MDDimensionStats.h" +#include "MantidDataObjects/MDLeanEvent.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { #ifndef __INTEL_COMPILER // As of July 13, the packing has no effect for the // Intel compiler and produces a warning @@ -279,7 +279,7 @@ public: } }; -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBoxBase.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.h similarity index 99% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBoxBase.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.h index 8cd3a3e43350b8e78cd491afc3a7da40082bbbbe..985985c09c37d842b5ded8b01951e239bd3a92f5 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBoxBase.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.h @@ -3,8 +3,8 @@ #include "MantidAPI/IMDNode.h" #include <iosfwd> -#include "MantidMDEvents/MDBin.h" -#include "MantidMDEvents/MDLeanEvent.h" +#include "MantidDataObjects/MDBin.h" +#include "MantidDataObjects/MDLeanEvent.h" #include "MantidAPI/BoxController.h" #include "MantidAPI/IMDWorkspace.h" #include "MantidAPI/CoordTransform.h" @@ -18,7 +18,7 @@ #define MDBOX_TRACK_CENTROID namespace Mantid { -namespace MDEvents { +namespace DataObjects { #ifndef __INTEL_COMPILER // As of July 13, the packing has no effect for the // Intel compiler and produces a warning @@ -380,7 +380,7 @@ public: #pragma pack(pop) // Return to default packing size #endif -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid #endif /* MDBOXBASE_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBoxFlatTree.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBoxFlatTree.h similarity index 97% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBoxFlatTree.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBoxFlatTree.h index ef01cbbad77f6eeeabbba82253b6382b6d807734..12b0106eb095d6508ce10638b32fc77377d72b0e 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBoxFlatTree.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBoxFlatTree.h @@ -3,12 +3,12 @@ #include "MantidKernel/Matrix.h" #include "MantidAPI/BoxController.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDGridBox.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDGridBox.h" +#include "MantidDataObjects/MDEventWorkspace.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { //=============================================================================================== /** The class responsible for saving/loading MD boxes structure to/from HDD and for flattening/restoring diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBoxIterator.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBoxIterator.h similarity index 89% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBoxIterator.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBoxIterator.h index 1516df9efeb881e7067da6c184206c8099fba108..fe6e414c2105a239ffa37208dfa5eebd2b8b9d29 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBoxIterator.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBoxIterator.h @@ -1,16 +1,16 @@ -#ifndef MANTID_MDEVENTS_MDBOXITERATOR_H_ -#define MANTID_MDEVENTS_MDBOXITERATOR_H_ +#ifndef MANTID_DATAOBJECTS_MDBOXITERATOR_H_ +#define MANTID_DATAOBJECTS_MDBOXITERATOR_H_ #include "MantidAPI/IMDIterator.h" #include "MantidGeometry/MDGeometry/MDImplicitFunction.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDLeanEvent.h" -#include "MantidMDEvents/SkippingPolicy.h" +#include "MantidDataObjects/MDBoxBase.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDLeanEvent.h" +#include "MantidDataObjects/SkippingPolicy.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { // Forward declaration. class SkippingPolicy; @@ -118,6 +118,6 @@ private: }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_MDBOXITERATOR_H_ */ +#endif /* MANTID_DATAOBJECTS_MDBOXITERATOR_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBoxSaveable.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBoxSaveable.h similarity index 95% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBoxSaveable.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBoxSaveable.h index f2abb2b91bf85f495fe4b21f4369b05d841fbcea..e8e75c3d3ed6f8b691939ca705b7ee8dccb80d26 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBoxSaveable.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDBoxSaveable.h @@ -1,11 +1,11 @@ -#ifndef MANTID_MDEVENTS_MDBOX_SAVEABLE_H -#define MANTID_MDEVENTS_MDBOX_SAVEABLE_H +#ifndef MANTID_DATAOBJECTS_MDBOX_SAVEABLE_H +#define MANTID_DATAOBJECTS_MDBOX_SAVEABLE_H #include "MantidKernel/ISaveable.h" #include "MantidAPI/IMDNode.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { //=============================================================================================== /** Two classes responsible for implementing methods which automatically diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDDimensionStats.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDDimensionStats.h similarity index 89% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDDimensionStats.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDDimensionStats.h index f6e1e48921e76c1ccf43ab9bb07ca23028e2f154..11bdc59770673b42ddc83b662a861168c879a706 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDDimensionStats.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDDimensionStats.h @@ -1,11 +1,11 @@ -#ifndef MANTID_MDEVENTS_MDDIMENSIONSTATS_H_ -#define MANTID_MDEVENTS_MDDIMENSIONSTATS_H_ +#ifndef MANTID_DATAOBJECTS_MDDIMENSIONSTATS_H_ +#define MANTID_DATAOBJECTS_MDDIMENSIONSTATS_H_ #include "MantidKernel/System.h" -#include "MantidMDEvents/MDLeanEvent.h" +#include "MantidDataObjects/MDLeanEvent.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { /** A simple class holding some statistics * on the distribution of events in a particular dimension @@ -64,6 +64,6 @@ public: }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_MDDIMENSIONSTATS_H_ */ +#endif /* MANTID_DATAOBJECTS_MDDIMENSIONSTATS_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEvent.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDEvent.h similarity index 99% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEvent.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDEvent.h index ef290905c207f956887e09e3e2bba4f92305845e..a8b1073dc88131060a6e82aad668a2a0a44e422b 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEvent.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDEvent.h @@ -5,12 +5,12 @@ #include "MantidGeometry/MDGeometry/MDTypes.h" #include "MantidKernel/System.h" #include "MantidAPI/BoxController.h" -#include "MantidMDEvents/MDLeanEvent.h" +#include "MantidDataObjects/MDLeanEvent.h" #include <cmath> #include <numeric> namespace Mantid { -namespace MDEvents { +namespace DataObjects { // To ensure the structure is as small as possible #pragma pack(push, 2) @@ -262,7 +262,7 @@ public: // Return to normal packing #pragma pack(pop) -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventFactory.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDEventFactory.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventFactory.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDEventFactory.h index 554725e47b80064bf6ae989ee52fd08a55a947c2..0b1e1af51f4af3e9182428701ecf5c426929d8b6 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventFactory.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDEventFactory.h @@ -1,19 +1,18 @@ -#ifndef MANTID_MDEVENTS_MDEVENTFACTORY_H_ -#define MANTID_MDEVENTS_MDEVENTFACTORY_H_ +#ifndef MANTID_DATAOBJECTS_MDEVENTFACTORY_H_ +#define MANTID_DATAOBJECTS_MDEVENTFACTORY_H_ #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidKernel/System.h" -#include "MantidMDEvents/MDBin.h" -#include "MantidMDEvents/MDEvent.h" -#include "MantidMDEvents/MDLeanEvent.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidGeometry/MDGeometry/MDDimensionExtents.h" -#include "MantidMDEvents/MDWSDescription.h" + +#include "MantidDataObjects/MDBin.h" +#include "MantidDataObjects/MDEvent.h" +#include "MantidDataObjects/MDLeanEvent.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" + #include <boost/shared_ptr.hpp> namespace Mantid { -namespace MDEvents { +namespace DataObjects { /** MDEventFactory : collection of methods * to create MDLeanEvent* instances, by specifying the number @@ -619,6 +618,6 @@ typedef MDBin<MDLeanEvent<9>, 9> MDBin9Lean; //################################################################## } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_MDEVENTFACTORY_H_ */ +#endif /* MANTID_DATAOBJECTS_MDEVENTFACTORY_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventInserter.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDEventInserter.h similarity index 93% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventInserter.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDEventInserter.h index 3a3e2cbe1c4b0be409fc77e3156e8a8c854a7969..f2a20607738abe817bed57b495ff5977e2bf43e3 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventInserter.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDEventInserter.h @@ -1,10 +1,11 @@ -#ifndef MANTID_MDEVENTS_MDEVENTINSERTER_H_ -#define MANTID_MDEVENTS_MDEVENTINSERTER_H_ +#ifndef MANTID_DATAOBJECTS_MDEVENTINSERTER_H_ +#define MANTID_DATAOBJECTS_MDEVENTINSERTER_H_ #include "MantidKernel/System.h" +#include "MantidGeometry/MDGeometry/MDTypes.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { /** MDEventInserter : Helper class that provides a generic interface for adding events to an MDWorkspace without knowing whether the workspace is storing @@ -104,7 +105,7 @@ private: } }; -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid -#endif /* MANTID_MDEVENTS_MDEVENTINSERTER_H_ */ +#endif /* MANTID_DATAOBJECTS_MDEVENTINSERTER_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventWorkspace.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.h similarity index 95% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventWorkspace.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.h index aa134a84b56d0f3e4a649e825d5287402c7c9f72..a1e927591f525c2ef21ea726a0b0d3d65cdf4e86 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventWorkspace.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.h @@ -5,17 +5,17 @@ #include "MantidKernel/ProgressBase.h" #include "MantidKernel/System.h" #include "MantidAPI/BoxController.h" -//#include "MantidMDEvents/BoxCtrlChangesList.h" +//#include "MantidDataObjects/BoxCtrlChangesList.h" #include "MantidAPI/CoordTransform.h" -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/MDLeanEvent.h" -#include "MantidMDEvents/MDGridBox.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDBoxBase.h" +#include "MantidDataObjects/MDLeanEvent.h" +#include "MantidDataObjects/MDGridBox.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidAPI/ITableWorkspace.h" #include "MantidAPI/IMDIterator.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { /** Templated class for the multi-dimensional event workspace. * @@ -173,7 +173,7 @@ private: Kernel::SpecialCoordinateSystem m_coordSystem; }; -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDGridBox.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDGridBox.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.h index 3445c59293724df543c4cb89820373714b44b980..16b7af7ccc87f358838780758d900a1638a973a2 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDGridBox.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.h @@ -8,12 +8,12 @@ #include "MantidKernel/System.h" #include "MantidKernel/Task.h" #include "MantidKernel/ThreadScheduler.h" -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDLeanEvent.h" +#include "MantidDataObjects/MDBoxBase.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDLeanEvent.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { #ifndef __INTEL_COMPILER // As of July 13, the packing has no effect for the // Intel compiler and produces a warning @@ -245,7 +245,7 @@ private: #pragma pack(pop) // Return to default packing size #endif -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid #endif /* MDGRIDBOX_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDHistoWorkspace.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDHistoWorkspace.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDHistoWorkspace.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDHistoWorkspace.h index b43bb81ba1b601c6af22dd207f73c7db2e7cd6d8..67a4238e2aac3f5ca77faa5426620a87a89ac0a8 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDHistoWorkspace.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDHistoWorkspace.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_MDHISTOWORKSPACE_H_ -#define MANTID_MDEVENTS_MDHISTOWORKSPACE_H_ +#ifndef MANTID_DATAOBJECTS_MDHISTOWORKSPACE_H_ +#define MANTID_DATAOBJECTS_MDHISTOWORKSPACE_H_ #include "MantidAPI/IMDIterator.h" #include "MantidAPI/IMDWorkspace.h" @@ -16,7 +16,7 @@ // using Mantid::API::MDNormalization; namespace Mantid { -namespace MDEvents { +namespace DataObjects { /** MDHistoWorkspace: * @@ -435,6 +435,6 @@ typedef boost::shared_ptr<MDHistoWorkspace> MDHistoWorkspace_sptr; typedef boost::shared_ptr<const MDHistoWorkspace> MDHistoWorkspace_const_sptr; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_MDHISTOWORKSPACE_H_ */ +#endif /* MANTID_DATAOBJECTS_MDHISTOWORKSPACE_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDHistoWorkspaceIterator.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDHistoWorkspaceIterator.h similarity index 93% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDHistoWorkspaceIterator.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDHistoWorkspaceIterator.h index bcfc75db181b4b72d1caf2984f69cbd1c226e879..4eae0c223115210a887c3023af9a217476b9237f 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDHistoWorkspaceIterator.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDHistoWorkspaceIterator.h @@ -1,14 +1,14 @@ -#ifndef MANTID_MDEVENTS_MDHISTOWORKSPACEITERATOR_H_ -#define MANTID_MDEVENTS_MDHISTOWORKSPACEITERATOR_H_ +#ifndef MANTID_DATAOBJECTS_MDHISTOWORKSPACEITERATOR_H_ +#define MANTID_DATAOBJECTS_MDHISTOWORKSPACEITERATOR_H_ #include "MantidKernel/System.h" #include "MantidAPI/IMDIterator.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidGeometry/MDGeometry/MDImplicitFunction.h" -#include "MantidMDEvents/SkippingPolicy.h" +#include "MantidDataObjects/SkippingPolicy.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { /** An implementation of IMDIterator that iterates through a MDHistoWorkspace. It treats the bin in the workspace as @@ -156,7 +156,7 @@ protected: SkippingPolicy_scptr m_skippingPolicy; }; -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid -#endif /* MANTID_MDEVENTS_MDHISTOWORKSPACEITERATOR_H_ */ +#endif /* MANTID_DATAOBJECTS_MDHISTOWORKSPACEITERATOR_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDLeanEvent.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDLeanEvent.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDLeanEvent.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDLeanEvent.h index ea1dfd188adb00a4bc7880648d4ae816c2446a11..bc07aad83dfb006177098c18ead1540cbc9b42a1 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDLeanEvent.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MDLeanEvent.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_MDLEANEVENT_H_ -#define MANTID_MDEVENTS_MDLEANEVENT_H_ +#ifndef MANTID_DATAOBJECTS_MDLEANEVENT_H_ +#define MANTID_DATAOBJECTS_MDLEANEVENT_H_ #include "MantidKernel/System.h" #include "MantidGeometry/MDGeometry/IMDDimension.h" @@ -9,7 +9,7 @@ #include <cmath> namespace Mantid { -namespace MDEvents { +namespace DataObjects { /** Templated class holding data about a neutron detection event * in N-dimensions (for example, Qx, Qy, Qz, E). @@ -304,7 +304,7 @@ public: } }; -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid -#endif /* MANTID_MDEVENTS_MDLEANEVENT_H_ */ +#endif /* MANTID_DATAOBJECTS_MDLEANEVENT_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/SkippingPolicy.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/SkippingPolicy.h similarity index 89% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/SkippingPolicy.h rename to Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/SkippingPolicy.h index f6ae94271bf8952dd49b9529f6ed02dca7ddd889..1d473a5b12460c26ceb3b339d7785d2628fd96ad 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/SkippingPolicy.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/SkippingPolicy.h @@ -1,13 +1,13 @@ -#ifndef MANTID_MDEVENTS_SKIPPINGPOLICY_H_ -#define MANTID_MDEVENTS_SKIPPINGPOLICY_H_ +#ifndef MANTID_DATAOBJECTS_SKIPPINGPOLICY_H_ +#define MANTID_DATAOBJECTS_SKIPPINGPOLICY_H_ #include "MantidKernel/System.h" -#include "MantidMDEvents/SkippingPolicy.h" +#include "MantidDataObjects/SkippingPolicy.h" #include "MantidAPI/IMDIterator.h" #include <boost/scoped_ptr.hpp> namespace Mantid { -namespace MDEvents { +namespace DataObjects { /** SkippingPolicy : Policy types for skipping in MDiterators. @@ -70,7 +70,7 @@ public: typedef boost::scoped_ptr<SkippingPolicy> SkippingPolicy_scptr; -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid -#endif /* MANTID_MDEVENTS_SKIPPINGPOLICY_H_ */ +#endif /* MANTID_DATAOBJECTS_SKIPPINGPOLICY_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/scripts/.gitignore b/Code/Mantid/Framework/DataObjects/scripts/.gitignore similarity index 100% rename from Code/Mantid/Framework/MDEvents/scripts/.gitignore rename to Code/Mantid/Framework/DataObjects/scripts/.gitignore diff --git a/Code/Mantid/Framework/MDEvents/scripts/analysis.py b/Code/Mantid/Framework/DataObjects/scripts/analysis.py similarity index 100% rename from Code/Mantid/Framework/MDEvents/scripts/analysis.py rename to Code/Mantid/Framework/DataObjects/scripts/analysis.py diff --git a/Code/Mantid/Framework/MDEvents/src/AffineMatrixParameter.cpp b/Code/Mantid/Framework/DataObjects/src/AffineMatrixParameter.cpp similarity index 98% rename from Code/Mantid/Framework/MDEvents/src/AffineMatrixParameter.cpp rename to Code/Mantid/Framework/DataObjects/src/AffineMatrixParameter.cpp index 137bc1429ef19137cbf7de5cdb64468c2ef27aad..6c1a42ea72f5cf768f8486f8e2d24213a7777b4f 100644 --- a/Code/Mantid/Framework/MDEvents/src/AffineMatrixParameter.cpp +++ b/Code/Mantid/Framework/DataObjects/src/AffineMatrixParameter.cpp @@ -1,7 +1,7 @@ -#include "MantidMDEvents/AffineMatrixParameter.h" +#include "MantidDataObjects/AffineMatrixParameter.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { //---------------------------------------------------------------------------------------------- /** Constructor diff --git a/Code/Mantid/Framework/MDEvents/src/AffineMatrixParameterParser.cpp b/Code/Mantid/Framework/DataObjects/src/AffineMatrixParameterParser.cpp similarity index 96% rename from Code/Mantid/Framework/MDEvents/src/AffineMatrixParameterParser.cpp rename to Code/Mantid/Framework/DataObjects/src/AffineMatrixParameterParser.cpp index 48bf80342637b072a48bc57e42e55a9f0a12c920..913b828a756999e8a817bb72b40bab51c55cf864 100644 --- a/Code/Mantid/Framework/MDEvents/src/AffineMatrixParameterParser.cpp +++ b/Code/Mantid/Framework/DataObjects/src/AffineMatrixParameterParser.cpp @@ -1,8 +1,8 @@ -#include "MantidMDEvents/AffineMatrixParameterParser.h" +#include "MantidDataObjects/AffineMatrixParameterParser.h" #include <boost/algorithm/string.hpp> namespace Mantid { -namespace MDEvents { +namespace DataObjects { AffineMatrixParameterParser::AffineMatrixParameterParser() {} diff --git a/Code/Mantid/Framework/MDEvents/src/BoxControllerNeXusIO.cpp b/Code/Mantid/Framework/DataObjects/src/BoxControllerNeXusIO.cpp similarity index 99% rename from Code/Mantid/Framework/MDEvents/src/BoxControllerNeXusIO.cpp rename to Code/Mantid/Framework/DataObjects/src/BoxControllerNeXusIO.cpp index a4f36f9f82c59f277b86290a29e091a9bdf940fe..4d8bbd0a4030c7a7ac1a177866bcec5b64533611 100644 --- a/Code/Mantid/Framework/MDEvents/src/BoxControllerNeXusIO.cpp +++ b/Code/Mantid/Framework/DataObjects/src/BoxControllerNeXusIO.cpp @@ -1,13 +1,13 @@ -#include "MantidMDEvents/BoxControllerNeXusIO.h" -#include "MantidMDEvents/MDBoxFlatTree.h" +#include "MantidDataObjects/BoxControllerNeXusIO.h" +#include "MantidDataObjects/MDBoxFlatTree.h" #include "MantidKernel/Exception.h" #include "MantidAPI/FileFinder.h" -#include "MantidMDEvents/MDEvent.h" +#include "MantidDataObjects/MDEvent.h" #include <string> namespace Mantid { -namespace MDEvents { +namespace DataObjects { // Default headers(attributes) describing the contents of the data, written by // this class const char *EventHeaders[] = { diff --git a/Code/Mantid/Framework/MDEvents/src/CoordTransformAffine.cpp b/Code/Mantid/Framework/DataObjects/src/CoordTransformAffine.cpp similarity index 98% rename from Code/Mantid/Framework/MDEvents/src/CoordTransformAffine.cpp rename to Code/Mantid/Framework/DataObjects/src/CoordTransformAffine.cpp index c1b721bd4ca3cec9d5fea2199f6aac155d396b08..433b2a4496bf2accdefa7369ffac1ccc97456111 100644 --- a/Code/Mantid/Framework/MDEvents/src/CoordTransformAffine.cpp +++ b/Code/Mantid/Framework/DataObjects/src/CoordTransformAffine.cpp @@ -2,11 +2,11 @@ #include "MantidKernel/Exception.h" #include "MantidKernel/Matrix.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/CoordTransformAffine.h" +#include "MantidDataObjects/CoordTransformAffine.h" #include <boost/algorithm/string.hpp> #include <boost/format.hpp> #include "MantidKernel/VectorHelper.h" -#include "MantidMDEvents/CoordTransformAligned.h" +#include "MantidDataObjects/CoordTransformAligned.h" #include "MantidAPI/CoordTransform.h" #include <iostream> @@ -15,7 +15,7 @@ using namespace Mantid::Kernel; using Mantid::API::CoordTransform; namespace Mantid { -namespace MDEvents { +namespace DataObjects { //---------------------------------------------------------------------------------------------- /** Constructor. @@ -334,4 +334,4 @@ CoordTransformAffine::combineTransformations(CoordTransform *first, } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDEvents/src/CoordTransformAffineParser.cpp b/Code/Mantid/Framework/DataObjects/src/CoordTransformAffineParser.cpp similarity index 94% rename from Code/Mantid/Framework/MDEvents/src/CoordTransformAffineParser.cpp rename to Code/Mantid/Framework/DataObjects/src/CoordTransformAffineParser.cpp index b2f92cbb25171c055e371b10d0f2b0488bda44c5..2fa78604972253880b65cf7c2e89f8e072f58074 100644 --- a/Code/Mantid/Framework/MDEvents/src/CoordTransformAffineParser.cpp +++ b/Code/Mantid/Framework/DataObjects/src/CoordTransformAffineParser.cpp @@ -1,14 +1,14 @@ #include "MantidAPI/SingleValueParameterParser.h" -#include "MantidMDEvents/AffineMatrixParameterParser.h" +#include "MantidDataObjects/AffineMatrixParameterParser.h" #include "MantidAPI/CoordTransform.h" -#include "MantidMDEvents/CoordTransformAffine.h" -#include "MantidMDEvents/CoordTransformAffineParser.h" +#include "MantidDataObjects/CoordTransformAffine.h" +#include "MantidDataObjects/CoordTransformAffineParser.h" #include <Poco/DOM/Element.h> #include <Poco/DOM/NodeList.h> namespace Mantid { -namespace MDEvents { +namespace DataObjects { /// Constructor CoordTransformAffineParser::CoordTransformAffineParser() {} diff --git a/Code/Mantid/Framework/MDEvents/src/CoordTransformAligned.cpp b/Code/Mantid/Framework/DataObjects/src/CoordTransformAligned.cpp similarity index 98% rename from Code/Mantid/Framework/MDEvents/src/CoordTransformAligned.cpp rename to Code/Mantid/Framework/DataObjects/src/CoordTransformAligned.cpp index 74246751b32076f76bc9a3f79de03925a4b55193..e541a274f052e3c526086ffb0c46dd4e253c514b 100644 --- a/Code/Mantid/Framework/MDEvents/src/CoordTransformAligned.cpp +++ b/Code/Mantid/Framework/DataObjects/src/CoordTransformAligned.cpp @@ -1,4 +1,4 @@ -#include "MantidMDEvents/CoordTransformAligned.h" +#include "MantidDataObjects/CoordTransformAligned.h" #include "MantidKernel/System.h" #include "MantidKernel/Strings.h" #include "MantidKernel/Matrix.h" @@ -7,7 +7,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; namespace Mantid { -namespace MDEvents { +namespace DataObjects { //---------------------------------------------------------------------------------------------- /** Constructor @@ -202,4 +202,4 @@ std::string CoordTransformAligned::id() const { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDEvents/src/CoordTransformDistance.cpp b/Code/Mantid/Framework/DataObjects/src/CoordTransformDistance.cpp similarity index 98% rename from Code/Mantid/Framework/MDEvents/src/CoordTransformDistance.cpp rename to Code/Mantid/Framework/DataObjects/src/CoordTransformDistance.cpp index 6c58f7ed8e3c89e46104bd06bba6bbf135ff9b74..682b8c9987e09cb7ebcf3c76be946fac4e445d78 100644 --- a/Code/Mantid/Framework/MDEvents/src/CoordTransformDistance.cpp +++ b/Code/Mantid/Framework/DataObjects/src/CoordTransformDistance.cpp @@ -2,7 +2,7 @@ #include "MantidKernel/System.h" #include "MantidKernel/System.h" #include "MantidAPI/CoordTransform.h" -#include "MantidMDEvents/CoordTransformDistance.h" +#include "MantidDataObjects/CoordTransformDistance.h" #include <boost/algorithm/string.hpp> #include <boost/format.hpp> @@ -12,7 +12,7 @@ using namespace Mantid::Kernel; using Mantid::API::CoordTransform; namespace Mantid { -namespace MDEvents { +namespace DataObjects { //---------------------------------------------------------------------------------------------- /** Constructor @@ -156,4 +156,4 @@ std::string CoordTransformDistance::id() const { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDEvents/src/CoordTransformDistanceParser.cpp b/Code/Mantid/Framework/DataObjects/src/CoordTransformDistanceParser.cpp similarity index 92% rename from Code/Mantid/Framework/MDEvents/src/CoordTransformDistanceParser.cpp rename to Code/Mantid/Framework/DataObjects/src/CoordTransformDistanceParser.cpp index 38a66a2f0c2d99a24a91961148351df23b731c5c..66a5179255425f4a13bc3ec7acb284ec700e2805 100644 --- a/Code/Mantid/Framework/MDEvents/src/CoordTransformDistanceParser.cpp +++ b/Code/Mantid/Framework/DataObjects/src/CoordTransformDistanceParser.cpp @@ -1,10 +1,10 @@ -#include "MantidMDEvents/CoordTransformDistanceParser.h" -#include "MantidMDEvents/CoordTransformDistance.h" +#include "MantidDataObjects/CoordTransformDistanceParser.h" +#include "MantidDataObjects/CoordTransformDistance.h" #include "MantidAPI/VectorParameterParser.h" #include "MantidAPI/SingleValueParameterParser.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { /// Constructor CoordTransformDistanceParser::CoordTransformDistanceParser() {} @@ -64,13 +64,13 @@ Mantid::API::CoordTransform *CoordTransformDistanceParser::createTransform( // Parse the coordinate centre parameter. CoordCenterParser coordCenterParser; parameter = dynamic_cast<Poco::XML::Element *>(parameters->item(2)); - boost::shared_ptr<Mantid::MDEvents::CoordCenterVectorParam> + boost::shared_ptr<Mantid::DataObjects::CoordCenterVectorParam> coordCenterParam(coordCenterParser.createWithoutDelegation(parameter)); // Parse the dimensions used parameter. DimsUsedParser dimsUsedParser; parameter = dynamic_cast<Poco::XML::Element *>(parameters->item(3)); - boost::shared_ptr<Mantid::MDEvents::DimensionsUsedVectorParam> + boost::shared_ptr<Mantid::DataObjects::DimensionsUsedVectorParam> dimsUsedVecParm(dimsUsedParser.createWithoutDelegation(parameter)); ////Generate the coordinate transform and return diff --git a/Code/Mantid/Framework/DataObjects/src/FakeMD.cpp b/Code/Mantid/Framework/DataObjects/src/FakeMD.cpp new file mode 100644 index 0000000000000000000000000000000000000000..67b3d6ec84af23811da0cfbaa27733c2056ef2f7 --- /dev/null +++ b/Code/Mantid/Framework/DataObjects/src/FakeMD.cpp @@ -0,0 +1,374 @@ +//-------------------------------------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------------------------------------- +#include "MantidDataObjects/FakeMD.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventInserter.h" +#include "MantidKernel/ThreadPool.h" +#include "MantidKernel/ThreadScheduler.h" +#include "MantidKernel/Utils.h" + +#include <boost/random/uniform_int.hpp> +#include <boost/random/uniform_real.hpp> + +namespace Mantid { +namespace DataObjects { + +using Kernel::ThreadPool; +using Kernel::ThreadSchedulerFIFO; + +/** + * Constructor + * @param uniformParams Add a uniform, randomized distribution of events + * @param peakParams Add a peak with a normal distribution around a central + point + * @param randomSeed Seed int for the random number generator + * @param randomizeSignal If true, the events' signal and error values will be " + randomized around 1.0+-0.5 + */ +FakeMD::FakeMD(const std::vector<double> &uniformParams, + const std::vector<double> &peakParams, const int randomSeed, + const bool randomizeSignal) + : m_uniformParams(uniformParams), m_peakParams(peakParams), + m_randomSeed(randomSeed), m_randomizeSignal(randomizeSignal), m_detIDs(), + m_randGen(1), m_uniformDist() { + if (uniformParams.empty() && peakParams.empty()) { + throw std::invalid_argument( + "You must specify at least one of peakParams or uniformParams"); + } +} + +/** + * Add the fake data to the given workspace + * @param workspace A pointer to MD event workspace to fill using the object + * parameters + */ +void FakeMD::fill(API::IMDEventWorkspace_sptr workspace) { + setupDetectorCache(*workspace); + + CALL_MDEVENT_FUNCTION(this->addFakePeak, workspace) + CALL_MDEVENT_FUNCTION(this->addFakeUniformData, workspace) + + // Mark that events were added, so the file back end (if any) needs updating + workspace->setFileNeedsUpdating(true); +} + +/** + * Setup a detector cache for randomly picking IDs from the first + * instrument in the ExperimentInfo list. + * @param workspace The input workspace + */ +void FakeMD::setupDetectorCache(const API::IMDEventWorkspace &workspace) { + try { + auto inst = workspace.getExperimentInfo(0)->getInstrument(); + m_detIDs = inst->getDetectorIDs(true); // true=skip monitors + size_t max = m_detIDs.size() - 1; + m_uniformDist = boost::uniform_int<size_t>(0, max); // Includes max + } catch (std::invalid_argument &) { + } +} + +/** Function makes up a fake single-crystal peak and adds it to the workspace. + * + * @param ws A pointer to the workspace that receives the events + */ +template <typename MDE, size_t nd> +void FakeMD::addFakePeak(typename MDEventWorkspace<MDE, nd>::sptr ws) { + if (m_peakParams.empty()) + return; + + if (m_peakParams.size() != nd + 2) + throw std::invalid_argument("PeakParams needs to have ndims+2 arguments."); + if (m_peakParams[0] <= 0) + throw std::invalid_argument("PeakParams: number_of_events needs to be > 0"); + size_t num = size_t(m_peakParams[0]); + + // Width of the peak + double desiredRadius = m_peakParams.back(); + + boost::mt19937 rng; + boost::uniform_real<coord_t> u2(0, 1.0); // Random from 0 to 1.0 + boost::variate_generator<boost::mt19937 &, boost::uniform_real<coord_t>> + genUnit(rng, u2); + rng.seed((unsigned int)(m_randomSeed)); + + // Inserter to help choose the correct event type + auto eventHelper = + MDEventInserter<typename MDEventWorkspace<MDE, nd>::sptr>(ws); + + for (size_t i = 0; i < num; ++i) { + // Algorithm to generate points along a random n-sphere (sphere with not + // necessarily 3 dimensions) + // from http://en.wikipedia.org/wiki/N-sphere as of May 6, 2011. + + // First, points in a hyper-cube of size 1.0, centered at 0. + coord_t centers[nd]; + coord_t radiusSquared = 0; + for (size_t d = 0; d < nd; d++) { + centers[d] = genUnit() - 0.5f; // Distribute around +- the center + radiusSquared += centers[d] * centers[d]; + } + + // Make a unit vector pointing in this direction + coord_t radius = static_cast<coord_t>(sqrt(radiusSquared)); + for (size_t d = 0; d < nd; d++) + centers[d] /= radius; + + // Now place the point along this radius, scaled with ^1/n for uniformity. + coord_t radPos = genUnit(); + radPos = static_cast<coord_t>( + pow(radPos, static_cast<coord_t>(1.0 / static_cast<coord_t>(nd)))); + for (size_t d = 0; d < nd; d++) { + // Multiply by the scaling and the desired peak radius + centers[d] *= (radPos * static_cast<coord_t>(desiredRadius)); + // Also offset by the center of the peak, as taken in Params + centers[d] += static_cast<coord_t>(m_peakParams[d + 1]); + } + + // Default or randomized error/signal + float signal = 1.0; + float errorSquared = 1.0; + if (m_randomizeSignal) { + signal = float(0.5 + genUnit()); + errorSquared = float(0.5 + genUnit()); + } + + // Create and add the event. + eventHelper.insertMDEvent(signal, errorSquared, 1, pickDetectorID(), + centers); // 1 = run number + } + + ws->splitBox(); + auto *ts = new ThreadSchedulerFIFO(); + ThreadPool tp(ts); + ws->splitAllIfNeeded(ts); + tp.joinAll(); + ws->refreshCache(); +} + +/** + * Function makes up a fake uniform event data and adds it to the workspace. + * @param ws + */ +template <typename MDE, size_t nd> +void FakeMD::addFakeUniformData(typename MDEventWorkspace<MDE, nd>::sptr ws) { + if (m_uniformParams.empty()) + return; + + bool randomEvents = true; + if (m_uniformParams[0] < 0) { + randomEvents = false; + m_uniformParams[0] = -m_uniformParams[0]; + } + + if (m_uniformParams.size() == 1) { + if (randomEvents) { + for (size_t d = 0; d < nd; ++d) { + m_uniformParams.push_back(ws->getDimension(d)->getMinimum()); + m_uniformParams.push_back(ws->getDimension(d)->getMaximum()); + } + } else // regular events + { + size_t nPoints = size_t(m_uniformParams[0]); + double Vol = 1; + for (size_t d = 0; d < nd; ++d) + Vol *= (ws->getDimension(d)->getMaximum() - + ws->getDimension(d)->getMinimum()); + + if (Vol == 0 || Vol > std::numeric_limits<float>::max()) + throw std::invalid_argument( + " Domain ranges are not defined properly for workspace: " + + ws->getName()); + + double dV = Vol / double(nPoints); + double delta0 = std::pow(dV, 1. / double(nd)); + for (size_t d = 0; d < nd; ++d) { + double min = ws->getDimension(d)->getMinimum(); + m_uniformParams.push_back(min * (1 + FLT_EPSILON) - min + FLT_EPSILON); + double extent = ws->getDimension(d)->getMaximum() - min; + size_t nStrides = size_t(extent / delta0); + if (nStrides < 1) + nStrides = 1; + m_uniformParams.push_back(extent / static_cast<double>(nStrides)); + } + } + } + if ((m_uniformParams.size() != 1 + nd * 2)) + throw std::invalid_argument( + "UniformParams: needs to have ndims*2+1 arguments "); + + if (randomEvents) + addFakeRandomData<MDE, nd>(m_uniformParams, ws); + else + addFakeRegularData<MDE, nd>(m_uniformParams, ws); + + ws->splitBox(); + auto *ts = new ThreadSchedulerFIFO(); + ThreadPool tp(ts); + ws->splitAllIfNeeded(ts); + tp.joinAll(); + ws->refreshCache(); +} + +/** + * Add fake randomized data to the workspace + * @param params A reference to the parameter vector + * @param ws The workspace to hold the data + */ +template <typename MDE, size_t nd> +void FakeMD::addFakeRandomData(const std::vector<double> ¶ms, + typename MDEventWorkspace<MDE, nd>::sptr ws) { + + size_t num = size_t(params[0]); + if (num == 0) + throw std::invalid_argument( + " number of distributed events can not be equal to 0"); + + boost::mt19937 rng; + rng.seed((unsigned int)(m_randomSeed)); + + // Unit-size randomizer + boost::uniform_real<double> u2(0, 1.0); // Random from 0 to 1.0 + boost::variate_generator<boost::mt19937 &, boost::uniform_real<double>> + genUnit(rng, u2); + + // Make a random generator for each dimensions + typedef boost::variate_generator<boost::mt19937 &, + boost::uniform_real<double>> gen_t; + + // Inserter to help choose the correct event type + auto eventHelper = + MDEventInserter<typename MDEventWorkspace<MDE, nd>::sptr>(ws); + + gen_t *gens[nd]; + for (size_t d = 0; d < nd; ++d) { + double min = params[d * 2 + 1]; + double max = params[d * 2 + 2]; + if (max <= min) + throw std::invalid_argument( + "UniformParams: min must be < max for all dimensions."); + + boost::uniform_real<double> u(min, max); // Range + gen_t *gen = new gen_t(rng, u); + gens[d] = gen; + } + + // Create all the requested events + for (size_t i = 0; i < num; ++i) { + coord_t centers[nd]; + for (size_t d = 0; d < nd; d++) { + centers[d] = static_cast<coord_t>( + (*gens[d])()); // use a different generator for each dimension + } + + // Default or randomized error/signal + float signal = 1.0; + float errorSquared = 1.0; + if (m_randomizeSignal) { + signal = float(0.5 + genUnit()); + errorSquared = float(0.5 + genUnit()); + } + + // Create and add the event. + eventHelper.insertMDEvent(signal, errorSquared, 1, pickDetectorID(), + centers); // 1 = run number + } + + /// Clean up the generators + for (size_t d = 0; d < nd; ++d) + delete gens[d]; +} + +template <typename MDE, size_t nd> +void FakeMD::addFakeRegularData(const std::vector<double> ¶ms, + typename MDEventWorkspace<MDE, nd>::sptr ws) { + // the parameters for regular distribution of events over the box + std::vector<double> startPoint(nd), delta(nd); + std::vector<size_t> indexMax(nd); + size_t gridSize(0); + + size_t num = size_t(params[0]); + if (num == 0) + throw std::invalid_argument( + " number of distributed events can not be equal to 0"); + + // Inserter to help choose the correct event type + auto eventHelper = + MDEventInserter<typename MDEventWorkspace<MDE, nd>::sptr>(ws); + + gridSize = 1; + for (size_t d = 0; d < nd; ++d) { + double min = ws->getDimension(d)->getMinimum(); + double max = ws->getDimension(d)->getMaximum(); + double shift = params[d * 2 + 1]; + double step = params[d * 2 + 2]; + if (shift < 0) + shift = 0; + if (shift >= step) + shift = step * (1 - FLT_EPSILON); + + startPoint[d] = min + shift; + if ((startPoint[d] < min) || (startPoint[d] >= max)) + throw std::invalid_argument("RegularData: starting point must be within " + "the box for all dimensions."); + + if (step <= 0) + throw(std::invalid_argument( + "Step of the regular grid is less or equal to 0")); + + indexMax[d] = size_t((max - min) / step); + if (indexMax[d] == 0) + indexMax[d] = 1; + // deal with round-off errors + while ((startPoint[d] + double(indexMax[d] - 1) * step) >= max) + step *= (1 - FLT_EPSILON); + + delta[d] = step; + + gridSize *= indexMax[d]; + } + // Create all the requested events + std::vector<size_t> indexes; + size_t cellCount(0); + for (size_t i = 0; i < num; ++i) { + coord_t centers[nd]; + + Kernel::Utils::getIndicesFromLinearIndex(cellCount, indexMax, indexes); + ++cellCount; + if (cellCount >= gridSize) + cellCount = 0; + + for (size_t d = 0; d < nd; d++) { + centers[d] = coord_t(startPoint[d] + delta[d] * double(indexes[d])); + } + + // Default or randomized error/signal + float signal = 1.0; + float errorSquared = 1.0; + + // Create and add the event. + eventHelper.insertMDEvent(signal, errorSquared, 1, pickDetectorID(), + centers); // 1 = run number + } +} + +/** + * Pick a detector ID for a particular event + * @returns A detector ID randomly selected from the instrument + */ +detid_t FakeMD::pickDetectorID() { + if (m_detIDs.empty()) { + return -1; + } else { + /// A variate generator to combine a random number generator with a + /// distribution + typedef boost::variate_generator< + boost::mt19937 &, boost::uniform_int<size_t>> uniform_generator; + uniform_generator uniformRand(m_randGen, m_uniformDist); + const size_t randIndex = uniformRand(); + return m_detIDs[randIndex]; + } +} + +} // namespace DataObjects +} // namespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/src/MDBin.cpp b/Code/Mantid/Framework/DataObjects/src/MDBin.cpp similarity index 85% rename from Code/Mantid/Framework/MDEvents/src/MDBin.cpp rename to Code/Mantid/Framework/DataObjects/src/MDBin.cpp index 3be929a1c8b979e8a4a03c17227fa3eb6de24140..bc69e1eaef8e2c81b5fc9f5fe22886aae68ef0f4 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDBin.cpp +++ b/Code/Mantid/Framework/DataObjects/src/MDBin.cpp @@ -1,8 +1,8 @@ -#include "MantidMDEvents/MDBin.h" +#include "MantidDataObjects/MDBin.h" #include "MantidKernel/System.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { //---------------------------------------------------------------------------------------------- /** Constructor. Clears the signal and error. @@ -16,4 +16,4 @@ TMDE(MDBin)::MDBin() : m_signal(0), m_errorSquared(0) { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDEvents/src/MDBox.cpp b/Code/Mantid/Framework/DataObjects/src/MDBox.cpp similarity index 99% rename from Code/Mantid/Framework/MDEvents/src/MDBox.cpp rename to Code/Mantid/Framework/DataObjects/src/MDBox.cpp index 6f4964c01fddff83be93bdfb5332fe1b16df1538..efbc6f64817ab43682aadd0718b2dbddf5ce60ec 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDBox.cpp +++ b/Code/Mantid/Framework/DataObjects/src/MDBox.cpp @@ -1,16 +1,16 @@ -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDBoxSaveable.h" -#include "MantidMDEvents/MDEvent.h" -#include "MantidMDEvents/MDLeanEvent.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDBoxSaveable.h" +#include "MantidDataObjects/MDEvent.h" +#include "MantidDataObjects/MDLeanEvent.h" #include "MantidKernel/DiskBuffer.h" -#include "MantidMDEvents/MDGridBox.h" +#include "MantidDataObjects/MDGridBox.h" #include <boost/math/special_functions/round.hpp> #include <cmath> using namespace Mantid::API; namespace Mantid { -namespace MDEvents { +namespace DataObjects { /**Destructor */ TMDE(MDBox)::~MDBox() { @@ -886,6 +886,6 @@ TMDE(void MDBox)::clearFileBacked(bool loadDiskBackedData) { } } -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/src/MDBoxBase.cpp b/Code/Mantid/Framework/DataObjects/src/MDBoxBase.cpp similarity index 98% rename from Code/Mantid/Framework/MDEvents/src/MDBoxBase.cpp rename to Code/Mantid/Framework/DataObjects/src/MDBoxBase.cpp index 65fd8bd9c2cab78f70e0e2fffbe28c93c56a8ce1..30dc2b64a82a0d0b903e147f7d9fa59d8376cdfd 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDBoxBase.cpp +++ b/Code/Mantid/Framework/DataObjects/src/MDBoxBase.cpp @@ -1,5 +1,5 @@ -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/MDEvent.h" +#include "MantidDataObjects/MDBoxBase.h" +#include "MantidDataObjects/MDEvent.h" #include "MantidKernel/System.h" #include "MantidKernel/VMD.h" #include <limits> @@ -8,7 +8,7 @@ using NeXus::File; namespace Mantid { -namespace MDEvents { +namespace DataObjects { //----------------------------------------------------------------------------------------------- /** Default constructor. @@ -286,4 +286,4 @@ TMDE(size_t MDBoxBase)::addEventsUnsafe(const std::vector<MDE> &events) { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDEvents/src/MDBoxFlatTree.cpp b/Code/Mantid/Framework/DataObjects/src/MDBoxFlatTree.cpp similarity index 99% rename from Code/Mantid/Framework/MDEvents/src/MDBoxFlatTree.cpp rename to Code/Mantid/Framework/DataObjects/src/MDBoxFlatTree.cpp index 52782b30ed61049b7cad6ee81995d96a16a956ae..152bc6ff62fe6a306bf270bc4ac68501f13eccfe 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDBoxFlatTree.cpp +++ b/Code/Mantid/Framework/DataObjects/src/MDBoxFlatTree.cpp @@ -1,10 +1,10 @@ #include "MantidKernel/Strings.h" -#include "MantidMDEvents/MDBoxFlatTree.h" -#include "MantidMDEvents/MDEvent.h" -#include "MantidMDEvents/MDLeanEvent.h" +#include "MantidDataObjects/MDBoxFlatTree.h" +#include "MantidDataObjects/MDEvent.h" +#include "MantidDataObjects/MDLeanEvent.h" #include "MantidAPI/BoxController.h" #include "MantidAPI/FileBackedExperimentInfo.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include <Poco/File.h> #if defined(__GLIBCXX__) && __GLIBCXX__ >= 20100121 // libstdc++-4.4.3 @@ -14,7 +14,7 @@ typedef std::auto_ptr< ::NeXus::File> file_holder_type; #endif namespace Mantid { -namespace MDEvents { +namespace DataObjects { namespace { /// static logger Kernel::Logger g_log("MDBoxFlatTree"); diff --git a/Code/Mantid/Framework/MDEvents/src/MDBoxIterator.cpp b/Code/Mantid/Framework/DataObjects/src/MDBoxIterator.cpp similarity index 98% rename from Code/Mantid/Framework/MDEvents/src/MDBoxIterator.cpp rename to Code/Mantid/Framework/DataObjects/src/MDBoxIterator.cpp index 5f359050673580f4d81cb57b00ca3df416235d95..e475db612dec99b96b1b997ecda001addaf4ce51 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDBoxIterator.cpp +++ b/Code/Mantid/Framework/DataObjects/src/MDBoxIterator.cpp @@ -1,14 +1,14 @@ #include "MantidGeometry/MDGeometry/MDImplicitFunction.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/MDBoxIterator.h" +#include "MantidDataObjects/MDBoxBase.h" +#include "MantidDataObjects/MDBoxIterator.h" using namespace Mantid; using namespace Mantid::API; using namespace Mantid::Geometry; namespace Mantid { -namespace MDEvents { +namespace DataObjects { //---------------------------------------------------------------------------------------------- /** Constructor @@ -349,4 +349,4 @@ TMDE(bool MDBoxIterator)::isWithinBounds(size_t) const { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDEvents/src/MDBoxSaveable.cpp b/Code/Mantid/Framework/DataObjects/src/MDBoxSaveable.cpp similarity index 92% rename from Code/Mantid/Framework/MDEvents/src/MDBoxSaveable.cpp rename to Code/Mantid/Framework/DataObjects/src/MDBoxSaveable.cpp index 2beecb642de48775543ba45273ed80df75f62c82..79a220bc12c46d47bd4d890a35b95efffac36ef7 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDBoxSaveable.cpp +++ b/Code/Mantid/Framework/DataObjects/src/MDBoxSaveable.cpp @@ -1,8 +1,8 @@ -#include "MantidMDEvents/MDBoxSaveable.h" -#include "MantidMDEvents/MDBox.h" +#include "MantidDataObjects/MDBoxSaveable.h" +#include "MantidDataObjects/MDBox.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { MDBoxSaveable::MDBoxSaveable(API::IMDNode *const Host) : m_MDNode(Host) {} diff --git a/Code/Mantid/Framework/MDEvents/src/MDEventFactory.cpp b/Code/Mantid/Framework/DataObjects/src/MDEventFactory.cpp similarity index 97% rename from Code/Mantid/Framework/MDEvents/src/MDEventFactory.cpp rename to Code/Mantid/Framework/DataObjects/src/MDEventFactory.cpp index 4f59f97fb8b849e9afa9a151849480e34975220d..4cc5c83b6bbf460929e880e0038e3dc6d1956952 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDEventFactory.cpp +++ b/Code/Mantid/Framework/DataObjects/src/MDEventFactory.cpp @@ -1,16 +1,16 @@ #include <boost/shared_ptr.hpp> -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDGridBox.h" -#include "MantidMDEvents/MDBin.h" -#include "MantidMDEvents/MDBoxIterator.h" -#include "MantidMDEvents/MDEvent.h" -#include "MantidMDEvents/MDLeanEvent.h" +#include "MantidDataObjects/MDBoxBase.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDGridBox.h" +#include "MantidDataObjects/MDBin.h" +#include "MantidDataObjects/MDBoxIterator.h" +#include "MantidDataObjects/MDEvent.h" +#include "MantidDataObjects/MDLeanEvent.h" // We need to include the .cpp files so that the declarations are picked up // correctly. Weird, I know. @@ -23,7 +23,7 @@ #include "MDBoxIterator.cpp" namespace Mantid { -namespace MDEvents { +namespace DataObjects { //### BEGIN AUTO-GENERATED CODE //################################################################# /* Code below Auto-generated by 'generate_mdevent_declarations.py' @@ -417,4 +417,4 @@ public: LOOP<MDEventFactory::MAX_MD_DIMENSIONS_NUM> MDEventFactory::CODE_GENERATOR; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDEvents/src/MDEventWorkspace.cpp b/Code/Mantid/Framework/DataObjects/src/MDEventWorkspace.cpp similarity index 98% rename from Code/Mantid/Framework/MDEvents/src/MDEventWorkspace.cpp rename to Code/Mantid/Framework/DataObjects/src/MDEventWorkspace.cpp index 03e4c2b0d716a5455ab7e7a8de3c619dec258041..4d80b6e407ec97bacaa1443a3fa7fa108d3669c2 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDEventWorkspace.cpp +++ b/Code/Mantid/Framework/DataObjects/src/MDEventWorkspace.cpp @@ -9,15 +9,15 @@ #include "MantidKernel/ThreadScheduler.h" #include "MantidKernel/Timer.h" #include "MantidKernel/Utils.h" -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDGridBox.h" -#include "MantidMDEvents/MDLeanEvent.h" +#include "MantidDataObjects/MDBoxBase.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDGridBox.h" +#include "MantidDataObjects/MDLeanEvent.h" #include <iomanip> #include <functional> #include <algorithm> -#include "MantidMDEvents/MDBoxIterator.h" +#include "MantidDataObjects/MDBoxIterator.h" #include "MantidKernel/Memory.h" #include "MantidKernel/Exception.h" @@ -28,7 +28,7 @@ using namespace Mantid::Geometry; using namespace Mantid::DataObjects; namespace Mantid { -namespace MDEvents { +namespace DataObjects { //----------------------------------------------------------------------------------------------- /** Default constructor @@ -798,6 +798,6 @@ TMDE(void MDEventWorkspace)::setCoordinateSystem( m_coordSystem = coordSystem; } -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/src/MDGridBox.cpp b/Code/Mantid/Framework/DataObjects/src/MDGridBox.cpp similarity index 99% rename from Code/Mantid/Framework/MDEvents/src/MDGridBox.cpp rename to Code/Mantid/Framework/DataObjects/src/MDGridBox.cpp index 9cc188e4e96a4d47aff6ca0e551b911850e798a3..23d4223f503939e8c7876a1fe6b36b6c376b5153 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDGridBox.cpp +++ b/Code/Mantid/Framework/DataObjects/src/MDGridBox.cpp @@ -6,9 +6,9 @@ #include "MantidKernel/ThreadScheduler.h" #include "MantidKernel/ThreadSchedulerMutexes.h" #include "MantidKernel/WarningSuppressions.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDEvent.h" -#include "MantidMDEvents/MDGridBox.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDEvent.h" +#include "MantidDataObjects/MDGridBox.h" #include <boost/math/special_functions/round.hpp> #include <ostream> #include "MantidKernel/Strings.h" @@ -26,7 +26,7 @@ using namespace Mantid::API; #endif namespace Mantid { -namespace MDEvents { +namespace DataObjects { ////=============================================================================================== ////=============================================================================================== @@ -1733,6 +1733,6 @@ TMDE(void MDGridBox)::clearFileBacked(bool loadDiskBackedData) { (*it)->clearFileBacked(loadDiskBackedData); } } -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/src/MDHistoWorkspace.cpp b/Code/Mantid/Framework/DataObjects/src/MDHistoWorkspace.cpp similarity index 99% rename from Code/Mantid/Framework/MDEvents/src/MDHistoWorkspace.cpp rename to Code/Mantid/Framework/DataObjects/src/MDHistoWorkspace.cpp index f83adb37808c86556b6a5e530893a941e3dc5878..2ab9a0911192b3b58416bc817ca3cd2979f69d75 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDHistoWorkspace.cpp +++ b/Code/Mantid/Framework/DataObjects/src/MDHistoWorkspace.cpp @@ -3,8 +3,8 @@ #include "MantidKernel/System.h" #include "MantidKernel/Utils.h" #include "MantidKernel/VMD.h" -#include "MantidMDEvents/MDHistoWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspaceIterator.h" +#include "MantidDataObjects/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspaceIterator.h" #include "MantidGeometry/MDGeometry/MDHistoDimension.h" #include "MantidGeometry/MDGeometry/MDDimensionExtents.h" #include <map> @@ -18,7 +18,7 @@ using namespace Mantid::Geometry; using namespace Mantid::API; namespace Mantid { -namespace MDEvents { +namespace DataObjects { //---------------------------------------------------------------------------------------------- /** Constructor given the 4 dimensions * @param dimX :: X dimension binning parameters @@ -1219,4 +1219,4 @@ boost::shared_ptr<IMDHistoWorkspace> MDHistoWorkspace::clone() const { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDEvents/src/MDHistoWorkspaceIterator.cpp b/Code/Mantid/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp similarity index 99% rename from Code/Mantid/Framework/MDEvents/src/MDHistoWorkspaceIterator.cpp rename to Code/Mantid/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp index 1af9c29df95e36340f000759fe4e2e5fdbb056cf..0213d77f9be76d9fd52887e0033a19ad5d34d5ed 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDHistoWorkspaceIterator.cpp +++ b/Code/Mantid/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp @@ -1,4 +1,4 @@ -#include "MantidMDEvents/MDHistoWorkspaceIterator.h" +#include "MantidDataObjects/MDHistoWorkspaceIterator.h" #include "MantidKernel/System.h" #include "MantidKernel/VMD.h" #include "MantidKernel/Utils.h" @@ -9,7 +9,7 @@ using namespace Mantid::API; using Mantid::Geometry::IMDDimension_const_sptr; namespace Mantid { -namespace MDEvents { +namespace DataObjects { namespace { size_t integerPower(const size_t base, const size_t pow) { size_t result = 1; @@ -473,4 +473,4 @@ bool MDHistoWorkspaceIterator::isWithinBounds(size_t index) const { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/DataObjects/src/MDLeanEvent.cpp b/Code/Mantid/Framework/DataObjects/src/MDLeanEvent.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c3cfaf97571c1c6d51d8562b4c46deef232c0d9d --- /dev/null +++ b/Code/Mantid/Framework/DataObjects/src/MDLeanEvent.cpp @@ -0,0 +1,6 @@ +#include "MantidDataObjects/MDLeanEvent.h" +#include "MantidKernel/System.h" + +namespace Mantid { +namespace DataObjects {} // namespace Mantid +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDEvents/src/generate_mdevent_declarations.py b/Code/Mantid/Framework/DataObjects/src/generate_mdevent_declarations.py similarity index 98% rename from Code/Mantid/Framework/MDEvents/src/generate_mdevent_declarations.py rename to Code/Mantid/Framework/DataObjects/src/generate_mdevent_declarations.py index cd091712a875d9c433a435abeb2c9bec4a18b0d1..4f0eede0b83b6d230df866556c395d2d76b0de99 100644 --- a/Code/Mantid/Framework/MDEvents/src/generate_mdevent_declarations.py +++ b/Code/Mantid/Framework/DataObjects/src/generate_mdevent_declarations.py @@ -159,7 +159,7 @@ def generate(): # All of the classes to instantiate classes = classes_cpp + mdevent_types - padding,lines,lines_after=parse_file("../inc/MantidMDEvents/MDEventFactory.h", + padding,lines,lines_after=parse_file("../inc/MantidDataObjects/MDEventFactory.h", "//### BEGIN AUTO-GENERATED CODE ###", "//### END AUTO-GENERATED CODE ###"); @@ -203,7 +203,7 @@ def generate(): lines += footer_lines + lines_after - f = open("../inc/MantidMDEvents/MDEventFactory.h", 'w') + f = open("../inc/MantidDataObjects/MDEventFactory.h", 'w') for line in lines: f.write(line + "\n") f.close() diff --git a/Code/Mantid/Framework/MDEvents/test/AffineMatrixParameterParserTest.h b/Code/Mantid/Framework/DataObjects/test/AffineMatrixParameterParserTest.h similarity index 97% rename from Code/Mantid/Framework/MDEvents/test/AffineMatrixParameterParserTest.h rename to Code/Mantid/Framework/DataObjects/test/AffineMatrixParameterParserTest.h index 1ca549ae4a9c1442911f9c7c2b68a820ce1d9064..861befc132336127edd68d6c1b71bf1d7d30d35f 100644 --- a/Code/Mantid/Framework/MDEvents/test/AffineMatrixParameterParserTest.h +++ b/Code/Mantid/Framework/DataObjects/test/AffineMatrixParameterParserTest.h @@ -11,9 +11,9 @@ #include <Poco/Path.h> #include <cxxtest/TestSuite.h> -#include "MantidMDEvents/AffineMatrixParameterParser.h" +#include "MantidDataObjects/AffineMatrixParameterParser.h" -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; class AffineMatrixParameterParserTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDEvents/test/AffineMatrixParameterTest.h b/Code/Mantid/Framework/DataObjects/test/AffineMatrixParameterTest.h similarity index 97% rename from Code/Mantid/Framework/MDEvents/test/AffineMatrixParameterTest.h rename to Code/Mantid/Framework/DataObjects/test/AffineMatrixParameterTest.h index 7ecc581f722bc4112f884ede49e0280d99787350..d20778a21c3c1765a8bcd8fe32dbb5d0aaceda22 100644 --- a/Code/Mantid/Framework/MDEvents/test/AffineMatrixParameterTest.h +++ b/Code/Mantid/Framework/DataObjects/test/AffineMatrixParameterTest.h @@ -2,10 +2,10 @@ #define AFFINE_MATRIX_PARAMETER_TEST_H #include <cxxtest/TestSuite.h> -#include "MantidMDEvents/AffineMatrixParameter.h" +#include "MantidDataObjects/AffineMatrixParameter.h" #include "MantidGeometry/MDGeometry/MDTypes.h" -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid; class AffineMatrixParameterTest : public CxxTest::TestSuite diff --git a/Code/Mantid/Framework/MDEvents/test/BoxControllerNeXusIOTest.h b/Code/Mantid/Framework/DataObjects/test/BoxControllerNeXusIOTest.h similarity index 73% rename from Code/Mantid/Framework/MDEvents/test/BoxControllerNeXusIOTest.h rename to Code/Mantid/Framework/DataObjects/test/BoxControllerNeXusIOTest.h index 4e514e0cc368790630ba6373b452ad85ee128a1a..767149fbb80cd5e16996b7de0fc7c8f40ac684bb 100644 --- a/Code/Mantid/Framework/MDEvents/test/BoxControllerNeXusIOTest.h +++ b/Code/Mantid/Framework/DataObjects/test/BoxControllerNeXusIOTest.h @@ -1,42 +1,40 @@ #ifndef BOXCONTROLLER_NEXUS_IO_TEST_H #define BOXCONTROLLER_NEXUS_IO_TEST_H -#include <cxxtest/TestSuite.h> +#include "MantidAPI/FileFinder.h" +#include "MantidDataObjects/BoxControllerNeXusIO.h" +#include "MantidTestHelpers/MDEventsTestHelper.h" + #include <map> #include <memory> -#include <Poco/File.h> + +#include <cxxtest/TestSuite.h> + #include <nexus/NeXusFile.hpp> -#include "MantidTestHelpers/MDEventsTestHelper.h" -#include "MantidMDEvents/BoxControllerNeXusIO.h" -#include "MantidAPI/FileFinder.h" -using namespace Mantid; -using namespace Mantid::Geometry; -using namespace Mantid::Kernel; -using namespace Mantid::API; -//using namespace Mantid::MDEvens; +#include <Poco/File.h> + class BoxControllerNeXusIOTest : public CxxTest::TestSuite { - BoxController_sptr sc; - std::string xxfFileName; - +public: - BoxControllerNeXusIOTest() - { - sc = BoxController_sptr(new BoxController(4)); - xxfFileName= "BoxCntrlNexusIOxxfFile.nxs"; - } + static BoxControllerNeXusIOTest *createSuite() { return new BoxControllerNeXusIOTest(); } + static void destroySuite(BoxControllerNeXusIOTest * suite) { delete suite; } + Mantid::API::BoxController_sptr sc; + std::string xxfFileName; -public: -static BoxControllerNeXusIOTest *createSuite() { return new BoxControllerNeXusIOTest(); } -static void destroySuite(BoxControllerNeXusIOTest * suite) { delete suite; } + BoxControllerNeXusIOTest() + { + sc = Mantid::API::BoxController_sptr(new Mantid::API::BoxController(4)); + xxfFileName= "BoxCntrlNexusIOxxfFile.nxs"; + } void setUp() { - std::string FullPathFile = API::FileFinder::Instance().getFullPath(this->xxfFileName); + std::string FullPathFile = Mantid::API::FileFinder::Instance().getFullPath(this->xxfFileName); if(!FullPathFile.empty()) Poco::File(FullPathFile).remove(); @@ -44,9 +42,10 @@ void setUp() void test_contstructor_setters() { + using Mantid::DataObjects::BoxControllerNeXusIO; - MDEvents::BoxControllerNeXusIO *pSaver(NULL); - TS_ASSERT_THROWS_NOTHING(pSaver=new MDEvents::BoxControllerNeXusIO(sc.get())); + BoxControllerNeXusIO *pSaver(NULL); + TS_ASSERT_THROWS_NOTHING(pSaver = createTestBoxController()); size_t CoordSize; std::string typeName; @@ -75,12 +74,18 @@ void setUp() void test_CreateOrOpenFile() { - MDEvents::BoxControllerNeXusIO *pSaver(NULL); - TS_ASSERT_THROWS_NOTHING(pSaver=new MDEvents::BoxControllerNeXusIO(sc.get())); + using Mantid::coord_t; + using Mantid::API::FileFinder; + using Mantid::DataObjects::BoxControllerNeXusIO; + using Mantid::Kernel::Exception::FileError; + + BoxControllerNeXusIO *pSaver(NULL); + TS_ASSERT_THROWS_NOTHING(pSaver = createTestBoxController()); pSaver->setDataType(sizeof(coord_t),"MDLeanEvent"); std::string FullPathFile; - TSM_ASSERT_THROWS("new file does not open in read mode",pSaver->openFile(this->xxfFileName,"r"), Kernel::Exception::FileError); + TSM_ASSERT_THROWS("new file does not open in read mode", + pSaver->openFile(this->xxfFileName,"r"), FileError); TS_ASSERT_THROWS_NOTHING(pSaver->openFile(this->xxfFileName,"w")); TS_ASSERT_THROWS_NOTHING(FullPathFile = pSaver->getFileName()); @@ -88,7 +93,7 @@ void setUp() TS_ASSERT_THROWS_NOTHING(pSaver->closeFile()); TS_ASSERT(!pSaver->isOpened()); - TSM_ASSERT("file created ",!API::FileFinder::Instance().getFullPath(FullPathFile).empty()); + TSM_ASSERT("file created ",!FileFinder::Instance().getFullPath(FullPathFile).empty()); // now I can open this file for reading TS_ASSERT_THROWS_NOTHING(pSaver->openFile(FullPathFile,"r")); @@ -106,13 +111,15 @@ void setUp() delete pSaver; if(Poco::File(FullPathFile).exists()) - Poco::File(FullPathFile).remove(); + Poco::File(FullPathFile).remove(); } void test_free_space_index_is_written_out_and_read_in() { - MDEvents::BoxControllerNeXusIO *pSaver(NULL); - TS_ASSERT_THROWS_NOTHING(pSaver=new MDEvents::BoxControllerNeXusIO(sc.get())); + using Mantid::DataObjects::BoxControllerNeXusIO; + + BoxControllerNeXusIO *pSaver(NULL); + TS_ASSERT_THROWS_NOTHING(pSaver = createTestBoxController()); std::string FullPathFile; TS_ASSERT_THROWS_NOTHING(pSaver->openFile(this->xxfFileName,"w")); @@ -148,7 +155,8 @@ void setUp() struct IF // if in/out formats are different we can not read different data format from it { public: - static void compareReadTheSame(API::IBoxControllerIO *pSaver,const std::vector<FROM> &/*inputData*/,size_t /*nEvents*/,size_t /*nColumns*/) + static void compareReadTheSame(Mantid::API::IBoxControllerIO *pSaver, + const std::vector<FROM> &/*inputData*/,size_t /*nEvents*/,size_t /*nColumns*/) { TS_ASSERT(pSaver->isOpened()); TS_ASSERT_THROWS_NOTHING(pSaver->closeFile()); @@ -160,7 +168,7 @@ void setUp() struct IF<FROM,FROM> // if in/out formats are the same, we can read what was written earlier { public: - static void compareReadTheSame(API::IBoxControllerIO *pSaver,const std::vector<FROM> &inputData,size_t nEvents,size_t nColumns) + static void compareReadTheSame(Mantid::API::IBoxControllerIO *pSaver,const std::vector<FROM> &inputData,size_t nEvents,size_t nColumns) { std::vector<FROM> toRead; TS_ASSERT_THROWS_NOTHING(pSaver->loadBlock(toRead,100,nEvents)); @@ -179,8 +187,10 @@ void setUp() template<typename FROM,typename TO> void WriteReadRead() { - MDEvents::BoxControllerNeXusIO *pSaver(NULL); - TS_ASSERT_THROWS_NOTHING(pSaver=new MDEvents::BoxControllerNeXusIO(sc.get())); + using Mantid::DataObjects::BoxControllerNeXusIO; + + BoxControllerNeXusIO *pSaver(NULL); + TS_ASSERT_THROWS_NOTHING(pSaver = createTestBoxController()); pSaver->setDataType(sizeof(FROM),"MDEvent"); std::string FullPathFile; @@ -237,5 +247,13 @@ void test_WriteFloatReadReadDouble() { this->WriteReadRead<float,double>(); } + +private: + /// Create a test box controller. Ownership is passed to the caller + Mantid::DataObjects::BoxControllerNeXusIO * createTestBoxController() + { + return new Mantid::DataObjects::BoxControllerNeXusIO(sc.get()); + } + }; #endif diff --git a/Code/Mantid/Framework/DataObjects/test/CMakeLists.txt b/Code/Mantid/Framework/DataObjects/test/CMakeLists.txt index c01342ab052f934a50814df5291975a0b1318fb5..d75b642dd00ebbf2fee31c11b09889f35550c3bf 100644 --- a/Code/Mantid/Framework/DataObjects/test/CMakeLists.txt +++ b/Code/Mantid/Framework/DataObjects/test/CMakeLists.txt @@ -8,7 +8,11 @@ if ( CXXTEST_FOUND ) ../../TestHelpers/src/ComponentCreationHelper.cpp ../../TestHelpers/src/WorkspaceCreationHelper.cpp ../../TestHelpers/src/NexusTestHelper.cpp - ) + ../../TestHelpers/src/MDEventsTestHelper.cpp + ../../TestHelpers/src/ScopedFileHelper.cpp + ../../TestHelpers/src/BoxControllerDummyIO.cpp + ) + cxxtest_add_test ( DataObjectsTest ${TEST_FILES} ) target_link_libraries( DataObjectsTest DataObjects ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES}) # Specify implicit dependency, but don't link to it diff --git a/Code/Mantid/Framework/MDEvents/test/CoordTransformAffineParserTest.h b/Code/Mantid/Framework/DataObjects/test/CoordTransformAffineParserTest.h similarity index 93% rename from Code/Mantid/Framework/MDEvents/test/CoordTransformAffineParserTest.h rename to Code/Mantid/Framework/DataObjects/test/CoordTransformAffineParserTest.h index 37a731f5705f844ede1dddb932494375fb1d892c..bff89b3216eff7da6ef86eefd6c9937be2ece9c7 100644 --- a/Code/Mantid/Framework/MDEvents/test/CoordTransformAffineParserTest.h +++ b/Code/Mantid/Framework/DataObjects/test/CoordTransformAffineParserTest.h @@ -1,7 +1,7 @@ -#ifndef MANTID_MDEVENTS_COORDTRANSFORMPARSERTEST_H_ -#define MANTID_MDEVENTS_COORDTRANSFORMPARSERTEST_H_ +#ifndef MANTID_DATAOBJECTS_COORDTRANSFORMPARSERTEST_H_ +#define MANTID_DATAOBJECTS_COORDTRANSFORMPARSERTEST_H_ -#include "MantidMDEvents/CoordTransformAffineParser.h" +#include "MantidDataObjects/CoordTransformAffineParser.h" #include "MantidAPI/CoordTransform.h" #include <cxxtest/TestSuite.h> @@ -13,9 +13,9 @@ #include <Poco/DOM/NodeFilter.h> #include <Poco/File.h> #include <Poco/Path.h> -#include "MantidMDEvents/CoordTransformAffine.h" +#include "MantidDataObjects/CoordTransformAffine.h" -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; class CoordTransformAffineParserTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDEvents/test/CoordTransformAffineTest.h b/Code/Mantid/Framework/DataObjects/test/CoordTransformAffineTest.h similarity index 97% rename from Code/Mantid/Framework/MDEvents/test/CoordTransformAffineTest.h rename to Code/Mantid/Framework/DataObjects/test/CoordTransformAffineTest.h index 76d6a7b591b24dabc85c779e87c4b7fea4e00a9a..3616f51a39bbc614fee263ab2930158a412232d7 100644 --- a/Code/Mantid/Framework/MDEvents/test/CoordTransformAffineTest.h +++ b/Code/Mantid/Framework/DataObjects/test/CoordTransformAffineTest.h @@ -1,22 +1,22 @@ -#ifndef MANTID_MDEVENTS_COORDTRANSFORMAFFINETEST_H_ -#define MANTID_MDEVENTS_COORDTRANSFORMAFFINETEST_H_ +#ifndef MANTID_DATAOBJECTS_COORDTRANSFORMAFFINETEST_H_ +#define MANTID_DATAOBJECTS_COORDTRANSFORMAFFINETEST_H_ #include "MantidAPI/CoordTransform.h" #include "MantidKernel/Quat.h" #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include "MantidKernel/VMD.h" -#include "MantidMDEvents/CoordTransformAffine.h" -#include "MantidMDEvents/CoordTransformAligned.h" -#include "MantidMDEvents/CoordTransformDistance.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/CoordTransformAffine.h" +#include "MantidDataObjects/CoordTransformAligned.h" +#include "MantidDataObjects/CoordTransformDistance.h" +#include "MantidDataObjects/MDEventFactory.h" #include <cxxtest/TestSuite.h> #include <iomanip> #include <iostream> using namespace Mantid; using namespace Mantid::Kernel; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using Mantid::API::CoordTransform; class CoordTransformAffineTest : public CxxTest::TestSuite @@ -433,5 +433,5 @@ public: -#endif /* MANTID_MDEVENTS_COORDTRANSFORMAFFINETEST_H_ */ +#endif /* MANTID_DATAOBJECTS_COORDTRANSFORMAFFINETEST_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/test/CoordTransformAlignedTest.h b/Code/Mantid/Framework/DataObjects/test/CoordTransformAlignedTest.h similarity index 94% rename from Code/Mantid/Framework/MDEvents/test/CoordTransformAlignedTest.h rename to Code/Mantid/Framework/DataObjects/test/CoordTransformAlignedTest.h index 620c34fb9af014beec92687caee4de316d1c3cd7..7585b31134d9dc4e1145dd6daa924913cacf3522 100644 --- a/Code/Mantid/Framework/MDEvents/test/CoordTransformAlignedTest.h +++ b/Code/Mantid/Framework/DataObjects/test/CoordTransformAlignedTest.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_COORDTRANSFORMALIGNEDTEST_H_ -#define MANTID_MDEVENTS_COORDTRANSFORMALIGNEDTEST_H_ +#ifndef MANTID_DATAOBJECTS_COORDTRANSFORMALIGNEDTEST_H_ +#define MANTID_DATAOBJECTS_COORDTRANSFORMALIGNEDTEST_H_ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" @@ -7,12 +7,12 @@ #include <iostream> #include <iomanip> -#include "MantidMDEvents/CoordTransformAligned.h" +#include "MantidDataObjects/CoordTransformAligned.h" #include "MantidKernel/Matrix.h" -#include "MantidMDEvents/CoordTransformAffine.h" +#include "MantidDataObjects/CoordTransformAffine.h" using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::API; using namespace Mantid::Kernel; @@ -183,5 +183,5 @@ public: } }; -#endif /* MANTID_MDEVENTS_COORDTRANSFORMALIGNEDTEST_H_ */ +#endif /* MANTID_DATAOBJECTS_COORDTRANSFORMALIGNEDTEST_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/test/CoordTransformDistanceParserTest.h b/Code/Mantid/Framework/DataObjects/test/CoordTransformDistanceParserTest.h similarity index 91% rename from Code/Mantid/Framework/MDEvents/test/CoordTransformDistanceParserTest.h rename to Code/Mantid/Framework/DataObjects/test/CoordTransformDistanceParserTest.h index f296e430adaedeb487d6759aa38d92e91abe975d..4bf442c0f9d5f88f2492a8bd8154a37cc72e8df8 100644 --- a/Code/Mantid/Framework/MDEvents/test/CoordTransformDistanceParserTest.h +++ b/Code/Mantid/Framework/DataObjects/test/CoordTransformDistanceParserTest.h @@ -1,8 +1,8 @@ -#ifndef MANTID_MDEVENTS_COORDTRANSFORMDISTANCEPARSERTEST_H_ -#define MANTID_MDEVENTS_COORDTRANSFORMDISTANCEPARSERTEST_H_ +#ifndef MANTID_DATAOBJECTS_COORDTRANSFORMDISTANCEPARSERTEST_H_ +#define MANTID_DATAOBJECTS_COORDTRANSFORMDISTANCEPARSERTEST_H_ -#include "MantidMDEvents/CoordTransformDistanceParser.h" -#include "MantidMDEvents/CoordTransformDistance.h" +#include "MantidDataObjects/CoordTransformDistanceParser.h" +#include "MantidDataObjects/CoordTransformDistance.h" #include <cxxtest/TestSuite.h> #include <Poco/DOM/DOMParser.h> @@ -13,9 +13,9 @@ #include <Poco/DOM/NodeFilter.h> #include <Poco/File.h> #include <Poco/Path.h> -#include "MantidMDEvents/CoordTransformAffine.h" +#include "MantidDataObjects/CoordTransformAffine.h" -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; class CoordTransformDistanceParserTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDEvents/test/CoordTransformDistanceTest.h b/Code/Mantid/Framework/DataObjects/test/CoordTransformDistanceTest.h similarity index 94% rename from Code/Mantid/Framework/MDEvents/test/CoordTransformDistanceTest.h rename to Code/Mantid/Framework/DataObjects/test/CoordTransformDistanceTest.h index f6d805ecf87566b6e06ee491faaaf83a78e5b7aa..d014723917d32c71f2f614a80360dd27fad509ca 100644 --- a/Code/Mantid/Framework/MDEvents/test/CoordTransformDistanceTest.h +++ b/Code/Mantid/Framework/DataObjects/test/CoordTransformDistanceTest.h @@ -1,16 +1,16 @@ -#ifndef MANTID_MDEVENTS_COORDTRANSFORMDISTANCETEST_H_ -#define MANTID_MDEVENTS_COORDTRANSFORMDISTANCETEST_H_ +#ifndef MANTID_DATAOBJECTS_COORDTRANSFORMDISTANCETEST_H_ +#define MANTID_DATAOBJECTS_COORDTRANSFORMDISTANCETEST_H_ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" -#include "MantidMDEvents/CoordTransformDistance.h" +#include "MantidDataObjects/CoordTransformDistance.h" #include <cxxtest/TestSuite.h> #include <iomanip> #include <iostream> #include "MantidAPI/CoordTransform.h" using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using Mantid::API::CoordTransform; class CoordTransformDistanceTest : public CxxTest::TestSuite @@ -170,5 +170,5 @@ public: }; -#endif /* MANTID_MDEVENTS_COORDTRANSFORMDISTANCETEST_H_ */ +#endif /* MANTID_DATAOBJECTS_COORDTRANSFORMDISTANCETEST_H_ */ diff --git a/Code/Mantid/Framework/DataObjects/test/FakeMDTest.h b/Code/Mantid/Framework/DataObjects/test/FakeMDTest.h new file mode 100644 index 0000000000000000000000000000000000000000..c5dee6e0e8a9296635ac87804da31d3570bc9d8b --- /dev/null +++ b/Code/Mantid/Framework/DataObjects/test/FakeMDTest.h @@ -0,0 +1,162 @@ +#ifndef MANTID_DATAOBJECTS_FAKEMDTEST_H_ +#define MANTID_DATAOBJECTS_FAKEMDTEST_H_ + +#include <vector> + +#include "MantidDataObjects/FakeMD.h" + +#include "MantidTestHelpers/ComponentCreationHelper.h" +#include "MantidTestHelpers/MDEventsTestHelper.h" + +#include <boost/assign/list_of.hpp> +#include <cxxtest/TestSuite.h> + +class FakeMDTest : 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 FakeMDTest *createSuite() { return new FakeMDTest(); } + static void destroySuite(FakeMDTest *suite) { delete suite; } + + //--------------------------------------------------------------------------- + // Failure cases + //--------------------------------------------------------------------------- + void test_empty_peak_and_uniform_params_throws_exception() { + using Mantid::DataObjects::FakeMD; + + const std::vector<double> peakParams; + const std::vector<double> uniformParams; + const int randomSeed(0); + const bool randomizeSignal(false); + + TS_ASSERT_THROWS( + FakeMD(uniformParams, peakParams, randomSeed, randomizeSignal), + std::invalid_argument); + } + + //--------------------------------------------------------------------------- + // Success cases + //--------------------------------------------------------------------------- + + void test_no_randomize() { + using Mantid::DataObjects::FakeMD; + using Mantid::DataObjects::MDEventsTestHelper::makeMDEW; + using namespace boost::assign; + + // Destination workspace + auto fakeData = makeMDEW<3>(10, 0.0, 10.0, 1); + // 1000 boxes with 1 event each + TS_ASSERT_EQUALS(fakeData->getNPoints(), 1000); + + const std::vector<double> peakParams = list_of(1000.0)(5.0)(5.0)(5.0)(1.0); + const std::vector<double> uniformParams = list_of(10000.0); + const int randomSeed(0); + const bool randomizeSignal(false); + + FakeMD faker(uniformParams, peakParams, randomSeed, randomizeSignal); + faker.fill(fakeData); + // Now there are 11000 more points. + TS_ASSERT_EQUALS(fakeData->getNPoints(), 12000); + } + + void test_exec_randomizeSignal() { + using Mantid::DataObjects::FakeMD; + using Mantid::DataObjects::MDEventsTestHelper::makeMDEW; + using namespace boost::assign; + + auto fakeData = makeMDEW<3>(10, 0.0, 10.0, 0); + TS_ASSERT_EQUALS(fakeData->getNPoints(), 0); + TS_ASSERT_DELTA(fakeData->getBox()->getSignal(), 0.0, 1e-5); + + const std::vector<double> peakParams = list_of(100.0)(5.0)(5.0)(5.0)(1.0); + const std::vector<double> uniformParams = list_of(100.0); + const int randomSeed(0); + const bool randomizeSignal(true); + + FakeMD faker(uniformParams, peakParams, randomSeed, randomizeSignal); + faker.fill(fakeData); + + // Now there are 200 more points. + TS_ASSERT_EQUALS(fakeData->getNPoints(), 200); + // 200 +- 100 signal + TS_ASSERT_DELTA(fakeData->getBox()->getSignal(), 200.0, 100); + TS_ASSERT_DELTA(fakeData->getBox()->getErrorSquared(), 200.0, 100); + // But not exactly 200 + TS_ASSERT_DIFFERS(fakeData->getBox()->getSignal(), 200.0); + TS_ASSERT_DIFFERS(fakeData->getBox()->getErrorSquared(), 200.0); + + TSM_ASSERT("If the workspace is file-backed, then it needs updating.", + fakeData->fileNeedsUpdating()); + } + + void testExecRegularSignal() { + using Mantid::DataObjects::FakeMD; + using Mantid::DataObjects::MDEventsTestHelper::makeMDEW; + using namespace boost::assign; + + auto fakeData = makeMDEW<3>(10, 0.0, 10.0, 0); + + // No events + TS_ASSERT_EQUALS(fakeData->getNPoints(), 0); + TS_ASSERT_DELTA(fakeData->getBox()->getSignal(), 0.0, 1e-5); + + const std::vector<double> peakParams; + const std::vector<double> uniformParams = list_of(-1000.0); + const int randomSeed(0); + const bool randomizeSignal(false); + + FakeMD faker(uniformParams, peakParams, randomSeed, randomizeSignal); + faker.fill(fakeData); + + // Now there are 1000 more points. + TS_ASSERT_EQUALS(fakeData->getNPoints(), 1000); + TS_ASSERT_DELTA(fakeData->getBox()->getSignal(), 1000.0, 1.e-6); + TS_ASSERT_DELTA(fakeData->getBox()->getErrorSquared(), 1000.0, 1.e-6); + + TSM_ASSERT("If the workspace is file-backed, then it needs updating.", + fakeData->fileNeedsUpdating()); + } + + void test_Creating_Full_MDEvents_Adds_DetectorIDs_To_Workspace() { + using Mantid::DataObjects::FakeMD; + using Mantid::DataObjects::MDEvent; + using Mantid::DataObjects::MDEventsTestHelper::makeAnyMDEW; + using Mantid::Kernel::PropertyWithValue; + using namespace boost::assign; + + auto fakeData = makeAnyMDEW<MDEvent<3>, 3>(10, 0.0, 10.0, 0); + // Give it an instrument + auto inst = ComponentCreationHelper::createTestInstrumentRectangular2(1, 16); + auto ei = fakeData->getExperimentInfo(0); + ei->setInstrument(inst); + // Give it a run number + ei->mutableRun().addProperty( + new PropertyWithValue<std::string>("run_number", "12345"), true); + + + const std::vector<double> peakParams; + const std::vector<double> uniformParams = list_of(-1000.0); + const int randomSeed(0); + const bool randomizeSignal(false); + + FakeMD faker(uniformParams, peakParams, randomSeed, randomizeSignal); + faker.fill(fakeData); + + TS_ASSERT_EQUALS(1000, fakeData->getNEvents()); + + Mantid::detid_t expectedIDs[10] = {106, 255, 184, 238, 0, + 32, 77, 255, 37, 60}; + auto it = fakeData->createIterator(); + size_t counter(0); + while (counter < 10) { + int32_t id = it->getInnerDetectorID(0); + TS_ASSERT_EQUALS(expectedIDs[counter], id); + it->next(); + ++counter; + } + + delete it; + } +}; + +#endif /* MANTID_DATAOBJECTS_FakeMD_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/test/MDBinTest.h b/Code/Mantid/Framework/DataObjects/test/MDBinTest.h similarity index 67% rename from Code/Mantid/Framework/MDEvents/test/MDBinTest.h rename to Code/Mantid/Framework/DataObjects/test/MDBinTest.h index 465e89db1c044cbc8dd6b2bc4fb06fe1adcf26c1..56d1addae74ba6b7040f9af43e6073f9f51a2b72 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDBinTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDBinTest.h @@ -1,16 +1,16 @@ -#ifndef MANTID_MDEVENTS_MDBINTEST_H_ -#define MANTID_MDEVENTS_MDBINTEST_H_ +#ifndef MANTID_DATAOBJECTS_MDBINTEST_H_ +#define MANTID_DATAOBJECTS_MDBINTEST_H_ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" -#include "MantidMDEvents/MDBin.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDBin.h" +#include "MantidDataObjects/MDEventFactory.h" #include <cxxtest/TestSuite.h> #include <iomanip> #include <iostream> using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; class MDBinTest : public CxxTest::TestSuite { @@ -31,5 +31,5 @@ public: }; -#endif /* MANTID_MDEVENTS_MDBINTEST_H_ */ +#endif /* MANTID_DATAOBJECTS_MDBINTEST_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/test/MDBoxBaseTest.h b/Code/Mantid/Framework/DataObjects/test/MDBoxBaseTest.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/test/MDBoxBaseTest.h rename to Code/Mantid/Framework/DataObjects/test/MDBoxBaseTest.h index 44733b33da4bba3eca1f3ad9cf477e91f12309f8..6f6125c1ec44a3f6c7dae5828af0bea457ca891b 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDBoxBaseTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDBoxBaseTest.h @@ -1,11 +1,11 @@ -#ifndef MANTID_MDEVENTS_MDBOXBASETEST_H_ -#define MANTID_MDEVENTS_MDBOXBASETEST_H_ +#ifndef MANTID_DATAOBJECTS_MDBOXBASETEST_H_ +#define MANTID_DATAOBJECTS_MDBOXBASETEST_H_ #include "MantidGeometry/MDGeometry/MDDimensionExtents.h" #include "MantidKernel/ConfigService.h" #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" -#include "MantidMDEvents/MDBoxBase.h" +#include "MantidDataObjects/MDBoxBase.h" #include <cxxtest/TestSuite.h> #include <iomanip> #include <iostream> @@ -13,7 +13,7 @@ #include "MantidAPI/CoordTransform.h" using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using Mantid::Kernel::ConfigService; /** Tester class that implements the minimum MDBoxBase to @@ -541,5 +541,5 @@ public: }; -#endif /* MANTID_MDEVENTS_MDBOXBASETEST_H_ */ +#endif /* MANTID_DATAOBJECTS_MDBOXBASETEST_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/test/MDBoxFlatTreeTest.h b/Code/Mantid/Framework/DataObjects/test/MDBoxFlatTreeTest.h similarity index 76% rename from Code/Mantid/Framework/MDEvents/test/MDBoxFlatTreeTest.h rename to Code/Mantid/Framework/DataObjects/test/MDBoxFlatTreeTest.h index d83d2c4a046023890ef83b639986853be911b5ed..4bdcfbc47339c9365c8b0cbb4e9ea3651e5b091a 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDBoxFlatTreeTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDBoxFlatTreeTest.h @@ -1,17 +1,15 @@ -#ifndef MANTID_MDEVENTS_MDBOX_FLATTREE_H_ -#define MANTID_MDEVENTS_MDBOX_FLATTREE_H_ +#ifndef MANTID_DATAOBJECTS_MDBOX_FLATTREE_H_ +#define MANTID_DATAOBJECTS_MDBOX_FLATTREE_H_ -#include "MantidAPI/FrameworkManager.h" -#include "MantidMDEvents/MDBoxFlatTree.h" +#include "MantidDataObjects/MDBoxFlatTree.h" #include "MantidTestHelpers/MDEventsTestHelper.h" -#include "MantidMDEvents/MDLeanEvent.h" -#include "MantidAPI/BoxController.h" +#include "MantidDataObjects/MDLeanEvent.h" +#include <boost/make_shared.hpp> #include <cxxtest/TestSuite.h> #include <Poco/File.h> -using namespace Mantid; -using namespace Mantid::MDEvents; +using Mantid::DataObjects::MDBoxFlatTree; class MDBoxFlatTreeTest :public CxxTest::TestSuite { @@ -23,10 +21,9 @@ public: MDBoxFlatTreeTest() { - // load dependent DLL, which are used in MDEventsTestHelper (e.g. MDAlgorithms to create MD workspace) - // Mantid::API::FrameworkManager::Instance(); + using Mantid::DataObjects::MDEventsTestHelper::makeFakeMDEventWorkspace; // make non-file backet mdEv workspace with 10000 events - spEw3 = MDEventsTestHelper::makeFileBackedMDEW("TestLeanEvWS", false,10000); + spEw3 = makeFakeMDEventWorkspace("TestLeanEvWS", 10000); } void testFlatTreeOperations() @@ -57,18 +54,18 @@ public: TS_ASSERT_THROWS_NOTHING(BoxStoredTree.loadBoxStructure("someFile.nxs",nDims,"MDLeanEvent")); size_t nDim = size_t(BoxStoredTree.getNDims()); - API::BoxController_sptr new_bc = boost::shared_ptr<API::BoxController>(new API::BoxController(nDim)); + auto new_bc = boost::make_shared<Mantid::API::BoxController>(nDim); new_bc->fromXMLString(BoxStoredTree.getBCXMLdescr()); TSM_ASSERT("Should restore the box controller equal to the one before saving ",*(spEw3->getBoxController())==*(new_bc)); - std::vector<API::IMDNode *>Boxes; + std::vector<Mantid::API::IMDNode *>Boxes; TS_ASSERT_THROWS_NOTHING(BoxStoredTree.restoreBoxTree(Boxes ,new_bc, false,false)); - std::vector<API::IMDNode *>OldBoxes; + std::vector<Mantid::API::IMDNode *>OldBoxes; TS_ASSERT_THROWS_NOTHING(spEw3->getBoxes(OldBoxes, 1000, false)); // just in case, should be already sorted - API::IMDNode::sortObjByID(OldBoxes); + Mantid::API::IMDNode::sortObjByID(OldBoxes); for(size_t i=0;i<OldBoxes.size();i++) { @@ -93,4 +90,4 @@ private: }; -#endif \ No newline at end of file +#endif diff --git a/Code/Mantid/Framework/MDEvents/test/MDBoxIteratorTest.h b/Code/Mantid/Framework/DataObjects/test/MDBoxIteratorTest.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/test/MDBoxIteratorTest.h rename to Code/Mantid/Framework/DataObjects/test/MDBoxIteratorTest.h index 7de1ebe404ee35768e89a87b405098d0fc28d8ba..813299daa61593297fe750fb084e95521653adb5 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDBoxIteratorTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDBoxIteratorTest.h @@ -1,22 +1,22 @@ -#ifndef MANTID_MDEVENTS_MDBOXITERATORTEST_H_ -#define MANTID_MDEVENTS_MDBOXITERATORTEST_H_ +#ifndef MANTID_DATAOBJECTS_MDBOXITERATORTEST_H_ +#define MANTID_DATAOBJECTS_MDBOXITERATORTEST_H_ #include "MantidGeometry/MDGeometry/MDBoxImplicitFunction.h" #include "MantidGeometry/MDGeometry/MDImplicitFunction.h" #include "MantidGeometry/MDGeometry/MDPlane.h" #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" -#include "MantidMDEvents/MDBoxIterator.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDGridBox.h" -#include "MantidMDEvents/MDBox.h" +#include "MantidDataObjects/MDBoxIterator.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDGridBox.h" +#include "MantidDataObjects/MDBox.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include <cxxtest/TestSuite.h> #include <iomanip> #include <iostream> #include <gmock/gmock.h> -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::API; using namespace Mantid; using namespace Mantid::Kernel; @@ -757,5 +757,5 @@ public: }; -#endif /* MANTID_MDEVENTS_MDBOXITERATORTEST_H_ */ +#endif /* MANTID_DATAOBJECTS_MDBOXITERATORTEST_H_ */ #undef RUN_CXX_PERFORMANCE_TEST_EMBEDDED diff --git a/Code/Mantid/Framework/MDEvents/test/MDBoxSaveableTest.h b/Code/Mantid/Framework/DataObjects/test/MDBoxSaveableTest.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/test/MDBoxSaveableTest.h rename to Code/Mantid/Framework/DataObjects/test/MDBoxSaveableTest.h index e1b1c79279c6554518f0607f309decb3ae8290bb..7b4897705b131b7907e13a66dfbb1c914f08a1f8 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDBoxSaveableTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDBoxSaveableTest.h @@ -12,11 +12,11 @@ #include "MantidKernel/DiskBuffer.h" #include "MantidKernel/MultiThreaded.h" #include "MantidAPI/BoxController.h" -#include "MantidMDEvents/CoordTransformDistance.h" -#include "MantidMDEvents/MDBin.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDEvent.h" -#include "MantidMDEvents/BoxControllerNeXusIO.h" +#include "MantidDataObjects/CoordTransformDistance.h" +#include "MantidDataObjects/MDBin.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDEvent.h" +#include "MantidDataObjects/BoxControllerNeXusIO.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/BoxControllerDummyIO.h" @@ -24,7 +24,7 @@ using namespace Mantid; using namespace Mantid::Geometry; using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; class MDBoxSaveableTest : public CxxTest::TestSuite { @@ -740,6 +740,7 @@ static void destroySuite(MDBoxSaveableTest * suite) { delete suite; } */ void test_splitAllIfNeeded_fileBacked() { + using Mantid::DataObjects::BoxControllerNeXusIO; typedef MDLeanEvent<2> MDE; @@ -749,7 +750,7 @@ static void destroySuite(MDBoxSaveableTest * suite) { delete suite; } BoxController_sptr spBc = boost::shared_ptr<BoxController >(b->getBoxController()); - auto fbc =boost::shared_ptr<API::IBoxControllerIO>(new MDEvents::BoxControllerNeXusIO(spBc.get())); + auto fbc =boost::shared_ptr<API::IBoxControllerIO>(new BoxControllerNeXusIO(spBc.get())); spBc->setSplitThreshold(100); spBc->setMaxDepth(4); spBc->setFileBacked(fbc,"MDGridBoxTest.nxs"); diff --git a/Code/Mantid/Framework/MDEvents/test/MDBoxTest.h b/Code/Mantid/Framework/DataObjects/test/MDBoxTest.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/test/MDBoxTest.h rename to Code/Mantid/Framework/DataObjects/test/MDBoxTest.h index 136448053eaadf53ded9e2492b388fcf9c3302bb..be79dd888761334727d80d592de6416f4a1045d0 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDBoxTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDBoxTest.h @@ -12,17 +12,17 @@ #include "MantidKernel/DiskBuffer.h" #include "MantidKernel/MultiThreaded.h" #include "MantidAPI/BoxController.h" -#include "MantidMDEvents/CoordTransformDistance.h" -#include "MantidMDEvents/MDBin.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDLeanEvent.h" +#include "MantidDataObjects/CoordTransformDistance.h" +#include "MantidDataObjects/MDBin.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDLeanEvent.h" #include "MantidTestHelpers/MDEventsTestHelper.h" using namespace Mantid; using namespace Mantid::Geometry; using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; class MDBoxTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDEvents/test/MDDimensionStatsTest.h b/Code/Mantid/Framework/DataObjects/test/MDDimensionStatsTest.h similarity index 71% rename from Code/Mantid/Framework/MDEvents/test/MDDimensionStatsTest.h rename to Code/Mantid/Framework/DataObjects/test/MDDimensionStatsTest.h index 77068ad423c6b814dc6692a4baeaaa0b9718aede..f37553d6f583b396ce61cabb1d65d59f51621b08 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDDimensionStatsTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDDimensionStatsTest.h @@ -1,15 +1,13 @@ -#ifndef MANTID_MDEVENTS_MDDIMENSIONSTATSTEST_H_ -#define MANTID_MDEVENTS_MDDIMENSIONSTATSTEST_H_ +#ifndef MANTID_DATAOBJECTS_MDDIMENSIONSTATSTEST_H_ +#define MANTID_DATAOBJECTS_MDDIMENSIONSTATSTEST_H_ + +#include "MantidDataObjects/MDDimensionStats.h" -#include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> -#include "MantidMDEvents/MDDimensionStats.h" +#include <cxxtest/TestSuite.h> -using namespace Mantid::MDEvents; +using Mantid::DataObjects::MDDimensionStats; class MDDimensionStatsTest : public CxxTest::TestSuite { @@ -42,5 +40,5 @@ public: }; -#endif /* MANTID_MDEVENTS_MDDIMENSIONSTATSTEST_H_ */ +#endif /* MANTID_DATAOBJECTS_MDDIMENSIONSTATSTEST_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/test/MDEventFactoryTest.h b/Code/Mantid/Framework/DataObjects/test/MDEventFactoryTest.h similarity index 92% rename from Code/Mantid/Framework/MDEvents/test/MDEventFactoryTest.h rename to Code/Mantid/Framework/DataObjects/test/MDEventFactoryTest.h index 040e25fdeec869dd5f4843d78c88f6b8c1a0c6e7..ea83166110460b36e1e9ec8260de978cdee75274 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDEventFactoryTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDEventFactoryTest.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_MDEVENTFACTORYTEST_H_ -#define MANTID_MDEVENTS_MDEVENTFACTORYTEST_H_ +#ifndef MANTID_DATAOBJECTS_MDEVENTFACTORYTEST_H_ +#define MANTID_DATAOBJECTS_MDEVENTFACTORYTEST_H_ #include <cxxtest/TestSuite.h> #include <MantidKernel/Timer.h> @@ -7,10 +7,10 @@ #include <iostream> #include <iomanip> -#include <MantidMDEvents/MDEventFactory.h> +#include <MantidDataObjects/MDEventFactory.h> -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::API; class MDEventFactoryTest : public CxxTest::TestSuite @@ -103,5 +103,5 @@ public: }; -#endif /* MANTID_MDEVENTS_MDEVENTFACTORYTEST_H_ */ +#endif /* MANTID_DATAOBJECTS_MDEVENTFACTORYTEST_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/test/MDEventInserterTest.h b/Code/Mantid/Framework/DataObjects/test/MDEventInserterTest.h similarity index 92% rename from Code/Mantid/Framework/MDEvents/test/MDEventInserterTest.h rename to Code/Mantid/Framework/DataObjects/test/MDEventInserterTest.h index b7edbd209ec130d20cdab8c99ef84b81e5d5d6fa..a2058249377aab67aacb44a197b3be5f970f0c55 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDEventInserterTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDEventInserterTest.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_MDEVENTINSERTERTEST_H_ -#define MANTID_MDEVENTS_MDEVENTINSERTERTEST_H_ +#ifndef MANTID_DATAOBJECTS_MDEVENTINSERTERTEST_H_ +#define MANTID_DATAOBJECTS_MDEVENTINSERTERTEST_H_ #include <cxxtest/TestSuite.h> #include "MantidKernel/Timer.h" @@ -9,16 +9,16 @@ #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/IAlgorithm.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDEvent.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDEvent.h" #include <iostream> #include <iomanip> -#include "MantidMDEvents/MDEventInserter.h" +#include "MantidDataObjects/MDEventInserter.h" using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::API; class MDEventInserterTest : public CxxTest::TestSuite @@ -125,4 +125,4 @@ public: }; -#endif /* MANTID_MDEVENTS_MDEVENTINSERTERTEST_H_ */ +#endif /* MANTID_DATAOBJECTS_MDEVENTINSERTERTEST_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/test/MDEventTest.h b/Code/Mantid/Framework/DataObjects/test/MDEventTest.h similarity index 94% rename from Code/Mantid/Framework/MDEvents/test/MDEventTest.h rename to Code/Mantid/Framework/DataObjects/test/MDEventTest.h index 94f9f6960c9aaca19d0935c094fad4c42ba2f5f0..4d542ff494eb779fd0f9bf57defeba67cc8d94b2 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDEventTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDEventTest.h @@ -3,15 +3,14 @@ #include "MantidKernel/MultiThreaded.h" #include "MantidKernel/Timer.h" -#include "MantidMDEvents/MDEvent.h" -#include "MantidMDEvents/MDEvent.h" +#include "MantidDataObjects/MDEvent.h" +#include "MantidDataObjects/MDEvent.h" #include <cxxtest/TestSuite.h> #include <map> #include <memory> -using namespace Mantid; -using namespace Mantid::Kernel; -using namespace Mantid::MDEvents; +using Mantid::DataObjects::MDEvent; +using Mantid::DataObjects::MDLeanEvent; class MDEventTest : public CxxTest::TestSuite { @@ -38,8 +37,8 @@ static void destroySuite(MDEventTest * suite) { delete suite; } // NOTE: The pragma (pack,2) call has no effect on some platforms: RHEL5, Ubuntu 10.04 and MacOS as of now. // Therefore these tests fail and the events are somewhat too big on these platforms: - // TS_ASSERT_EQUALS( sizeof(a), sizeof(coord_t)*3+8+6); - // TS_ASSERT_EQUALS( sizeof(b), sizeof(coord_t)*4+8+6); + // TS_ASSERT_EQUALS( sizeof(a), sizeof(Mantid::coord_t)*3+8+6); + // TS_ASSERT_EQUALS( sizeof(b), sizeof(Mantid::coord_t)*4+8+6); } void test_constructor() @@ -55,7 +54,7 @@ static void destroySuite(MDEventTest * suite) { delete suite; } void test_constructor_withCoords() { // Fixed-size array - coord_t coords[3] = {0.125, 1.25, 2.5}; + Mantid::coord_t coords[3] = {0.125, 1.25, 2.5}; MDEvent<3> b(2.5, 1.5, 123, 456789, coords ); TS_ASSERT_EQUALS( b.getSignal(), 2.5); TS_ASSERT_EQUALS( b.getErrorSquared(), 1.5); @@ -69,7 +68,7 @@ static void destroySuite(MDEventTest * suite) { delete suite; } /** Note: the copy constructor is not explicitely written but rather is filled in by the compiler */ void test_CopyConstructor() { - coord_t coords[3] = {0.125, 1.25, 2.5}; + Mantid::coord_t coords[3] = {0.125, 1.25, 2.5}; MDEvent<3> b(2.5, 1.5, 123, 456789, coords ); MDEvent<3> a(b); TS_ASSERT_EQUALS( a.getNumDims(), 3); @@ -100,7 +99,7 @@ static void destroySuite(MDEventTest * suite) { delete suite; } } - std::vector<coord_t> data; + std::vector<Mantid::coord_t> data; size_t ncols; double totalSignal(0); double totalErrSq(0); @@ -170,7 +169,7 @@ static void destroySuite(MDEventTest * suite) { delete suite; } } - std::vector<coord_t> data; + std::vector<Mantid::coord_t> data; size_t ncols; double totalSignal(0); double totalErrSq(0); @@ -258,7 +257,7 @@ public: float error(2.5); uint16_t runIndex = 123; uint16_t detectorId = 45678; - coord_t center[3] = {1.25, 2.5, 3.5}; + Mantid::coord_t center[3] = {1.25, 2.5, 3.5}; for (size_t i=0; i<num; i++) events3.push_back( MDEvent<3>(signal, error, runIndex, detectorId, center) ); } @@ -269,7 +268,7 @@ public: float error(2.5); uint16_t runIndex = 123; uint16_t detectorId = 45678; - coord_t center[4] = {1.25, 2.5, 3.5, 4.75}; + Mantid::coord_t center[4] = {1.25, 2.5, 3.5, 4.75}; for (size_t i=0; i<num; i++) events4.push_back( MDEvent<4>(signal, error, runIndex, detectorId, center) ); } @@ -278,7 +277,7 @@ public: { float signal(1.5); float error(2.5); - coord_t center[3] = {1.25, 2.5, 3.5}; + Mantid::coord_t center[3] = {1.25, 2.5, 3.5}; for (size_t i=0; i<num; i++) lean_events3.push_back( MDLeanEvent<3>(signal, error, center) ); } @@ -287,7 +286,7 @@ public: { float signal(1.5); float error(2.5); - coord_t center[4] = {1.25, 2.5, 3.5, 4.75}; + Mantid::coord_t center[4] = {1.25, 2.5, 3.5, 4.75}; for (size_t i=0; i<num; i++) lean_events4.push_back( MDLeanEvent<4>(signal, error, center) ); } @@ -311,7 +310,7 @@ public: } - std::vector<coord_t> data; + std::vector<Mantid::coord_t> data; size_t ncols; double totalSignal(0); double totalErrSq(0); @@ -348,7 +347,7 @@ public: } - std::vector<coord_t> data; + std::vector<Mantid::coord_t> data; size_t ncols; double totalSignal(0); double totalErrSq(0); diff --git a/Code/Mantid/Framework/MDEvents/test/MDEventWorkspaceTest.h b/Code/Mantid/Framework/DataObjects/test/MDEventWorkspaceTest.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/test/MDEventWorkspaceTest.h rename to Code/Mantid/Framework/DataObjects/test/MDEventWorkspaceTest.h index b4af4acd1a7f0850a259d54f032c4fc3ca73f356..98fed03ff3a89748733ec17843fc678840b0fce9 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDEventWorkspaceTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDEventWorkspaceTest.h @@ -9,12 +9,12 @@ #include "MantidKernel/ProgressText.h" #include "MantidKernel/Timer.h" #include "MantidAPI/BoxController.h" -#include "MantidMDEvents/CoordTransformDistance.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDGridBox.h" -#include "MantidMDEvents/MDLeanEvent.h" +#include "MantidDataObjects/CoordTransformDistance.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDGridBox.h" +#include "MantidDataObjects/MDLeanEvent.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include <boost/random/linear_congruential.hpp> #include <boost/random/mersenne_twister.hpp> @@ -30,7 +30,7 @@ using namespace Mantid; using namespace Mantid::Kernel; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::API; using namespace Mantid::Geometry; diff --git a/Code/Mantid/Framework/MDEvents/test/MDGridBoxTest.h b/Code/Mantid/Framework/DataObjects/test/MDGridBoxTest.h similarity index 99% rename from Code/Mantid/Framework/MDEvents/test/MDGridBoxTest.h rename to Code/Mantid/Framework/DataObjects/test/MDGridBoxTest.h index 455454dbb3dcf01276a9d04812ebe4113c66cd20..6c5c184ab99d8030420289141aa3b82b703bd6e6 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDGridBoxTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDGridBoxTest.h @@ -13,10 +13,10 @@ #include "MantidKernel/Timer.h" #include "MantidKernel/Utils.h" #include "MantidAPI/BoxController.h" -#include "MantidMDEvents/CoordTransformDistance.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDLeanEvent.h" -#include "MantidMDEvents/MDGridBox.h" +#include "MantidDataObjects/CoordTransformDistance.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDLeanEvent.h" +#include "MantidDataObjects/MDGridBox.h" #include <nexus/NeXusFile.hpp> #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MDBoxTest.h" @@ -36,7 +36,7 @@ using namespace Mantid; using namespace Mantid::Kernel; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::API; using namespace Mantid::Geometry; using namespace testing; diff --git a/Code/Mantid/Framework/MDEvents/test/MDHistoWorkspaceIteratorTest.h b/Code/Mantid/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/test/MDHistoWorkspaceIteratorTest.h rename to Code/Mantid/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h index 64a45ac4d24bd08287fc3ba51395fed2cb466099..d8949c9a26ad8f969bbb9a509add03679c30c678 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDHistoWorkspaceIteratorTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h @@ -1,11 +1,11 @@ -#ifndef MANTID_MDEVENTS_MDHISTOWORKSPACEITERATORTEST_H_ -#define MANTID_MDEVENTS_MDHISTOWORKSPACEITERATORTEST_H_ +#ifndef MANTID_DATAOBJECTS_MDHISTOWORKSPACEITERATORTEST_H_ +#define MANTID_DATAOBJECTS_MDHISTOWORKSPACEITERATORTEST_H_ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include "MantidGeometry/MDGeometry/MDHistoDimension.h" -#include "MantidMDEvents/MDHistoWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspaceIterator.h" +#include "MantidDataObjects/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspaceIterator.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include <cxxtest/TestSuite.h> #include <iomanip> @@ -17,7 +17,7 @@ #include <boost/function.hpp> using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::API; using namespace Mantid::Kernel; using Mantid::Kernel::VMD; @@ -32,11 +32,11 @@ class MDHistoWorkspaceIteratorTest: public CxxTest::TestSuite private: /// Helper type allows masking to take place directly on MDHistoWorkspaces for testing purposes. - class WritableHistoWorkspace: public Mantid::MDEvents::MDHistoWorkspace + class WritableHistoWorkspace: public Mantid::DataObjects::MDHistoWorkspace { public: WritableHistoWorkspace(MDHistoDimension_sptr x) : - Mantid::MDEvents::MDHistoWorkspace(x) + Mantid::DataObjects::MDHistoWorkspace(x) { } void setMaskValueAt(size_t at, bool value) @@ -267,7 +267,7 @@ public: ws->setMaskValueAt(4, true); //Mask the second bin ws->setMaskValueAt(5, false); //NOT MASKED - Mantid::MDEvents::MDHistoWorkspace_sptr ws_sptr(ws); + Mantid::DataObjects::MDHistoWorkspace_sptr ws_sptr(ws); MDHistoWorkspaceIterator* histoIt = dynamic_cast<MDHistoWorkspaceIterator*>(ws_sptr->createIterator()); @@ -801,5 +801,5 @@ public: }; -#endif /* MANTID_MDEVENTS_MDHISTOWORKSPACEITERATORTEST_H_ */ +#endif /* MANTID_DATAOBJECTS_MDHISTOWORKSPACEITERATORTEST_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/test/MDHistoWorkspaceTest.h b/Code/Mantid/Framework/DataObjects/test/MDHistoWorkspaceTest.h similarity index 99% rename from Code/Mantid/Framework/MDEvents/test/MDHistoWorkspaceTest.h rename to Code/Mantid/Framework/DataObjects/test/MDHistoWorkspaceTest.h index 4c3ce0f394843b553bd30fa9a8821144ef5056da..cdc1be0e3c94cceebcf8bc19a4812fec4b244448 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDHistoWorkspaceTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDHistoWorkspaceTest.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_MDHISTOWORKSPACETEST_H_ -#define MANTID_MDEVENTS_MDHISTOWORKSPACETEST_H_ +#ifndef MANTID_DATAOBJECTS_MDHISTOWORKSPACETEST_H_ +#define MANTID_DATAOBJECTS_MDHISTOWORKSPACETEST_H_ #include "MantidAPI/IMDIterator.h" #include "MantidAPI/IMDWorkspace.h" @@ -9,8 +9,8 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include "MantidKernel/VMD.h" -#include "MantidMDEvents/MDHistoWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspaceIterator.h" +#include "MantidDataObjects/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspaceIterator.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include <boost/math/special_functions/fpclassify.hpp> #include <cxxtest/TestSuite.h> @@ -20,7 +20,7 @@ #include "MantidKernel/Strings.h" using namespace Mantid::DataObjects; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; using namespace Mantid::API; using namespace Mantid::Kernel; @@ -974,5 +974,5 @@ public: }; -#endif /* MANTID_MDEVENTS_MDHISTOWORKSPACETEST_H_ */ +#endif /* MANTID_DATAOBJECTS_MDHISTOWORKSPACETEST_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/test/MDLeanEventTest.h b/Code/Mantid/Framework/DataObjects/test/MDLeanEventTest.h similarity index 93% rename from Code/Mantid/Framework/MDEvents/test/MDLeanEventTest.h rename to Code/Mantid/Framework/DataObjects/test/MDLeanEventTest.h index 7954c9ed60d38f68c363231e603cce98da756aac..e485b4e6f30a9fae858fbabbf0e668026bd1369a 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDLeanEventTest.h +++ b/Code/Mantid/Framework/DataObjects/test/MDLeanEventTest.h @@ -1,15 +1,15 @@ -#ifndef MANTID_MDEVENTS_MDLEANEVENTTEST_H_ -#define MANTID_MDEVENTS_MDLEANEVENTTEST_H_ +#ifndef MANTID_DATAOBJECTS_MDLEANEVENTTEST_H_ +#define MANTID_DATAOBJECTS_MDLEANEVENTTEST_H_ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" -#include "MantidMDEvents/MDLeanEvent.h" +#include "MantidDataObjects/MDLeanEvent.h" #include <cxxtest/TestSuite.h> #include <iomanip> #include <iostream> using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; class MDLeanEventTest : public CxxTest::TestSuite { @@ -116,5 +116,5 @@ public: }; -#endif /* MANTID_MDEVENTS_MDLEANEVENTTEST_H_ */ +#endif /* MANTID_DATAOBJECTS_MDLEANEVENTTEST_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/test/SkippingPolicyTest.h b/Code/Mantid/Framework/DataObjects/test/SkippingPolicyTest.h similarity index 64% rename from Code/Mantid/Framework/MDEvents/test/SkippingPolicyTest.h rename to Code/Mantid/Framework/DataObjects/test/SkippingPolicyTest.h index 04e24d0a983e00d7ed029fc0a68948f9a581592b..5b514725590e7a345f7482481b1d6206a627b8aa 100644 --- a/Code/Mantid/Framework/MDEvents/test/SkippingPolicyTest.h +++ b/Code/Mantid/Framework/DataObjects/test/SkippingPolicyTest.h @@ -1,15 +1,10 @@ -#ifndef MANTID_MDEVENTS_SKIPPINGPOLICYTEST_H_ -#define MANTID_MDEVENTS_SKIPPINGPOLICYTEST_H_ +#ifndef MANTID_DATAOBJECTS_SKIPPINGPOLICYTEST_H_ +#define MANTID_DATAOBJECTS_SKIPPINGPOLICYTEST_H_ +#include "MantidDataObjects/SkippingPolicy.h" #include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> -#include "MantidMDEvents/SkippingPolicy.h" - -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; class SkippingPolicyTest : public CxxTest::TestSuite { @@ -30,4 +25,4 @@ public: }; -#endif /* MANTID_MDEVENTS_SKIPPINGPOLICYTEST_H_ */ \ No newline at end of file +#endif /* MANTID_DATAOBJECTS_SKIPPINGPOLICYTEST_H_ */ diff --git a/Code/Mantid/Framework/Kernel/src/ComputeResourceInfo.cpp b/Code/Mantid/Framework/Kernel/src/ComputeResourceInfo.cpp index 6669c1f228310ec4bcba078f3f79a072f96cad77..df25d17cbd3513f0e73c46bb2dea1ddef2c97212 100644 --- a/Code/Mantid/Framework/Kernel/src/ComputeResourceInfo.cpp +++ b/Code/Mantid/Framework/Kernel/src/ComputeResourceInfo.cpp @@ -40,7 +40,7 @@ ComputeResourceInfo::ComputeResourceInfo(const FacilityInfo *fac, // default: Mantid web service API: // http://www.mantidproject.org/Remote_Job_Submission_API m_managerType = "MantidWebServiceAPIJobManager"; - std::string type = elem->getAttribute("JobManagerType"); + std::string type = elem->getAttribute("jobmanagertype"); if (!type.empty()) { m_managerType = type; } diff --git a/Code/Mantid/Framework/Kernel/test/ComputeResourceInfoTest.h b/Code/Mantid/Framework/Kernel/test/ComputeResourceInfoTest.h index 213a98ed2098662b0748101000aaaa992a0a8cc0..b1b561bbc78c6ed7802f2c9f10d150d46231933b 100644 --- a/Code/Mantid/Framework/Kernel/test/ComputeResourceInfoTest.h +++ b/Code/Mantid/Framework/Kernel/test/ComputeResourceInfoTest.h @@ -105,7 +105,7 @@ public: void test_normalSCARF() { const std::string scarf = "<computeResource name=\"" + scarfName + - "\" JobManagerType=\"" + scarfType + "\">" + "\" jobmanagertype=\"" + scarfType + "\">" "<baseURL>" + scarfURL + "</baseURL>" "</computeResource>"; @@ -139,7 +139,7 @@ public: void test_brokenSCARF() { const std::string type = "SCARFLSFJobManager"; const std::string err = "<computeResource foo=\"" + scarfName + - "\" JobManagerType=\"" + type + "\">" + "\" jobmanagertype=\"" + type + "\">" "<URL>" + scarfURL + "</URL>" "</computeResource>"; diff --git a/Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt b/Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt index 0e2f238894bde22742308c3059194480d88ffa1d..3e92b53e508838bb7f92d2ea1a2b9f2f41c90df6 100644 --- a/Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt +++ b/Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt @@ -7,12 +7,19 @@ set ( SRC_FILES src/BinMD.cpp src/BinaryOperationMD.cpp src/BooleanBinaryOperationMD.cpp + src/BoxControllerSettingsAlgorithm.cpp src/CalculateCoverageDGS.cpp + src/CalculateReflectometryQBase.cpp src/CentroidPeaksMD.cpp src/CentroidPeaksMD2.cpp src/CloneMDWorkspace.cpp src/CompareMDWorkspaces.cpp + src/ConvToMDBase.cpp src/ConvertCWPDMDToSpectra.cpp + src/ConvToMDEventsWS.cpp + src/ConvToMDHistoWS.cpp + src/ConvToMDSelector.cpp + src/ConvertMDHistoToMatrixWorkspace.cpp src/ConvertSpiceDataToRealSpace.cpp src/ConvertToDetectorFaceMD.cpp src/ConvertToDiffractionMDWorkspace.cpp @@ -21,6 +28,7 @@ set ( SRC_FILES src/ConvertToMDMinMaxGlobal.cpp src/ConvertToMDMinMaxLocal.cpp src/ConvertToMDParent.cpp + src/ConvertToReflectometryQ.cpp src/CreateMDHistoWorkspace.cpp src/CreateMDWorkspace.cpp src/CutMD.cpp @@ -30,8 +38,14 @@ set ( SRC_FILES src/ExponentialMD.cpp src/FakeMDEventData.cpp src/FindPeaksMD.cpp + src/FitMD.cpp src/GreaterThanMD.cpp src/IDynamicRebinning.cpp + src/ImportMDEventWorkspace.cpp + src/ImportMDHistoWorkspace.cpp + src/ImportMDHistoWorkspaceBase.cpp + src/Integrate3DEvents.cpp + src/IntegrateEllipsoids.cpp src/IntegrateFlux.cpp src/IntegratePeaksMD.cpp src/IntegratePeaksMD2.cpp @@ -43,14 +57,23 @@ set ( SRC_FILES src/LoadMD.cpp src/LoadSQW.cpp src/LogarithmMD.cpp + src/MDEventWSWrapper.cpp src/MDNormDirectSC.cpp src/MDNormSCD.cpp + src/MDTransfAxisNames.cpp + src/MDTransfFactory.cpp + src/MDTransfModQ.cpp + src/MDTransfNoQ.cpp + src/MDTransfQ3D.cpp + src/MDWSDescription.cpp + src/MDWSTransform.cpp src/MaskMD.cpp src/MergeMD.cpp src/MergeMDFiles.cpp src/MinusMD.cpp src/MultiplyMD.cpp src/NotMD.cpp + src/OneStepMDEW.cpp src/OrMD.cpp src/PlusMD.cpp src/PowerMD.cpp @@ -70,6 +93,12 @@ set ( SRC_FILES src/Quantification/Resolution/TobyFitYVector.cpp src/Quantification/ResolutionConvolvedCrossSection.cpp src/Quantification/SimulateResolutionConvolvedModel.cpp + src/QueryMDWorkspace.cpp + src/ReflectometryTransform.cpp + src/ReflectometryTransformKiKf.cpp + src/ReflectometryTransformP.cpp + src/ReflectometryTransformQxQz.cpp + src/SaveIsawQvector.cpp src/SaveMD.cpp src/SaveZODS.cpp src/SetMDUsingMask.cpp @@ -78,6 +107,8 @@ set ( SRC_FILES src/ThresholdMD.cpp src/TransformMD.cpp src/UnaryOperationMD.cpp + src/UnitsConversionHelper.cpp + src/UserFunctionMD.cpp src/Vector3DParameterParser.cpp src/WeightedMeanMD.cpp src/XorMD.cpp @@ -92,12 +123,16 @@ set ( INC_FILES inc/MantidMDAlgorithms/BinMD.h inc/MantidMDAlgorithms/BinaryOperationMD.h inc/MantidMDAlgorithms/BooleanBinaryOperationMD.h + inc/MantidMDAlgorithms/BoxControllerSettingsAlgorithm.h inc/MantidMDAlgorithms/CalculateCoverageDGS.h + inc/MantidMDAlgorithms/CalculateReflectometryQBase.h inc/MantidMDAlgorithms/CentroidPeaksMD.h inc/MantidMDAlgorithms/CentroidPeaksMD2.h inc/MantidMDAlgorithms/CloneMDWorkspace.h inc/MantidMDAlgorithms/CompareMDWorkspaces.h + inc/MantidMDAlgorithms/ConvToMDBase.h inc/MantidMDAlgorithms/ConvertCWPDMDToSpectra.h + inc/MantidMDAlgorithms/ConvertMDHistoToMatrixWorkspace.h inc/MantidMDAlgorithms/ConvertSpiceDataToRealSpace.h inc/MantidMDAlgorithms/ConvertToDetectorFaceMD.h inc/MantidMDAlgorithms/ConvertToDiffractionMDWorkspace.h @@ -106,6 +141,7 @@ set ( INC_FILES inc/MantidMDAlgorithms/ConvertToMDMinMaxGlobal.h inc/MantidMDAlgorithms/ConvertToMDMinMaxLocal.h inc/MantidMDAlgorithms/ConvertToMDParent.h + inc/MantidMDAlgorithms/ConvertToReflectometryQ.h inc/MantidMDAlgorithms/CreateMDHistoWorkspace.h inc/MantidMDAlgorithms/CreateMDWorkspace.h inc/MantidMDAlgorithms/CutMD.h @@ -116,9 +152,15 @@ set ( INC_FILES inc/MantidMDAlgorithms/ExponentialMD.h inc/MantidMDAlgorithms/FakeMDEventData.h inc/MantidMDAlgorithms/FindPeaksMD.h + inc/MantidMDAlgorithms/FitMD.h inc/MantidMDAlgorithms/GSLFunctions.h inc/MantidMDAlgorithms/GreaterThanMD.h inc/MantidMDAlgorithms/IDynamicRebinning.h + inc/MantidMDAlgorithms/ImportMDEventWorkspace.h + inc/MantidMDAlgorithms/ImportMDHistoWorkspace.h + inc/MantidMDAlgorithms/ImportMDHistoWorkspaceBase.h + inc/MantidMDAlgorithms/Integrate3DEvents.h + inc/MantidMDAlgorithms/IntegrateEllipsoids.h inc/MantidMDAlgorithms/IntegrateFlux.h inc/MantidMDAlgorithms/IntegratePeaksMD.h inc/MantidMDAlgorithms/IntegratePeaksMD2.h @@ -130,14 +172,23 @@ set ( INC_FILES inc/MantidMDAlgorithms/LoadMD.h inc/MantidMDAlgorithms/LoadSQW.h inc/MantidMDAlgorithms/LogarithmMD.h + inc/MantidMDAlgorithms/MDEventWSWrapper.h inc/MantidMDAlgorithms/MDNormDirectSC.h inc/MantidMDAlgorithms/MDNormSCD.h + inc/MantidMDAlgorithms/MDTransfAxisNames.h + inc/MantidMDAlgorithms/MDTransfFactory.h + inc/MantidMDAlgorithms/MDTransfModQ.h + inc/MantidMDAlgorithms/MDTransfNoQ.h + inc/MantidMDAlgorithms/MDTransfQ3D.h + inc/MantidMDAlgorithms/MDWSDescription.h + inc/MantidMDAlgorithms/MDWSTransform.h inc/MantidMDAlgorithms/MaskMD.h inc/MantidMDAlgorithms/MergeMD.h inc/MantidMDAlgorithms/MergeMDFiles.h inc/MantidMDAlgorithms/MinusMD.h inc/MantidMDAlgorithms/MultiplyMD.h inc/MantidMDAlgorithms/NotMD.h + inc/MantidMDAlgorithms/OneStepMDEW.h inc/MantidMDAlgorithms/OrMD.h inc/MantidMDAlgorithms/PlusMD.h inc/MantidMDAlgorithms/PowerMD.h @@ -157,6 +208,12 @@ set ( INC_FILES inc/MantidMDAlgorithms/Quantification/Resolution/TobyFitYVector.h inc/MantidMDAlgorithms/Quantification/ResolutionConvolvedCrossSection.h inc/MantidMDAlgorithms/Quantification/SimulateResolutionConvolvedModel.h + inc/MantidMDAlgorithms/QueryMDWorkspace.h + inc/MantidMDAlgorithms/ReflectometryTransform.h + inc/MantidMDAlgorithms/ReflectometryTransformKiKf.h + inc/MantidMDAlgorithms/ReflectometryTransformP.h + inc/MantidMDAlgorithms/ReflectometryTransformQxQz.h + inc/MantidMDAlgorithms/SaveIsawQvector.h inc/MantidMDAlgorithms/SaveMD.h inc/MantidMDAlgorithms/SaveZODS.h inc/MantidMDAlgorithms/SetMDUsingMask.h @@ -165,6 +222,7 @@ set ( INC_FILES inc/MantidMDAlgorithms/ThresholdMD.h inc/MantidMDAlgorithms/TransformMD.h inc/MantidMDAlgorithms/UnaryOperationMD.h + inc/MantidMDAlgorithms/UnitsConversionHelper.h inc/MantidMDAlgorithms/Vector3DParameter.h inc/MantidMDAlgorithms/Vector3DParameterParser.h inc/MantidMDAlgorithms/WeightedMeanMD.h @@ -178,6 +236,7 @@ set ( TEST_FILES #CreateMDFitWorkspaceTest.h AndMDTest.h BooleanBinaryOperationMDTest.h + BoxControllerSettingsAlgorithmTest.h CachedExperimentInfoTest.h CalculateCoverageDGSTest.h CentroidPeaksMD2Test.h @@ -186,6 +245,7 @@ set ( TEST_FILES CompareMDWorkspacesTest.h ConvertCWPDMDToSpectraTest.h ConvertEventsToMDTest.h + ConvertMDHistoToMatrixWorkspaceTest.h ConvertSpiceDataToRealSpaceTest.h ConvertToDetectorFaceMDTest.h ConvertToDiffractionMDWorkspace2Test.h @@ -195,6 +255,7 @@ set ( TEST_FILES ConvertToMDMinMaxLocalTest.h ConvertToMDTest.h ConvertToQ3DdETest.h + ConvertToReflectometryQTest.h CreateMDHistoWorkspaceTest.h CreateMDWorkspaceTest.h CutMDTest.h @@ -204,9 +265,14 @@ set ( TEST_FILES ExponentialMDTest.h FakeMDEventDataTest.h FindPeaksMDTest.h + FitMDTest.h FitResolutionConvolvedModelTest.h ForegroundModelTest.h GreaterThanMDTest.h + ImportMDEventWorkspaceTest.h + ImportMDHistoWorkspaceTest.h + Integrate3DEventsTest.h + IntegrateEllipsoidsTest.h IntegrateFluxTest.h IntegratePeaksMD2Test.h IntegratePeaksMDTest.h @@ -216,9 +282,16 @@ set ( TEST_FILES LoadMDTest.h LoadSQWTest.h LogarithmMDTest.h + MDEventWSWrapperTest.h MDNormDirectSCTest.h MDNormSCDTest.h MDResolutionConvolutionFactoryTest.h + MDTransfAxisNamesTest.h + MDTransfFactoryTest.h + MDTransfModQTest.h + MDTransfQ3DTest.h + MDWSDescriptionTest.h + MDWSTransfTest.h MaskMDTest.h MergeMDFilesTest.h MergeMDTest.h @@ -227,11 +300,17 @@ set ( TEST_FILES MullerAnsatzTest.h MultiplyMDTest.h NotMDTest.h + OneStepMDEWTest.h OrMDTest.h PlusMDTest.h PowerMDTest.h PreprocessDetectorsToMDTest.h + QueryMDWorkspaceTest.h + ReflectometryTransformKiKfTest.h + ReflectometryTransformPTest.h + ReflectometryTransformQxQzTest.h ResolutionConvolvedCrossSectionTest.h + SaveIsawQvectorTest.h SaveMDTest.h SaveZODSTest.h SetMDUsingMaskTest.h @@ -245,6 +324,7 @@ set ( TEST_FILES TobyFitYVectorTest.h TransformMDTest.h UnaryOperationMDTest.h + UnitsConversionHelperTest.h WeightedMeanMDTest.h XorMDTest.h ) @@ -274,8 +354,8 @@ endif () # Add to the 'Framework' group in VS set_property ( TARGET MDAlgorithms PROPERTY FOLDER "MantidFramework" ) -include_directories ( inc ../MDEvents/inc ) -target_link_libraries ( MDAlgorithms ${MANTIDLIBS} MDEvents ) +include_directories ( inc ) +target_link_libraries ( MDAlgorithms ${MANTIDLIBS} ) # Add the unit tests directory add_subdirectory ( test ) diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/AndMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/AndMD.h index 7fbde45cf0fbe9bb3de8d088e923a3546a6643ad..d15a1c5a50b68f7a9db16bc36f7de8ce0ccd30a9 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/AndMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/AndMD.h @@ -43,8 +43,8 @@ public: virtual int version() const; private: - void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand); + void execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand); }; } // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BinMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BinMD.h index 59764a15667691413896b76dbec28012ed8de56a..74d7c1809a94dc3cfe22908650982e84d3e3ec75 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BinMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BinMD.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_BINMD_H_ -#define MANTID_MDEVENTS_BINMD_H_ +#ifndef MANTID_MDALGORITHMS_BINMD_H_ +#define MANTID_MDALGORITHMS_BINMD_H_ #include "MantidAPI/Algorithm.h" #include "MantidAPI/CoordTransform.h" @@ -8,10 +8,10 @@ #include "MantidGeometry/MDGeometry/MDImplicitFunction.h" #include "MantidKernel/System.h" #include "MantidKernel/VMD.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidMDAlgorithms/SlicingAlgorithm.h" namespace Mantid { @@ -60,15 +60,15 @@ private: /// Helper method template <typename MDE, size_t nd> - void binByIterating(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void binByIterating(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); /// Method to bin a single MDBox template <typename MDE, size_t nd> - void binMDBox(MDEvents::MDBox<MDE, nd> *box, const size_t *const chunkMin, + void binMDBox(DataObjects::MDBox<MDE, nd> *box, const size_t *const chunkMin, const size_t *const chunkMax); /// The output MDHistoWorkspace - Mantid::MDEvents::MDHistoWorkspace_sptr outWS; + Mantid::DataObjects::MDHistoWorkspace_sptr outWS; /// Progress reporting Mantid::API::Progress *prog; /// ImplicitFunction used @@ -82,6 +82,6 @@ private: }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_BINMD_H_ */ +#endif /* MANTID_MDALGORITHMS_BINMD_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BinaryOperationMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BinaryOperationMD.h index 27f58fe2e1df146f4f8db5f441fbc8c318e3b786..574408c9b7f0f4e4936f5f8294cbc47ea856c7a6 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BinaryOperationMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BinaryOperationMD.h @@ -1,12 +1,11 @@ #ifndef MANTID_MDALGORITHMS_BINARYOPERATIONMD_H_ #define MANTID_MDALGORITHMS_BINARYOPERATIONMD_H_ -#include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidAPI/IMDWorkspace.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" #include "MantidAPI/IMDEventWorkspace.h" +#include "MantidAPI/IMDWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidDataObjects/WorkspaceSingleValue.h" namespace Mantid { @@ -69,12 +68,12 @@ protected: /// Run the algorithm with a MDHisotWorkspace as output and operand virtual void - execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand) = 0; + execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand) = 0; /// Run the algorithm with a MDHisotWorkspace as output, scalar and operand virtual void execHistoScalar( - Mantid::MDEvents::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar) = 0; /// The name of the first input workspace property @@ -98,8 +97,8 @@ protected: /// For checkInputs Mantid::API::IMDEventWorkspace_sptr m_lhs_event; Mantid::API::IMDEventWorkspace_sptr m_rhs_event; - Mantid::MDEvents::MDHistoWorkspace_sptr m_lhs_histo; - Mantid::MDEvents::MDHistoWorkspace_sptr m_rhs_histo; + Mantid::DataObjects::MDHistoWorkspace_sptr m_lhs_histo; + Mantid::DataObjects::MDHistoWorkspace_sptr m_rhs_histo; Mantid::DataObjects::WorkspaceSingleValue_sptr m_lhs_scalar; Mantid::DataObjects::WorkspaceSingleValue_sptr m_rhs_scalar; @@ -109,9 +108,9 @@ protected: Mantid::API::IMDEventWorkspace_sptr m_out_event; /// Operand MDHistoWorkspace - Mantid::MDEvents::MDHistoWorkspace_sptr m_operand_histo; + Mantid::DataObjects::MDHistoWorkspace_sptr m_operand_histo; /// Output MDHistoWorkspace - Mantid::MDEvents::MDHistoWorkspace_sptr m_out_histo; + Mantid::DataObjects::MDHistoWorkspace_sptr m_out_histo; /// Operand WorkspaceSingleValue Mantid::DataObjects::WorkspaceSingleValue_sptr m_operand_scalar; diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BooleanBinaryOperationMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BooleanBinaryOperationMD.h index 3f542aa98ae13211c442e13169b5b9d6067435ba..028f5cf745d70a11f923b5c1faab20e726e7fa91 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BooleanBinaryOperationMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BooleanBinaryOperationMD.h @@ -52,13 +52,13 @@ protected: void checkInputs(); void execEvent(); virtual void - execHistoScalar(Mantid::MDEvents::MDHistoWorkspace_sptr out, + execHistoScalar(Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar); /// Run the algorithm with a MDHisotWorkspace as output and operand virtual void - execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand) = 0; + execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand) = 0; }; } // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/BoxControllerSettingsAlgorithm.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BoxControllerSettingsAlgorithm.h similarity index 90% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/BoxControllerSettingsAlgorithm.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BoxControllerSettingsAlgorithm.h index 3e561c626aebbbcccb823af1263b69e2dccd7ed8..aab8d17553b390a52ace084b6c75f3fa334c297f 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/BoxControllerSettingsAlgorithm.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/BoxControllerSettingsAlgorithm.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_BOXCONTROLLERSETTINGSALGORITHM_H_ -#define MANTID_MDEVENTS_BOXCONTROLLERSETTINGSALGORITHM_H_ +#ifndef MANTID_MDALGORITHMS_BOXCONTROLLERSETTINGSALGORITHM_H_ +#define MANTID_MDALGORITHMS_BOXCONTROLLERSETTINGSALGORITHM_H_ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" @@ -7,7 +7,7 @@ #include "MantidGeometry/Instrument.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** An abstract algorithm sub-class for algorithms that * define properties for BoxController settings. @@ -65,7 +65,7 @@ protected: private: }; -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid -#endif /* MANTID_MDEVENTS_BOXCONTROLLERSETTINGSALGORITHM_H_ */ +#endif /* MANTID_MDALGORITHMS_BOXCONTROLLERSETTINGSALGORITHM_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CalculateCoverageDGS.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CalculateCoverageDGS.h index decf5ad7399a7cd517b2b6365763d15afbee3051..c27d40674a83b6b84dd546cdebcba17b6abd7647 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CalculateCoverageDGS.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CalculateCoverageDGS.h @@ -4,7 +4,7 @@ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" #include "MantidKernel/Matrix.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" namespace Mantid { namespace MDAlgorithms { @@ -60,7 +60,7 @@ private: Mantid::Kernel::DblMatrix m_rubw; /// Normalization workspace (this is the coverage workspace) - Mantid::MDEvents::MDHistoWorkspace_sptr m_normWS; + Mantid::DataObjects::MDHistoWorkspace_sptr m_normWS; std::vector<Kernel::VMD> calculateIntersections(const double theta, const double phi); diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CalculateReflectometryQBase.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CalculateReflectometryQBase.h similarity index 71% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CalculateReflectometryQBase.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CalculateReflectometryQBase.h index 21bc50d8f93766a83068981f4fccb5c2d7fcf47f..88e876b73da75cb438d1e67c67187a27dc418c2d 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/CalculateReflectometryQBase.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CalculateReflectometryQBase.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_CALCULATE_REFLECTOMETRYQ_BASE_H_ -#define MANTID_MDEVENTS_CALCULATE_REFLECTOMETRYQ_BASE_H_ +#ifndef MANTID_MDALGORITHMS_CALCULATE_REFLECTOMETRYQ_BASE_H_ +#define MANTID_MDALGORITHMS_CALCULATE_REFLECTOMETRYQ_BASE_H_ #include "MantidKernel/System.h" @@ -10,7 +10,7 @@ class IMDDimension; } } -namespace MDEvents { +namespace MDAlgorithms { /** Base class for reflectometry Q transformations */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CentroidPeaksMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CentroidPeaksMD.h index a57881d56253f167947c59656a96a88b9c39805b..fa73a0247052dacc6ed7e2959a8a94508bc46cc5 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CentroidPeaksMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CentroidPeaksMD.h @@ -5,7 +5,7 @@ #include "MantidAPI/Algorithm.h" #include "MantidAPI/IMDEventWorkspace.h" #include "MantidDataObjects/PeaksWorkspace.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" namespace Mantid { namespace MDAlgorithms { @@ -41,13 +41,13 @@ private: void exec(); template <typename MDE, size_t nd> - void integrate(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void integrate(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); /// Input MDEventWorkspace Mantid::API::IMDEventWorkspace_sptr inWS; }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_CENTROIDPEAKSMD_H_ */ +#endif /* MANTID_MDALGORITHMS_CENTROIDPEAKSMD_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CentroidPeaksMD2.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CentroidPeaksMD2.h index 24fe9438e5d4ad833e22d866374a8a6f32557cea..c5fbb8920faec0cbc3dcfc98476de15b72d48d5b 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CentroidPeaksMD2.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CentroidPeaksMD2.h @@ -5,7 +5,7 @@ #include "MantidAPI/Algorithm.h" #include "MantidAPI/IMDEventWorkspace.h" #include "MantidDataObjects/PeaksWorkspace.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" namespace Mantid { namespace MDAlgorithms { @@ -41,13 +41,13 @@ private: void exec(); template <typename MDE, size_t nd> - void integrate(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void integrate(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); /// Input MDEventWorkspace Mantid::API::IMDEventWorkspace_sptr inWS; }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_CENTROIDPEAKSMD2_H_ */ +#endif /* MANTID_MDALGORITHMS_CENTROIDPEAKSMD2_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CloneMDWorkspace.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CloneMDWorkspace.h index dbc361454e395b1569a3919c01e0743b326581d8..07a7a5718ecc390e85ab12b113918793180e9130 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CloneMDWorkspace.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CloneMDWorkspace.h @@ -1,9 +1,9 @@ -#ifndef MANTID_MDEVENTS_CLONEMDWORKSPACE_H_ -#define MANTID_MDEVENTS_CLONEMDWORKSPACE_H_ +#ifndef MANTID_MDALGORITHMS_CLONEMDWORKSPACE_H_ +#define MANTID_MDALGORITHMS_CLONEMDWORKSPACE_H_ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" namespace Mantid { namespace MDAlgorithms { @@ -60,10 +60,10 @@ private: void exec(); template <typename MDE, size_t nd> - void doClone(const typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void doClone(const typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); }; -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid -#endif /* MANTID_MDEVENTS_CLONEMDWORKSPACE_H_ */ +#endif /* MANTID_MDALGORITHMS_CLONEMDWORKSPACE_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CompareMDWorkspaces.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CompareMDWorkspaces.h index 13010053ff58fd1a53097bcf39a8cc2a665698de..d51d54dd9f389b3f766ac5db7261c22c0d4e65b4 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CompareMDWorkspaces.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CompareMDWorkspaces.h @@ -4,8 +4,8 @@ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" #include "MantidAPI/IMDWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" namespace Mantid { namespace MDAlgorithms { @@ -55,12 +55,12 @@ private: void doComparison(); void compareMDGeometry(Mantid::API::IMDWorkspace_sptr ws1, Mantid::API::IMDWorkspace_sptr ws2); - void compareMDHistoWorkspaces(Mantid::MDEvents::MDHistoWorkspace_sptr ws1, - Mantid::MDEvents::MDHistoWorkspace_sptr ws2); + void compareMDHistoWorkspaces(Mantid::DataObjects::MDHistoWorkspace_sptr ws1, + Mantid::DataObjects::MDHistoWorkspace_sptr ws2); template <typename MDE, size_t nd> void compareMDWorkspaces( - typename Mantid::MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + typename Mantid::DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); template <typename T> void compare(T a, T b, const std::string &message); diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvToMDBase.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvToMDBase.h similarity index 64% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvToMDBase.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvToMDBase.h index eb8328a5f534cb3d621708d276ae8b6ac091ab80..b9d2dff43b2f2d52940a9579fc9f28b0fd0d1129 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvToMDBase.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvToMDBase.h @@ -1,56 +1,51 @@ -#ifndef MANTID_MDEVENTS_CONVERTMD_BASE_H -#define MANTID_MDEVENTS_CONVERTMD_BASE_H - -#include "MantidKernel/Logger.h" +#ifndef MANTID_MDALGORITHMS_CONVERTMD_BASE_H +#define MANTID_MDALGORITHMS_CONVERTMD_BASE_H +#include "MantidAPI/ExperimentInfo.h" +#include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/NumericAxis.h" #include "MantidAPI/Progress.h" -#include "MantidAPI/ExperimentInfo.h" +#include "MantidKernel/Logger.h" -#include "MantidAPI/MatrixWorkspace.h" +#include "MantidMDAlgorithms/MDWSDescription.h" +#include "MantidMDAlgorithms/MDEventWSWrapper.h" +#include "MantidMDAlgorithms/MDTransfInterface.h" +#include "MantidMDAlgorithms/MDTransfFactory.h" +#include "MantidMDAlgorithms/UnitsConversionHelper.h" -#include "MantidMDEvents/MDWSDescription.h" -#include "MantidMDEvents/MDEventWSWrapper.h" +namespace Mantid { +namespace MDAlgorithms { +/** Class describes the interface to the methods, which perform conversion from + usual workspaces to MDEventWorkspace -#include "MantidMDEvents/MDTransfInterface.h" -#include "MantidMDEvents/MDTransfFactory.h" + See http://www.mantidproject.org/Writing_custom_ConvertTo_MD_transformation + for detailed description of this + class place in the algorithms hierarchy. -// units conversion -#include "MantidMDEvents/UnitsConversionHelper.h" -namespace Mantid { -namespace MDEvents { -/** class describes the interface to the methods, which perform conversion from - usual workspaces to MDEventWorkspace - * - * See http://www.mantidproject.org/Writing_custom_ConvertTo_MD_transformation - for detailed description of this - * class place in the algorithms hierarchy. - * - * - * @date 07-01-2012 + @date 07-01-2012 Copyright © 2010 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge - National Laboratory & European Spallation Source + National Laboratory & European Spallation Source - This file is part of Mantid. + 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 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. + 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/>. + 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> + File/ change history is stored at: + <https://github.com/mantidproject/mantid> + Code Documentation is available at: <http://doxygen.mantidproject.org> */ class DLLExport ConvToMDBase { @@ -65,7 +60,7 @@ public: /// method which starts the conversion procedure virtual void runConversion(API::Progress *) = 0; /// virtual destructor - virtual ~ConvToMDBase(){}; + virtual ~ConvToMDBase(){} /** method returns unit conversion helper, used to convert input workspace units to the units, used by appropriate MD transformation @@ -77,7 +72,7 @@ protected: API::MatrixWorkspace_const_sptr m_InWS2D; // pointer to the class, which keeps target workspace and provides functions // adding additional MD events to it. - boost::shared_ptr<MDEvents::MDEventWSWrapper> m_OutWSWrapper; + boost::shared_ptr<MDEventWSWrapper> m_OutWSWrapper; // shared pointer to the converter, which converts WS coordinates to MD // coordinates MDTransf_sptr m_QConverter; diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvToMDEventsWS.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvToMDEventsWS.h similarity index 76% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvToMDEventsWS.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvToMDEventsWS.h index 4db1de68b9cc62bfbfbe194b187f440455f26ceb..a46e43344b1ee7d91894b1a96a9cedda31f8ff29 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvToMDEventsWS.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvToMDEventsWS.h @@ -1,27 +1,24 @@ -#ifndef MANTID_MDEVENTS_CONV_TOMD_EVENTSWS_H -#define MANTID_MDEVENTS_CONV_TOMD_EVENTSWS_H +#ifndef MANTID_MDALGORITHMS_CONV_TOMD_EVENTSWS_H +#define MANTID_MDALGORITHMS_CONV_TOMD_EVENTSWS_H // -#include "MantidKernel/System.h" -#include "MantidKernel/Exception.h" #include "MantidAPI/Algorithm.h" -#include <vector> - #include "MantidDataObjects/EventWorkspace.h" - -#include "MantidAPI/NumericAxis.h" -#include "MantidAPI/Progress.h" +#include "MantidDataObjects/MDEvent.h" +#include "MantidKernel/Exception.h" #include "MantidKernel/PhysicalConstants.h" +#include "MantidMDAlgorithms/ConvToMDBase.h" +#include "MantidMDAlgorithms/MDEventWSWrapper.h" +#include "MantidMDAlgorithms/MDTransfFactory.h" -#include "MantidMDEvents/MDEventWSWrapper.h" -#include "MantidMDEvents/MDEvent.h" - -#include "MantidMDEvents/ConvToMDBase.h" -// coordinate transformation -#include "MantidMDEvents/MDTransfFactory.h" +#include <vector> namespace Mantid { -namespace MDEvents { -/** The class specializes ConvToMDEventsBase for the case when the conversion +// Forward declarations +namespace API { +class Progress; +} +namespace MDAlgorithms { +/** The class specializes ConvToDataObjectsBase for the case when the conversion occurs from Events WS to the MD events WS * * @@ -58,8 +55,8 @@ namespace MDEvents { class ConvToMDEventsWS : public ConvToMDBase { public: - size_t initialize(const MDEvents::MDWSDescription &WSD, - boost::shared_ptr<MDEvents::MDEventWSWrapper> inWSWrapper, + size_t initialize(const MDWSDescription &WSD, + boost::shared_ptr<MDEventWSWrapper> inWSWrapper, bool ignoreZeros); void runConversion(API::Progress *pProgress); @@ -75,7 +72,7 @@ private: template <class T> size_t convertEventList(size_t workspaceIndex); }; -} // endNamespace MDEvents +} // endNamespace DataObjects } // endNamespace Mantid #endif diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvToMDHistoWS.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvToMDHistoWS.h similarity index 79% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvToMDHistoWS.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvToMDHistoWS.h index 8c72f670b8c41a1193302c7e701559b4911d590d..9c8e5b6bbfa7d3508ec23ebe377ad408e0c31379 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvToMDHistoWS.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvToMDHistoWS.h @@ -1,20 +1,19 @@ -#ifndef MANTID_MDEVENTS_CONV_TOMD_HISTOWS_H -#define MANTID_MDEVENTS_CONV_TOMD_HISTOWS_H +#ifndef MANTID_MDALGORITHMS_CONV_TOMD_HISTOWS_H +#define MANTID_MDALGORITHMS_CONV_TOMD_HISTOWS_H #include "MantidDataObjects/Workspace2D.h" - -#include "MantidAPI/NumericAxis.h" -#include "MantidAPI/Progress.h" - -#include "MantidMDEvents/MDEventWSWrapper.h" -#include "MantidMDEvents/MDEvent.h" - -#include "MantidMDEvents/ConvToMDBase.h" -// coordinate transformation -#include "MantidMDEvents/MDTransfInterface.h" +#include "MantidDataObjects/MDEvent.h" +#include "MantidMDAlgorithms/ConvToMDBase.h" +#include "MantidMDAlgorithms/MDEventWSWrapper.h" +#include "MantidMDAlgorithms/MDTransfInterface.h" namespace Mantid { -namespace MDEvents { + +// Forward declaration +namespace API { +class Progress; +} +namespace MDAlgorithms { /** The class to transform matrix workspace into MDEvent workspace when matrix workspace is ragged 2D workspace * @@ -52,9 +51,10 @@ namespace MDEvents { class ConvToMDHistoWS : public ConvToMDBase { public: - size_t initialize(const MDEvents::MDWSDescription &WSD, - boost::shared_ptr<MDEvents::MDEventWSWrapper> inWSWrapper, - bool ignoreZeros); + size_t + initialize(const MDWSDescription &WSD, + boost::shared_ptr<MDEventWSWrapper> inWSWrapper, + bool ignoreZeros); void runConversion(API::Progress *pProgress); diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvToMDSelector.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvToMDSelector.h similarity index 90% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvToMDSelector.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvToMDSelector.h index b3c6ceecdc10438fde345c982a5fda10c869584f..f80c4b80e38f3947f50ce9fa0bc34a243e7fafff 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvToMDSelector.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvToMDSelector.h @@ -1,11 +1,10 @@ -#ifndef MANTID_MDEVENTS_WS_SELECTOR_H -#define MANTID_MDEVENTS_WS_SELECTOR_H +#ifndef MANTID_MDALGORITHMS_WS_SELECTOR_H +#define MANTID_MDALGORITHMS_WS_SELECTOR_H -#include "MantidMDEvents/ConvToMDEventsWS.h" -#include "MantidMDEvents/ConvToMDHistoWS.h" +#include "MantidMDAlgorithms/ConvToMDBase.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** small class to select proper solver as function of the workspace kind and (possibly, in a future) other workspace parameters. * may be replaced by usual mantid factory in a future; @@ -51,4 +50,4 @@ public: } // end MDAlgorithms Namespace } // end Mantid Namespace -#endif \ No newline at end of file +#endif diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ConvertMDHistoToMatrixWorkspace.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertMDHistoToMatrixWorkspace.h similarity index 91% rename from Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ConvertMDHistoToMatrixWorkspace.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertMDHistoToMatrixWorkspace.h index 4e28dcb5e2d645fe2c3d2dc8c3d79e23abe505cc..216d3ceba2b0fabad44a20fdf91b25565ba260eb 100644 --- a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ConvertMDHistoToMatrixWorkspace.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertMDHistoToMatrixWorkspace.h @@ -1,5 +1,5 @@ -#ifndef MANTID_ALGORITHMS_CONVERTMDHISTOTOMATRIXWORKSPACE_H_ -#define MANTID_ALGORITHMS_CONVERTMDHISTOTOMATRIXWORKSPACE_H_ +#ifndef MANTID_MDALGORITHMS_CONVERTMDHISTOTOMATRIXWORKSPACE_H_ +#define MANTID_MDALGORITHMS_CONVERTMDHISTOTOMATRIXWORKSPACE_H_ //---------------------------------------------------------------------- // Includes @@ -12,7 +12,7 @@ namespace API { class IMDHistoWorkspace; } -namespace Algorithms { +namespace MDAlgorithms { /** Creates a single spectrum Workspace2D with X,Y, and E copied from an first non-integrated dimension of a IMDHistoWorkspace. @@ -83,7 +83,7 @@ private: size_t calcStride(const API::IMDHistoWorkspace &workspace, size_t dim) const; }; -} // namespace Algorithms +} // namespace MDAlgorithms } // namespace Mantid -#endif /*MANTID_ALGORITHMS_CONVERTMDHISTOTOMATRIXWORKSPACE_H_*/ +#endif /*MANTID_MDALGORITHMS_CONVERTMDHISTOTOMATRIXWORKSPACE_H_*/ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToDetectorFaceMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToDetectorFaceMD.h index d9f3158b01859e7c6fbc0d7c775241fe8d6645ce..951ffc6ae81ece960d6a0e053ea12394fd2378b7 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToDetectorFaceMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToDetectorFaceMD.h @@ -1,13 +1,12 @@ #ifndef MANTID_MDALGORITHMS_CONVERTTODETECTORFACEMD_H_ #define MANTID_MDALGORITHMS_CONVERTTODETECTORFACEMD_H_ -#include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" #include "MantidDataObjects/EventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDLeanEvent.h" #include "MantidGeometry/Instrument/RectangularDetector.h" -#include "MantidMDEvents/BoxControllerSettingsAlgorithm.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDLeanEvent.h" +#include "MantidMDAlgorithms/BoxControllerSettingsAlgorithm.h" namespace Mantid { namespace MDAlgorithms { @@ -39,7 +38,7 @@ namespace MDAlgorithms { Code Documentation is available at: <http://doxygen.mantidproject.org> */ class DLLExport ConvertToDetectorFaceMD - : public Mantid::MDEvents::BoxControllerSettingsAlgorithm { + : public MDAlgorithms::BoxControllerSettingsAlgorithm { public: ConvertToDetectorFaceMD(); virtual ~ConvertToDetectorFaceMD(); @@ -62,7 +61,7 @@ private: template <class T, class MDE, size_t nd> void convertEventList( - boost::shared_ptr<Mantid::MDEvents::MDEventWorkspace<MDE, nd>> outWS, + boost::shared_ptr<Mantid::DataObjects::MDEventWorkspace<MDE, nd>> outWS, size_t workspaceIndex, coord_t x, coord_t y, coord_t bankNum, uint16_t runIndex, int32_t detectorID); diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToDiffractionMDWorkspace.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToDiffractionMDWorkspace.h index 6c17274724180bf3d5741e2b1532c1fb44e845f0..13a0aa98ca1709b211eb086f4e012066a1375cd1 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToDiffractionMDWorkspace.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToDiffractionMDWorkspace.h @@ -1,18 +1,13 @@ -#ifndef MANTID_MDEVENTS_CONVERTTODIFFRACTIONMDWORKSPACE_H_ -#define MANTID_MDEVENTS_CONVERTTODIFFRACTIONMDWORKSPACE_H_ +#ifndef MANTID_MDALGORITHMS_CONVERTTODIFFRACTIONMDWORKSPACE_H_ +#define MANTID_MDALGORITHMS_CONVERTTODIFFRACTIONMDWORKSPACE_H_ #include "MantidAPI/Algorithm.h" #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidAPI/Progress.h" #include "MantidDataObjects/EventWorkspace.h" -#include "MantidKernel/PhysicalConstants.h" -#include "MantidKernel/ProgressBase.h" -#include "MantidKernel/ProgressText.h" -#include "MantidKernel/System.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidKernel/V3D.h" -#include "MantidMDEvents/BoxControllerSettingsAlgorithm.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidMDAlgorithms/BoxControllerSettingsAlgorithm.h" namespace Mantid { namespace MDAlgorithms { @@ -25,10 +20,9 @@ namespace MDAlgorithms { * @date 2011-03-01 13:14:48.236513 */ class DLLExport ConvertToDiffractionMDWorkspace - : public MDEvents::BoxControllerSettingsAlgorithm { + : public BoxControllerSettingsAlgorithm { public: ConvertToDiffractionMDWorkspace(); - ~ConvertToDiffractionMDWorkspace(){}; /// Algorithm's name for identification virtual const std::string name() const { @@ -41,7 +35,7 @@ public: } /// Algorithm's version for identification - virtual int version() const { return 1; }; + virtual int version() const { return 1; } /// Algorithm's category for identification virtual const std::string category() const { return "MDAlgorithms"; } @@ -61,7 +55,7 @@ private: DataObjects::EventWorkspace_sptr m_inEventWS; /// The output MDEventWorkspace<3> - MDEvents::MDEventWorkspace3Lean::sptr ws; + DataObjects::MDEventWorkspace3Lean::sptr ws; /// Do we clear events on the input during loading? bool ClearInputWorkspace; /// Use the histogram representation with one event per bin @@ -97,6 +91,6 @@ private: }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_CONVERTTODIFFRACTIONMDWORKSPACE_H_ */ +#endif /* MANTID_MDALGORITHMS_CONVERTTODIFFRACTIONMDWORKSPACE_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToDiffractionMDWorkspace2.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToDiffractionMDWorkspace2.h index c00fc0e75dba13a967c72c0b955f926be9a615ac..8c29dcb92e7200da02da879e7a0cbd78967f90df 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToDiffractionMDWorkspace2.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToDiffractionMDWorkspace2.h @@ -1,19 +1,7 @@ -#ifndef MANTID_MDEVENTS_CONVERTTODIFFRACTIONMDWORKSPACE2_H_ -#define MANTID_MDEVENTS_CONVERTTODIFFRACTIONMDWORKSPACE2_H_ +#ifndef MANTID_MDALGORITHMS_CONVERTTODIFFRACTIONMDWORKSPACE2_H_ +#define MANTID_MDALGORITHMS_CONVERTTODIFFRACTIONMDWORKSPACE2_H_ -#include "MantidAPI/Algorithm.h" -#include "MantidAPI/IMDEventWorkspace.h" -#include "MantidAPI/Progress.h" -#include "MantidDataObjects/EventWorkspace.h" -#include "MantidKernel/PhysicalConstants.h" -#include "MantidKernel/ProgressBase.h" -#include "MantidKernel/ProgressText.h" -#include "MantidKernel/System.h" -#include "MantidKernel/V3D.h" -#include "MantidMDEvents/BoxControllerSettingsAlgorithm.h" -#include "MantidMDAlgorithms/ConvertToMD.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidMDAlgorithms/BoxControllerSettingsAlgorithm.h" namespace Mantid { namespace MDAlgorithms { @@ -29,17 +17,17 @@ namespace MDAlgorithms { * @date 2013-05-20 */ class DLLExport ConvertToDiffractionMDWorkspace2 - : public MDEvents::BoxControllerSettingsAlgorithm { + : public MDAlgorithms::BoxControllerSettingsAlgorithm { public: /** Constructor */ - ConvertToDiffractionMDWorkspace2(){}; + ConvertToDiffractionMDWorkspace2(){} /** Destructor */ - virtual ~ConvertToDiffractionMDWorkspace2(){}; + virtual ~ConvertToDiffractionMDWorkspace2(){} /// Algorithm's name for identification virtual const std::string name() const { return "ConvertToDiffractionMDWorkspace"; - }; + } /// Summary of algorithms purpose virtual const std::string summary() const { return "Create a MDEventWorkspace with events in reciprocal space (Qx, Qy, " @@ -47,7 +35,7 @@ public: } /// Algorithm's version for identification - virtual int version() const { return 2; }; + virtual int version() const { return 2; } /// Algorithm's category for identification virtual const std::string category() const { return "MDAlgorithms"; } @@ -75,6 +63,6 @@ protected: // for testing }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_CONVERTTODIFFRACTIONMDWORKSPACE_H_ */ +#endif /* MANTID_MDALGORITHMS_CONVERTTODIFFRACTIONMDWORKSPACE_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMD.h index 61c660372487d26ef470ce50cd1a205a3e0e5f83..0d5e15b0c2d9fffe6bd209d7c175922043a457b9 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMD.h @@ -1,12 +1,11 @@ -#ifndef MANTID_MDALGORITHMS_CONVERT_TO_MDEVENTS_H_ -#define MANTID_MDALGORITHMS_CONVERT_TO_MDEVENTS_H_ +#ifndef MANTID_MDALGORITHMS_CONVERT_TO_MDALGORITHMS_H_ +#define MANTID_MDALGORITHMS_CONVERT_TO_MDALGORITHMS_H_ -#include "MantidMDEvents/MDWSDescription.h" -#include "MantidMDEvents/BoxControllerSettingsAlgorithm.h" -#include "MantidMDEvents/ConvToMDBase.h" +#include "MantidMDAlgorithms/BoxControllerSettingsAlgorithm.h" +#include "MantidMDAlgorithms/ConvertToMDParent.h" +#include "MantidMDAlgorithms/MDWSDescription.h" #include "MantidKernel/DeltaEMode.h" -#include "MantidMDAlgorithms/ConvertToMDParent.h" namespace Mantid { namespace MDAlgorithms { @@ -28,24 +27,24 @@ namespace MDAlgorithms { Copyright © 2010 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source - This file is part of Mantid. + 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 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. + 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/>. + 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> + File change history is stored at: +<https://github.com/mantidproject/mantid> + Code Documentation is available at: <http://doxygen.mantidproject.org> */ /// Convert to MD Events class itself: @@ -80,7 +79,7 @@ protected: // for testing, otherwise private: Mantid::API::MatrixWorkspace_sptr m_InWS2D; // TODO: This will eventually go. ///The pointer to class which keeps output // MD workspace and is responsible for adding data to N-dimensional workspace; - boost::shared_ptr<MDEvents::MDEventWSWrapper> m_OutWSWrapper; + boost::shared_ptr<MDAlgorithms::MDEventWSWrapper> m_OutWSWrapper; // Workflow helpers: /**Check if target workspace new or existing one and we need to create new @@ -88,7 +87,7 @@ protected: // for testing, otherwise private: bool doWeNeedNewTargetWorkspace(API::IMDEventWorkspace_sptr spws); /**Create new MD workspace using existing parameters for algorithm */ API::IMDEventWorkspace_sptr - createNewMDWorkspace(const MDEvents::MDWSDescription &NewMDWSDescription); + createNewMDWorkspace(const MDAlgorithms::MDWSDescription &NewMDWSDescription); bool buildTargetWSDescription(API::IMDEventWorkspace_sptr spws, const std::string &Q_mod_req, @@ -98,12 +97,12 @@ protected: // for testing, otherwise private: std::vector<double> &dimMax, const std::string &QFrame, const std::string &convertTo_, - MDEvents::MDWSDescription &targWSDescr); + MDAlgorithms::MDWSDescription &targWSDescr); /// par of store metadata routine which generate metadata necessary for /// initializing ConvertToMD plugin void addExperimentInfo(API::IMDEventWorkspace_sptr &mdEventWS, - MDEvents::MDWSDescription &targWSDescr) const; + MDAlgorithms::MDWSDescription &targWSDescr) const; /// Store metadata and set some metadata, needed for plugin to run on the /// target workspace description @@ -122,4 +121,4 @@ protected: // for testing, otherwise private: } // namespace Mantid } // namespace MDAlgorithms -#endif /* MANTID_MDEVENTS_MAKEDIFFRACTIONMDEVENTWORKSPACE_H_ */ +#endif /* MANTID_MDALGORITHMS_MAKEDIFFRACTIONMDEVENTWORKSPACE_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMDMinMaxLocal.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMDMinMaxLocal.h index 5c390e6dff91115ce470aa252654ac24479b8fea..32acb5f7f1eb8eb986ed23ff5fc1bb501c2ce473 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMDMinMaxLocal.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMDMinMaxLocal.h @@ -46,8 +46,8 @@ public: virtual int version() const { return 1; } protected: // for testing - void findMinMaxValues(MDEvents::MDWSDescription &targWSDescr, - MDEvents::MDTransfInterface *const qTransf, + void findMinMaxValues(MDWSDescription &targWSDescr, + MDTransfInterface *const qTransf, Kernel::DeltaEMode::Type dEMode, std::vector<double> &MinValues, std::vector<double> &MaxValues); diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMDParent.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMDParent.h index 5becbffc3567875e6fc60e53774aa72b91cfc16c..ce3bce5662a49510111a7a005d121962d9912117 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMDParent.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMDParent.h @@ -1,9 +1,9 @@ #ifndef MANTID_MDALGORITHMS_CONVERT_TO_MD_PARENT_H_ #define MANTID_MDALGORITHMS_CONVERT_TO_MD_PARENT_H_ -#include "MantidMDEvents/MDWSDescription.h" -#include "MantidMDEvents/BoxControllerSettingsAlgorithm.h" -#include "MantidMDEvents/ConvToMDBase.h" +#include "MantidMDAlgorithms/BoxControllerSettingsAlgorithm.h" +#include "MantidMDAlgorithms/ConvToMDBase.h" +#include "MantidMDAlgorithms/MDWSDescription.h" #include "MantidKernel/DeltaEMode.h" @@ -45,11 +45,10 @@ namespace MDAlgorithms { */ /// Convert to MD Events class itself: -class DLLExport ConvertToMDParent - : public MDEvents::BoxControllerSettingsAlgorithm { +class DLLExport ConvertToMDParent : public BoxControllerSettingsAlgorithm { public: - ConvertToMDParent(){}; - ~ConvertToMDParent(){}; + ConvertToMDParent() {} + ~ConvertToMDParent() {} /// Algorithm's name for identification virtual const std::string name() const = 0; @@ -74,7 +73,7 @@ protected: static Mantid::Kernel::Logger &g_Log; /// pointer to the class, which does the particular conversion - boost::shared_ptr<MDEvents::ConvToMDBase> m_Convertor; + boost::shared_ptr<MDAlgorithms::ConvToMDBase> m_Convertor; /// Template to check if a variable equal to NaN template <class T> inline bool isNaN(T val) { @@ -86,4 +85,4 @@ protected: } // namespace Mantid } // namespace MDAlgorithms -#endif /* MANTID_MDEVENTS_MAKEDIFFRACTIONMDEVENTWORKSPACE_H_ */ +#endif /* MANTID_MDALGORITHMS_MAKEDIFFRACTIONMDEVENTWORKSPACE_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvertToReflectometryQ.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToReflectometryQ.h similarity index 89% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvertToReflectometryQ.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToReflectometryQ.h index 7fca9daf26af7343ebc31cbd882610f3171def12..4137496a8026f10d62ae80dd3f5101a72f58be19 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ConvertToReflectometryQ.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToReflectometryQ.h @@ -1,10 +1,10 @@ -#ifndef MANTID_MDEVENTS_CONVERTTOREFLECTOMETRYQ_H_ -#define MANTID_MDEVENTS_CONVERTTOREFLECTOMETRYQ_H_ +#ifndef MANTID_MDALGORITHMS_CONVERTTOREFLECTOMETRYQ_H_ +#define MANTID_MDALGORITHMS_CONVERTTOREFLECTOMETRYQ_H_ -#include "MantidMDEvents/BoxControllerSettingsAlgorithm.h" +#include "MantidMDAlgorithms/BoxControllerSettingsAlgorithm.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** ConvertToReflectometryQ : Creates a 2D MD Histogram workspace with two axis qz and qx. diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CreateMDHistoWorkspace.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CreateMDHistoWorkspace.h index 14704f57a42cd21f5c52dd580b93644aba6532b6..15fb2f2c0a703a9dafedcfa65edd7bc2d9d64588 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CreateMDHistoWorkspace.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CreateMDHistoWorkspace.h @@ -1,13 +1,12 @@ -#ifndef MANTID_MDEVENTS_CREATEMDHISTOWORKSPACE_H_ -#define MANTID_MDEVENTS_CREATEMDHISTOWORKSPACE_H_ +#ifndef MANTID_MDALGORITHMS_CREATEMDHISTOWORKSPACE_H_ +#define MANTID_MDALGORITHMS_CREATEMDHISTOWORKSPACE_H_ -#include "MantidKernel/System.h" -#include "MantidMDEvents/ImportMDHistoWorkspaceBase.h" +#include "MantidMDAlgorithms/ImportMDHistoWorkspaceBase.h" namespace Mantid { namespace MDAlgorithms { -/** CreateMDHistoWorkspace : TODO: DESCRIPTION +/** CreateMDHistoWorkspace @date 2012-06-21 @@ -33,7 +32,7 @@ namespace MDAlgorithms { Code Documentation is available at: <http://doxygen.mantidproject.org> */ class DLLExport CreateMDHistoWorkspace - : public MDEvents::ImportMDHistoWorkspaceBase { + : public MDAlgorithms::ImportMDHistoWorkspaceBase { public: CreateMDHistoWorkspace(); virtual ~CreateMDHistoWorkspace(); @@ -53,7 +52,7 @@ private: void exec(); }; -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid -#endif /* MANTID_MDEVENTS_CREATEMDHISTOWORKSPACE_H_ */ \ No newline at end of file +#endif /* MANTID_MDALGORITHMS_CREATEMDHISTOWORKSPACE_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CreateMDWorkspace.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CreateMDWorkspace.h index 989d9deba4a1f0dd9d6d63c8b912d402365b73f8..d5790370522d8237295d617e9582855ade2374cc 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CreateMDWorkspace.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CreateMDWorkspace.h @@ -1,11 +1,10 @@ -#ifndef MANTID_MDEVENTS_CREATEMDWORKSPACE_H_ -#define MANTID_MDEVENTS_CREATEMDWORKSPACE_H_ +#ifndef MANTID_MDALGORITHMS_CREATEMDWORKSPACE_H_ +#define MANTID_MDALGORITHMS_CREATEMDWORKSPACE_H_ #include "MantidAPI/Algorithm.h" -#include "MantidKernel/System.h" -#include "MantidMDEvents/BoxControllerSettingsAlgorithm.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidMDAlgorithms/BoxControllerSettingsAlgorithm.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" namespace Mantid { namespace MDAlgorithms { @@ -20,13 +19,13 @@ namespace MDAlgorithms { * @date 2011-02-25 11:54:52.003137 */ class DLLExport CreateMDWorkspace - : public MDEvents::BoxControllerSettingsAlgorithm { + : public MDAlgorithms::BoxControllerSettingsAlgorithm { public: CreateMDWorkspace(); ~CreateMDWorkspace(); /// Algorithm's name for identification - virtual const std::string name() const { return "CreateMDWorkspace"; }; + virtual const std::string name() const { return "CreateMDWorkspace"; } /// Summary of algorithms purpose virtual const std::string summary() const { return "Creates an empty MDEventWorkspace with a given number of " @@ -34,7 +33,7 @@ public: } /// Algorithm's version for identification - virtual int version() const { return 1; }; + virtual int version() const { return 1; } /// Algorithm's category for identification virtual const std::string category() const { return "MDAlgorithms"; } @@ -43,10 +42,10 @@ private: void exec(); template <typename MDE, size_t nd> - void finish(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void finish(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_CREATEMDWORKSPACE_H_ */ +#endif /* MANTID_MDALGORITHMS_CREATEMDWORKSPACE_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/DivideMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/DivideMD.h index ec3c98a49fedd247bd873079c9e8b74c9998a0ed..3103ceb10ebefd3ef1b4d223e6cd6c6f280b1f75 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/DivideMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/DivideMD.h @@ -57,17 +57,17 @@ private: void execEvent(); /// Run the algorithm with a MDHisotWorkspace as output and operand - void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand); + void execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand); /// Run the algorithm with a MDHisotWorkspace as output, scalar and operand void - execHistoScalar(Mantid::MDEvents::MDHistoWorkspace_sptr out, + execHistoScalar(Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar); template <typename MDE, size_t nd> void execEventScalar( - typename Mantid::MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + typename Mantid::DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); }; } // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/EqualToMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/EqualToMD.h index 4b1ea4e77033992694d3aed7945c1ecd672019aa..543dbc0d2fe820b2e6ed1a61b92a131ffd0d8a69 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/EqualToMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/EqualToMD.h @@ -44,10 +44,10 @@ public: private: void initExtraProperties(); bool acceptScalar() const { return true; } - void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand); + void execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand); void - execHistoScalar(Mantid::MDEvents::MDHistoWorkspace_sptr out, + execHistoScalar(Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar); }; diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ExponentialMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ExponentialMD.h index 9624a9a9e3ac63c2939907adc9975205caec0083..0d7abded670feb8840d9ad50e5056a4b06f64ff5 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ExponentialMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ExponentialMD.h @@ -54,7 +54,7 @@ private: void execEvent(Mantid::API::IMDEventWorkspace_sptr out); /// Run the algorithm with a MDHistoWorkspace - void execHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out); + void execHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out); }; } // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FakeMDEventData.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FakeMDEventData.h index 4c16a032a72a24b67281eae932acaacaa7dcdb00..0150766cbb4d33a5b237a6002f03df85cd7f4f2a 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FakeMDEventData.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FakeMDEventData.h @@ -1,42 +1,49 @@ -#ifndef MANTID_MDEVENTS_FAKEMDEVENTDATA_H_ -#define MANTID_MDEVENTS_FAKEMDEVENTDATA_H_ +#ifndef MANTID_MDALGORITHMS_FAKEMDEVENTDATA_H_ +#define MANTID_MDALGORITHMS_FAKEMDEVENTDATA_H_ -#include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidKernel/System.h" -#include "MantidKernel/ArrayProperty.h" - -#include <boost/random/mersenne_twister.hpp> -#include <boost/random/uniform_int.hpp> -#include <boost/random/variate_generator.hpp> +#include "MantidMDAlgorithms/DllConfig.h" namespace Mantid { namespace MDAlgorithms { /** FakeMDEventData : Algorithm to create fake multi-dimensional event - * data that gets added to MDEventWorkspace, for use in testing. + data that gets added to MDEventWorkspace, for use in testing. + + 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> * - * @author Janik Zikovsky - * @date 2011-03-30 13:13:10.349627 */ -class DLLExport FakeMDEventData : public API::Algorithm { +class MANTID_MDALGORITHMS_DLL FakeMDEventData : public API::Algorithm { public: - FakeMDEventData(); - ~FakeMDEventData(); - /// Algorithm's name for identification - virtual const std::string name() const { return "FakeMDEventData"; }; + virtual const std::string name() const { return "FakeMDEventData"; } /// Summary of algorithms purpose virtual const std::string summary() const { return "Adds fake multi-dimensional event data to an existing " "MDEventWorkspace, for use in testing.\nYou can create a blank " "MDEventWorkspace with CreateMDWorkspace."; } - - /// Algorithm's version for identification - virtual int version() const { return 1; }; + /// Algorithm's verion for identification + virtual int version() const { return 1; } /// Algorithm's category for identification virtual const std::string category() const { return "MDAlgorithms"; } @@ -45,36 +52,9 @@ private: void init(); /// Run the algorithm void exec(); - - /// Setup a detector cache for randomly picking IDs from the given workspace's - /// instrument - void setupDetectorCache(const API::IMDEventWorkspace &ws); - /// Pick a detector ID for a particular event - detid_t pickDetectorID(); - - template <typename MDE, size_t nd> - void addFakePeak(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); - template <typename MDE, size_t nd> - void - addFakeUniformData(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); - - template <typename MDE, size_t nd> - void addFakeRandomData(const std::vector<double> ¶ms, - typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); - template <typename MDE, size_t nd> - void - addFakeRegularData(const std::vector<double> ¶ms, - typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); - - /// All detector IDs for this instrument - std::vector<detid_t> m_detIDs; - /// Random number generator - boost::mt19937 m_randGen; - /// Uniform distribution - boost::uniform_int<size_t> m_uniformDist; }; } // namespace Mantid -} // namespace MDEvents +} // namespace MDAlgorithms -#endif /* MANTID_MDEVENTS_FAKEMDEVENTDATA_H_ */ +#endif /* MANTID_MDALGORITHMS_FAKEMDEVENTDATA_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FindPeaksMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FindPeaksMD.h index f1b135530ee766d174b5dd1f717ad28ddad1fe3f..c834de29471181b21eb53866133c7315b176e74f 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FindPeaksMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FindPeaksMD.h @@ -7,8 +7,8 @@ #include "MantidAPI/Progress.h" #include "MantidDataObjects/PeaksWorkspace.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidKernel/Matrix.h" #include "MantidKernel/V3D.h" @@ -59,9 +59,9 @@ private: /// Run find peaks on an MDEventWorkspace template <typename MDE, size_t nd> - void findPeaks(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void findPeaks(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); /// Run find peaks on a histo workspace - void findPeaksHisto(Mantid::MDEvents::MDHistoWorkspace_sptr ws); + void findPeaksHisto(Mantid::DataObjects::MDHistoWorkspace_sptr ws); /// Output PeaksWorkspace Mantid::DataObjects::PeaksWorkspace_sptr peakWS; @@ -99,6 +99,6 @@ private: }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_FINDPEAKSMD_H_ */ +#endif /* MANTID_MDALGORITHMS_FINDPEAKSMD_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/FitMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FitMD.h similarity index 96% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/FitMD.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FitMD.h index 195c7be5ef0e011c10ec8bc2b7b45f03359a03a2..1d13172f5f3d76352a9ea912306c54345160a777 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/FitMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FitMD.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_FITMD_H_ -#define MANTID_MDEVENTS_FITMD_H_ +#ifndef MANTID_MDALGORITHMS_FITMD_H_ +#define MANTID_MDALGORITHMS_FITMD_H_ //---------------------------------------------------------------------- // Includes @@ -16,7 +16,7 @@ class IMDEventWorkspace; class IMDHistoWorkspace; } -namespace MDEvents { +namespace MDAlgorithms { /** Creates FunctionDomainMD from an IMDWorkspace. Does not create any properties. @@ -115,7 +115,7 @@ protected: size_t m_count; }; -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid -#endif /*MANTID_MDEVENTS_FITMD_H_*/ +#endif /*MANTID_MDALGORITHMS_FITMD_H_*/ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/GreaterThanMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/GreaterThanMD.h index d0a7510f42c41a914ac7575192365fd083dd5386..86f7214e7124e8695b1132fc0403eed5a1244a21 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/GreaterThanMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/GreaterThanMD.h @@ -51,10 +51,10 @@ private: bool acceptScalar() const { return true; } bool commutative() const { return false; } - void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand); + void execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand); void - execHistoScalar(Mantid::MDEvents::MDHistoWorkspace_sptr out, + execHistoScalar(Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar); }; diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ImportMDEventWorkspace.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ImportMDEventWorkspace.h similarity index 87% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ImportMDEventWorkspace.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ImportMDEventWorkspace.h index 6ad8db85aaab46eec1a9a722d4007259d00159a0..0143a82abfcf515cd9ddf39cf48cf4a34d8a5890 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ImportMDEventWorkspace.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ImportMDEventWorkspace.h @@ -1,14 +1,12 @@ -#ifndef MANTID_MDEVENTS_IMPORTMDEVENTWORKSPACE_H_ -#define MANTID_MDEVENTS_IMPORTMDEVENTWORKSPACE_H_ +#ifndef MANTID_MDALGORITHMS_IMPORTMDEVENTWORKSPACE_H_ +#define MANTID_MDALGORITHMS_IMPORTMDEVENTWORKSPACE_H_ -#include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include <deque> namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** ImportMDEventWorkspace : Loads a file containing dimensionality and data for an MDEventWorkspace. Handles either full mdevents for mdleanevents as input @@ -71,14 +69,14 @@ private: /// Possible Event Types enum MDEventType { Lean, Full, NotSpecified }; /// Flag indicating whether full md events for lean events will be generated. - bool m_IsFullMDEvents; + bool m_IsFullDataObjects; /// Actual number of dimensions specified size_t m_nDimensions; /// Actual number of md events provided. - size_t m_nMDEvents; + size_t m_nDataObjects; /// call back to add event data template <typename MDE, size_t nd> - void addEventsData(typename MDEventWorkspace<MDE, nd>::sptr ws); + void addEventsData(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); /// Quick check of the structure, so we can abort if passed junk. void quickFileCheck(); /// Check that the a flag exists in the file. @@ -88,7 +86,7 @@ private: void exec(); }; -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid -#endif /* MANTID_MDEVENTS_IMPORTMDEVENTWORKSPACE_H_ */ +#endif /* MANTID_MDALGORITHMS_IMPORTMDEVENTWORKSPACE_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ImportMDHistoWorkspace.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ImportMDHistoWorkspace.h similarity index 84% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ImportMDHistoWorkspace.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ImportMDHistoWorkspace.h index dad7ae8d20af71377e5d11040368d2da76f367ba..be699d5f8a8e1dbf1f8ce85f2ed465dfc6e0c0cd 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ImportMDHistoWorkspace.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ImportMDHistoWorkspace.h @@ -1,11 +1,10 @@ -#ifndef MANTID_MDEVENTS_IMPORTMDHISTOWORKSPACE_H_ -#define MANTID_MDEVENTS_IMPORTMDHISTOWORKSPACE_H_ +#ifndef MANTID_MDALGORITHMS_IMPORTMDHISTOWORKSPACE_H_ +#define MANTID_MDALGORITHMS_IMPORTMDHISTOWORKSPACE_H_ -#include "MantidKernel/System.h" -#include "MantidMDEvents/ImportMDHistoWorkspaceBase.h" +#include "MantidMDAlgorithms/ImportMDHistoWorkspaceBase.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** ImportMDHistoWorkspace : Takes a text file containing structured signal and error information and imports it @@ -53,7 +52,7 @@ private: void exec(); }; -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid -#endif /* MANTID_MDEVENTS_IMPORTMDHISTOWORKSPACE_H_ */ +#endif /* MANTID_MDALGORITHMS_IMPORTMDHISTOWORKSPACE_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ImportMDHistoWorkspaceBase.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ImportMDHistoWorkspaceBase.h similarity index 84% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ImportMDHistoWorkspaceBase.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ImportMDHistoWorkspaceBase.h index 2328cede33069e778694ff8ead60f9c46a71f66c..81e9ec99362001611a5d6f3fd00b028642c66508 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ImportMDHistoWorkspaceBase.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ImportMDHistoWorkspaceBase.h @@ -1,13 +1,13 @@ -#ifndef MANTID_MDEVENTS_IMPORTMDHISTOWORKSPACEBASE_H_ -#define MANTID_MDEVENTS_IMPORTMDHISTOWORKSPACEBASE_H_ +#ifndef MANTID_MDALGORITHMS_IMPORTMDHISTOWORKSPACEBASE_H_ +#define MANTID_MDALGORITHMS_IMPORTMDHISTOWORKSPACEBASE_H_ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include <vector> namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** ImportMDHistoWorkspaceBase : Base class for algorithms Importing data as MDHistoWorkspaces. @@ -44,7 +44,7 @@ protected: /// Vector containing the number of bins in each dimension. std::vector<int> nbins; /// Creates an empty md histo workspace (with dimensions) - MDHistoWorkspace_sptr createEmptyOutputWorkspace(); + DataObjects::MDHistoWorkspace_sptr createEmptyOutputWorkspace(); /// Initialise the properties associated with the generic import (those to do /// with dimensionality). void initGenericImportProps(); @@ -56,7 +56,7 @@ private: size_t m_bin_product; }; -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid -#endif /* MANTID_MDEVENTS_IMPORTMDHISTOWORKSPACEBASE_H_ */ \ No newline at end of file +#endif /* MANTID_MDALGORITHMS_IMPORTMDHISTOWORKSPACEBASE_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/Integrate3DEvents.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h similarity index 92% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/Integrate3DEvents.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h index d70da28336da29e879fb8bfaf361eed21cebbcce..3e81114c826cd43c9663e259d6fbba5b198630e3 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/Integrate3DEvents.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h @@ -2,6 +2,7 @@ #define INTEGRATE_3D_EVENTS_H #include <vector> +#include <boost/shared_ptr.hpp> #include <boost/unordered_map.hpp> #include "MantidKernel/V3D.h" #include "MantidKernel/Matrix.h" @@ -15,7 +16,7 @@ namespace DataObjects { class PeakShapeEllipsoid; } -namespace MDEvents { +namespace MDAlgorithms { /** @class Integrate3DEvents @@ -54,14 +55,13 @@ namespace MDEvents { <http://doxygen.mantidproject.org> */ -typedef Mantid::Kernel::Matrix<double> DblMatrix; typedef boost::unordered_map<int64_t, std::vector<std::pair<double, Mantid::Kernel::V3D> > > EventListMap; typedef boost::unordered_map<int64_t, Mantid::Kernel::V3D> PeakQMap; class DLLExport Integrate3DEvents { public: /// Construct object to store events around peaks and integrate peaks - Integrate3DEvents(std::vector<std::pair<double, Mantid::Kernel::V3D> > const &peak_q_list, DblMatrix const &UBinv, + Integrate3DEvents(std::vector<std::pair<double, Mantid::Kernel::V3D> > const &peak_q_list, Kernel::DblMatrix const &UBinv, double radius); ~Integrate3DEvents(); @@ -84,10 +84,10 @@ private: /// Calculate the 3x3 covariance matrix of a list of Q-vectors at 0,0,0 static void makeCovarianceMatrix(std::vector<std::pair<double, Mantid::Kernel::V3D> > const &events, - DblMatrix &matrix, double radius); + Kernel::DblMatrix &matrix, double radius); /// Calculate the eigen vectors of a 3x3 real symmetric matrix - static void getEigenVectors(DblMatrix const &cov_matrix, + static void getEigenVectors(Kernel::DblMatrix const &cov_matrix, std::vector<Mantid::Kernel::V3D> &eigen_vectors); /// Calculate the standard deviation of 3D events in a specified direction @@ -113,11 +113,11 @@ private: // Private data members PeakQMap peak_qs; // hashtable with peak Q-vectors EventListMap event_lists; // hashtable with lists of events for each peak - DblMatrix UBinv; // matrix mapping from Q to h,k,l + Kernel::DblMatrix UBinv; // matrix mapping from Q to h,k,l double radius; // size of sphere to use for events around a peak }; -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/IntegrateEllipsoids.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegrateEllipsoids.h similarity index 66% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/IntegrateEllipsoids.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegrateEllipsoids.h index 619cf8fa6910dfb21bb6c2cef663a274c7b0c705..d3fadb25388193dc3de26fdfc58136a6561b0cb6 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/IntegrateEllipsoids.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegrateEllipsoids.h @@ -1,12 +1,12 @@ -#ifndef MANTID_MDEVENTS_INTEGRATE_ELLIPSOIDS_H_ -#define MANTID_MDEVENTS_INTEGRATE_ELLIPSOIDS_H_ +#ifndef MANTID_MDALGORITHMS_INTEGRATE_ELLIPSOIDS_H_ +#define MANTID_MDALGORITHMS_INTEGRATE_ELLIPSOIDS_H_ #include "MantidAPI/Algorithm.h" #include "MantidAPI/MatrixWorkspace.h" -#include "MantidMDEvents/MDWSDescription.h" +#include "MantidMDAlgorithms/MDWSDescription.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { class DLLExport IntegrateEllipsoids : public API::Algorithm { public: @@ -29,10 +29,10 @@ private: MDWSDescription m_targWSDescr; - void initTargetWSDescr(API::MatrixWorkspace_sptr& wksp); + void initTargetWSDescr(API::MatrixWorkspace_sptr &wksp); }; -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid -#endif /* MANTID_MDEVENTS_INTEGRATE_ELLIPSOIDS_H_ */ +#endif /* MANTID_MDALGORITHMS_INTEGRATE_ELLIPSOIDS_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegratePeaksMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegratePeaksMD.h index d0209e6bd02f71e9d7ede1202e77b3b1cc69ece6..f7b8c249fc70f2a2948d8501a82049df57a1d595 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegratePeaksMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegratePeaksMD.h @@ -5,7 +5,7 @@ #include "MantidAPI/IMDEventWorkspace.h" #include "MantidDataObjects/PeaksWorkspace.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidAPI/CompositeFunction.h" namespace Mantid { @@ -41,7 +41,7 @@ private: void exec(); template <typename MDE, size_t nd> - void integrate(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void integrate(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); /// Input MDEventWorkspace Mantid::API::IMDEventWorkspace_sptr inWS; @@ -54,6 +54,6 @@ private: }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects #endif /* MANTID_MDALGORITHMS_INTEGRATEPEAKSMD_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegratePeaksMD2.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegratePeaksMD2.h index 4207275f86463206533e878b53e9d8a1dcb6eb4f..bc851103b597ad58255b8034efdb568e6b7950b3 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegratePeaksMD2.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegratePeaksMD2.h @@ -5,7 +5,7 @@ #include "MantidAPI/IMDEventWorkspace.h" #include "MantidDataObjects/PeaksWorkspace.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidAPI/CompositeFunction.h" namespace Mantid { @@ -41,7 +41,7 @@ private: void exec(); template <typename MDE, size_t nd> - void integrate(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void integrate(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); /// Input MDEventWorkspace Mantid::API::IMDEventWorkspace_sptr inWS; @@ -61,6 +61,6 @@ private: }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects #endif /* MANTID_MDALGORITHMS_INTEGRATEPEAKSMD_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LessThanMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LessThanMD.h index 11f030c68b110ca00f1955f87568f0a8bc892c44..96997e8fff5e5f57f08f90e9f45c549ca1c9f04e 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LessThanMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LessThanMD.h @@ -45,10 +45,10 @@ private: bool acceptScalar() const { return true; } bool commutative() const { return false; } - void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand); + void execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand); void - execHistoScalar(Mantid::MDEvents::MDHistoWorkspace_sptr out, + execHistoScalar(Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar); }; diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadMD.h index 1377fd4dc122d97a790ebf4399a69f1a7e4a1903..8eb3131709cdcc06b99190025a7616ee1250b044 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadMD.h @@ -1,10 +1,10 @@ -#ifndef MANTID_MDEVENTS_LOADMD_H_ -#define MANTID_MDEVENTS_LOADMD_H_ +#ifndef MANTID_MDALGORITHMS_LOADMD_H_ +#define MANTID_MDALGORITHMS_LOADMD_H_ #include "MantidAPI/IFileLoader.h" #include "MantidAPI/IMDEventWorkspace.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include <boost/scoped_ptr.hpp> namespace Mantid { @@ -64,13 +64,13 @@ private: /// Helper method template <typename MDE, size_t nd> - void doLoad(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void doLoad(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); void loadExperimentInfos( boost::shared_ptr<Mantid::API::MultipleExperimentInfos> ws); void loadSlab(std::string name, void *data, - MDEvents::MDHistoWorkspace_sptr ws, NeXus::NXnumtype dataType); + DataObjects::MDHistoWorkspace_sptr ws, NeXus::NXnumtype dataType); void loadHisto(); void loadDimensions(); @@ -99,7 +99,7 @@ private: bool m_BoxStructureAndMethadata; }; -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid -#endif /* MANTID_MDEVENTS_LOADMD_H_ */ +#endif /* MANTID_MDALGORITHMS_LOADMD_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadSQW.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadSQW.h index 77f03174723d57d0093167c22e71fc29f90a5278..50ac21f27cf7b1cb6e3372ad15012b0937e52498 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadSQW.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadSQW.h @@ -1,10 +1,10 @@ -#ifndef MANTID_MDEVENTS_LOAD_SQW_H_ -#define MANTID_MDEVENTS_LOAD_SQW_H_ +#ifndef MANTID_MDALGORITHMS_LOAD_SQW_H_ +#define MANTID_MDALGORITHMS_LOAD_SQW_H_ #include "MantidAPI/IFileLoader.h" #include "MantidKernel/FileDescriptor.h" #include "MantidAPI/Progress.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidGeometry/MDGeometry/MDHistoDimensionBuilder.h" #include <fstream> #include <string> @@ -110,7 +110,7 @@ private: protected: // for testing /// Read events onto the workspace. virtual void readEvents( - Mantid::MDEvents::MDEventWorkspace<MDEvents::MDEvent<4>, 4> *ws); + Mantid::DataObjects::MDEventWorkspace<DataObjects::MDEvent<4>, 4> *ws); /// Read DND dimensions. void readDNDDimensions( @@ -122,7 +122,7 @@ protected: // for testing /// Extract lattice information virtual void addLattice( - Mantid::MDEvents::MDEventWorkspace<MDEvents::MDEvent<4>, 4> *ws); + Mantid::DataObjects::MDEventWorkspace<DataObjects::MDEvent<4>, 4> *ws); /// Parse metadata from file. void parseMetadata(const std::string &fileName); // New controlling function @@ -132,7 +132,7 @@ protected: // for testing std::vector<Mantid::Geometry::MDHistoDimensionBuilder> &DimVector); /// add range of dimensions to the workspace; void addDimsToWs( - Mantid::MDEvents::MDEventWorkspace<MDEvents::MDEvent<4>, 4> *ws, + Mantid::DataObjects::MDEventWorkspace<DataObjects::MDEvent<4>, 4> *ws, std::vector<Mantid::Geometry::MDHistoDimensionBuilder> &DimVector); /// read real box sizes for all Horace Boxes; @@ -167,6 +167,6 @@ protected: // for testing }; } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects -#endif /* MANTID_MDEVENTS_MAKEDIFFRACTIONMDEVENTWORKSPACE_H_ */ +#endif /* MANTID_MDALGORITHMS_MAKEDIFFRACTIONMDEVENTWORKSPACE_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LogarithmMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LogarithmMD.h index 645ecbde92a7a7262ec04aa61fee89dbf8c4e064..8aa4743d51a173639338dd5561ded9b73f1412e1 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LogarithmMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LogarithmMD.h @@ -56,7 +56,7 @@ private: void execEvent(Mantid::API::IMDEventWorkspace_sptr out); /// Run the algorithm with a MDHistoWorkspace - void execHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out); + void execHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out); }; } // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventWSWrapper.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDEventWSWrapper.h similarity index 93% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventWSWrapper.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDEventWSWrapper.h index f890d996da7f62756cea09a2b59b011d563f0d7b..c16730dfa1761c61c831f1f141c18363b557eb4f 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventWSWrapper.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDEventWSWrapper.h @@ -1,18 +1,18 @@ -#ifndef MANTID_MDEVENTS_MDEVENT_WS_WRAPPER_H -#define MANTID_MDEVENTS_MDEVENT_WS_WRAPPER_H +#ifndef MANTID_MDALGORITHMS_MDEVENT_WS_WRAPPER_H +#define MANTID_MDALGORITHMS_MDEVENT_WS_WRAPPER_H -#include "MantidMDEvents/MDEvent.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDWSDescription.h" +#include "MantidDataObjects/MDEvent.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidMDAlgorithms/MDWSDescription.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** The class which wraps MD Events factory and allow to work with a N-dimensional templated MDEvent workspace like usuall class with n-dimension as a parameter * * Introduced to decrease code bloat and increase efficiency of methods and -algorithms, which use MDEvents write interface and run-time defined number of +algorithms, which use DataObjects write interface and run-time defined number of dimensions @date 2011-28-12 @@ -83,7 +83,7 @@ public: void releaseWorkspace(); /// get access to the internal workspace API::IMDEventWorkspace_sptr pWorkspace() { return m_Workspace; } - // should it be moved to the IMDEvents? + // should it be moved to the IDataObjects? // void refreshCentroid(){ (this->*(mdCalCentroid[m_NDimensions]))(); }; /** initiate the class with pointer to existing MD workspace */ void setMDWS(API::IMDEventWorkspace_sptr spWS); @@ -150,7 +150,7 @@ private: mutable bool m_needSplitting; }; -} // endnamespace MDEvents +} // endnamespace MDAlgorithms } // endnamespace Mantid #endif diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDNormDirectSC.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDNormDirectSC.h index 4f4cb22d5e92e4008bd261c4bf0c2a6c64cd839b..375dea557814745e6daab6a00e8116651f5ee0ad 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDNormDirectSC.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDNormDirectSC.h @@ -49,8 +49,8 @@ private: void cacheInputs(); std::string inputEnergyMode() const; - MDEvents::MDHistoWorkspace_sptr binInputWS(); - void createNormalizationWS(const MDEvents::MDHistoWorkspace &dataWS); + DataObjects::MDHistoWorkspace_sptr binInputWS(); + void createNormalizationWS(const DataObjects::MDHistoWorkspace &dataWS); std::vector<coord_t> getValuesFromOtherDimensions(bool &skipNormalization) const; Kernel::Matrix<coord_t> @@ -69,7 +69,7 @@ private: const double phi); /// Normalization workspace - MDEvents::MDHistoWorkspace_sptr m_normWS; + DataObjects::MDHistoWorkspace_sptr m_normWS; /// Input workspace API::IMDEventWorkspace_sptr m_inputWS; /// limits for h,k,l, dE dimensions diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDNormSCD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDNormSCD.h index 7e9e2c10f7da16165c059db098daa62ccf0909f1..a0c1a0ed9d66e176118196357774d42e7e2f6ff9 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDNormSCD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDNormSCD.h @@ -49,8 +49,8 @@ private: void cacheInputs(); std::string inputEnergyMode() const; - MDEvents::MDHistoWorkspace_sptr binInputWS(); - void createNormalizationWS(const MDEvents::MDHistoWorkspace &dataWS); + DataObjects::MDHistoWorkspace_sptr binInputWS(); + void createNormalizationWS(const DataObjects::MDHistoWorkspace &dataWS); std::vector<coord_t> getValuesFromOtherDimensions(bool &skipNormalization) const; Kernel::Matrix<coord_t> @@ -72,7 +72,7 @@ private: const double phi); /// Normalization workspace - MDEvents::MDHistoWorkspace_sptr m_normWS; + DataObjects::MDHistoWorkspace_sptr m_normWS; /// Input workspace API::IMDEventWorkspace_sptr m_inputWS; /// limits for h,k,l dimensions diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfAxisNames.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfAxisNames.h similarity index 93% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfAxisNames.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfAxisNames.h index 7713db08cccff7016d7c3a34536756667637c378..b32fbb4f7b3fd53f421e4ddc4f26e505a7184d68 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfAxisNames.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfAxisNames.h @@ -1,11 +1,11 @@ -#ifndef MANTID_MDEVENTS_MDTRANSF_AXIS_NAMES_H -#define MANTID_MDEVENTS_MDTRANSF_AXIS_NAMES_H -//#include "MantidMDEvents/MDTransfDEHelper.h" +#ifndef MANTID_MDALGORITHMS_MDTRANSF_AXIS_NAMES_H +#define MANTID_MDALGORITHMS_MDTRANSF_AXIS_NAMES_H +//#include "MantidDataObjects/MDTransfDEHelper.h" #include "MantidKernel/DeltaEMode.h" #include "MantidKernel/V3D.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** The class defines default axis names/dimension ID-s for MD workspace which can be obtained/used * in the MD transformations converting matrix workspace to Q or Q-dE space @@ -75,7 +75,7 @@ std::string DLLExport makeAxisName(const Kernel::V3D &vector, /**creates string representation of the number with accuracy, cpecified by eps*/ std::string DLLExport sprintfd(const double data, const double eps); -} // endnamespace MDEvents +} // endnamespace MDAlgorithms } // endnamespace Mantid #endif \ No newline at end of file diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfDEHelper.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfDEHelper.h index 67cc13991b47cea7cb58972094d43663e96e9df7..57d184a11f930466d4a0db18a8fb48093534a0d4 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfDEHelper.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfDEHelper.h @@ -2,7 +2,7 @@ #define H_MDTRANSF_DE_HELPER namespace Mantid { -namespace MDEvents { +namespace DataObjects { /** The class is here do define common operations/interfaces involved in dE (energy transfer) for the MD transformations, * which actually do energy transfer analyzis @@ -67,7 +67,7 @@ private: const std::vector<std::string> EmodesList; }; -} // endnamespace MDEvents +} // endnamespace DataObjects } // endnamespace Mantid #endif \ No newline at end of file diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfFactory.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfFactory.h similarity index 86% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfFactory.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfFactory.h index 2948bb1f31b92b0d84864be8a24f82f65323c94e..9ef9d39451a022d1a06b89439d6b30287f4838da 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfFactory.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfFactory.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_MD_TRANSFORMATION_FACTORYIMPL_H -#define MANTID_MDEVENTS_MD_TRANSFORMATION_FACTORYIMPL_H +#ifndef MANTID_MDALGORITHMS_MD_TRANSFORMATION_FACTORYIMPL_H +#define MANTID_MDALGORITHMS_MD_TRANSFORMATION_FACTORYIMPL_H /* Used to register unit classes into the factory. creates a global object in an * anonymous namespace. The object itself does nothing, but the comma operator @@ -18,35 +18,37 @@ #define DECLARE_MD_TRANSF(classname) \ namespace { \ Mantid::Kernel::RegistrationHelper \ - register_alg_##classname(((Mantid::MDEvents::MDTransfFactory::Instance() \ + register_alg_##classname(((Mantid::MDAlgorithms::MDTransfFactory::Instance() \ .subscribe<classname>(#classname)), \ 0)); \ } \ - const std::string Mantid::MDEvents::classname::transfID() const { \ + const std::string Mantid::MDAlgorithms::classname::transfID() const { \ return #classname; \ } #define DECLARE_MD_TRANSFID(classname, regID) \ namespace { \ Mantid::Kernel::RegistrationHelper \ - register_alg_##classname(((Mantid::MDEvents::MDTransfFactory::Instance() \ + register_alg_##classname(((Mantid::MDAlgorithms::MDTransfFactory::Instance() \ .subscribe<classname>(#regID)), \ 0)); \ } \ - const std::string Mantid::MDEvents::classname::transfID() const { \ + const std::string Mantid::MDAlgorithms::classname::transfID() const { \ return #regID; \ } //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidKernel/DllConfig.h" +#include "MantidMDAlgorithms/DllConfig.h" + #include "MantidKernel/DynamicFactory.h" #include "MantidKernel/SingletonHolder.h" -#include "MantidMDEvents/MDTransfInterface.h" + +#include "MantidMDAlgorithms/MDTransfInterface.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** Creates instances of concrete transformations into multidimensional (MD) coordinates. @@ -88,13 +90,7 @@ namespace MDEvents { File change history is stored at: <https://github.com/mantidproject/mantid> Code Documentation is available at: <http://doxygen.mantidproject.org> */ -#ifdef IN_MANTID_MDEVENT -#define MANTID_MDEVENTS_DLL DLLExport -#else -#define MANTID_MDEVENTS_DLL DLLImport -#endif /* IN_MANTID_MDEVENT*/ - -class MANTID_MDEVENTS_DLL MDTransfFactoryImpl +class MANTID_MDALGORITHMS_DLL MDTransfFactoryImpl : public Kernel::DynamicFactory<MDTransfInterface> { public: virtual boost::shared_ptr<MDTransfInterface> @@ -122,14 +118,14 @@ private: /// AlgorithmFactoryImpl (needed for dllexport/dllimport) . #ifdef _WIN32 // this breaks new namespace declaration rules; need to find a better fix -template class MANTID_MDEVENTS_DLL +template class MANTID_MDALGORITHMS_DLL Mantid::Kernel::SingletonHolder<MDTransfFactoryImpl>; #endif /* _WIN32 */ /// The specialization of the SingletonHolder class that holds the /// MDTransformations Factory typedef Kernel::SingletonHolder<MDTransfFactoryImpl> MDTransfFactory; -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid #endif diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfInterface.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfInterface.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfInterface.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfInterface.h index 7aa6cf336b68ef64b3e63073bd5891bb0c9bfb89..624caad868dee5f8d46c801efb57198fe692534b 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfInterface.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfInterface.h @@ -1,13 +1,17 @@ -#ifndef MANTID_MDEVENTS_IMD_TRANSFORMATION_H -#define MANTID_MDEVENTS_IMD_TRANSFORMATION_H +#ifndef MANTID_MDALGORITHMS_IMD_TRANSFORMATION_H +#define MANTID_MDALGORITHMS_IMD_TRANSFORMATION_H + +#include "MantidAPI/MatrixWorkspace.h" + #include "MantidGeometry/MDGeometry/MDTypes.h" + #include "MantidKernel/cow_ptr.h" #include "MantidKernel/DeltaEMode.h" -#include "MantidMDEvents/MDWSDescription.h" -#include "MantidAPI/MatrixWorkspace.h" + +#include "MantidMDAlgorithms/MDWSDescription.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** Interface to set of sub-classes used by ConvertToMD algorithm and responsible for conversion of input workspace * data into MD events. @@ -227,4 +231,4 @@ typedef boost::shared_ptr<const MDTransfInterface> MDTransf_const_sptr; } // End MDAlgorighms namespace } // End Mantid namespace -#endif \ No newline at end of file +#endif diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfModQ.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfModQ.h similarity index 96% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfModQ.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfModQ.h index 48cd90a9c3f0a2f3e477fb723ab1eb7f4b012e19..773dc55455398705bd37f6479898403cd72e3d55 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfModQ.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfModQ.h @@ -1,11 +1,11 @@ -#ifndef MANTID_MDEVENTS_MODQ_TRANSF_H -#define MANTID_MDEVENTS_MODQ_TRANSF_H +#ifndef MANTID_MDALGORITHMS_MODQ_TRANSF_H +#define MANTID_MDALGORITHMS_MODQ_TRANSF_H // -#include "MantidMDEvents/MDTransfInterface.h" -#include "MantidMDEvents/MDTransfFactory.h" +#include "MantidMDAlgorithms/MDTransfInterface.h" +#include "MantidMDAlgorithms/MDTransfFactory.h" // namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** Class responsible for conversion of input workspace * data into proper number of output dimensions for ModQ case diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfNoQ.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfNoQ.h similarity index 95% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfNoQ.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfNoQ.h index bf668b5720b9b3275c04174eba791fc1078082e3..bb9ef259251f1f1a22eb7c71d27e3f2dbe9e5675 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfNoQ.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfNoQ.h @@ -1,14 +1,12 @@ -#ifndef MANTID_MDEVENTS_NOQ_TRANSF_H -#define MANTID_MDEVENTS_NOQ_TRANSF_H -// -#include "MantidMDEvents/MDTransfInterface.h" -//#include "MantidMDEvents/ConvToMDBase.h" -#include "MantidMDEvents/MDTransfFactory.h" +#ifndef MANTID_MDALGORITHMS_NOQ_TRANSF_H +#define MANTID_MDALGORITHMS_NOQ_TRANSF_H + #include "MantidAPI/NumericAxis.h" +#include "MantidMDAlgorithms/MDTransfInterface.h" +#include "MantidMDAlgorithms/MDTransfFactory.h" -// namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** Class responsible for conversion of input workspace * data into proper number of output dimensions in NoQ case, when the data from diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfQ3D.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfQ3D.h similarity index 94% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfQ3D.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfQ3D.h index 0b80f881e4c41ed664d0b08cdf15fff04603f375..1db019647c7af7bddf7d27bef8b6cb847c481c8d 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfQ3D.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfQ3D.h @@ -1,13 +1,12 @@ -#ifndef MANTID_MDEVENTS_Q3D_TRANSF_H -#define MANTID_MDEVENTS_Q3D_TRANSF_H +#ifndef MANTID_MDALGORITHMS_Q3D_TRANSF_H +#define MANTID_MDALGORITHMS_Q3D_TRANSF_H // -#include "MantidMDEvents/MDTransfInterface.h" -#include "MantidMDEvents/MDTransfFactory.h" -//#include "MantidMDEvents/MDTransfDEHelper.h" -#include "MantidMDEvents/MDTransfModQ.h" +#include "MantidMDAlgorithms/MDTransfInterface.h" +#include "MantidMDAlgorithms/MDTransfFactory.h" +#include "MantidMDAlgorithms/MDTransfModQ.h" // namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** Class responsible for conversion of input workspace * data into proper number of output dimensions for Q3D case diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSDescription.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDWSDescription.h similarity index 96% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSDescription.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDWSDescription.h index 5487c91648cead13887acdd859852abee07dde3a..884b90cb8445275fb14d96b1b36d39c071dfe59c 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSDescription.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDWSDescription.h @@ -1,25 +1,27 @@ -#ifndef MANTID_MDEVENTS_WS_DESCRIPTION_H -#define MANTID_MDEVENTS_WS_DESCRIPTION_H +#ifndef MANTID_MDALGORITHMS_WS_DESCRIPTION_H +#define MANTID_MDALGORITHMS_WS_DESCRIPTION_H -#include "MantidKernel/PropertyManager.h" +#include "MantidAPI/LogManager.h" #include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/MatrixWorkspace.h" + +#include "MantidGeometry/Crystal/OrientedLattice.h" + #include "MantidKernel/Logger.h" #include "MantidKernel/PhysicalConstants.h" -#include "MantidGeometry/Crystal/OrientedLattice.h" +#include "MantidKernel/PropertyManager.h" -#include "MantidMDEvents/MDEvent.h" +#include "MantidDataObjects/MDEvent.h" #include "MantidDataObjects/TableWorkspace.h" -#include "MantidAPI/LogManager.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /*** Class wrapping together all parameters, related to conversion from a workspace to MDEventoWorkspace * * used to provide common interface for subclasses, dealing with creation of MD workspace and conversion of - * ws data into MDEvents + * ws data into DataObjects * * It also defines some auxiliary functions, used for convenient description of MD workspace @@ -114,7 +116,7 @@ public: // for the time being /// copy some parameters from the input workspace, as target md WS do not have /// all information about the algorithm. void setUpMissingParameters( - const MDEvents::MDWSDescription &SourceMatrixWorkspace); + const MDWSDescription &SourceMatrixWorkspace); /// method builds MD Event ws description from a matrix workspace and the /// transformations, requested to be performed on the workspace @@ -124,7 +126,7 @@ public: // for the time being std::vector<std::string>()); /// compare two descriptions and select the complimentary result. - void checkWSCorresponsMDWorkspace(MDEvents::MDWSDescription &NewMDWorkspace); + void checkWSCorresponsMDWorkspace(MDWSDescription &NewMDWorkspace); void setMinMax(const std::vector<double> &minVal, const std::vector<double> &maxVal); @@ -195,4 +197,4 @@ private: }; } } -#endif \ No newline at end of file +#endif diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSTransform.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDWSTransform.h similarity index 88% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSTransform.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDWSTransform.h index d61ba9c6cc7b07d25dafc55a80d02bb2712a694b..f888dd210e2a958bbe7ceb1b64f80bab8303cbcd 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSTransform.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDWSTransform.h @@ -1,11 +1,11 @@ -#ifndef MANTID_MDEVENTS_MDWS_TRANSFORMATION_H -#define MANTID_MDEVENTS_MDWS_TRANSFORMATION_H +#ifndef MANTID_MDALGORITHMS_MDWS_TRANSFORMATION_H +#define MANTID_MDALGORITHMS_MDWS_TRANSFORMATION_H -#include "MantidMDEvents/MDTransfAxisNames.h" -#include "MantidMDEvents/MDWSDescription.h" +#include "MantidMDAlgorithms/MDTransfAxisNames.h" +#include "MantidMDAlgorithms/MDWSDescription.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /*** The class responsible for building Momentums Transformation Matrix for CnvrtToMD algorithm * from the input parameters of the algorithm and parameters, retrieved from @@ -84,20 +84,18 @@ public: const std::vector<double> &wt); std::vector<double> - getTransfMatrix(MDEvents::MDWSDescription &TargWSDescription, + getTransfMatrix(MDAlgorithms::MDWSDescription &TargWSDescription, const std::string &FrameRequested, const std::string &QScaleRequested) const; /// construct meaningful dimension names for Q3D case and different /// transformation types defined by the class - // void setQ3DDimensionsNames(MDEvents::MDWSDescription - // &TargWSDescription,const std::string &QScaleRequested)const; - void setQ3DDimensionsNames(MDEvents::MDWSDescription &TargWSDescription, + void setQ3DDimensionsNames(MDAlgorithms::MDWSDescription &TargWSDescription, CnvrtToMD::TargetFrame FrameID, CnvrtToMD::CoordScaling scaling) const; /// construct meaningful dimension names for ModQ case and different /// transformation types defined by the class; - void setModQDimensionsNames(MDEvents::MDWSDescription &TargWSDescription, + void setModQDimensionsNames(MDAlgorithms::MDWSDescription &TargWSDescription, const std::string &QScaleRequested) const; /// return the list of possible scalings for momentums std::vector<std::string> getQScalings() const { return m_QScalingID; } @@ -128,7 +126,7 @@ private: protected: // for testing /// function generates "Kind of" W transformation matrix for different /// Q-conversion modes; - Kernel::DblMatrix buildQTrahsf(MDEvents::MDWSDescription &TargWSDescription, + Kernel::DblMatrix buildQTrahsf(MDAlgorithms::MDWSDescription &TargWSDescription, CnvrtToMD::CoordScaling scaling, bool UnitUB = false) const; /// build orthogonal coordinate around two input vecotors u and v expressed in @@ -137,15 +135,15 @@ protected: // for testing // Kernel::V3D &u, const Kernel::V3D &v)const; std::vector<double> - getTransfMatrix(MDEvents::MDWSDescription &TargWSDescription, + getTransfMatrix(MDAlgorithms::MDWSDescription &TargWSDescription, CnvrtToMD::TargetFrame FrameID, CnvrtToMD::CoordScaling &scaling) const; CnvrtToMD::TargetFrame - findTargetFrame(MDEvents::MDWSDescription &TargWSDescription) const; + findTargetFrame(MDAlgorithms::MDWSDescription &TargWSDescription) const; // helper function which verifies, if the input information availble on the // workspace consistent with the frame requiested - void checkTargetFrame(const MDEvents::MDWSDescription &TargWSDescription, + void checkTargetFrame(const MDAlgorithms::MDWSDescription &TargWSDescription, const CnvrtToMD::TargetFrame CoordFrameID) const; }; } diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MergeMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MergeMD.h index 91cdb6c2b1a306403aff2a49dc45d6d9c68d1ad1..07818057fa82d5d12661f81ea18fe3232dd47654 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MergeMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MergeMD.h @@ -1,11 +1,10 @@ #ifndef MANTID_MDALGORITHMS_MERGEMD_H_ #define MANTID_MDALGORITHMS_MERGEMD_H_ -#include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidMDEvents/BoxControllerSettingsAlgorithm.h" #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidMDAlgorithms/BoxControllerSettingsAlgorithm.h" namespace Mantid { namespace MDAlgorithms { @@ -36,7 +35,7 @@ namespace MDAlgorithms { Code Documentation is available at: <http://doxygen.mantidproject.org> */ class DLLExport MergeMD - : public Mantid::MDEvents::BoxControllerSettingsAlgorithm { + : public BoxControllerSettingsAlgorithm { public: MergeMD(); virtual ~MergeMD(); @@ -56,7 +55,7 @@ private: void createOutputWorkspace(std::vector<std::string> &inputs); template <typename MDE, size_t nd> - void doPlus(typename Mantid::MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void doPlus(typename Mantid::DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); /// Vector of input MDWorkspaces std::vector<Mantid::API::IMDEventWorkspace_sptr> m_workspaces; diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MergeMDFiles.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MergeMDFiles.h index a1811bb8852b37d4a50d3075ea8d92d02b3b4657..e168b75547861aec11a49c752debe681cbfec58b 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MergeMDFiles.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MergeMDFiles.h @@ -4,8 +4,8 @@ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDBoxFlatTree.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDBoxFlatTree.h" #include <nexus/NeXusFile.hpp> namespace Mantid { @@ -72,9 +72,9 @@ private: uint64_t loadEventsFromSubBoxes(API::IMDNode *TargetBox); // the class which flatten the box structure and deal with it - MDEvents::MDBoxFlatTree m_BoxStruct; + DataObjects::MDBoxFlatTree m_BoxStruct; // the vector of box structures for contributing files components - std::vector<MDEvents::MDBoxFlatTree> m_fileComponentsStructure; + std::vector<DataObjects::MDBoxFlatTree> m_fileComponentsStructure; protected: /// number of workspace dimensions diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MinusMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MinusMD.h index 276e942a0272fdf0c27f0f53243b6b80ff17f222..180e47fe8fff9514a37e0aa133b2dfda983bcac7 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MinusMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MinusMD.h @@ -54,18 +54,18 @@ private: void checkInputs(); template <typename MDE, size_t nd> - void doMinus(typename Mantid::MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void doMinus(typename Mantid::DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); /// Run the algorithm with an MDEventWorkspace as output void execEvent(); /// Run the algorithm with a MDHisotWorkspace as output and operand - void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand); + void execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand); /// Run the algorithm with a MDHisotWorkspace as output, scalar and operand void - execHistoScalar(Mantid::MDEvents::MDHistoWorkspace_sptr out, + execHistoScalar(Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar); }; diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MultiplyMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MultiplyMD.h index 8ddeab66220a5b55634497c48d44eec3585ed9f1..5378bf803645d99ee841edefc5d923d9b4b511db 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MultiplyMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MultiplyMD.h @@ -4,7 +4,7 @@ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" #include "MantidMDAlgorithms/BinaryOperationMD.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" namespace Mantid { namespace MDAlgorithms { @@ -58,17 +58,17 @@ private: void execEvent(); /// Run the algorithm with a MDHisotWorkspace as output and operand - void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand); + void execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand); /// Run the algorithm with a MDHisotWorkspace as output, scalar and operand void - execHistoScalar(Mantid::MDEvents::MDHistoWorkspace_sptr out, + execHistoScalar(Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar); template <typename MDE, size_t nd> void execEventScalar( - typename Mantid::MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + typename Mantid::DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); }; } // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/NotMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/NotMD.h index 542d8e27a0c8e361a6d1d678b92cda84b01a7d18..a023353bcf491ea4165d42ec82db7109e6088732 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/NotMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/NotMD.h @@ -54,7 +54,7 @@ private: void execEvent(Mantid::API::IMDEventWorkspace_sptr out); /// Run the algorithm with a MDHistoWorkspace - void execHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out); + void execHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out); }; } // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/OneStepMDEW.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/OneStepMDEW.h similarity index 84% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/OneStepMDEW.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/OneStepMDEW.h index cd93dea6be1b5c15c4256e8e4077747cbd7d0164..4916397e4ac91d387fc4197f7f804e192b052f84 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/OneStepMDEW.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/OneStepMDEW.h @@ -1,11 +1,11 @@ -#ifndef MANTID_MDEVENTS_ONESTEPMDEW_H_ -#define MANTID_MDEVENTS_ONESTEPMDEW_H_ +#ifndef MANTID_MDALGORITHMS_ONESTEPMDEW_H_ +#define MANTID_MDALGORITHMS_ONESTEPMDEW_H_ #include "MantidKernel/System.h" #include "MantidAPI/DeprecatedAlgorithm.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** OneStepMDEW : Assumes elastic diffration. Load Event data and immediately *converts to MDEvent with Lorentz correction applied. @@ -39,6 +39,6 @@ private: }; } // namespace Mantid -} // namespace MDEvents +} // namespace MDAlgorithms -#endif /* MANTID_MDEVENTS_ONESTEPMDEW_H_ */ +#endif /* MANTID_MDALGORITHMS_ONESTEPMDEW_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/OrMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/OrMD.h index e845b3477163e683c9253835b8b45a405ac8aa1c..3cc11b1e834d1b68c8fa15221890b9bdb1ed9c9e 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/OrMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/OrMD.h @@ -42,8 +42,8 @@ public: virtual int version() const; private: - void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand); + void execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand); }; } // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/PlusMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/PlusMD.h index 0f885c058e2f8078d25fba082d1d992ba1600edf..bd4207f2396e82aad2b79d55f25141fe3df476a8 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/PlusMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/PlusMD.h @@ -4,7 +4,7 @@ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidMDAlgorithms/BinaryOperationMD.h" namespace Mantid { @@ -62,16 +62,16 @@ private: void execEvent(); /// Run the algorithm with a MDHisotWorkspace as output and operand - void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand); + void execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand); /// Run the algorithm with a MDHisotWorkspace as output, scalar and operand void - execHistoScalar(Mantid::MDEvents::MDHistoWorkspace_sptr out, + execHistoScalar(Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar); template <typename MDE, size_t nd> - void doPlus(typename Mantid::MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void doPlus(typename Mantid::DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); /// Workspace into which stuff will get added Mantid::API::IMDEventWorkspace_sptr iws1; diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/PowerMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/PowerMD.h index bb4b63d36c6985a2a880b3786de513f59a030f2a..1ecb4cf7151a55535b8317f365de3b15c2e2211f 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/PowerMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/PowerMD.h @@ -56,7 +56,7 @@ private: void execEvent(Mantid::API::IMDEventWorkspace_sptr out); /// Run the algorithm with a MDHistoWorkspace - void execHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out); + void execHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out); }; } // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/PreprocessDetectorsToMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/PreprocessDetectorsToMD.h index 146d415305678cadc77d1d556ab37da6b956a422..7464a55bd76b1e3209a19e205b493542fbaa5642 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/PreprocessDetectorsToMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/PreprocessDetectorsToMD.h @@ -86,6 +86,6 @@ protected: // for testing double getEi(const API::MatrixWorkspace_const_sptr &inputWS) const; }; -} // MDEvents +} // DataObjects } // Mantid #endif \ No newline at end of file diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/ResolutionConvolvedCrossSection.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/ResolutionConvolvedCrossSection.h index 70a07db798a71c4d28d31f5718b25f420c977f0e..6282a173f261f8cbacd3d8d7ff6cac78bf33008d 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/ResolutionConvolvedCrossSection.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/ResolutionConvolvedCrossSection.h @@ -23,9 +23,9 @@ Code Documentation is available at: <http://doxygen.mantidproject.org> */ #include "MantidAPI/IFunctionMD.h" -#include "MantidAPI/ParamFunction.h" #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidMDEvents/MDEvent.h" +#include "MantidAPI/ParamFunction.h" +#include "MantidDataObjects/MDEvent.h" namespace Mantid { namespace API { @@ -100,7 +100,7 @@ private: API::IMDEventWorkspace_const_sptr m_inputWS; /// Output events. Need to find a better way to handle other dimensions - mutable std::list<MDEvents::MDEvent<4>> m_simulatedEvents; + mutable std::list<DataObjects::MDEvent<4>> m_simulatedEvents; }; } } diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/SimulateResolutionConvolvedModel.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/SimulateResolutionConvolvedModel.h index 7572149ab690446ad9a896705d8543c42737aae8..99527c8c2b6e578793b80e3ce9a251103d665ab0 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/SimulateResolutionConvolvedModel.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Quantification/SimulateResolutionConvolvedModel.h @@ -2,7 +2,7 @@ #define MANTID_MDALGORITHMS_SIMULATERESOLUTIONCONVOLVEDMODEL_H_ #include "MantidMDAlgorithms/Quantification/FitResolutionConvolvedModel.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" namespace Mantid { namespace API { @@ -66,7 +66,7 @@ private: /// The input domain boost::shared_ptr<API::FunctionValues> m_calculatedValues; /// The output workspace type - typedef MDEvents::MDEventWorkspace<MDEvents::MDEvent<4>, 4> QOmegaWorkspace; + typedef DataObjects::MDEventWorkspace<DataObjects::MDEvent<4>, 4> QOmegaWorkspace; /// The output workspace boost::shared_ptr<QOmegaWorkspace> m_outputWS; diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/QueryMDWorkspace.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/QueryMDWorkspace.h similarity index 83% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/QueryMDWorkspace.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/QueryMDWorkspace.h index e9ad55e0b2ad9be9e8cda9d477dfa7c3d497d6d5..02339cc8cdcf1043882f351de447542a5d191ae3 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/QueryMDWorkspace.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/QueryMDWorkspace.h @@ -1,12 +1,11 @@ -#ifndef MANTID_MDEVENTS_QUERYMDWORKSPACE_H_ -#define MANTID_MDEVENTS_QUERYMDWORKSPACE_H_ +#ifndef MANTID_MDALGORITHMS_QUERYMDWORKSPACE_H_ +#define MANTID_MDALGORITHMS_QUERYMDWORKSPACE_H_ -#include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** QueryMDWorkspace : Query an MDWorkspace in order to extract overview information as a table workspace. Signal and Error squared values as well as @@ -41,14 +40,14 @@ public: virtual ~QueryMDWorkspace(); /// Algorithm's name for identification - virtual const std::string name() const { return "QueryMDWorkspace"; }; + virtual const std::string name() const { return "QueryMDWorkspace"; } /// Summary of algorithms purpose virtual const std::string summary() const { return "Query the IMDWorkspace in order to extract summary information."; } /// Algorithm's version for identification - virtual int version() const { return 1; }; + virtual int version() const { return 1; } /// Algorithm's category for identification virtual const std::string category() const { return "MDAlgorithms"; } @@ -60,10 +59,10 @@ private: template <typename MDE, size_t nd> void - getBoxData(typename Mantid::MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + getBoxData(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); }; -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid -#endif /* MANTID_MDEVENTS_QUERYMDWORKSPACE_H_ */ +#endif /* MANTID_MDALGORITHMS_QUERYMDWORKSPACE_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransform.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ReflectometryTransform.h similarity index 86% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransform.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ReflectometryTransform.h index a48f0b259408330b097a20e86452cb55cca27a2a..e2a46f13001712cb67fba5167f8176ae681d34d0 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransform.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ReflectometryTransform.h @@ -1,17 +1,17 @@ -#ifndef MANTID_MDEVENTS_REFLECTOMETRYMDTRANFORM_H_ -#define MANTID_MDEVENTS_REFLECTOMETRYMDTRANFORM_H_ +#ifndef MANTID_MDALGORITHMS_REFLECTOMETRYMDTRANFORM_H_ +#define MANTID_MDALGORITHMS_REFLECTOMETRYMDTRANFORM_H_ -#include "MantidKernel/System.h" +#include "MantidAPI/BoxController.h" #include "MantidAPI/IEventWorkspace.h" #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidAPI/BoxController.h" + +#include "MantidDataObjects/MDEventFactory.h" namespace Mantid { namespace API { class MatrixWorkspace; } -namespace MDEvents { +namespace MDAlgorithms { /** ReflectometryMDTransform : Abstract type for reflectometry transforms to MDWorkspaces. This is a Strategy Design Pattern. @@ -45,10 +45,10 @@ protected: const size_t m_nbinsx; const size_t m_nbinsz; - boost::shared_ptr<MDEventWorkspace2Lean> - createMDWorkspace(Mantid::Geometry::IMDDimension_sptr, - Mantid::Geometry::IMDDimension_sptr, - Mantid::API::BoxController_sptr boxController) const; + boost::shared_ptr<DataObjects::MDEventWorkspace2Lean> + createMDWorkspace(Geometry::IMDDimension_sptr, + Geometry::IMDDimension_sptr, + API::BoxController_sptr boxController) const; public: // Execute the strategy to produce a transformed, output MDWorkspace diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformKiKf.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ReflectometryTransformKiKf.h similarity index 90% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformKiKf.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ReflectometryTransformKiKf.h index d33861ca56a7ed68e24432dcf4f24cfe1312a373..7377059cb3937ca13705461c0bf3d534974e35f6 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformKiKf.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ReflectometryTransformKiKf.h @@ -1,16 +1,17 @@ -#ifndef MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMKIKF_H_ -#define MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMKIKF_H_ +#ifndef MANTID_MDALGORITHMS_REFLECTOMETRYTRANSFORMKIKF_H_ +#define MANTID_MDALGORITHMS_REFLECTOMETRYTRANSFORMKIKF_H_ #include <cmath> -#include "MantidKernel/System.h" #include "MantidKernel/ClassMacros.h" -#include "MantidAPI/MatrixWorkspace.h" + #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidMDEvents/ReflectometryTransform.h" +#include "MantidAPI/MatrixWorkspace.h" + +#include "MantidMDAlgorithms/ReflectometryTransform.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** class CalculateReflectometryK: Calculation type for converting to ki or kf given a theta value (in degrees) and a wavelength @@ -85,7 +86,7 @@ private: DISABLE_COPY_AND_ASSIGN(ReflectometryTransformKiKf) }; -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid -#endif /* MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMKIKF_H_ */ +#endif /* MANTID_MDALGORITHMS_REFLECTOMETRYTRANSFORMKIKF_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformP.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ReflectometryTransformP.h similarity index 91% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformP.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ReflectometryTransformP.h index 237b88e25d450408bbdf092160366853e778a5ac..7f8bc4ad8b752de9d6d94e8b623d42aff7a05976 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformP.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ReflectometryTransformP.h @@ -1,13 +1,12 @@ -#ifndef MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMP_H_ -#define MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMP_H_ +#ifndef MANTID_MDALGORITHMS_REFLECTOMETRYTRANSFORMP_H_ +#define MANTID_MDALGORITHMS_REFLECTOMETRYTRANSFORMP_H_ #include <cmath> -#include "MantidKernel/System.h" -#include "MantidMDEvents/ReflectometryTransform.h" +#include "MantidMDAlgorithms/ReflectometryTransform.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** class CalculateReflectometryPBase: Base class for p-type transforms. @@ -35,7 +34,6 @@ class CalculateReflectometryDiffP : public CalculateReflectometryPBase { public: CalculateReflectometryDiffP(const double &thetaInitial) : CalculateReflectometryPBase(thetaInitial) {} - ~CalculateReflectometryDiffP(){}; double execute(const double &wavelength) { double wavenumber = 2 * M_PI / wavelength; double ki = wavenumber * m_sinThetaInitial; @@ -110,7 +108,7 @@ public: execute(Mantid::API::MatrixWorkspace_const_sptr inputWs) const; }; -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid -#endif /* MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMP_H_ */ +#endif /* MANTID_MDALGORITHMS_REFLECTOMETRYTRANSFORMP_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformQxQz.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ReflectometryTransformQxQz.h similarity index 92% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformQxQz.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ReflectometryTransformQxQz.h index 2d7f86bd2ec1e7bf4673a0a172896c79cf631b8f..d7bf30a5f4c60bbbd7a45e6b0896ef1e08878f50 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/ReflectometryTransformQxQz.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ReflectometryTransformQxQz.h @@ -1,14 +1,13 @@ -#ifndef MANTID_MDEVENTS_REFLECTOMETRYTRANFORMQXQZ_H_ -#define MANTID_MDEVENTS_REFLECTOMETRYTRANFORMQXQZ_H_ +#ifndef MANTID_MDALGORITHMS_REFLECTOMETRYTRANFORMQXQZ_H_ +#define MANTID_MDALGORITHMS_REFLECTOMETRYTRANFORMQXQZ_H_ -#include "MantidKernel/System.h" +#include "MantidMDAlgorithms/ReflectometryTransform.h" +#include "MantidMDAlgorithms/CalculateReflectometryQBase.h" #include "MantidKernel/ClassMacros.h" -#include "MantidMDEvents/ReflectometryTransform.h" -#include "MantidMDEvents/CalculateReflectometryQBase.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** Converts from inputs of wavelength, incident theta and final theta to Qx for @@ -140,7 +139,7 @@ private: DISABLE_COPY_AND_ASSIGN(ReflectometryTransformQxQz) }; -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid -#endif /* MANTID_MDEVENTS_REFLECTOMETRYTRANFORMQXQZ_H_ */ +#endif /* MANTID_MDALGORITHMS_REFLECTOMETRYTRANFORMQXQZ_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/SaveIsawQvector.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SaveIsawQvector.h similarity index 85% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/SaveIsawQvector.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SaveIsawQvector.h index 4e53fb7c0b802c15b3de817d288acecf3f61addb..1b774e3bfbd9319a7a332bea7b500adf13fa24d7 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/SaveIsawQvector.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SaveIsawQvector.h @@ -1,14 +1,14 @@ -#ifndef MANTID_MDEVENTS_SAVEISAWQVECTOR_H_ -#define MANTID_MDEVENTS_SAVEISAWQVECTOR_H_ +#ifndef MANTID_MDALGORITHMS_SAVEISAWQVECTOR_H_ +#define MANTID_MDALGORITHMS_SAVEISAWQVECTOR_H_ #include "MantidAPI/Algorithm.h" #include "MantidDataObjects/EventWorkspace.h" -#include "MantidMDEvents/MDWSDescription.h" +#include "MantidMDAlgorithms//MDWSDescription.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { -/** SaveIsawQvector : TODO: DESCRIPTION +/** SaveIsawQvector Copyright © 2012 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source @@ -54,7 +54,7 @@ private: void initTargetWSDescr(DataObjects::EventWorkspace_sptr wksp); }; -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid -#endif /* MANTID_MDEVENTS_SAVEISAWQVECTOR_H_ */ +#endif /* MANTID_MDALGORITHMS_SAVEISAWQVECTOR_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SaveMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SaveMD.h index df204ed45564f5cef454ccbbd653a452ba2ae992..dbc944730f4ec1c17e825ff2f70c93ae4e5bc38d 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SaveMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SaveMD.h @@ -1,9 +1,9 @@ -#ifndef MANTID_MDEVENTS_SAVEMD_H_ -#define MANTID_MDEVENTS_SAVEMD_H_ +#ifndef MANTID_MDALGORITHMS_SAVEMD_H_ +#define MANTID_MDALGORITHMS_SAVEMD_H_ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" namespace Mantid { @@ -60,10 +60,10 @@ private: /// Helper method template <typename MDE, size_t nd> - void doSaveEvents(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void doSaveEvents(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); /// Save the MDHistoWorkspace. - void doSaveHisto(Mantid::MDEvents::MDHistoWorkspace_sptr ws); + void doSaveHisto(Mantid::DataObjects::MDHistoWorkspace_sptr ws); /// Save all the affine matricies void saveAffineTransformMatricies(::NeXus::File *const file, @@ -79,7 +79,7 @@ private: std::string tag = ""); }; -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid -#endif /* MANTID_MDEVENTS_SAVEMD_H_ */ +#endif /* MANTID_MDALGORITHMS_SAVEMD_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SliceMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SliceMD.h index c53a24e7ae16485309d3e9696539931e0fa5edd0..d7683aa70935f7d813ce636a82424668fc8adc4b 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SliceMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SliceMD.h @@ -1,9 +1,9 @@ -#ifndef MANTID_MDEVENTS_SLICEMD_H_ -#define MANTID_MDEVENTS_SLICEMD_H_ +#ifndef MANTID_MDALGORITHMS_SLICEMD_H_ +#define MANTID_MDALGORITHMS_SLICEMD_H_ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidMDAlgorithms/SlicingAlgorithm.h" namespace Mantid { @@ -71,11 +71,11 @@ private: /// Helper method template <typename MDE, size_t nd> - void doExec(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void doExec(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); /// Method to actually do the slice template <typename MDE, size_t nd, typename OMDE, size_t ond> - void slice(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + void slice(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); protected: // for testing /* /// Method to slice box's events if the box itself belongs to the slice @@ -87,7 +87,7 @@ protected: // for testing chunkMax);*/ }; -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid -#endif /* MANTID_MDEVENTS_SLICEMD_H_ */ +#endif /* MANTID_MDALGORITHMS_SLICEMD_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SlicingAlgorithm.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SlicingAlgorithm.h index eec87bcf1800d2fe581c5b70b95c1d52dad36121..dbcb8fd542d0e08e1b223cdd018fb362afaaa898 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SlicingAlgorithm.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/SlicingAlgorithm.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_SLICINGALGORITHM_H_ -#define MANTID_MDEVENTS_SLICINGALGORITHM_H_ +#ifndef MANTID_MDALGORITHMS_SLICINGALGORITHM_H_ +#define MANTID_MDALGORITHMS_SLICINGALGORITHM_H_ #include "MantidAPI/Algorithm.h" #include "MantidAPI/CoordTransform.h" @@ -9,11 +9,11 @@ #include "MantidGeometry/MDGeometry/MDImplicitFunction.h" #include "MantidKernel/System.h" #include "MantidKernel/VMD.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" -#include "MantidMDEvents/CoordTransformAffine.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" +#include "MantidDataObjects/CoordTransformAffine.h" namespace Mantid { namespace MDAlgorithms { @@ -107,9 +107,9 @@ protected: Mantid::API::IMDWorkspace_sptr m_intermediateWS; /// Coordinate transformation to save in the output WS, from the intermediate /// WS - Mantid::MDEvents::CoordTransformAffine *m_transformFromIntermediate; + Mantid::DataObjects::CoordTransformAffine *m_transformFromIntermediate; /// Coordinate transformation to save in the intermediate WS - Mantid::MDEvents::CoordTransformAffine *m_transformToIntermediate; + Mantid::DataObjects::CoordTransformAffine *m_transformToIntermediate; /// Set to true if the cut is aligned with the axes bool m_axisAligned; @@ -152,7 +152,7 @@ protected: bool m_NormalizeBasisVectors; }; -} // namespace MDEvents +} // namespace DataObjects } // namespace Mantid -#endif /* MANTID_MDEVENTS_SLICINGALGORITHM_H_ */ +#endif /* MANTID_MDALGORITHMS_SLICINGALGORITHM_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/TransformMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/TransformMD.h index 2efc994e8f0e8bbae7030301d2bd537445956709..33cc64046faab47067d2e6309a20e685c2583273 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/TransformMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/TransformMD.h @@ -3,7 +3,7 @@ #include "MantidKernel/System.h" #include "MantidAPI/Algorithm.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" namespace Mantid { namespace MDAlgorithms { @@ -53,7 +53,7 @@ private: template <typename MDE, size_t nd> void - doTransform(typename Mantid::MDEvents::MDEventWorkspace<MDE, nd>::sptr ws); + doTransform(typename Mantid::DataObjects::MDEventWorkspace<MDE, nd>::sptr ws); std::vector<double> m_scaling; std::vector<double> m_offset; diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/UnaryOperationMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/UnaryOperationMD.h index b699c82e00e3cfe67b43497fa8fc02be4611f221..4ccb41c67d42ab153dac132f8c4e16b381c437b1 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/UnaryOperationMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/UnaryOperationMD.h @@ -5,7 +5,7 @@ #include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/IMDWorkspace.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" namespace Mantid { namespace MDAlgorithms { @@ -63,7 +63,7 @@ protected: virtual void execEvent(Mantid::API::IMDEventWorkspace_sptr out) = 0; /// Run the algorithm with a MDHistoWorkspace - virtual void execHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out) = 0; + virtual void execHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out) = 0; /// Input workspace Mantid::API::IMDWorkspace_sptr m_in; @@ -72,7 +72,7 @@ protected: Mantid::API::IMDEventWorkspace_sptr m_in_event; /// Input workspace (MDHisto) - Mantid::MDEvents::MDHistoWorkspace_sptr m_in_histo; + Mantid::DataObjects::MDHistoWorkspace_sptr m_in_histo; /// Output workspace Mantid::API::IMDWorkspace_sptr m_out; diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/UnitsConversionHelper.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/UnitsConversionHelper.h similarity index 94% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/UnitsConversionHelper.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/UnitsConversionHelper.h index 74c471a3c7e7b82f5c347dfc90c48ec6dc6bbac2..aa2e48093ffcfeed81ed7ee7e94183f84fa23e09 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/UnitsConversionHelper.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/UnitsConversionHelper.h @@ -1,15 +1,15 @@ -#ifndef MANTID_MDEVENTS_UNIT_CONVERSION_HELPER_H -#define MANTID_MDEVENTS_UNIT_CONVERSION_HELPER_H +#ifndef MANTID_MDALGORITHMS_UNIT_CONVERSION_HELPER_H +#define MANTID_MDALGORITHMS_UNIT_CONVERSION_HELPER_H //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- #include "MantidKernel/Unit.h" #include "MantidAPI/MatrixWorkspace.h" -#include "MantidMDEvents/MDWSDescription.h" +#include "MantidMDAlgorithms/MDWSDescription.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** The class helps to organize unit conversion when running transformation from a matrix(event) workspace into MD event workspace @@ -94,7 +94,7 @@ protected: // for testing bool forceViaTOF = false); }; -} // endNamespace MDEvents +} // endNamespace DataObjects } // endNamespace Mantid -#endif \ No newline at end of file +#endif diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/UserFunctionMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/UserFunctionMD.h similarity index 93% rename from Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/UserFunctionMD.h rename to Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/UserFunctionMD.h index d7af8f269ae265102ec4a1a3b6e2f3c906099847..92cd440ae81edd7a6e08a9063ca37ad53854d397 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/UserFunctionMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/UserFunctionMD.h @@ -1,5 +1,5 @@ -#ifndef MANTID_MDEVENTS_USERFUNCTIONMD_H_ -#define MANTID_MDEVENTS_USERFUNCTIONMD_H_ +#ifndef MANTID_MDALGORITHMS_USERFUNCTIONMD_H_ +#define MANTID_MDALGORITHMS_USERFUNCTIONMD_H_ //---------------------------------------------------------------------- // Includes @@ -9,7 +9,7 @@ #include "MantidGeometry/muParser_Silent.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** A user defined function. @@ -81,7 +81,7 @@ private: std::string m_formula; }; -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid -#endif /*MANTID_MDEVENTS_USERFUNCTIONMD_H_*/ +#endif /*MANTID_MDALGORITHMS_USERFUNCTIONMD_H_*/ diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/WeightedMeanMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/WeightedMeanMD.h index 03416b95ac81580aa08ec1be58151c109fdce312..8fd1965ef6e24d46af985f2eb69c7a63a96a193d 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/WeightedMeanMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/WeightedMeanMD.h @@ -2,7 +2,7 @@ #define MANTID_MDALGORITHMS_WEIGHTEDMEANMD_H_ #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidMDAlgorithms/BinaryOperationMD.h" namespace Mantid { @@ -59,12 +59,12 @@ private: void execEvent(); /// Run the algorithm with a MDHisotWorkspace as output and operand - void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand); + void execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand); /// Run the algorithm with a MDHisotWorkspace as output, scalar and operand void - execHistoScalar(Mantid::MDEvents::MDHistoWorkspace_sptr out, + execHistoScalar(Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar); }; diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/XorMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/XorMD.h index 0d1b2e0feec30f576b705d8f5160cdab547ff27f..4e2d46a08bde9944018879b9a2af58987468c909 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/XorMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/XorMD.h @@ -42,8 +42,8 @@ public: virtual int version() const; private: - void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand); + void execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand); }; } // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDAlgorithms/src/AndMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/AndMD.cpp index 4f18cf8d18502c6e8cd7166b66c9c6917d47a298..596f64c9b0369ba01804e0c4434142e8107bd654 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/AndMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/AndMD.cpp @@ -1,5 +1,4 @@ #include "MantidMDAlgorithms/AndMD.h" -#include "MantidKernel/System.h" using namespace Mantid::Kernel; using namespace Mantid::API; @@ -30,8 +29,8 @@ int AndMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand void -AndMD::execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand) { +AndMD::execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand) { out->operator&=(*operand); } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/BinMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/BinMD.cpp index 418ef2789c7d9a2313f2aff7063094c83fb46981..25772e258465cd89adab2cf7a22e137605b6b035 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/BinMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/BinMD.cpp @@ -5,17 +5,17 @@ #include "MantidKernel/Strings.h" #include "MantidKernel/System.h" #include "MantidKernel/Utils.h" -#include "MantidMDEvents/CoordTransformAffineParser.h" -#include "MantidMDEvents/CoordTransformAligned.h" -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/CoordTransformAffineParser.h" +#include "MantidDataObjects/CoordTransformAligned.h" +#include "MantidDataObjects/MDBoxBase.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidMDAlgorithms/BinMD.h" #include <boost/algorithm/string.hpp> #include "MantidKernel/EnabledWhenProperty.h" -#include "MantidMDEvents/CoordTransformAffine.h" +#include "MantidDataObjects/CoordTransformAffine.h" using Mantid::Kernel::CPUTimer; using Mantid::Kernel::EnabledWhenProperty; @@ -29,7 +29,7 @@ DECLARE_ALGORITHM(BinMD) using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; //---------------------------------------------------------------------------------------------- /** Constructor @@ -163,7 +163,7 @@ inline void BinMD::binMDBox(MDBox<MDE, nd> *box, const size_t *const chunkMin, // Add the CACHED signal from the entire box signals[lastLinearIndex] += box->getSignal(); errors[lastLinearIndex] += box->getErrorSquared(); - // TODO: If MDEvents get a weight, this would need to get the summed + // TODO: If DataObjects get a weight, this would need to get the summed // weight. numEvents[lastLinearIndex] += static_cast<signal_t>(box->getNPoints()); @@ -213,7 +213,7 @@ inline void BinMD::binMDBox(MDBox<MDE, nd> *box, const size_t *const chunkMin, // Sum the signals as doubles to preserve precision signals[linearIndex] += static_cast<signal_t>(it->getSignal()); errors[linearIndex] += static_cast<signal_t>(it->getErrorSquared()); - // TODO: If MDEvents get a weight, this would need to get the summed + // TODO: If DataObjects get a weight, this would need to get the summed // weight. numEvents[linearIndex] += 1.0; } @@ -426,4 +426,4 @@ void BinMD::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDAlgorithms/src/BinaryOperationMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/BinaryOperationMD.cpp index c618b3692d4518e8986f7d6e6e7f32e06f5ed94f..58c4371b8964673c701097e2c686cd42f76d7639 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/BinaryOperationMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/BinaryOperationMD.cpp @@ -2,8 +2,8 @@ #include "MantidKernel/System.h" #include "MantidAPI/IMDWorkspace.h" #include "MantidDataObjects/WorkspaceSingleValue.h" -#include "MantidMDEvents/MDHistoWorkspace.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDHistoWorkspace.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/WorkspaceProperty.h" @@ -11,7 +11,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::DataObjects; using Mantid::Geometry::IMDDimension_const_sptr; diff --git a/Code/Mantid/Framework/MDAlgorithms/src/BooleanBinaryOperationMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/BooleanBinaryOperationMD.cpp index 26d6ce085794916100f135b842e07bb25c8ae737..40d804e3ca3e3a6cdd754673f4a46c6c97731035 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/BooleanBinaryOperationMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/BooleanBinaryOperationMD.cpp @@ -63,7 +63,7 @@ void BooleanBinaryOperationMD::execEvent() { //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output, scalar and operand void BooleanBinaryOperationMD::execHistoScalar( - Mantid::MDEvents::MDHistoWorkspace_sptr /*out*/, + Mantid::DataObjects::MDHistoWorkspace_sptr /*out*/, Mantid::DataObjects::WorkspaceSingleValue_const_sptr /*scalar*/) { throw std::runtime_error("Cannot perform the " + this->name() + " operation on a WorkspaceSingleValue."); diff --git a/Code/Mantid/Framework/MDEvents/src/BoxControllerSettingsAlgorithm.cpp b/Code/Mantid/Framework/MDAlgorithms/src/BoxControllerSettingsAlgorithm.cpp similarity index 98% rename from Code/Mantid/Framework/MDEvents/src/BoxControllerSettingsAlgorithm.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/BoxControllerSettingsAlgorithm.cpp index 3faab863271be2946a20a140f463c3470084eb75..9f2fd500fc25f28eb9062662bbced9473e1127d9 100644 --- a/Code/Mantid/Framework/MDEvents/src/BoxControllerSettingsAlgorithm.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/BoxControllerSettingsAlgorithm.cpp @@ -1,4 +1,4 @@ -#include "MantidMDEvents/BoxControllerSettingsAlgorithm.h" +#include "MantidMDAlgorithms/BoxControllerSettingsAlgorithm.h" #include "MantidKernel/System.h" #include "MantidKernel/Strings.h" #include "MantidKernel/ArrayProperty.h" @@ -8,7 +8,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { //---------------------------------------------------------------------------------------------- /** Constructor @@ -160,4 +160,4 @@ void BoxControllerSettingsAlgorithm::setBoxController(BoxController_sptr bc) { } } // namespace Mantid -} // namespace MDEvents +} // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp b/Code/Mantid/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp index 9a435bf5db1b499e9be40c1bc8fe4f5d422009d4..bf8e2b171d087986687d723b52f7e0a4f54c0522 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp @@ -1,6 +1,6 @@ #include "MantidMDAlgorithms/CalculateCoverageDGS.h" #include "MantidAPI/WorkspaceValidators.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidKernel/ArrayProperty.h" #include "MantidKernel/ArrayLengthValidator.h" #include "MantidKernel/BoundedValidator.h" @@ -15,7 +15,7 @@ namespace MDAlgorithms { using namespace Mantid::Kernel; using Mantid::API::WorkspaceProperty; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; namespace { diff --git a/Code/Mantid/Framework/MDEvents/src/CalculateReflectometryQBase.cpp b/Code/Mantid/Framework/MDAlgorithms/src/CalculateReflectometryQBase.cpp similarity index 70% rename from Code/Mantid/Framework/MDEvents/src/CalculateReflectometryQBase.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/CalculateReflectometryQBase.cpp index a77644d83581f40eea4a7c6baee52b7885ed407c..260802305abd036d28f22d16a66138ca05865955 100644 --- a/Code/Mantid/Framework/MDEvents/src/CalculateReflectometryQBase.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/CalculateReflectometryQBase.cpp @@ -1,8 +1,8 @@ -#include "MantidMDEvents/CalculateReflectometryQBase.h" +#include "MantidMDAlgorithms/CalculateReflectometryQBase.h" #include <cmath> namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { CalculateReflectometryQBase::CalculateReflectometryQBase() : to_radians_factor(M_PI / 180) {} diff --git a/Code/Mantid/Framework/MDAlgorithms/src/CentroidPeaksMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/CentroidPeaksMD.cpp index 43e8c56db0320cb3542ba539a3a5579d944d3d77..ebca0a474b7a2d11b50ff6a6c8907b411ada50a8 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/CentroidPeaksMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/CentroidPeaksMD.cpp @@ -2,8 +2,8 @@ #include "MantidKernel/ListValidator.h" #include "MantidAPI/IMDEventWorkspace.h" #include "MantidDataObjects/PeaksWorkspace.h" -#include "MantidMDEvents/CoordTransformDistance.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/CoordTransformDistance.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidMDAlgorithms/IntegratePeaksMD.h" #include "MantidMDAlgorithms/CentroidPeaksMD.h" @@ -19,7 +19,7 @@ using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::Geometry; using namespace Mantid::Kernel; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; //---------------------------------------------------------------------------------------------- /** Constructor @@ -184,4 +184,4 @@ void CentroidPeaksMD::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDAlgorithms/src/CentroidPeaksMD2.cpp b/Code/Mantid/Framework/MDAlgorithms/src/CentroidPeaksMD2.cpp index 84c33588c1728daa3199093d0326fce3581c5822..f152fd9c55ae11d684077b9a76c908e7024b719e 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/CentroidPeaksMD2.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/CentroidPeaksMD2.cpp @@ -2,8 +2,8 @@ #include "MantidKernel/ListValidator.h" #include "MantidAPI/IMDEventWorkspace.h" #include "MantidDataObjects/PeaksWorkspace.h" -#include "MantidMDEvents/CoordTransformDistance.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/CoordTransformDistance.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidMDAlgorithms/IntegratePeaksMD.h" #include "MantidMDAlgorithms/CentroidPeaksMD2.h" @@ -19,7 +19,7 @@ using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::Geometry; using namespace Mantid::Kernel; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; //---------------------------------------------------------------------------------------------- /** Constructor @@ -174,4 +174,4 @@ void CentroidPeaksMD2::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDAlgorithms/src/CloneMDWorkspace.cpp b/Code/Mantid/Framework/MDAlgorithms/src/CloneMDWorkspace.cpp index 0ebe5d5d9404f63b630f7b2dc863a2920c723334..31f8607da61b0ac35487801e2518588c2808e8ef 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/CloneMDWorkspace.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/CloneMDWorkspace.cpp @@ -1,15 +1,15 @@ #include "MantidAPI/IMDEventWorkspace.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include <Poco/File.h> #include <Poco/Path.h> #include "MantidAPI/FileProperty.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidMDAlgorithms/CloneMDWorkspace.h" using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { @@ -142,4 +142,4 @@ void CloneMDWorkspace::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDAlgorithms/src/CompareMDWorkspaces.cpp b/Code/Mantid/Framework/MDAlgorithms/src/CompareMDWorkspaces.cpp index 28178f447fa3f61fec2290e4a5c8209cda0dbd1c..7eb692273ab5a80a0fdca343c938b3cc56d9ac7c 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/CompareMDWorkspaces.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/CompareMDWorkspaces.cpp @@ -3,13 +3,13 @@ #include "MantidKernel/Strings.h" #include "MantidKernel/System.h" #include "MantidMDAlgorithms/CompareMDWorkspaces.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidGeometry/MDGeometry/IMDDimension.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; //============================================================================= @@ -158,8 +158,8 @@ CompareMDWorkspaces::compareMDGeometry(Mantid::API::IMDWorkspace_sptr ws1, /** Compare the dimensions etc. of two MDWorkspaces */ void CompareMDWorkspaces::compareMDHistoWorkspaces( - Mantid::MDEvents::MDHistoWorkspace_sptr ws1, - Mantid::MDEvents::MDHistoWorkspace_sptr ws2) { + Mantid::DataObjects::MDHistoWorkspace_sptr ws1, + Mantid::DataObjects::MDHistoWorkspace_sptr ws2) { compare(ws1->getNumDims(), ws2->getNumDims(), "Workspaces have a different number of dimensions"); compare(ws1->getNPoints(), ws2->getNPoints(), diff --git a/Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvToMDBase.cpp similarity index 95% rename from Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/ConvToMDBase.cpp index 34beee6fd332e6437181aeded445836a1df17d7a..133cdb99934cf54d248bddcec69426d7de8afcb9 100644 --- a/Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvToMDBase.cpp @@ -1,7 +1,7 @@ -#include "MantidMDEvents/ConvToMDBase.h" +#include "MantidMDAlgorithms/ConvToMDBase.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { // logger for conversion Kernel::Logger ConvToMDBase::g_Log("MD-Algorithms"); @@ -18,8 +18,8 @@ Kernel::Logger ConvToMDBase::g_Log("MD-Algorithms"); * events into resulting MD workspace. By false(default), they do. */ size_t ConvToMDBase::initialize( - const MDEvents::MDWSDescription &WSD, - boost::shared_ptr<MDEvents::MDEventWSWrapper> inWSWrapper, + const MDAlgorithms::MDWSDescription &WSD, + boost::shared_ptr<MDAlgorithms::MDEventWSWrapper> inWSWrapper, bool ignoreZeros) { m_ignoreZeros = ignoreZeros; diff --git a/Code/Mantid/Framework/MDEvents/src/ConvToMDEventsWS.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp similarity index 96% rename from Code/Mantid/Framework/MDEvents/src/ConvToMDEventsWS.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp index 3015cc6ff6f870c7287f66d9b86f5c6d3ae970cf..df99f02ffa983e83d4a6d4b64f9bc7e66ce15d7a 100644 --- a/Code/Mantid/Framework/MDEvents/src/ConvToMDEventsWS.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp @@ -1,8 +1,9 @@ -#include "MantidMDEvents/ConvToMDEventsWS.h" -#include "MantidMDEvents/UnitsConversionHelper.h" +#include "MantidMDAlgorithms/ConvToMDEventsWS.h" + +#include "MantidMDAlgorithms/UnitsConversionHelper.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /**function converts particular list of events of type T into MD workspace and * adds these events to the workspace itself */ template <class T> @@ -99,8 +100,8 @@ workspaces @param ignoreZeros -- if zero value signals should be rejected */ size_t ConvToMDEventsWS::initialize( - const MDEvents::MDWSDescription &WSD, - boost::shared_ptr<MDEvents::MDEventWSWrapper> inWSWrapper, + const MDWSDescription &WSD, + boost::shared_ptr<MDEventWSWrapper> inWSWrapper, bool ignoreZeros) { size_t numSpec = ConvToMDBase::initialize(WSD, inWSWrapper, ignoreZeros); @@ -202,5 +203,5 @@ void ConvToMDEventsWS::runConversion(API::Progress *pProgress) { m_OutWSWrapper->pWorkspace()->setCoordinateSystem(m_coordinateSystem); } -} // endNamespace MDEvents +} // endNamespace DataObjects } // endNamespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/src/ConvToMDHistoWS.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvToMDHistoWS.cpp similarity index 96% rename from Code/Mantid/Framework/MDEvents/src/ConvToMDHistoWS.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/ConvToMDHistoWS.cpp index 1210c81ea4ed97f76e7dc1ee97155fadb6bd72fd..2890e99c3b712d26ca6ac6086dc56f284f9cc779 100644 --- a/Code/Mantid/Framework/MDEvents/src/ConvToMDHistoWS.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvToMDHistoWS.cpp @@ -1,7 +1,7 @@ -#include "MantidMDEvents/ConvToMDHistoWS.h" +#include "MantidMDAlgorithms/ConvToMDHistoWS.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { // service variable used for efficient filling of the MD event WS -> should be // moved to configuration? #define DATA_BUFFER_SIZE 8192 @@ -20,8 +20,8 @@ workspaces @param ignoreZeros -- if zero value signals should be rejected */ size_t ConvToMDHistoWS::initialize( - const MDEvents::MDWSDescription &WSD, - boost::shared_ptr<MDEvents::MDEventWSWrapper> inWSWrapper, + const MDWSDescription &WSD, + boost::shared_ptr<MDEventWSWrapper> inWSWrapper, bool ignoreZeros) { size_t numSpec = ConvToMDBase::initialize(WSD, inWSWrapper, ignoreZeros); @@ -31,7 +31,7 @@ size_t ConvToMDHistoWS::initialize( boost::dynamic_pointer_cast<const DataObjects::Workspace2D>(m_InWS2D); if (!pWS2D) throw(std::logic_error( - "ConvToMDEventsHisto should work with defined histrogram workspace")); + "ConvToDataObjectsHisto should work with defined histrogram workspace")); return numSpec; } @@ -258,7 +258,7 @@ void ConvToMDHistoWS::runConversion(API::Progress *pProgress) { m_OutWSWrapper->pWorkspace()->setCoordinateSystem(m_coordinateSystem); } /**function calculates the size of temporary memory used to keep convertTo MD -* data before these data should be added to MDEvents +* data before these data should be added to DataObjects * @param nThreads -- number of threads used to process data * @param specSize -- the size of single spectra in matrix workspace; * @param nPointsToProcess -- total number of data points in the workspace @@ -278,5 +278,5 @@ void ConvToMDHistoWS::estimateThreadWork(size_t nThreads, size_t specSize, m_spectraChunk = std::max(nSpectras / nThreads, static_cast<size_t>(1)); } -} // endNamespace MDEvents +} // endNamespace DataObjects } // endNamespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/src/ConvToMDSelector.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvToMDSelector.cpp similarity index 82% rename from Code/Mantid/Framework/MDEvents/src/ConvToMDSelector.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/ConvToMDSelector.cpp index 12fd075a015e3fb5d9ce5091ec7d1d6a5c2f13c6..56a3d70e62a062d9b65e9e8072ebee67af82aa59 100644 --- a/Code/Mantid/Framework/MDEvents/src/ConvToMDSelector.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvToMDSelector.cpp @@ -1,7 +1,12 @@ -#include "MantidMDEvents/ConvToMDSelector.h" +#include "MantidMDAlgorithms/ConvToMDSelector.h" + +#include "MantidDataObjects/EventWorkspace.h" +#include "MantidDataObjects/Workspace2D.h" +#include "MantidMDAlgorithms/ConvToMDEventsWS.h" +#include "MantidMDAlgorithms/ConvToMDHistoWS.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { // workspaces which currently can be converted to md workspaces: enum wsType { Matrix2DWS, //< Workspace2D @@ -27,7 +32,7 @@ boost::shared_ptr<ConvToMDBase> ConvToMDSelector::convSelector( inputWSType = Matrix2DWS; if (inputWSType == Undefined) - throw(std::invalid_argument("ConvToMDEventsSelector::got a workspace which " + throw(std::invalid_argument("ConvToDataObjectsSelector::got a workspace which " "is neither matrix nor event workspace; Can " "not deal with it")); @@ -51,7 +56,7 @@ boost::shared_ptr<ConvToMDBase> ConvToMDSelector::convSelector( return boost::shared_ptr<ConvToMDBase>(new ConvToMDHistoWS()); default: throw(std::logic_error( - "ConvToMDEventsSelector: requested converter for unknown ws type")); + "ConvToDataObjectsSelector: requested converter for unknown ws type")); } } else { // existing converter is suitable for the workspace @@ -59,4 +64,4 @@ boost::shared_ptr<ConvToMDBase> ConvToMDSelector::convSelector( } } } // end MDAlgorithms Namespace -} // end Mantid Namespace \ No newline at end of file +} // end Mantid Namespace diff --git a/Code/Mantid/Framework/Algorithms/src/ConvertMDHistoToMatrixWorkspace.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvertMDHistoToMatrixWorkspace.cpp similarity index 99% rename from Code/Mantid/Framework/Algorithms/src/ConvertMDHistoToMatrixWorkspace.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/ConvertMDHistoToMatrixWorkspace.cpp index 331de76b553fe156e82a20a4f4053c36ce4e86bb..5967cd572d6e40c35c7a533cc9250ac3b51a8c8b 100644 --- a/Code/Mantid/Framework/Algorithms/src/ConvertMDHistoToMatrixWorkspace.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvertMDHistoToMatrixWorkspace.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidAlgorithms/ConvertMDHistoToMatrixWorkspace.h" +#include "MantidMDAlgorithms/ConvertMDHistoToMatrixWorkspace.h" #include "MantidAPI/IMDHistoWorkspace.h" #include "MantidKernel/UnitFactory.h" #include "MantidKernel/Unit.h" @@ -82,7 +82,7 @@ size_t findXAxis(const VMD &start, const VMD &end, } namespace Mantid { -namespace Algorithms { +namespace MDAlgorithms { // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(ConvertMDHistoToMatrixWorkspace) @@ -356,5 +356,5 @@ size_t ConvertMDHistoToMatrixWorkspace::calcStride( return stride; } -} // namespace Algorithms +} // namespace MDAlgorithms } // namespace Mantid diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp index a2adcd804e4626c7ce472b00e6f9cc571af23bf8..293bfe9ae066160d13c5b8684ad95440f3a3c495 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp @@ -8,12 +8,12 @@ #include "MantidGeometry/Instrument/RectangularDetector.h" #include "MantidKernel/ArrayProperty.h" #include "MantidGeometry/MDGeometry/MDHistoDimension.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::DataObjects; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; namespace Mantid { @@ -82,12 +82,12 @@ void ConvertToDetectorFaceMD::init() { */ template <class T, class MDE, size_t nd> void ConvertToDetectorFaceMD::convertEventList( - boost::shared_ptr<Mantid::MDEvents::MDEventWorkspace<MDE, nd>> outWS, + boost::shared_ptr<Mantid::DataObjects::MDEventWorkspace<MDE, nd>> outWS, size_t workspaceIndex, coord_t x, coord_t y, coord_t bankNum, uint16_t runIndex, int32_t detectorID) { EventList &el = in_ws->getEventList(workspaceIndex); - // The 3/4D MDEvents that will be added into the MDEventWorkspce + // The 3/4D DataObjects that will be added into the MDEventWorkspce std::vector<MDE> out_events; out_events.reserve(el.getNumberEvents()); diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp index 20fafa6debfb6e4d8b2174b6cc3ff55dd0e10bba..bc07e2d1294a07cd71bb158886526d9666c83aa0 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp @@ -13,8 +13,8 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include "MantidMDAlgorithms/ConvertToDiffractionMDWorkspace.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidAPI/MemoryManager.h" #include "MantidKernel/ListValidator.h" @@ -122,10 +122,10 @@ void ConvertToDiffractionMDWorkspace::init() { } /// Our MDLeanEvent dimension -typedef MDEvents::MDLeanEvent<3> MDE; +typedef DataObjects::MDLeanEvent<3> MDE; //---------------------------------------------------------------------------------------------- -/** Convert one spectrum to MDEvents. +/** Convert one spectrum to DataObjects. * Depending on options, it uses the histogram view or the * pure event view. * Then another method converts to 3D q-space and adds it to the @@ -184,7 +184,7 @@ template <class T> void ConvertToDiffractionMDWorkspace::convertEventList(int workspaceIndex, EventList &el) { size_t numEvents = el.getNumberEvents(); - MDEvents::MDBoxBase<MDEvents::MDLeanEvent<3>, 3> *box = ws->getBox(); + DataObjects::MDBoxBase<DataObjects::MDLeanEvent<3>, 3> *box = ws->getBox(); // Get the position of the detector there. const std::set<detid_t> &detectors = el.getDetectorIDs(); @@ -354,7 +354,7 @@ void ConvertToDiffractionMDWorkspace::exec() { // Try to get the output workspace IMDEventWorkspace_sptr i_out = getProperty("OutputWorkspace"); ws = boost::dynamic_pointer_cast< - MDEvents::MDEventWorkspace<MDEvents::MDLeanEvent<3>, 3>>(i_out); + DataObjects::MDEventWorkspace<DataObjects::MDLeanEvent<3>, 3>>(i_out); // Initalize the matrix to 3x3 identity mat = Kernel::Matrix<double>(3, 3, true); @@ -411,8 +411,8 @@ void ConvertToDiffractionMDWorkspace::exec() { if (!ws || !Append) { // Create an output workspace with 3 dimensions. size_t nd = 3; - i_out = MDEvents::MDEventFactory::CreateMDWorkspace(nd, "MDLeanEvent"); - ws = boost::dynamic_pointer_cast<MDEvents::MDEventWorkspace3Lean>(i_out); + i_out = DataObjects::MDEventFactory::CreateMDWorkspace(nd, "MDLeanEvent"); + ws = boost::dynamic_pointer_cast<DataObjects::MDEventWorkspace3Lean>(i_out); // ---------------- Get the extents ------------- std::vector<double> extents = getProperty("Extents"); @@ -619,4 +619,4 @@ void ConvertToDiffractionMDWorkspace::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace2.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace2.cpp index be93f447218f72fa0cb3d78778d55fbc2efa6ba6..16323cba30182c16aac450100512c61d418dd3e5 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace2.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace2.cpp @@ -1,23 +1,22 @@ #include "MantidMDAlgorithms/ConvertToDiffractionMDWorkspace2.h" -#include "MantidAPI/Algorithm.h" #include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/Progress.h" #include "MantidAPI/WorkspaceValidators.h" + #include "MantidDataObjects/EventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidDataObjects/Workspace2D.h" + #include "MantidKernel/ArrayProperty.h" -#include "MantidKernel/CPUTimer.h" -#include "MantidKernel/ProgressText.h" #include "MantidKernel/EnabledWhenProperty.h" -#include "MantidMDEvents/MDEventWorkspace.h" #include "MantidKernel/ListValidator.h" -#include "MantidMDEvents/MDWSTransform.h" +#include "MantidMDAlgorithms/MDTransfFactory.h" +#include "MantidMDAlgorithms/MDWSTransform.h" -using namespace Mantid; -using namespace Mantid::Kernel; using namespace Mantid::API; +using namespace Mantid::Kernel; using namespace Mantid::DataObjects; using namespace Mantid::Geometry; @@ -30,7 +29,7 @@ DECLARE_ALGORITHM(ConvertToDiffractionMDWorkspace2) /**Small class to diable propery on interface */ class DisabledProperty : public EnabledWhenProperty { public: - DisabledProperty() : EnabledWhenProperty("NonExistingProperty", IS_DEFAULT){}; + DisabledProperty() : EnabledWhenProperty("NonExistingProperty", IS_DEFAULT){} virtual bool fulfillsCriterion(const IPropertyManager * /*algo*/) const { return false; } @@ -128,24 +127,24 @@ void ConvertToDiffractionMDWorkspace2::convertFramePropertyNames( // ----------------- Handle the type of output // ------------------------------------- - MDEvents::MDWSTransform QSclAndFrames; + MDAlgorithms::MDWSTransform QSclAndFrames; if (TargFrame == frameOptions[0]) // "Q (sample frame)" { TargFrameName = - QSclAndFrames.getTargetFrame(MDEvents::CnvrtToMD::SampleFrame); + QSclAndFrames.getTargetFrame(MDAlgorithms::CnvrtToMD::SampleFrame); ScalingName = QSclAndFrames.getQScaling( - MDEvents::CnvrtToMD::NoScaling); //< momentums in A^-1 + MDAlgorithms::CnvrtToMD::NoScaling); //< momentums in A^-1 } else if (TargFrame == frameOptions[1]) // "Q (lab frame)" { - TargFrameName = QSclAndFrames.getTargetFrame(MDEvents::CnvrtToMD::LabFrame); + TargFrameName = QSclAndFrames.getTargetFrame(MDAlgorithms::CnvrtToMD::LabFrame); ScalingName = QSclAndFrames.getQScaling( - MDEvents::CnvrtToMD::NoScaling); //< momentums in A^-1 + MDAlgorithms::CnvrtToMD::NoScaling); //< momentums in A^-1 } else if (TargFrame == frameOptions[2]) // "HKL" { - TargFrameName = QSclAndFrames.getTargetFrame(MDEvents::CnvrtToMD::HKLFrame); + TargFrameName = QSclAndFrames.getTargetFrame(MDAlgorithms::CnvrtToMD::HKLFrame); ScalingName = QSclAndFrames.getQScaling( - MDEvents::CnvrtToMD::HKLScale); //< momentums in A^-1 + MDAlgorithms::CnvrtToMD::HKLScale); //< momentums in A^-1 } else { throw std::invalid_argument( "ConvertToDiffractionMDWorkspace2::Unknown target frame: " + TargFrame); @@ -198,7 +197,7 @@ void ConvertToDiffractionMDWorkspace2::exec() { this->getPropertyValue("OutputWorkspace")); Convert->setProperty("OverwriteExisting", !this->getProperty("Append")); - if (!MDEvents::MDTransfFactory::Instance().exists("Q3D")) { + if (!MDTransfFactory::Instance().exists("Q3D")) { throw std::runtime_error(" ConvertToMD Q3D plugin used to transform into " "DiffractionWorkspaced has not been registered " "with the MDTransformation factory"); @@ -248,4 +247,4 @@ void ConvertToDiffractionMDWorkspace2::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp index 36f8b333c09fbc27d83b866f15a182e83a67e969..b7bab452fc40d8e1160b02bffde7f1f91430273b 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp @@ -1,33 +1,30 @@ #include "MantidMDAlgorithms/ConvertToMD.h" -#include "MantidKernel/PhysicalConstants.h" -#include "MantidKernel/ProgressText.h" -#include "MantidKernel/IPropertyManager.h" -#include "MantidKernel/ArrayProperty.h" -#include "MantidKernel/IPropertySettings.h" -#include "MantidKernel/ArrayLengthValidator.h" -#include "MantidKernel/VisibleWhenProperty.h" -// +#include <algorithm> + #include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/Progress.h" #include "MantidAPI/WorkspaceValidators.h" -#include "MantidMDEvents/MDWSTransform.h" -// -#include "MantidDataObjects/Workspace2D.h" -#include <algorithm> +#include "MantidKernel/ArrayProperty.h" +#include "MantidKernel/ArrayLengthValidator.h" #include "MantidKernel/BoundedValidator.h" +#include "MantidKernel/IPropertyManager.h" +#include "MantidKernel/IPropertySettings.h" #include "MantidKernel/ListValidator.h" -#include "MantidMDEvents/ConvToMDSelector.h" +#include "MantidKernel/PhysicalConstants.h" +#include "MantidKernel/VisibleWhenProperty.h" + +#include "MantidDataObjects/EventWorkspace.h" #include "MantidDataObjects/TableWorkspace.h" +#include "MantidDataObjects/Workspace2D.h" + +#include "MantidMDAlgorithms/ConvToMDSelector.h" +#include "MantidMDAlgorithms/MDWSTransform.h" -using namespace Mantid; -using namespace Mantid::Kernel; using namespace Mantid::API; +using namespace Mantid::Kernel; using namespace Mantid::DataObjects; -using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; -using namespace Mantid::MDEvents::CnvrtToMD; namespace Mantid { namespace MDAlgorithms { @@ -35,6 +32,7 @@ namespace MDAlgorithms { // // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(ConvertToMD) + void ConvertToMD::init() { ConvertToMDParent::init(); declareProperty(new WorkspaceProperty<IMDEventWorkspace>( @@ -142,8 +140,8 @@ void ConvertToMD::exec() { // initiate class which would deal with any dimension workspaces requested by // algorithm parameters if (!m_OutWSWrapper) - m_OutWSWrapper = boost::shared_ptr<MDEvents::MDEventWSWrapper>( - new MDEvents::MDEventWSWrapper()); + m_OutWSWrapper = boost::shared_ptr<MDEventWSWrapper>( + new MDEventWSWrapper()); // -------- get Input workspace m_InWS2D = getProperty("InputWorkspace"); @@ -172,7 +170,7 @@ void ConvertToMD::exec() { // Build the target ws description as function of the input & output ws and // the parameters, supplied to the algorithm - MDEvents::MDWSDescription targWSDescr; + MDWSDescription targWSDescr; // get workspace parameters and build target workspace description, report if // there is need to build new target MD workspace bool createNewTargetWs = @@ -237,7 +235,7 @@ void ConvertToMD::exec() { */ void ConvertToMD::addExperimentInfo(API::IMDEventWorkspace_sptr &mdEventWS, - MDEvents::MDWSDescription &targWSDescr) const { + MDWSDescription &targWSDescr) const { // Copy ExperimentInfo (instrument, run, sample) to the output WS API::ExperimentInfo_sptr ei(m_InWS2D->cloneExperimentInfo()); @@ -365,7 +363,7 @@ bool ConvertToMD::buildTargetWSDescription( const std::string &dEModReq, const std::vector<std::string> &otherDimNames, std::vector<double> &dimMin, std::vector<double> &dimMax, const std::string &QFrame, const std::string &convertTo_, - MDEvents::MDWSDescription &targWSDescr) { + MDAlgorithms::MDWSDescription &targWSDescr) { // ------- Is there need to create new output workspace? bool createNewTargetWs = doWeNeedNewTargetWorkspace(spws); std::vector<int> split_into; @@ -404,7 +402,7 @@ bool ConvertToMD::buildTargetWSDescription( targWSDescr.setLorentsCorr(LorentzCorrections); // instantiate class, responsible for defining Mslice-type projection - MDEvents::MDWSTransform MsliceProj; + MDAlgorithms::MDWSTransform MsliceProj; // identify if u,v are present among input parameters and use defaults if not std::vector<double> ut = getProperty("UProj"); std::vector<double> vt = getProperty("VProj"); @@ -429,7 +427,7 @@ bool ConvertToMD::buildTargetWSDescription( { // dimensions are already build, so build MDWS description from existing // workspace - MDEvents::MDWSDescription oldWSDescr; + MDAlgorithms::MDWSDescription oldWSDescr; oldWSDescr.buildFromMDWS(spws); // some conversion parameters can not be defined by the target workspace. @@ -456,7 +454,7 @@ bool ConvertToMD::buildTargetWSDescription( * @return */ API::IMDEventWorkspace_sptr ConvertToMD::createNewMDWorkspace( - const MDEvents::MDWSDescription &targWSDescr) { + const MDWSDescription &targWSDescr) { // create new md workspace and set internal shared pointer of m_OutWSWrapper // to this workspace API::IMDEventWorkspace_sptr spws = diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp index a20bd7ded854596286142d337585f59ef3578238..95e20b6fc4a56fd0130d8306ca97180b21c37dcd 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp @@ -1,18 +1,19 @@ #include "MantidMDAlgorithms/ConvertToMDMinMaxGlobal.h" + #include "MantidAPI/WorkspaceValidators.h" -#include "MantidKernel/ListValidator.h" -#include "MantidMDEvents/ConvToMDSelector.h" -#include "MantidMDEvents/MDWSTransform.h" #include "MantidKernel/ArrayProperty.h" -#include "MantidKernel/VisibleWhenProperty.h" +#include "MantidKernel/ListValidator.h" #include "MantidKernel/TimeSeriesProperty.h" -#include "MantidGeometry/Crystal/OrientedLattice.h" +#include "MantidKernel/VisibleWhenProperty.h" #include "MantidDataObjects/EventWorkspace.h" +#include "MantidGeometry/Crystal/OrientedLattice.h" +#include "MantidMDAlgorithms/ConvToMDSelector.h" +#include "MantidMDAlgorithms/MDWSTransform.h" using namespace Mantid; using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { @@ -63,7 +64,7 @@ void ConvertToMDMinMaxGlobal::init() { "An input Matrix Workspace (Workspace2D or Event workspace) "); std::vector<std::string> Q_modes = - MDEvents::MDTransfFactory::Instance().getKeys(); + MDAlgorithms::MDTransfFactory::Instance().getKeys(); // something to do with different moments of time when algorithm or test loads // library. To avoid empty factory always do this. if (Q_modes.empty()) diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDMinMaxLocal.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDMinMaxLocal.cpp index 7011353f34815570bf6d6c9934b942fd72c62d17..55a0ed80bb9f1040be2e90eaffaf8c5972c99dea 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDMinMaxLocal.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDMinMaxLocal.cpp @@ -1,16 +1,12 @@ #include "MantidMDAlgorithms/ConvertToMDMinMaxLocal.h" +#include <cfloat> + #include "MantidKernel/ArrayProperty.h" -#include "MantidGeometry/Objects/ShapeFactory.h" -#include "MantidGeometry/Instrument/RectangularDetector.h" -#include "MantidAPI/IMDNode.h" -#include "MantidMDEvents/MDWSTransform.h" -#include "MantidMDEvents/ConvToMDSelector.h" -#include "MantidMDEvents/UnitsConversionHelper.h" -#include "MantidKernel/UnitFactory.h" -#include "MantidKernel/MultiThreaded.h" -#include <cfloat> +#include "MantidMDAlgorithms/ConvToMDSelector.h" +#include "MantidMDAlgorithms/MDWSTransform.h" +#include "MantidMDAlgorithms/UnitsConversionHelper.h" using namespace Mantid::Kernel; using namespace Mantid::API; @@ -73,12 +69,12 @@ void ConvertToMDMinMaxLocal::exec() { // Build the target ws description as function of the input & output ws and // the parameters, supplied to the algorithm - MDEvents::MDWSDescription targWSDescr; + MDWSDescription targWSDescr; // get raw pointer to Q-transformation (do not delete this pointer, it's held // by MDTransfFactory!) - MDEvents::MDTransfInterface *pQtransf = - MDEvents::MDTransfFactory::Instance().create(QModReq).get(); + MDTransfInterface *pQtransf = + MDTransfFactory::Instance().create(QModReq).get(); // get number of dimensions this Q transformation generates from the // workspace. auto iEmode = Kernel::DeltaEMode().fromString(dEModReq); @@ -99,7 +95,7 @@ void ConvertToMDMinMaxLocal::exec() { targWSDescr.addProperty("RUN_INDEX", uint16_t(0), true); // instantiate class, responsible for defining Mslice-type projection - MDEvents::MDWSTransform MsliceProj; + MDAlgorithms::MDWSTransform MsliceProj; // identify if u,v are present among input parameters and use defaults if not std::vector<double> ut = getProperty("UProj"); std::vector<double> vt = getProperty("VProj"); @@ -130,12 +126,12 @@ void ConvertToMDMinMaxLocal::exec() { } void ConvertToMDMinMaxLocal::findMinMaxValues( - MDEvents::MDWSDescription &WSDescription, - MDEvents::MDTransfInterface *const pQtransf, + MDWSDescription &WSDescription, + MDTransfInterface *const pQtransf, Kernel::DeltaEMode::Type iEMode, std::vector<double> &MinValues, std::vector<double> &MaxValues) { - MDEvents::UnitsConversionHelper unitsConverter; + MDAlgorithms::UnitsConversionHelper unitsConverter; double signal(1), errorSq(1); // size_t nDims = MinValues.size(); diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDParent.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDParent.cpp index eb018d831dd214ebb20366bc4c01756f6b24342a..c4ace9f9774572e90a20d8887f5e47a4f47eaba2 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDParent.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDParent.cpp @@ -1,27 +1,18 @@ - #include "MantidMDAlgorithms/ConvertToMDParent.h" -#include "MantidKernel/BoundedValidator.h" -#include "MantidKernel/ListValidator.h" -#include "MantidKernel/PhysicalConstants.h" -#include "MantidKernel/IPropertyManager.h" -#include "MantidKernel/ArrayProperty.h" -#include "MantidKernel/IPropertySettings.h" -#include "MantidKernel/ArrayLengthValidator.h" -#include "MantidKernel/VisibleWhenProperty.h" -// #include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/WorkspaceValidators.h" -#include "MantidMDEvents/MDWSTransform.h" -// +#include "MantidKernel/ArrayProperty.h" +#include "MantidKernel/ListValidator.h" +#include "MantidKernel/VisibleWhenProperty.h" -#include "MantidMDEvents/ConvToMDSelector.h" +#include "MantidMDAlgorithms/MDWSTransform.h" +#include "MantidMDAlgorithms/ConvToMDSelector.h" -using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; -using namespace Mantid::MDEvents::CnvrtToMD; +using namespace Mantid::DataObjects; +using namespace Mantid::Kernel; namespace Mantid { namespace MDAlgorithms { @@ -44,7 +35,7 @@ void ConvertToMDParent::init() { "An input Matrix Workspace (2DMatrix or Event workspace) "); std::vector<std::string> Q_modes = - MDEvents::MDTransfFactory::Instance().getKeys(); + MDTransfFactory::Instance().getKeys(); // something to do with different moments of time when algorithm or test loads // library. To avoid empty factory always do this. if (Q_modes.empty()) @@ -71,7 +62,7 @@ void ConvertToMDParent::init() { "*MD Transformation factory* for further details.", Direction::InOut); - MDEvents::MDWSTransform QSclAndFrames; + MDWSTransform QSclAndFrames; std::vector<std::string> TargFrames = QSclAndFrames.getTargetFrames(); declareProperty( "Q3DFrames", TargFrames[CnvrtToMD::AutoSelect], diff --git a/Code/Mantid/Framework/MDEvents/src/ConvertToReflectometryQ.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp similarity index 96% rename from Code/Mantid/Framework/MDEvents/src/ConvertToReflectometryQ.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp index 1c5df9e388a81edc7a3cd313dc0245fc6f804bc7..bc71233a2de536ebd9985bcc0af62d46784e2e72 100644 --- a/Code/Mantid/Framework/MDEvents/src/ConvertToReflectometryQ.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp @@ -1,25 +1,29 @@ +#include "MantidMDAlgorithms/ConvertToReflectometryQ.h" + +#include "MantidAPI/IEventWorkspace.h" #include "MantidAPI/WorkspaceValidators.h" -#include "MantidMDEvents/ConvertToReflectometryQ.h" + #include "MantidDataObjects/EventWorkspace.h" #include "MantidDataObjects/Workspace2D.h" -#include "MantidKernel/EnabledWhenProperty.h" -#include "MantidKernel/TimeSeriesProperty.h" + #include "MantidKernel/ArrayProperty.h" -#include "MantidKernel/ListValidator.h" #include "MantidKernel/EnabledWhenProperty.h" -#include "MantidAPI/FrameworkManager.h" -#include "MantidAPI/IEventWorkspace.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/ReflectometryTransformQxQz.h" -#include "MantidMDEvents/ReflectometryTransformKiKf.h" -#include "MantidMDEvents/ReflectometryTransformP.h" +#include "MantidKernel/ListValidator.h" +#include "MantidKernel/TimeSeriesProperty.h" + +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventFactory.h" + +#include "MantidMDAlgorithms/ReflectometryTransformKiKf.h" +#include "MantidMDAlgorithms/ReflectometryTransformQxQz.h" +#include "MantidMDAlgorithms/ReflectometryTransformP.h" + #include <boost/shared_ptr.hpp> #include <boost/make_shared.hpp> +using namespace Mantid::API; using namespace Mantid::Kernel; using namespace Mantid::Geometry; -using namespace Mantid::API; using namespace Mantid::DataObjects; /*Non member helpers*/ @@ -117,7 +121,7 @@ void checkOutputDimensionalityChoice(const std::string &outputDimensions) { } namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(ConvertToReflectometryQ) diff --git a/Code/Mantid/Framework/MDAlgorithms/src/CreateMDHistoWorkspace.cpp b/Code/Mantid/Framework/MDAlgorithms/src/CreateMDHistoWorkspace.cpp index 71f53a68117703c65d067e3de08745376fc66300..a312ee39c8481fe6dc9ac72f824f9c0d99b0eab5 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/CreateMDHistoWorkspace.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/CreateMDHistoWorkspace.cpp @@ -4,7 +4,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { @@ -98,4 +98,4 @@ void CreateMDHistoWorkspace::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp b/Code/Mantid/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp index ce32a1c004e3f7613f2de8a0af33798bd631db48..96204512e009bead9a7ecfa64d57d983d0fa16e2 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp @@ -4,7 +4,7 @@ #include "MantidKernel/ArrayProperty.h" #include "MantidKernel/System.h" #include "MantidMDAlgorithms/CreateMDWorkspace.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidKernel/Memory.h" #include <math.h> #include "MantidKernel/EnabledWhenProperty.h" @@ -15,7 +15,7 @@ namespace MDAlgorithms { using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(CreateMDWorkspace) @@ -187,4 +187,4 @@ void CreateMDWorkspace::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDAlgorithms/src/DivideMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/DivideMD.cpp index d5a31cf34ce80ced56d5a8c411926a51b92fd15f..7174d81d5f25736b46c1103d1e2c4e7dbf466982 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/DivideMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/DivideMD.cpp @@ -1,13 +1,13 @@ #include "MantidMDAlgorithms/DivideMD.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/MDBox.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDBoxBase.h" +#include "MantidDataObjects/MDBox.h" using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { @@ -121,15 +121,15 @@ void DivideMD::execEvent() { //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand void DivideMD::execHistoHisto( - Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand) { + Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand) { out->divide(*operand); } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output, scalar and operand void DivideMD::execHistoScalar( - Mantid::MDEvents::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar) { out->divide(scalar->dataY(0)[0], scalar->dataE(0)[0]); } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/EqualToMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/EqualToMD.cpp index 32216e09f5f1fa7379c9a731add7ceb8c8481f99..010147432ff6254911480c1a7bf3d900cf38aa07 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/EqualToMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/EqualToMD.cpp @@ -38,8 +38,8 @@ void EqualToMD::initExtraProperties() { //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand void EqualToMD::execHistoHisto( - Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand) { + Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand) { double tolerance = getProperty("Tolerance"); out->equalTo(*operand, tolerance); } @@ -47,7 +47,7 @@ void EqualToMD::execHistoHisto( //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and a scalar on the RHS void EqualToMD::execHistoScalar( - Mantid::MDEvents::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar) { double tolerance = getProperty("Tolerance"); out->equalTo(scalar->dataY(0)[0], tolerance); diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ExponentialMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ExponentialMD.cpp index 7da6298e57aa2d4887cd664a3dbd502def1431d3..505bf3849f0a6182c6539d3e43f04298355f7055 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ExponentialMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ExponentialMD.cpp @@ -46,7 +46,7 @@ void ExponentialMD::execEvent(Mantid::API::IMDEventWorkspace_sptr /*out*/) { //---------------------------------------------------------------------------------------------- /// ExponentialMD::Run the algorithm with a MDHistoWorkspace -void ExponentialMD::execHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out) { +void ExponentialMD::execHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out) { out->exp(); } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/FakeMDEventData.cpp b/Code/Mantid/Framework/MDAlgorithms/src/FakeMDEventData.cpp index ac531d73baa8ca16b28322a8d0ebca6238d590dc..4e951bceacd9fdf30f3da54024b86d821f46c4d4 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/FakeMDEventData.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/FakeMDEventData.cpp @@ -1,54 +1,27 @@ -#include "MantidKernel/ArrayProperty.h" -#include "MantidKernel/System.h" +//---------------------------------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------------------------------- #include "MantidMDAlgorithms/FakeMDEventData.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventInserter.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include <boost/math/distributions/normal.hpp> -#include <boost/math/special_functions/fpclassify.hpp> -#include <boost/math/special_functions/pow.hpp> -#include <boost/random/linear_congruential.hpp> -#include <boost/random/mersenne_twister.hpp> -#include <boost/random/uniform_int.hpp> -#include <boost/random/uniform_real.hpp> -#include <boost/random/variate_generator.hpp> -#include <math.h> -#include "MantidKernel/ThreadScheduler.h" -#include "MantidKernel/ThreadPool.h" -#include "MantidKernel/VectorHelper.h" -#include "MantidKernel/Utils.h" -#include <cfloat> -#include <limits> + +#include "MantidKernel/ArrayProperty.h" +#include "MantidDataObjects/FakeMD.h" namespace Mantid { namespace MDAlgorithms { +using namespace API; +using namespace DataObjects; +using namespace Kernel; + // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(FakeMDEventData) -using namespace Mantid::Kernel; -using namespace Mantid::API; -using namespace Mantid::MDEvents; - -//---------------------------------------------------------------------------------------------- -/** Constructor - */ -FakeMDEventData::FakeMDEventData() : m_randGen(1), m_uniformDist() {} - -//---------------------------------------------------------------------------------------------- -/** Destructor - */ -FakeMDEventData::~FakeMDEventData() {} - -//---------------------------------------------------------------------------------------------- - -//---------------------------------------------------------------------------------------------- /** Initialize the algorithm's properties. */ void FakeMDEventData::init() { declareProperty(new WorkspaceProperty<IMDEventWorkspace>("InputWorkspace", "", Direction::InOut), - "An input workspace, that will get MDEvents added to it"); + "An input workspace, that will get DataObjects added to it"); declareProperty(new ArrayProperty<double>("UniformParams", ""), "Add a uniform, randomized distribution of events.\n" @@ -77,383 +50,15 @@ void FakeMDEventData::init() { "randomized around 1.0+-0.5."); } -//---------------------------------------------------------------------------------------------- -/** Function makes up a fake single-crystal peak and adds it to the workspace. - * - * @param ws - */ -template <typename MDE, size_t nd> -void FakeMDEventData::addFakePeak(typename MDEventWorkspace<MDE, nd>::sptr ws) { - std::vector<double> params = getProperty("PeakParams"); - bool RandomizeSignal = getProperty("RandomizeSignal"); - if (params.empty()) - return; - - if (params.size() != nd + 2) - throw std::invalid_argument("PeakParams needs to have ndims+2 arguments."); - if (params[0] <= 0) - throw std::invalid_argument("PeakParams: number_of_events needs to be > 0"); - size_t num = size_t(params[0]); - - Progress prog(this, 0.0, 1.0, 100); - size_t progIncrement = num / 100; - if (progIncrement == 0) - progIncrement = 1; - - // Width of the peak - double desiredRadius = params.back(); - - boost::mt19937 rng; - boost::uniform_real<coord_t> u2(0, 1.0); // Random from 0 to 1.0 - boost::variate_generator<boost::mt19937 &, boost::uniform_real<coord_t>> - genUnit(rng, u2); - int randomSeed = getProperty("RandomSeed"); - rng.seed((unsigned int)(randomSeed)); - - // Inserter to help choose the correct event type - auto eventHelper = - MDEvents::MDEventInserter<typename MDEventWorkspace<MDE, nd>::sptr>(ws); - - for (size_t i = 0; i < num; ++i) { - // Algorithm to generate points along a random n-sphere (sphere with not - // necessarily 3 dimensions) - // from http://en.wikipedia.org/wiki/N-sphere as of May 6, 2011. - - // First, points in a hyper-cube of size 1.0, centered at 0. - coord_t centers[nd]; - coord_t radiusSquared = 0; - for (size_t d = 0; d < nd; d++) { - centers[d] = genUnit() - 0.5f; // Distribute around +- the center - radiusSquared += centers[d] * centers[d]; - } - - // Make a unit vector pointing in this direction - coord_t radius = static_cast<coord_t>(sqrt(radiusSquared)); - for (size_t d = 0; d < nd; d++) - centers[d] /= radius; - - // Now place the point along this radius, scaled with ^1/n for uniformity. - coord_t radPos = genUnit(); - radPos = static_cast<coord_t>( - pow(radPos, static_cast<coord_t>(1.0 / static_cast<coord_t>(nd)))); - for (size_t d = 0; d < nd; d++) { - // Multiply by the scaling and the desired peak radius - centers[d] *= (radPos * static_cast<coord_t>(desiredRadius)); - // Also offset by the center of the peak, as taken in Params - centers[d] += static_cast<coord_t>(params[d + 1]); - } - - // Default or randomized error/signal - float signal = 1.0; - float errorSquared = 1.0; - if (RandomizeSignal) { - signal = float(0.5 + genUnit()); - errorSquared = float(0.5 + genUnit()); - } - - // Create and add the event. - eventHelper.insertMDEvent(signal, errorSquared, 1, pickDetectorID(), - centers); // 1 = run number - // Progress report - if ((i % progIncrement) == 0) - prog.report(); - } - - ws->splitBox(); - Kernel::ThreadScheduler *ts = new ThreadSchedulerFIFO(); - ThreadPool tp(ts); - ws->splitAllIfNeeded(ts); - tp.joinAll(); - ws->refreshCache(); -} - -//---------------------------------------------------------------------------------------------- -/** Function makes up a fake uniform event data and adds it to the workspace. - * - * @param ws - */ -template <typename MDE, size_t nd> -void FakeMDEventData::addFakeUniformData( - typename MDEventWorkspace<MDE, nd>::sptr ws) { - std::vector<double> params = getProperty("UniformParams"); - if (params.empty()) - return; - - bool randomEvents = true; - if (params[0] < 0) { - randomEvents = false; - params[0] = -params[0]; - } - - if (params.size() == 1) { - if (randomEvents) { - for (size_t d = 0; d < nd; ++d) { - params.push_back(ws->getDimension(d)->getMinimum()); - params.push_back(ws->getDimension(d)->getMaximum()); - } - } else // regular events - { - size_t nPoints = size_t(params[0]); - double Vol = 1; - for (size_t d = 0; d < nd; ++d) - Vol *= (ws->getDimension(d)->getMaximum() - - ws->getDimension(d)->getMinimum()); - - if (Vol == 0 || Vol > std::numeric_limits<float>::max()) - throw std::invalid_argument( - " Domain ranges are not defined properly for workspace: " + - ws->getName()); - - double dV = Vol / double(nPoints); - double delta0 = std::pow(dV, 1. / double(nd)); - for (size_t d = 0; d < nd; ++d) { - double min = ws->getDimension(d)->getMinimum(); - params.push_back(min * (1 + FLT_EPSILON) - min + FLT_EPSILON); - double extent = ws->getDimension(d)->getMaximum() - min; - size_t nStrides = size_t(extent / delta0); - if (nStrides < 1) - nStrides = 1; - params.push_back(extent / static_cast<double>(nStrides)); - } - } - } - if ((params.size() != 1 + nd * 2)) - throw std::invalid_argument( - "UniformParams: needs to have ndims*2+1 arguments "); - - if (randomEvents) - addFakeRandomData<MDE, nd>(params, ws); - else - addFakeRegularData<MDE, nd>(params, ws); - - ws->splitBox(); - Kernel::ThreadScheduler *ts = new ThreadSchedulerFIFO(); - ThreadPool tp(ts); - ws->splitAllIfNeeded(ts); - tp.joinAll(); - ws->refreshCache(); -} - -template <typename MDE, size_t nd> -void FakeMDEventData::addFakeRandomData( - const std::vector<double> ¶ms, - typename MDEventWorkspace<MDE, nd>::sptr ws) { - - bool RandomizeSignal = getProperty("RandomizeSignal"); - - size_t num = size_t(params[0]); - if (num == 0) - throw std::invalid_argument( - " number of distributed events can not be equal to 0"); - - Progress prog(this, 0.0, 1.0, 100); - size_t progIncrement = num / 100; - if (progIncrement == 0) - progIncrement = 1; - - boost::mt19937 rng; - int randomSeed = getProperty("RandomSeed"); - rng.seed((unsigned int)(randomSeed)); - - // Unit-size randomizer - boost::uniform_real<double> u2(0, 1.0); // Random from 0 to 1.0 - boost::variate_generator<boost::mt19937 &, boost::uniform_real<double>> - genUnit(rng, u2); - - // Make a random generator for each dimensions - typedef boost::variate_generator<boost::mt19937 &, - boost::uniform_real<double>> gen_t; - - // Inserter to help choose the correct event type - auto eventHelper = - MDEvents::MDEventInserter<typename MDEventWorkspace<MDE, nd>::sptr>(ws); - - gen_t *gens[nd]; - for (size_t d = 0; d < nd; ++d) { - double min = params[d * 2 + 1]; - double max = params[d * 2 + 2]; - if (max <= min) - throw std::invalid_argument( - "UniformParams: min must be < max for all dimensions."); - - boost::uniform_real<double> u(min, max); // Range - gen_t *gen = new gen_t(rng, u); - gens[d] = gen; - } - - // Create all the requested events - for (size_t i = 0; i < num; ++i) { - coord_t centers[nd]; - for (size_t d = 0; d < nd; d++) { - centers[d] = static_cast<coord_t>( - (*gens[d])()); // use a different generator for each dimension - } - - // Default or randomized error/signal - float signal = 1.0; - float errorSquared = 1.0; - if (RandomizeSignal) { - signal = float(0.5 + genUnit()); - errorSquared = float(0.5 + genUnit()); - } - - // Create and add the event. - eventHelper.insertMDEvent(signal, errorSquared, 1, pickDetectorID(), - centers); // 1 = run number - // Progress report - if ((i % progIncrement) == 0) - prog.report(); - } - - /// Clean up the generators - for (size_t d = 0; d < nd; ++d) - delete gens[d]; -} - -template <typename MDE, size_t nd> -void FakeMDEventData::addFakeRegularData( - const std::vector<double> ¶ms, - typename MDEventWorkspace<MDE, nd>::sptr ws) { - // the parameters for regular distribution of events over the box - std::vector<double> startPoint(nd), delta(nd); - std::vector<size_t> indexMax(nd); - size_t gridSize(0); - - // bool RandomizeSignal = getProperty("RandomizeSignal"); - - size_t num = size_t(params[0]); - if (num == 0) - throw std::invalid_argument( - " number of distributed events can not be equal to 0"); - - Progress prog(this, 0.0, 1.0, 100); - size_t progIncrement = num / 100; - if (progIncrement == 0) - progIncrement = 1; - - // Inserter to help choose the correct event type - auto eventHelper = - MDEvents::MDEventInserter<typename MDEventWorkspace<MDE, nd>::sptr>(ws); - - gridSize = 1; - for (size_t d = 0; d < nd; ++d) { - double min = ws->getDimension(d)->getMinimum(); - double max = ws->getDimension(d)->getMaximum(); - double shift = params[d * 2 + 1]; - double step = params[d * 2 + 2]; - if (shift < 0) - shift = 0; - if (shift >= step) - shift = step * (1 - FLT_EPSILON); - - startPoint[d] = min + shift; - if ((startPoint[d] < min) || (startPoint[d] >= max)) - throw std::invalid_argument("RegularData: starting point must be within " - "the box for all dimensions."); - - if (step <= 0) - throw(std::invalid_argument( - "Step of the regular grid is less or equal to 0")); - - indexMax[d] = size_t((max - min) / step); - if (indexMax[d] == 0) - indexMax[d] = 1; - // deal with round-off errors - while ((startPoint[d] + double(indexMax[d] - 1) * step) >= max) - step *= (1 - FLT_EPSILON); - - delta[d] = step; - - gridSize *= indexMax[d]; - } - // Create all the requested events - std::vector<size_t> indexes; - size_t cellCount(0); - for (size_t i = 0; i < num; ++i) { - coord_t centers[nd]; - - Kernel::Utils::getIndicesFromLinearIndex(cellCount, indexMax, indexes); - ++cellCount; - if (cellCount >= gridSize) - cellCount = 0; - - for (size_t d = 0; d < nd; d++) { - centers[d] = coord_t(startPoint[d] + delta[d] * double(indexes[d])); - } - - // Default or randomized error/signal - float signal = 1.0; - float errorSquared = 1.0; - // if (RandomizeSignal) - //{ - // signal = float(0.5 + genUnit()); - // errorSquared = float(0.5 + genUnit()); - //} - - // Create and add the event. - eventHelper.insertMDEvent(signal, errorSquared, 1, pickDetectorID(), - centers); // 1 = run number - // Progress report - if ((i % progIncrement) == 0) - prog.report(); - } -} - -//---------------------------------------------------------------------------------------------- -/** Execute the algorithm. - */ -void FakeMDEventData::exec() { - IMDEventWorkspace_sptr in_ws = getProperty("InputWorkspace"); - - if (getPropertyValue("UniformParams") == "" && - getPropertyValue("PeakParams") == "") - throw std::invalid_argument( - "You must specify at least one of PeakParams or UniformParams."); - - setupDetectorCache(*in_ws); - - CALL_MDEVENT_FUNCTION(this->addFakePeak, in_ws) - CALL_MDEVENT_FUNCTION(this->addFakeUniformData, in_ws) - - // Mark that events were added, so the file back end (if any) needs updating - in_ws->setFileNeedsUpdating(true); -} - /** - * Setup a detector cache for randomly picking IDs from the first - * instrument in the ExperimentInfo list. - * @param ws :: The input workspace + * Execute the algorithm. */ -void FakeMDEventData::setupDetectorCache(const API::IMDEventWorkspace &ws) { - try { - Geometry::Instrument_const_sptr inst = - ws.getExperimentInfo(0)->getInstrument(); - m_detIDs = inst->getDetectorIDs(true); // true=skip monitors - size_t max = m_detIDs.size() - 1; - m_uniformDist = boost::uniform_int<size_t>(0, max); // Includes max - } catch (std::invalid_argument &) { - g_log.information("Cannot retrieve instrument from input workspace, " - "detector information will be garbage."); - } -} +void FakeMDEventData::exec() { -/** - * Pick a detector ID for a particular event - * @returns A detector ID randomly selected from the instrument - */ -detid_t FakeMDEventData::pickDetectorID() { - if (m_detIDs.empty()) { - return -1; - } else { - /// A variate generator to combine a random number generator with a - /// distribution - typedef boost::variate_generator< - boost::mt19937 &, boost::uniform_int<size_t>> uniform_generator; - uniform_generator uniformRand(m_randGen, m_uniformDist); - const size_t randIndex = uniformRand(); - return m_detIDs[randIndex]; - } + FakeMD faker(getProperty("UniformParams"), getProperty("PeakParams"), + getProperty("RandomSeed"), getProperty("RandomizeSignal")); + faker.fill(getProperty("InputWorkspace")); } +} // namespace MDAlgorithms } // namespace Mantid -} // namespace MDEvents diff --git a/Code/Mantid/Framework/MDAlgorithms/src/FindPeaksMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/FindPeaksMD.cpp index 4dde159f78488647709b43c645cdd9b0468f45dc..68d4f01eba2cf28099313328e04dbcc1d570ea70 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/FindPeaksMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/FindPeaksMD.cpp @@ -1,8 +1,8 @@ #include "MantidDataObjects/PeaksWorkspace.h" #include "MantidKernel/System.h" #include "MantidMDAlgorithms/FindPeaksMD.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidKernel/VMD.h" #include <boost/math/special_functions/fpclassify.hpp> @@ -14,7 +14,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::DataObjects; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { @@ -30,7 +30,7 @@ template <typename MDE, size_t nd> struct IsFullEvent : boost::false_type {}; template <size_t nd> struct IsFullEvent<MDEvent<nd>, nd> : boost::true_type {}; /** - * Specialization if isFullEvent for MDEvents + * Specialization if isFullEvent for DataObjects * to return true */ template <typename MDE, size_t nd> @@ -39,7 +39,7 @@ bool isFullMDEvent(const boost::true_type &) { } /** - * Specialization if isFullEvent for MDEvents + * Specialization if isFullEvent for DataObjects * to return false */ template <typename MDE, size_t nd> @@ -426,7 +426,7 @@ void FindPeaksMD::findPeaks(typename MDEventWorkspace<MDE, nd>::sptr ws) { * * @param ws :: MDHistoWorkspace */ -void FindPeaksMD::findPeaksHisto(Mantid::MDEvents::MDHistoWorkspace_sptr ws) { +void FindPeaksMD::findPeaksHisto(Mantid::DataObjects::MDHistoWorkspace_sptr ws) { size_t nd = ws->getNumDims(); if (nd < 3) throw std::invalid_argument("Workspace must have at least 3 dimensions."); @@ -611,4 +611,4 @@ void FindPeaksMD::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDEvents/src/FitMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/FitMD.cpp similarity index 98% rename from Code/Mantid/Framework/MDEvents/src/FitMD.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/FitMD.cpp index 64d2ce71eb3e0d25065e015c49173539874838bb..42ff7fbf8bc205defca9304499de78719e644e0b 100644 --- a/Code/Mantid/Framework/MDEvents/src/FitMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/FitMD.cpp @@ -1,20 +1,20 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidMDEvents/FitMD.h" +#include "MantidMDAlgorithms/FitMD.h" -#include "MantidAPI/IMDWorkspace.h" +#include "MantidAPI/Algorithm.h" +#include "MantidAPI/AlgorithmFactory.h" #include "MantidAPI/FunctionProperty.h" #include "MantidAPI/FunctionDomainMD.h" #include "MantidAPI/FunctionValues.h" #include "MantidAPI/IFunctionMD.h" +#include "MantidAPI/IMDWorkspace.h" #include "MantidAPI/MemoryManager.h" #include "MantidAPI/WorkspaceProperty.h" -#include "MantidAPI/AlgorithmFactory.h" -#include "MantidAPI/Algorithm.h" #include "MantidGeometry/MDGeometry/MDHistoDimensionBuilder.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidKernel/BoundedValidator.h" #include "MantidKernel/PropertyWithValue.h" @@ -22,10 +22,11 @@ #include <algorithm> namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { DECLARE_DOMAINCREATOR(FitMD) using namespace API; +using namespace DataObjects; using namespace Kernel; /** @@ -189,7 +190,7 @@ boost::shared_ptr<API::Workspace> FitMD::createEventOutputWorkspace( // Add events // TODO: Generalize to ND (the current framework is a bit limiting) auto mdWS = boost::dynamic_pointer_cast< - MDEvents::MDEventWorkspace<MDEvents::MDEvent<4>, 4>>(outputWS); + DataObjects::MDEventWorkspace<DataObjects::MDEvent<4>, 4>>(outputWS); if (!mdWS) { return boost::shared_ptr<API::Workspace>(); } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/GreaterThanMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/GreaterThanMD.cpp index f98766cfff7d30ea0f189f1b70032d7f23c67c6c..ebc636a082ca7552af1c7cbe24f66333065ff6c2 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/GreaterThanMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/GreaterThanMD.cpp @@ -30,15 +30,15 @@ int GreaterThanMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand void GreaterThanMD::execHistoHisto( - Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand) { + Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand) { out->greaterThan(*operand); } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and a scalar on the RHS void GreaterThanMD::execHistoScalar( - Mantid::MDEvents::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar) { out->greaterThan(scalar->dataY(0)[0]); } diff --git a/Code/Mantid/Framework/MDEvents/src/ImportMDEventWorkspace.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp similarity index 93% rename from Code/Mantid/Framework/MDEvents/src/ImportMDEventWorkspace.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp index 25613ad38949bb3f7b0e8fabcaa5ba495c02e5a3..c69bfc19c71d4b5a4fd5b7d0930ed353f1f58517 100644 --- a/Code/Mantid/Framework/MDEvents/src/ImportMDEventWorkspace.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp @@ -1,18 +1,16 @@ -#include "MantidMDEvents/ImportMDEventWorkspace.h" -#include "MantidKernel/System.h" -#include "MantidAPI/FileProperty.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventInserter.h" -#include "MantidGeometry/MDGeometry/MDHistoDimension.h" +#include "MantidMDAlgorithms/ImportMDEventWorkspace.h" + #include <iostream> #include <fstream> + +#include "MantidAPI/FileProperty.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventInserter.h" +#include "MantidGeometry/MDGeometry/MDHistoDimension.h" + #include <boost/algorithm/string.hpp> #include <boost/algorithm/string/split.hpp> -using namespace Mantid::Kernel; -using namespace Mantid::API; -using namespace Mantid::Geometry; - namespace { /** Helper method that takes a string and performs a cast to the specified type. @@ -34,7 +32,13 @@ template <typename T> T convert(const std::string &str) { } namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { + +using namespace API; +using namespace DataObjects; +using namespace Geometry; +using namespace Kernel; + // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(ImportMDEventWorkspace) @@ -109,7 +113,7 @@ void ImportMDEventWorkspace::init() { /** Extracts mdevent information from the file data and directs the creation of new -MDEvents on the workspace. +DataObjects on the workspace. @param ws: Workspace to add the events to. */ template <typename MDE, size_t nd> @@ -119,12 +123,12 @@ void ImportMDEventWorkspace::addEventsData( MDEventInserter<typename MDEventWorkspace<MDE, nd>::sptr> inserter(ws); DataCollectionType::iterator mdEventEntriesIterator = m_posMDEventStart; std::vector<Mantid::coord_t> centers(nd); - for (size_t i = 0; i < m_nMDEvents; ++i) { + for (size_t i = 0; i < m_nDataObjects; ++i) { float signal = convert<float>(*(++mdEventEntriesIterator)); float error = convert<float>(*(++mdEventEntriesIterator)); uint16_t run_no = 0; int32_t detector_no = 0; - if (m_IsFullMDEvents) { + if (m_IsFullDataObjects) { run_no = convert<uint16_t>(*(++mdEventEntriesIterator)); detector_no = convert<int32_t>(*(++mdEventEntriesIterator)); } @@ -260,17 +264,17 @@ void ImportMDEventWorkspace::exec() { static_cast<int>(std::distance(m_posMDEventStart, m_file_data.end())); const size_t columnsForFullEvents = m_nDimensions + 4; // signal, error, run_no, detector_no - m_IsFullMDEvents = (nActualColumns == columnsForFullEvents); + m_IsFullDataObjects = (nActualColumns == columnsForFullEvents); - m_nMDEvents = posDiffMDEvent / nActualColumns; + m_nDataObjects = posDiffMDEvent / nActualColumns; // Get the min and max extents in each dimension. std::vector<double> extentMins(m_nDimensions); std::vector<double> extentMaxs(m_nDimensions); DataCollectionType::iterator mdEventEntriesIterator = m_posMDEventStart; - for (size_t i = 0; i < m_nMDEvents; ++i) { + for (size_t i = 0; i < m_nDataObjects; ++i) { mdEventEntriesIterator += 2; - if (m_IsFullMDEvents) { + if (m_IsFullDataObjects) { mdEventEntriesIterator += 2; } for (size_t j = 0; j < m_nDimensions; ++j) { @@ -282,7 +286,7 @@ void ImportMDEventWorkspace::exec() { // Create a target output workspace. IMDEventWorkspace_sptr outWs = MDEventFactory::CreateMDWorkspace( - m_nDimensions, m_IsFullMDEvents ? "MDEvent" : "MDLeanEvent"); + m_nDimensions, m_IsFullDataObjects ? "MDEvent" : "MDLeanEvent"); // Extract Dimensions and add to the output workspace. DataCollectionType::iterator dimEntriesIterator = m_posDimStart; @@ -304,4 +308,4 @@ void ImportMDEventWorkspace::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspace.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp similarity index 94% rename from Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspace.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp index 134a84b5007e1173d14c4820891e8a06dc6e420a..6ab4a246077402ccfdd58ba47dc9029d4b94dfa5 100644 --- a/Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspace.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp @@ -1,4 +1,4 @@ -#include "MantidMDEvents/ImportMDHistoWorkspace.h" +#include "MantidMDAlgorithms/ImportMDHistoWorkspace.h" #include "MantidAPI/FileProperty.h" #include <deque> @@ -6,12 +6,14 @@ #include <fstream> #include <iterator> -using namespace Mantid::Kernel; -using namespace Mantid::API; -using namespace Mantid::Geometry; - namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { + +using namespace API; +using namespace DataObjects; +using namespace Kernel; +using namespace Geometry; + // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(ImportMDHistoWorkspace) @@ -119,4 +121,4 @@ void ImportMDHistoWorkspace::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspaceBase.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ImportMDHistoWorkspaceBase.cpp similarity index 95% rename from Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspaceBase.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/ImportMDHistoWorkspaceBase.cpp index 57b619e6fca8ff8fd17b335e8d933a6ba02583a0..59bbfbca7879ebcd7863fc487ac210dda23b771e 100644 --- a/Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspaceBase.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ImportMDHistoWorkspaceBase.cpp @@ -1,17 +1,20 @@ -#include "MantidMDEvents/ImportMDHistoWorkspaceBase.h" -#include "MantidMDEvents/MDHistoWorkspace.h" -#include "MantidKernel/CompositeValidator.h" +#include "MantidMDAlgorithms/ImportMDHistoWorkspaceBase.h" + +#include "MantidDataObjects/MDHistoWorkspace.h" +#include "MantidKernel/ArrayProperty.h" #include "MantidKernel/BoundedValidator.h" +#include "MantidKernel/CompositeValidator.h" #include "MantidKernel/MandatoryValidator.h" -#include "MantidKernel/ArrayProperty.h" + #include <algorithm> -using namespace Mantid::Kernel; using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; +using namespace Mantid::Kernel; namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** Functor to compute the product of the set. @@ -110,4 +113,4 @@ MDHistoWorkspace_sptr ImportMDHistoWorkspaceBase::createEmptyOutputWorkspace() { } } // namespace Mantid -} // namespace MDEvents +} // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDEvents/src/Integrate3DEvents.cpp b/Code/Mantid/Framework/MDAlgorithms/src/Integrate3DEvents.cpp similarity index 99% rename from Code/Mantid/Framework/MDEvents/src/Integrate3DEvents.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/Integrate3DEvents.cpp index be5badfbf2b946558c083b9ae5ec11bc9fb1a7ba..8343d4646f21869815e01df8578b8dc4966a923e 100644 --- a/Code/Mantid/Framework/MDEvents/src/Integrate3DEvents.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/Integrate3DEvents.cpp @@ -5,7 +5,7 @@ #include <boost/make_shared.hpp> #include "MantidDataObjects/NoShape.h" #include "MantidDataObjects/PeakShapeEllipsoid.h" -#include "MantidMDEvents/Integrate3DEvents.h" +#include "MantidMDAlgorithms/Integrate3DEvents.h" extern "C" { @@ -17,9 +17,10 @@ extern "C" { using namespace Mantid::DataObjects; namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { using namespace std; +using Mantid::Kernel::DblMatrix; using Mantid::Kernel::V3D; /** @@ -475,6 +476,6 @@ PeakShapeEllipsoid_const_sptr Integrate3DEvents::ellipseIntegrateEvents( return boost::make_shared<const PeakShapeEllipsoid>(directions, abcRadii, abcBackgroundInnerRadii, abcBackgroundOuterRadii, Mantid::Kernel::QLab, "IntegrateEllipsoids"); } -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/src/IntegrateEllipsoids.cpp b/Code/Mantid/Framework/MDAlgorithms/src/IntegrateEllipsoids.cpp similarity index 87% rename from Code/Mantid/Framework/MDEvents/src/IntegrateEllipsoids.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/IntegrateEllipsoids.cpp index 57ede42f6f5f52bc4087bfa13ee87ad0b0ed525f..ec31dd315c1f69eef926ceafdcb683bccd6dadb9 100644 --- a/Code/Mantid/Framework/MDEvents/src/IntegrateEllipsoids.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/IntegrateEllipsoids.cpp @@ -1,6 +1,5 @@ -#include <iostream> -#include <fstream> -#include <boost/math/special_functions/round.hpp> +#include "MantidMDAlgorithms/IntegrateEllipsoids.h" + #include "MantidAPI/FileProperty.h" #include "MantidAPI/WorkspaceValidators.h" #include "MantidDataObjects/EventWorkspace.h" @@ -12,19 +11,22 @@ #include "MantidGeometry/Crystal/IndexingUtils.h" #include "MantidKernel/BoundedValidator.h" #include "MantidKernel/CompositeValidator.h" -#include "MantidKernel/V3D.h" -#include "MantidMDEvents/MDTransfFactory.h" -#include "MantidMDEvents/UnitsConversionHelper.h" -#include "MantidMDEvents/Integrate3DEvents.h" -#include "MantidMDEvents/IntegrateEllipsoids.h" -#include "MantidDataObjects/Workspace2D.h" #include "MantidKernel/Statistics.h" +#include "MantidMDAlgorithms/MDTransfFactory.h" +#include "MantidMDAlgorithms/UnitsConversionHelper.h" +#include "MantidMDAlgorithms/Integrate3DEvents.h" + +#include <boost/math/special_functions/round.hpp> using namespace Mantid::API; using namespace Mantid::Kernel; using namespace Mantid::Geometry; using namespace Mantid::DataObjects; +namespace Mantid { +namespace MDAlgorithms { + +namespace { /// This only works for diffraction. const std::string ELASTIC("Elastic"); @@ -34,10 +36,6 @@ const std::string Q3D("Q3D"); /// Q-vector is always three dimensional. const std::size_t DIMS(3); -namespace { - -using namespace Mantid::MDEvents; - /** * @brief qListFromEventWS creates qlist from events * @param integrator : itegrator object on which qlists are accumulated @@ -76,7 +74,7 @@ void qListFromEventWS(Integrate3DEvents &integrator, Progress &prog, double errorSq(1.); // ignorable garbage const std::vector<WeightedEventNoTime> &raw_events = events.getWeightedEventsNoTime(); - std::vector<std::pair<double, V3D> > qList; + std::vector<std::pair<double, V3D>> qList; for (auto event = raw_events.begin(); event != raw_events.end(); ++event) { double val = unitConverter.convertUnits(event->tof()); qConverter->calcMatrixCoord(val, locCoord, signal, errorSq); @@ -94,7 +92,8 @@ void qListFromEventWS(Integrate3DEvents &integrator, Progress &prog, } /** - * @brief qListFromHistoWS creates qlist from input workspaces of type Workspace2D + * @brief qListFromHistoWS creates qlist from input workspaces of type + * Workspace2D * @param integrator : itegrator object on which qlists are accumulated * @param prog : progress object * @param wksp : input Workspace2D @@ -125,7 +124,7 @@ void qListFromHistoWS(Integrate3DEvents &integrator, Progress &prog, double signal(1.); // ignorable garbage double errorSq(1.); // ignorable garbage - std::vector<std::pair<double, V3D> > qList; + std::vector<std::pair<double, V3D>> qList; // TODO. we should be able to do this in an OMP loop. for (size_t j = 0; j < yVals.size(); ++j) { @@ -150,7 +149,8 @@ void qListFromHistoWS(Integrate3DEvents &integrator, Progress &prog, int yValCounts = int(yVal); // we deliberately truncate. // Account for counts in histograms by increasing the qList with the // same q-point - qList.push_back(std::make_pair(yValCounts,qVec)); // Not ideal to control the size dynamically? + qList.push_back(std::make_pair( + yValCounts, qVec)); // Not ideal to control the size dynamically? } integrator.addEvents(qList); // We would have to put a lock around this. prog.report(); @@ -161,10 +161,7 @@ void qListFromHistoWS(Integrate3DEvents &integrator, Progress &prog, prog.report(); } } -} - -namespace Mantid { -namespace MDEvents { +} // end anonymous namespace /** NOTE: This has been adapted from the SaveIsawQvector algorithm. */ @@ -297,7 +294,7 @@ void IntegrateEllipsoids::exec() { size_t n_peaks = peak_ws->getNumberPeaks(); size_t indexed_count = 0; std::vector<V3D> peak_q_list; - std::vector<std::pair<double, V3D> > qList; + std::vector<std::pair<double, V3D>> qList; std::vector<V3D> hkl_vectors; for (size_t i = 0; i < n_peaks; i++) // Note: we skip un-indexed peaks { @@ -375,7 +372,7 @@ void IntegrateEllipsoids::exec() { double inti; double sigi; - std::vector<double> principalaxis1,principalaxis2,principalaxis3; + std::vector<double> principalaxis1, principalaxis2, principalaxis3; V3D peak_q; for (size_t i = 0; i < n_peaks; i++) { V3D hkl(peaks[i].getH(), peaks[i].getK(), peaks[i].getL()); @@ -390,7 +387,7 @@ void IntegrateEllipsoids::exec() { peaks[i].setSigmaIntensity(sigi); peaks[i].setPeakShape(shape); if (axes_radii.size() == 3) { - if (inti/sigi > cutoffIsigI || cutoffIsigI == EMPTY_DBL()){ + if (inti / sigi > cutoffIsigI || cutoffIsigI == EMPTY_DBL()) { principalaxis1.push_back(axes_radii[0]); principalaxis2.push_back(axes_radii[1]); principalaxis3.push_back(axes_radii[2]); @@ -401,11 +398,13 @@ void IntegrateEllipsoids::exec() { peaks[i].setSigmaIntensity(0.0); } } - if (principalaxis1.size() > 1 ){ + if (principalaxis1.size() > 1) { size_t histogramNumber = 3; Workspace_sptr wsProfile = WorkspaceFactory::Instance().create( - "Workspace2D", histogramNumber, principalaxis1.size(), principalaxis1.size()); - Workspace2D_sptr wsProfile2D = boost::dynamic_pointer_cast<Workspace2D>(wsProfile); + "Workspace2D", histogramNumber, principalaxis1.size(), + principalaxis1.size()); + Workspace2D_sptr wsProfile2D = + boost::dynamic_pointer_cast<Workspace2D>(wsProfile); AnalysisDataService::Instance().addOrReplace("EllipsoidAxes", wsProfile2D); for (size_t j = 0; j < principalaxis1.size(); j++) { wsProfile2D->dataX(0)[j] = static_cast<double>(j); @@ -420,34 +419,35 @@ void IntegrateEllipsoids::exec() { } Statistics stats1 = getStatistics(principalaxis1); g_log.notice() << "principalaxis1: " - << " mean " << stats1.mean - << " standard_deviation " << stats1.standard_deviation - << " minimum " << stats1.minimum - << " maximum " << stats1.maximum - << " median " << stats1.median << "\n"; + << " mean " << stats1.mean << " standard_deviation " + << stats1.standard_deviation << " minimum " << stats1.minimum + << " maximum " << stats1.maximum << " median " + << stats1.median << "\n"; Statistics stats2 = getStatistics(principalaxis2); g_log.notice() << "principalaxis2: " - << " mean " << stats2.mean - << " standard_deviation " << stats2.standard_deviation - << " minimum " << stats2.minimum - << " maximum " << stats2.maximum - << " median " << stats2.median << "\n"; + << " mean " << stats2.mean << " standard_deviation " + << stats2.standard_deviation << " minimum " << stats2.minimum + << " maximum " << stats2.maximum << " median " + << stats2.median << "\n"; Statistics stats3 = getStatistics(principalaxis3); g_log.notice() << "principalaxis3: " - << " mean " << stats3.mean - << " standard_deviation " << stats3.standard_deviation - << " minimum " << stats3.minimum - << " maximum " << stats3.maximum - << " median " << stats3.median << "\n"; - if (cutoffIsigI != EMPTY_DBL()){ + << " mean " << stats3.mean << " standard_deviation " + << stats3.standard_deviation << " minimum " << stats3.minimum + << " maximum " << stats3.maximum << " median " + << stats3.median << "\n"; + if (cutoffIsigI != EMPTY_DBL()) { principalaxis1.clear(); principalaxis2.clear(); principalaxis3.clear(); - specify_size=true; - peak_radius = std::max(std::max(stats1.mean,stats2.mean),stats3.mean) + numSigmas * - std::max(std::max(stats1.standard_deviation,stats2.standard_deviation),stats3.standard_deviation); + specify_size = true; + peak_radius = std::max(std::max(stats1.mean, stats2.mean), stats3.mean) + + numSigmas * std::max(std::max(stats1.standard_deviation, + stats2.standard_deviation), + stats3.standard_deviation); back_inner_radius = peak_radius; - back_outer_radius = peak_radius * 1.25992105; // A factor of 2 ^ (1/3) will make the background + back_outer_radius = + peak_radius * + 1.25992105; // A factor of 2 ^ (1/3) will make the background // shell volume equal to the peak region volume. V3D peak_q; for (size_t i = 0; i < n_peaks; i++) { @@ -455,12 +455,12 @@ void IntegrateEllipsoids::exec() { if (Geometry::IndexingUtils::ValidIndex(hkl, 1.0)) { peak_q = peaks[i].getQLabFrame(); std::vector<double> axes_radii; - integrator.ellipseIntegrateEvents(peak_q, specify_size, peak_radius, - back_inner_radius, back_outer_radius, - axes_radii, inti, sigi); + integrator.ellipseIntegrateEvents( + peak_q, specify_size, peak_radius, back_inner_radius, + back_outer_radius, axes_radii, inti, sigi); peaks[i].setIntensity(inti); peaks[i].setSigmaIntensity(sigi); - if (axes_radii.size() == 3){ + if (axes_radii.size() == 3) { principalaxis1.push_back(axes_radii[0]); principalaxis2.push_back(axes_radii[1]); principalaxis3.push_back(axes_radii[2]); @@ -470,12 +470,15 @@ void IntegrateEllipsoids::exec() { peaks[i].setSigmaIntensity(0.0); } } - if (principalaxis1.size() > 1 ){ + if (principalaxis1.size() > 1) { size_t histogramNumber = 3; Workspace_sptr wsProfile2 = WorkspaceFactory::Instance().create( - "Workspace2D", histogramNumber, principalaxis1.size(), principalaxis1.size()); - Workspace2D_sptr wsProfile2D2 = boost::dynamic_pointer_cast<Workspace2D>(wsProfile2); - AnalysisDataService::Instance().addOrReplace("EllipsoidAxes_2ndPass", wsProfile2D2); + "Workspace2D", histogramNumber, principalaxis1.size(), + principalaxis1.size()); + Workspace2D_sptr wsProfile2D2 = + boost::dynamic_pointer_cast<Workspace2D>(wsProfile2); + AnalysisDataService::Instance().addOrReplace("EllipsoidAxes_2ndPass", + wsProfile2D2); for (size_t j = 0; j < principalaxis1.size(); j++) { wsProfile2D2->dataX(0)[j] = static_cast<double>(j); wsProfile2D2->dataY(0)[j] = principalaxis1[j]; @@ -532,5 +535,5 @@ void IntegrateEllipsoids::initTargetWSDescr(MatrixWorkspace_sptr &wksp) { m_targWSDescr.m_PreprDetTable = table; } -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid diff --git a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp index e1980adb910df20c1ade113c663df4afe02c89f7..dcb8269ab1322e4dd76bacdfbdefe1e023431784 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp @@ -3,9 +3,9 @@ #include "MantidDataObjects/PeaksWorkspace.h" #include "MantidDataObjects/PeakShapeSpherical.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidMDAlgorithms/IntegratePeaksMD.h" -#include "MantidMDEvents/CoordTransformDistance.h" +#include "MantidDataObjects/CoordTransformDistance.h" #include "MantidKernel/ListValidator.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Workspace2D.h" @@ -31,7 +31,7 @@ DECLARE_ALGORITHM(IntegratePeaksMD) using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::DataObjects; using namespace Mantid::Geometry; @@ -689,4 +689,4 @@ double f_eval(double x, void *params) { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp index 83009e5e60fbf2043f82af27a24678d4e222e03b..297a3a9ac3e8dc118faaec195c4e511b793347c5 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp @@ -4,9 +4,9 @@ #include "MantidDataObjects/Peak.h" #include "MantidDataObjects/PeakShapeSpherical.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidMDAlgorithms/IntegratePeaksMD2.h" -#include "MantidMDEvents/CoordTransformDistance.h" +#include "MantidDataObjects/CoordTransformDistance.h" #include "MantidKernel/ListValidator.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Workspace2D.h" @@ -33,7 +33,7 @@ DECLARE_ALGORITHM(IntegratePeaksMD2) using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::DataObjects; using namespace Mantid::Geometry; @@ -760,4 +760,4 @@ double f_eval2(double x, void *params) { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDAlgorithms/src/LessThanMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/LessThanMD.cpp index ba6e3f654cb3654cb41a5a88ad124210b466af40..089a621bd3839a09e4134762957c888dec7f0d42 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/LessThanMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/LessThanMD.cpp @@ -30,15 +30,15 @@ int LessThanMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand void LessThanMD::execHistoHisto( - Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand) { + Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand) { out->lessThan(*operand); } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and a scalar on the RHS void LessThanMD::execHistoScalar( - Mantid::MDEvents::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar) { out->lessThan(scalar->dataY(0)[0]); } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp index 7b7d5eafaad185193718a2bc207b66940c027fed..694014471026ca7fd6e59de755a4f2bb92c69293 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp @@ -11,11 +11,11 @@ #include "MantidKernel/PropertyWithValue.h" #include "MantidKernel/System.h" #include "MantidMDAlgorithms/LoadMD.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDBoxFlatTree.h" -#include "MantidMDEvents/MDHistoWorkspace.h" -#include "MantidMDEvents/BoxControllerNeXusIO.h" -#include "MantidMDEvents/CoordTransformAffine.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDBoxFlatTree.h" +#include "MantidDataObjects/MDHistoWorkspace.h" +#include "MantidDataObjects/BoxControllerNeXusIO.h" +#include "MantidDataObjects/CoordTransformAffine.h" #include <nexus/NeXusException.hpp> #include <boost/algorithm/string.hpp> #include <vector> @@ -29,7 +29,7 @@ typedef std::auto_ptr<Mantid::API::IBoxControllerIO> file_holder_type; using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { @@ -355,7 +355,7 @@ void LoadMD::doLoad(typename MDEventWorkspace<MDE, nd>::sptr ws) { // ------------------------------------ if (fileBackEnd) { // TODO:: call to the file format factory auto loader = boost::shared_ptr<API::IBoxControllerIO>( - new MDEvents::BoxControllerNeXusIO(bc.get())); + new DataObjects::BoxControllerNeXusIO(bc.get())); loader->setDataType(sizeof(coord_t), MDE::getTypeName()); bc->setFileBacked(loader, m_filename); // boxes have been already made file-backed when restoring the boxTree; @@ -387,7 +387,7 @@ void LoadMD::doLoad(typename MDEventWorkspace<MDE, nd>::sptr ws) { // ------------------------------------ // TODO:: call to the file format factory auto loader = - file_holder_type(new MDEvents::BoxControllerNeXusIO(bc.get())); + file_holder_type(new DataObjects::BoxControllerNeXusIO(bc.get())); loader->setDataType(sizeof(coord_t), MDE::getTypeName()); loader->openFile(m_filename, "r"); @@ -487,4 +487,4 @@ CoordTransform *LoadMD::loadAffineMatrix(std::string entry_name) { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDAlgorithms/src/LoadSQW.cpp b/Code/Mantid/Framework/MDAlgorithms/src/LoadSQW.cpp index 5f2e8770c49ce0499d2a89ddc557b1bf360f7091..4f71e5fd9bbf2003ed9e1100f0f7dfa7cd06bf2b 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/LoadSQW.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/LoadSQW.cpp @@ -15,14 +15,14 @@ #include "MantidAPI/RegisterFileLoader.h" #include <iostream> #include <cfloat> -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/BoxControllerNeXusIO.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/BoxControllerNeXusIO.h" #include "MantidKernel/Memory.h" using namespace Mantid::Kernel; using namespace Mantid::API; using Mantid::Geometry::OrientedLattice; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { @@ -157,7 +157,7 @@ void LoadSQW::exec() { // set file backed boxes auto Saver = boost::shared_ptr<API::IBoxControllerIO>( - new MDEvents::BoxControllerNeXusIO(bc.get())); + new DataObjects::BoxControllerNeXusIO(bc.get())); bc->setFileBacked(Saver, m_outputFile); pWs->getBox()->setFileBacked(); bc->getFileIO()->setWriteBufferSize(1000000); @@ -208,7 +208,7 @@ void LoadSQW::exec() { /// Add events after reading pixels/datapoints from file. void - LoadSQW::readEvents(Mantid::MDEvents::MDEventWorkspace<MDEvent<4>, 4> *ws) { + LoadSQW::readEvents(Mantid::DataObjects::MDEventWorkspace<MDEvent<4>, 4> *ws) { CPUTimer tim; size_t maxNPix = ~size_t(0); @@ -380,7 +380,7 @@ lattice and add to workspace. @param ws : Workspace to modify. */ void - LoadSQW::addLattice(Mantid::MDEvents::MDEventWorkspace<MDEvent<4>, 4> *ws) { + LoadSQW::addLattice(Mantid::DataObjects::MDEventWorkspace<MDEvent<4>, 4> *ws) { std::vector<char> buf( 4 * (3 + 3)); // Where 4 = size_of(float) and 3 * 3 is size of b-matrix. this->m_fileStream.seekg(this->m_dataPositions.geom_start, std::ios::beg); @@ -626,7 +626,7 @@ void LoadSQW::readDNDDimensions( } /// add range of dimensions to the workspace; void LoadSQW::addDimsToWs( - Mantid::MDEvents::MDEventWorkspace<MDEvents::MDEvent<4>, 4> *ws, + Mantid::DataObjects::MDEventWorkspace<DataObjects::MDEvent<4>, 4> *ws, std::vector<Mantid::Geometry::MDHistoDimensionBuilder> &DimVector) { // Add dimensions to the workspace by invoking the dimension builders. for (size_t i = 0; i < 4; i++) { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/LogarithmMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/LogarithmMD.cpp index 2111d83e333a8a0d67fbf1ad9d1245d0d220b372..bd84bb2ee6762968ca1799f7b38113d73dd5cccd 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/LogarithmMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/LogarithmMD.cpp @@ -60,7 +60,7 @@ void LogarithmMD::execEvent(Mantid::API::IMDEventWorkspace_sptr /*out*/) { //---------------------------------------------------------------------------------------------- /// LogarithmMD::Run the algorithm with a MDHistoWorkspace -void LogarithmMD::execHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out) { +void LogarithmMD::execHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out) { bool natural = getProperty("Natural"); double filler = getProperty("Filler"); if (natural) diff --git a/Code/Mantid/Framework/MDEvents/src/MDEventWSWrapper.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MDEventWSWrapper.cpp similarity index 89% rename from Code/Mantid/Framework/MDEvents/src/MDEventWSWrapper.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/MDEventWSWrapper.cpp index fd39cfb1d7ae831ee30ac29ccf0c4ce3d13b249e..533603184968eaf186d48da676d36e0f1e7b3a45 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDEventWSWrapper.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MDEventWSWrapper.cpp @@ -1,7 +1,7 @@ -#include "MantidMDEvents/MDEventWSWrapper.h" +#include "MantidMDAlgorithms/MDEventWSWrapper.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** internal helper function to create empty MDEventWorkspace with nd dimensions and set up internal pointer to this workspace @@ -29,9 +29,9 @@ void MDEventWSWrapper::createEmptyEventWS(const Strings &targ_dim_names, const std::vector<double> &dimMax, const std::vector<size_t> &numBins) { - boost::shared_ptr<MDEvents::MDEventWorkspace<MDEvents::MDEvent<nd>, nd>> ws = - boost::shared_ptr<MDEvents::MDEventWorkspace<MDEvents::MDEvent<nd>, nd>>( - new MDEvents::MDEventWorkspace<MDEvents::MDEvent<nd>, nd>()); + boost::shared_ptr<DataObjects::MDEventWorkspace<DataObjects::MDEvent<nd>, nd>> ws = + boost::shared_ptr<DataObjects::MDEventWorkspace<DataObjects::MDEvent<nd>, nd>>( + new DataObjects::MDEventWorkspace<DataObjects::MDEvent<nd>, nd>()); size_t nBins(10); // Give all the dimensions @@ -89,19 +89,19 @@ void MDEventWSWrapper::addMDDataND(float *sigErr, uint16_t *runIndex, uint32_t *detId, coord_t *Coord, size_t dataSize) const { - MDEvents::MDEventWorkspace<MDEvents::MDEvent<nd>, nd> *const pWs = - dynamic_cast<MDEvents::MDEventWorkspace<MDEvents::MDEvent<nd>, nd> *>( + DataObjects::MDEventWorkspace<DataObjects::MDEvent<nd>, nd> *const pWs = + dynamic_cast<DataObjects::MDEventWorkspace<DataObjects::MDEvent<nd>, nd> *>( m_Workspace.get()); if (pWs) { for (size_t i = 0; i < dataSize; i++) { - pWs->addEvent(MDEvents::MDEvent<nd>( + pWs->addEvent(DataObjects::MDEvent<nd>( *(sigErr + 2 * i), *(sigErr + 2 * i + 1), *(runIndex + i), *(detId + i), (Coord + i * nd))); } } else { - MDEvents::MDEventWorkspace<MDEvents::MDLeanEvent<nd>, nd> *const pLWs = + DataObjects::MDEventWorkspace<DataObjects::MDLeanEvent<nd>, nd> *const pLWs = dynamic_cast< - MDEvents::MDEventWorkspace<MDEvents::MDLeanEvent<nd>, nd> *>( + DataObjects::MDEventWorkspace<DataObjects::MDLeanEvent<nd>, nd> *>( m_Workspace.get()); if (!pLWs) @@ -110,7 +110,7 @@ void MDEventWSWrapper::addMDDataND(float *sigErr, uint16_t *runIndex, "to add to it"); for (size_t i = 0; i < dataSize; i++) { - pLWs->addEvent(MDEvents::MDLeanEvent<nd>( + pLWs->addEvent(DataObjects::MDLeanEvent<nd>( *(sigErr + 2 * i), *(sigErr + 2 * i + 1), (Coord + i * nd))); } } @@ -128,8 +128,8 @@ void MDEventWSWrapper::addMDDataND<0>(float *, uint16_t *, uint32_t *, /***/ // void MDEventWSWrapper::splitBoxList(Kernel::ThreadScheduler * ts) template <size_t nd> void MDEventWSWrapper::splitBoxList() { - MDEvents::MDEventWorkspace<MDEvents::MDEvent<nd>, nd> *const pWs = - dynamic_cast<MDEvents::MDEventWorkspace<MDEvents::MDEvent<nd>, nd> *>( + DataObjects::MDEventWorkspace<DataObjects::MDEvent<nd>, nd> *const pWs = + dynamic_cast<DataObjects::MDEventWorkspace<DataObjects::MDEvent<nd>, nd> *>( m_Workspace.get()); if (!pWs) throw(std::bad_cast()); @@ -140,14 +140,14 @@ template <size_t nd> void MDEventWSWrapper::splitBoxList() { // for(size_t i=0;i<BoxList.size();i++) // { // bool - // rootFolderReplaced=MDEvents::MDBox<MDEvents::MDEvent<nd>,nd>::splitAllIfNeeded(BoxList[i],NULL); + // rootFolderReplaced=DataObjects::MDBox<DataObjects::MDEvent<nd>,nd>::splitAllIfNeeded(BoxList[i],NULL); // if(rootFolderReplaced) // { // RootBox = BoxList[i]; // } // } - // if(RootBox.boxPointer)pWs->setBox(reinterpret_cast<MDEvents::MDBoxBase<MDEvents::MDEvent<nd>,nd> + // if(RootBox.boxPointer)pWs->setBox(reinterpret_cast<DataObjects::MDBoxBase<DataObjects::MDEvent<nd>,nd> // *>(RootBox.boxPointer)); // BoxList.clear(); @@ -162,8 +162,8 @@ template <> void MDEventWSWrapper::splitBoxList<0>() { /// helper function to refresh centroid on MDEventWorkspace with nd dimensions template <size_t nd> void MDEventWSWrapper::calcCentroidND(void) { - MDEvents::MDEventWorkspace<MDEvents::MDEvent<nd>, nd> *const pWs = - dynamic_cast<MDEvents::MDEventWorkspace<MDEvents::MDEvent<nd>, nd> *>( + DataObjects::MDEventWorkspace<DataObjects::MDEvent<nd>, nd> *const pWs = + dynamic_cast<DataObjects::MDEventWorkspace<DataObjects::MDEvent<nd>, nd> *>( this->m_Workspace.get()); if (!pWs) throw(std::bad_cast()); @@ -296,5 +296,5 @@ MDEventWSWrapper::MDEventWSWrapper() LOOP<MAX_N_DIM>::EXEC(this); } -} // endnamespace MDEvents +} // endnamespace MDAlgorithms } // endnamespace Mantid \ No newline at end of file diff --git a/Code/Mantid/Framework/MDAlgorithms/src/MDNormDirectSC.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MDNormDirectSC.cpp index 1a433923211fb73996cfc950c61b9bee6fc9fd92..f8e90b16805caf3ba0615f534c96f5e17a3061fe 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/MDNormDirectSC.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MDNormDirectSC.cpp @@ -2,8 +2,8 @@ #include "MantidAPI/WorkspaceValidators.h" #include "MantidDataObjects/EventWorkspace.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidKernel/VectorHelper.h" @@ -12,7 +12,7 @@ namespace MDAlgorithms { using Mantid::Kernel::Direction; using Mantid::API::WorkspaceProperty; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::API; using namespace Mantid::Kernel; diff --git a/Code/Mantid/Framework/MDAlgorithms/src/MDNormSCD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MDNormSCD.cpp index 4043372b546d6de60783db5dcef01d59cbbc4155..b66b356678205fa96750e35fd8f98c26a0e03bcf 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/MDNormSCD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MDNormSCD.cpp @@ -2,8 +2,8 @@ #include "MantidAPI/WorkspaceValidators.h" #include "MantidDataObjects/EventWorkspace.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidKernel/VectorHelper.h" @@ -12,7 +12,7 @@ namespace MDAlgorithms { using Mantid::Kernel::Direction; using Mantid::API::WorkspaceProperty; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::API; using namespace Mantid::Kernel; diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfAxisNames.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MDTransfAxisNames.cpp similarity index 96% rename from Code/Mantid/Framework/MDEvents/src/MDTransfAxisNames.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/MDTransfAxisNames.cpp index 60d6ffcb81a7777ef3fbf363d3b237464a2d5203..aeaf6288efbbcfeb2128995e67ef1e3d8fe4c22a 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfAxisNames.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MDTransfAxisNames.cpp @@ -1,8 +1,8 @@ -#include "MantidMDEvents/MDTransfAxisNames.h" +#include "MantidMDAlgorithms/MDTransfAxisNames.h" #include <boost/format.hpp> namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { using namespace Mantid::Kernel; MDTransfAxisNames::MDTransfAxisNames() : m_DefaultDimID(CnvrtToMD::nDefaultID) { @@ -97,5 +97,5 @@ std::string DLLExport sprintfd(const double data, const double eps) { return boost::str(boost::format("%d") % dist); } -} // endnamespace MDEvents +} // endnamespace MDAlgorithms } // endnamespace Mantid diff --git a/Code/Mantid/Framework/MDAlgorithms/src/MDTransfDEHelper.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MDTransfDEHelper.cpp index adeb9822df7ea7111ae7ed3409aa1571d511a67a..0b50e4b258c030fe20bcb3c3d37d56499666a665 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/MDTransfDEHelper.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MDTransfDEHelper.cpp @@ -1,7 +1,7 @@ -#include "MantidMDEvents/MDTransfDEHelper.h" +#include "MantidDataObjects/MDTransfDEHelper.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { MDTransfDEHelper::MDTransfDEHelper() EmodesList(ConvertToMD::No_DE, "") { EmodesList[ConvertToMD::Elastic] = "Elastic"; @@ -12,5 +12,5 @@ ConvertToMD::Emodes getEmode(const std::string &Mode) const { return ConvertToMD::No_DE; } -} // endnamespace MDEvents +} // endnamespace DataObjects } // endnamespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfFactory.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MDTransfFactory.cpp similarity index 92% rename from Code/Mantid/Framework/MDEvents/src/MDTransfFactory.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/MDTransfFactory.cpp index d85a83ee64bbf6ea8505ffc69efa6803be860c91..ae80ebc0b46fc920db56c67ef0cb7ba907d1ef8a 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfFactory.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MDTransfFactory.cpp @@ -1,7 +1,7 @@ -#include "MantidMDEvents/MDTransfFactory.h" +#include "MantidMDAlgorithms/MDTransfFactory.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { MDTransfFactoryImpl::MDTransfFactoryImpl() : Kernel::DynamicFactory<MDTransfInterface>(), m_createdTransf() {} @@ -30,5 +30,5 @@ MDTransfFactoryImpl::create(const std::string &className) const { } } -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MDTransfModQ.cpp similarity index 99% rename from Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/MDTransfModQ.cpp index 64150e9fa8a1bed3a780afa511aac02462d61703..fe1aecb8937c0377fb03b91a31fc0ee8146c129a 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MDTransfModQ.cpp @@ -1,8 +1,8 @@ -#include "MantidMDEvents/MDTransfModQ.h" +#include "MantidMDAlgorithms/MDTransfModQ.h" #include "MantidKernel/RegistrationHelper.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { // register the class, whith conversion factory under ModQ name DECLARE_MD_TRANSFID(MDTransfModQ, |Q|) diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfNoQ.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MDTransfNoQ.cpp similarity index 98% rename from Code/Mantid/Framework/MDEvents/src/MDTransfNoQ.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/MDTransfNoQ.cpp index f8022527affa48d6e33e2cb3e96bcc7596ceb411..e7848cc31fc8ed49c2d27c09ed9d69b41747cd1b 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfNoQ.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MDTransfNoQ.cpp @@ -1,7 +1,7 @@ -#include "MantidMDEvents/MDTransfNoQ.h" +#include "MantidMDAlgorithms/MDTransfNoQ.h" // namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { // register the class, whith conversion factory under NoQ name DECLARE_MD_TRANSFID(MDTransfNoQ, CopyToMD) diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MDTransfQ3D.cpp similarity index 99% rename from Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/MDTransfQ3D.cpp index 4b28ee722568cff8fa139fedfe0e91bd1451ea66..87df6285ec46a8be08a5351926f05560b3a938b7 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MDTransfQ3D.cpp @@ -1,8 +1,8 @@ -#include "MantidMDEvents/MDTransfQ3D.h" +#include "MantidMDAlgorithms/MDTransfQ3D.h" #include "MantidKernel/RegistrationHelper.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { // register the class, whith conversion factory under Q3D name DECLARE_MD_TRANSFID(MDTransfQ3D, Q3D) diff --git a/Code/Mantid/Framework/MDEvents/src/MDWSDescription.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MDWSDescription.cpp similarity index 98% rename from Code/Mantid/Framework/MDEvents/src/MDWSDescription.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/MDWSDescription.cpp index fe787634d1dcfdf0098af6981ab8edb4310f7b25..bb19321d25be4cdeabcabf4f1f1d44cf39dd9c19 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDWSDescription.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MDWSDescription.cpp @@ -1,13 +1,16 @@ -#include "MantidMDEvents/MDWSDescription.h" -#include "MantidKernel/TimeSeriesProperty.h" -#include "MantidMDEvents/MDTransfFactory.h" +#include "MantidMDAlgorithms/MDWSDescription.h" + #include "MantidAPI/NumericAxis.h" + +#include "MantidKernel/TimeSeriesProperty.h" #include "MantidKernel/Strings.h" +#include "MantidMDAlgorithms/MDTransfFactory.h" + #include <boost/lexical_cast.hpp> namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** set specific (non-default) dimension name * @param nDim -- number of dimension; @@ -170,8 +173,8 @@ MDWSDescription::buildFromMDWS(const API::IMDEventWorkspace_const_sptr &pWS) { *@param SourceMatrWS -- the MDWS description obtained from input matrix *workspace and the algorithm parameters */ -void MDWSDescription::setUpMissingParameters( - const MDEvents::MDWSDescription &SourceMatrWS) { +void +MDWSDescription::setUpMissingParameters(const MDWSDescription &SourceMatrWS) { m_InWS = SourceMatrWS.m_InWS; m_Emode = SourceMatrWS.m_Emode; m_LorentzCorr = SourceMatrWS.m_LorentzCorr; @@ -199,7 +202,7 @@ void MDWSDescription::setUpMissingParameters( * */ void MDWSDescription::checkWSCorresponsMDWorkspace( - MDEvents::MDWSDescription &NewMDWorkspaceD) { + MDWSDescription &NewMDWorkspaceD) { if (m_NDims != NewMDWorkspaceD.m_NDims) { std::string ERR = "Dimension numbers are inconsistent: this workspace has " + @@ -425,5 +428,5 @@ MDWSDescription::getCoordinateSystem() const { return m_coordinateSystem; } -} // end namespace MDEvents +} // end namespace MDAlgorithms } // end namespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/src/MDWSTransform.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MDWSTransform.cpp similarity index 95% rename from Code/Mantid/Framework/MDEvents/src/MDWSTransform.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/MDWSTransform.cpp index d4c24c31db6ae03a2dbf4a6625d061470cf782f4..3944f5b34bdb7217e2d254d9a761c2b7394ba29c 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDWSTransform.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MDWSTransform.cpp @@ -1,10 +1,12 @@ -#include "MantidMDEvents/MDWSTransform.h" -#include "MantidMDEvents/MDTransfAxisNames.h" +#include "MantidMDAlgorithms/MDWSTransform.h" + #include "MantidKernel/Strings.h" -#include <float.h> +#include "MantidMDAlgorithms/MDTransfAxisNames.h" + +#include <cfloat> namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { namespace { // logger for the algorithm workspaces Kernel::Logger g_Log("MDWSTransform"); @@ -38,7 +40,7 @@ using namespace CnvrtToMD; * coordinate system. */ std::vector<double> -MDWSTransform::getTransfMatrix(MDEvents::MDWSDescription &TargWSDescription, +MDWSTransform::getTransfMatrix(MDWSDescription &TargWSDescription, const std::string &FrameRequested, const std::string &QScaleRequested) const { CoordScaling ScaleID = getQScaling(QScaleRequested); @@ -61,7 +63,7 @@ MDWSTransform::getTransfMatrix(MDEvents::MDWSDescription &TargWSDescription, *Sample frame -- otherwise */ CnvrtToMD::TargetFrame MDWSTransform::findTargetFrame( - MDEvents::MDWSDescription &TargWSDescription) const { + MDWSDescription &TargWSDescription) const { bool hasGoniometer = TargWSDescription.hasGoniometer(); bool hasLattice = TargWSDescription.hasLattice(); @@ -85,7 +87,7 @@ CnvrtToMD::TargetFrame MDWSTransform::findTargetFrame( *insufficient to define the frame requested */ void MDWSTransform::checkTargetFrame( - const MDEvents::MDWSDescription &TargWSDescription, + const MDWSDescription &TargWSDescription, const CnvrtToMD::TargetFrame CoordFrameID) const { switch (CoordFrameID) { case (LabFrame): // nothing needed for lab frame @@ -111,7 +113,7 @@ void MDWSTransform::checkTargetFrame( /** The matrix to convert neutron momentums into the target coordinate system */ std::vector<double> -MDWSTransform::getTransfMatrix(MDEvents::MDWSDescription &TargWSDescription, +MDWSTransform::getTransfMatrix(MDWSDescription &TargWSDescription, CnvrtToMD::TargetFrame FrameID, CoordScaling &ScaleID) const { @@ -198,7 +200,7 @@ MDWSTransform::getTransfMatrix(MDEvents::MDWSDescription &TargWSDescription, W*Unit*Lattice_param depending on inputs */ Kernel::DblMatrix -MDWSTransform::buildQTrahsf(MDEvents::MDWSDescription &TargWSDescription, +MDWSTransform::buildQTrahsf(MDWSDescription &TargWSDescription, CnvrtToMD::CoordScaling ScaleID, bool UnitUB) const { // implements strategy @@ -293,7 +295,7 @@ MDWSTransform::buildQTrahsf(MDEvents::MDWSDescription &TargWSDescription, */ void MDWSTransform::setQ3DDimensionsNames( - MDEvents::MDWSDescription &TargWSDescription, + MDWSDescription &TargWSDescription, CnvrtToMD::TargetFrame FrameID, CnvrtToMD::CoordScaling ScaleID) const { std::vector<Kernel::V3D> dimDirections; @@ -358,7 +360,7 @@ void MDWSTransform::setQ3DDimensionsNames( else for (int i = 0; i < 3; i++) TargWSDescription.setDimName( - i, MDEvents::makeAxisName(dimDirections[i], dimNames)); + i, MDAlgorithms::makeAxisName(dimDirections[i], dimNames)); if (ScaleID == NoScaling) { for (int i = 0; i < 3; i++) @@ -370,7 +372,7 @@ void MDWSTransform::setQ3DDimensionsNames( dMax = (dMax > LatPar[i]) ? (dMax) : (LatPar[i]); for (int i = 0; i < 3; i++) TargWSDescription.setDimUnit( - i, "in " + MDEvents::sprintfd(2 * M_PI / dMax, 1.e-3) + " A^-1"); + i, "in " + MDAlgorithms::sprintfd(2 * M_PI / dMax, 1.e-3) + " A^-1"); } if ((ScaleID == OrthogonalHKLScale) || (ScaleID == HKLScale)) { // get the length along each of the axes @@ -384,12 +386,12 @@ void MDWSTransform::setQ3DDimensionsNames( len.push_back(2 * M_PI * x.norm()); for (int i = 0; i < 3; i++) TargWSDescription.setDimUnit( - i, "in " + MDEvents::sprintfd(len[i], 1.e-3) + " A^-1"); + i, "in " + MDAlgorithms::sprintfd(len[i], 1.e-3) + " A^-1"); } } void MDWSTransform::setModQDimensionsNames( - MDEvents::MDWSDescription &TargWSDescription, + MDWSDescription &TargWSDescription, const std::string &QScaleRequested) const { // TODO: nothing meaningful has // been done at the moment, // should enable scaling if diff --git a/Code/Mantid/Framework/MDAlgorithms/src/MergeMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MergeMD.cpp index 2ab9e50751114cd76478d7ab9febde0d09b43c85..0c441665f31aa3dac30d220e6b4d973dca69d2b5 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/MergeMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MergeMD.cpp @@ -1,17 +1,17 @@ #include "MantidMDAlgorithms/MergeMD.h" #include "MantidKernel/Strings.h" #include "MantidGeometry/MDGeometry/IMDDimension.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidGeometry/MDGeometry/MDHistoDimension.h" #include "MantidKernel/ArrayProperty.h" -#include "MantidMDEvents/MDBoxIterator.h" +#include "MantidDataObjects/MDBoxIterator.h" #include "MantidKernel/CPUTimer.h" #include "MantidKernel/MandatoryValidator.h" using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/MergeMDFiles.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MergeMDFiles.cpp index d8c9419aa81de37ffa807f99f4b7eb0b94ded00d..44d21fa14a44d348e74887dbebadfd9028cdb734 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/MergeMDFiles.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MergeMDFiles.cpp @@ -3,9 +3,9 @@ #include "MantidKernel/CPUTimer.h" #include "MantidKernel/Strings.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/BoxControllerNeXusIO.h" +#include "MantidDataObjects/MDBoxBase.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/BoxControllerNeXusIO.h" #include "MantidMDAlgorithms/MergeMDFiles.h" #include "MantidAPI/MemoryManager.h" @@ -14,7 +14,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { @@ -205,7 +205,7 @@ void MergeMDFiles::doExecByCloning(Mantid::API::IMDEventWorkspace_sptr ws, bc->setMaxDepth(20); bc->setSplitThreshold(5000); auto saver = boost::shared_ptr<API::IBoxControllerIO>( - new MDEvents::BoxControllerNeXusIO(bc.get())); + new DataObjects::BoxControllerNeXusIO(bc.get())); saver->setDataType(sizeof(coord_t), m_MDEventType); if (m_fileBasedTargetWS) { bc->setFileBacked(saver, outputFile); diff --git a/Code/Mantid/Framework/MDAlgorithms/src/MinusMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MinusMD.cpp index 7985cc9b0eb03ff1491202cd5c745b816ac0eea4..88a37ab5534b77f66a26fb77dad7a46629746a62 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/MinusMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MinusMD.cpp @@ -1,13 +1,13 @@ #include "MantidMDAlgorithms/MinusMD.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDBoxIterator.h" -#include "MantidMDEvents/MDBox.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDBoxIterator.h" +#include "MantidDataObjects/MDBox.h" using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { @@ -130,15 +130,15 @@ void MinusMD::execEvent() { //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand void -MinusMD::execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand) { +MinusMD::execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand) { out->subtract(*operand); } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output, scalar and operand void MinusMD::execHistoScalar( - Mantid::MDEvents::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar) { out->subtract(scalar->dataY(0)[0], scalar->dataE(0)[0]); } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/MultiplyMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MultiplyMD.cpp index 5ba0de5c4512165f66e194b9091242368c2f4bbb..2873d6a079793ec1487fafb9cad836abc1bb6b56 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/MultiplyMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MultiplyMD.cpp @@ -1,13 +1,13 @@ #include "MantidKernel/System.h" #include "MantidMDAlgorithms/MultiplyMD.h" -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDBoxBase.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { @@ -120,15 +120,15 @@ void MultiplyMD::execEvent() { //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand void MultiplyMD::execHistoHisto( - Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand) { + Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand) { out->multiply(*operand); } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output, scalar and operand void MultiplyMD::execHistoScalar( - Mantid::MDEvents::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar) { out->multiply(scalar->dataY(0)[0], scalar->dataE(0)[0]); } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/NotMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/NotMD.cpp index 00757fb06ef3831758354d779186022def752783..bd1c688fc7568651ed003f876001c5ba363af9c7 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/NotMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/NotMD.cpp @@ -46,7 +46,7 @@ void NotMD::execEvent(Mantid::API::IMDEventWorkspace_sptr /*out*/) { //---------------------------------------------------------------------------------------------- /// NotMD::Run the algorithm with a MDHistoWorkspace -void NotMD::execHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out) { +void NotMD::execHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out) { out->operatorNot(); } diff --git a/Code/Mantid/Framework/MDEvents/src/OneStepMDEW.cpp b/Code/Mantid/Framework/MDAlgorithms/src/OneStepMDEW.cpp similarity index 94% rename from Code/Mantid/Framework/MDEvents/src/OneStepMDEW.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/OneStepMDEW.cpp index 758c88c4b48bf6b1d833734e8a33236a019c4979..17b83b7f4df496c4ee1d5f3e0186a3a2be7dc636 100644 --- a/Code/Mantid/Framework/MDEvents/src/OneStepMDEW.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/OneStepMDEW.cpp @@ -1,14 +1,14 @@ -#include "MantidMDEvents/OneStepMDEW.h" +#include "MantidMDAlgorithms/OneStepMDEW.h" #include "MantidKernel/System.h" #include "MantidAPI/FileProperty.h" #include "MantidAPI/FrameworkManager.h" #include "MantidDataObjects/EventWorkspace.h" #include "MantidAPI/IMDEventWorkspace.h" //#include "MantidNexus/LoadEventNexus.h" -//#include "MantidMDEvents/ConvertToDiffractionMDWorkspace.h" +//#include "MantidDataObjects/ConvertToDiffractionMDWorkspace.h" namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(OneStepMDEW) @@ -73,4 +73,4 @@ void OneStepMDEW::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDAlgorithms/src/OrMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/OrMD.cpp index 1ff0932783ea02630112cd9b865cf9d11269a00c..478b04d3a7f4b3ae53d68f9253b59de1ef1f19c0 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/OrMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/OrMD.cpp @@ -30,8 +30,8 @@ int OrMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand void -OrMD::execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand) { +OrMD::execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand) { out->operator|=(*operand); } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/PlusMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/PlusMD.cpp index 769c39152190c0252f563b997a08f03d24a708d1..2a18a714e36e81fd05eed0c9346b0f7d0ae5bf91 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/PlusMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/PlusMD.cpp @@ -1,14 +1,14 @@ #include "MantidAPI/IMDEventWorkspace.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/MDBoxIterator.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDBoxBase.h" +#include "MantidDataObjects/MDBoxIterator.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidMDAlgorithms/PlusMD.h" #include "MantidKernel/ThreadScheduler.h" #include "MantidKernel/ThreadPool.h" using namespace Mantid::Kernel; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::API; namespace Mantid { @@ -150,15 +150,15 @@ void PlusMD::checkInputs() { //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand void -PlusMD::execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand) { +PlusMD::execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand) { out->add(*operand); } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output, scalar and operand void PlusMD::execHistoScalar( - Mantid::MDEvents::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar) { out->add(scalar->dataY(0)[0], scalar->dataE(0)[0]); } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/PowerMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/PowerMD.cpp index d4e03afa6bcd7f32cd4eeb39bef23e19b86ba83f..0977843f8ec800578cbb4a3fb9ed229cd4bb0572 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/PowerMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/PowerMD.cpp @@ -53,7 +53,7 @@ void PowerMD::execEvent(Mantid::API::IMDEventWorkspace_sptr /*out*/) { //---------------------------------------------------------------------------------------------- /// PowerMD::Run the algorithm with a MDHistoWorkspace -void PowerMD::execHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out) { +void PowerMD::execHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out) { double exponent = getProperty("Exponent"); out->power(exponent); } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/ResolutionConvolvedCrossSection.cpp b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/ResolutionConvolvedCrossSection.cpp index ba9dd517a09566889f4be563555cea5982229c8e..69fe221cd35e9c7dbea2d53b6db31db9f56eafdb 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/ResolutionConvolvedCrossSection.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/ResolutionConvolvedCrossSection.cpp @@ -2,17 +2,15 @@ // Includes // #include "MantidMDAlgorithms/Quantification/ResolutionConvolvedCrossSection.h" -#include "MantidMDAlgorithms/Quantification/MDResolutionConvolution.h" -#include "MantidMDAlgorithms/Quantification/ForegroundModel.h" #include "MantidAPI/ChopperModel.h" +#include "MantidAPI/ExperimentInfo.h" #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/FunctionDomainMD.h" -#include "MantidAPI/ExperimentInfo.h" -#include "MantidAPI/MemoryManager.h" -#include "MantidKernel/CPUTimer.h" -#include "MantidMDEvents/MDEvent.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEvent.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidMDAlgorithms/Quantification/ForegroundModel.h" +#include "MantidMDAlgorithms/Quantification/MDResolutionConvolution.h" /// Parallel region start macro. Different to generic one as that is specific to /// algorithms @@ -52,6 +50,9 @@ namespace Mantid { namespace MDAlgorithms { DECLARE_FUNCTION(ResolutionConvolvedCrossSection) +using namespace DataObjects; +using namespace Kernel; + namespace { // Attribute names const char *RESOLUTION_ATTR = "ResolutionFunction"; @@ -174,8 +175,8 @@ double ResolutionConvolvedCrossSection::functionMD( PARALLEL_CRITICAL(ResolutionConvolvedCrossSection_functionMD) { m_simulatedEvents.insert( m_simulatedEvents.end(), - MDEvents::MDEvent<4>(static_cast<float>(contribution), 0.0f, - innerRun, box.getInnerDetectorID(j), centers)); + MDEvent<4>(static_cast<float>(contribution), 0.0f, innerRun, + box.getInnerDetectorID(j), centers)); } } @@ -197,7 +198,7 @@ double ResolutionConvolvedCrossSection::functionMD( void ResolutionConvolvedCrossSection::storeSimulatedEvents( const API::IMDEventWorkspace_sptr &resultWS) { auto outputWS = - boost::dynamic_pointer_cast<MDEvents::MDEventWorkspace4>(resultWS); + boost::dynamic_pointer_cast<MDEventWorkspace4>(resultWS); if (!outputWS) { throw std::invalid_argument( "ResolutionConvolvedCrossSection currently only supports 4 dimensions"); @@ -209,16 +210,12 @@ void ResolutionConvolvedCrossSection::storeSimulatedEvents( } m_simulatedEvents.clear(); - API::MemoryManager::Instance().releaseFreeMemory(); // This splits up all the boxes according to split thresholds and sizes. - auto threadScheduler = new Kernel::ThreadSchedulerFIFO(); - Kernel::ThreadPool threadPool(threadScheduler); + auto threadScheduler = new ThreadSchedulerFIFO(); + ThreadPool threadPool(threadScheduler); outputWS->splitAllIfNeeded(threadScheduler); threadPool.joinAll(); outputWS->refreshCache(); - - // Flush memory - API::MemoryManager::Instance().releaseFreeMemory(); } /** diff --git a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/SimulateResolutionConvolvedModel.cpp b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/SimulateResolutionConvolvedModel.cpp index e9cb4227084c3c752c0442c58bc1c398f0b4ff49..f26b4faa128941f25567ee0e83fd27e99bcf339f 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/SimulateResolutionConvolvedModel.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/SimulateResolutionConvolvedModel.cpp @@ -1,11 +1,10 @@ #include "MantidMDAlgorithms/Quantification/SimulateResolutionConvolvedModel.h" -#include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/IFunctionMD.h" -#include "MantidAPI/FunctionFactory.h" +#include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/FunctionDomainMD.h" +#include "MantidAPI/FunctionFactory.h" #include "MantidAPI/FunctionValues.h" -#include "MantidAPI/MemoryManager.h" #include "MantidGeometry/MDGeometry/MDHistoDimensionBuilder.h" #include "MantidKernel/ListValidator.h" #include "MantidKernel/MandatoryValidator.h" @@ -21,11 +20,9 @@ namespace MDAlgorithms { DECLARE_ALGORITHM(SimulateResolutionConvolvedModel) using namespace API; +using namespace DataObjects; +using namespace Geometry; using namespace Kernel; -using Geometry::MDHistoDimensionBuilder; -using Geometry::Vec_MDHistoDimensionBuilder; -using MDEvents::MDEventWorkspace; -using MDEvents::MDEvent; namespace { // Property names diff --git a/Code/Mantid/Framework/MDEvents/src/QueryMDWorkspace.cpp b/Code/Mantid/Framework/MDAlgorithms/src/QueryMDWorkspace.cpp similarity index 97% rename from Code/Mantid/Framework/MDEvents/src/QueryMDWorkspace.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/QueryMDWorkspace.cpp index 56817e25b25cd40d68ddb8877c43a56fbde093cd..6590cf97bf0b72b3504ee3708249577e2d3c0043 100644 --- a/Code/Mantid/Framework/MDEvents/src/QueryMDWorkspace.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/QueryMDWorkspace.cpp @@ -1,21 +1,21 @@ -#include "MantidMDEvents/QueryMDWorkspace.h" -#include "MantidKernel/System.h" +#include "MantidMDAlgorithms/QueryMDWorkspace.h" + #include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/IMDIterator.h" #include "MantidAPI/ITableWorkspace.h" -#include "MantidAPI/WorkspaceFactory.h" #include "MantidAPI/TableRow.h" -#include "MantidKernel/EnabledWhenProperty.h" +#include "MantidAPI/WorkspaceFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidKernel/BoundedValidator.h" +#include "MantidKernel/EnabledWhenProperty.h" #include "MantidKernel/ListValidator.h" -#include "../inc/MantidMDEvents/MDEventWorkspace.h" -#include "../inc/MantidMDEvents/MDEventFactory.h" -using namespace Mantid::Kernel; using namespace Mantid::API; +using namespace Mantid::DataObjects; +using namespace Mantid::Kernel; namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { // Register the class into the algorithm factory DECLARE_ALGORITHM(QueryMDWorkspace) @@ -116,7 +116,7 @@ void QueryMDWorkspace::init() { */ template <typename MDE, size_t nd> void QueryMDWorkspace::getBoxData( - typename Mantid::MDEvents::MDEventWorkspace<MDE, nd>::sptr ws) { + typename Mantid::DataObjects::MDEventWorkspace<MDE, nd>::sptr ws) { if (this->getPropertyValue("BoxDataTable").empty()) return; @@ -260,4 +260,4 @@ void QueryMDWorkspace::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDEvents/src/ReflectometryTransform.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ReflectometryTransform.cpp similarity index 96% rename from Code/Mantid/Framework/MDEvents/src/ReflectometryTransform.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/ReflectometryTransform.cpp index ac89c0adbd6dbbbc485256ca0cbd6c68c8b02666..01124de040d00b21ad11a0da6cf5d9ddf16847cc 100644 --- a/Code/Mantid/Framework/MDEvents/src/ReflectometryTransform.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ReflectometryTransform.cpp @@ -1,14 +1,15 @@ -#include "MantidMDEvents/ReflectometryTransform.h" +#include "MantidMDAlgorithms/ReflectometryTransform.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/BinEdgeAxis.h" #include "MantidKernel/UnitFactory.h" #include <boost/shared_ptr.hpp> -using namespace Mantid::Kernel; using namespace Mantid::API; +using namespace Mantid::DataObjects; +using namespace Mantid::Kernel; namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { ReflectometryTransform::ReflectometryTransform(int numberOfBinsQx, int numberOfBinsQz) diff --git a/Code/Mantid/Framework/MDEvents/src/ReflectometryTransformKiKf.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ReflectometryTransformKiKf.cpp similarity index 96% rename from Code/Mantid/Framework/MDEvents/src/ReflectometryTransformKiKf.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/ReflectometryTransformKiKf.cpp index 3488408d2e9ad1f1753cc8d5bd1ad591a318d0b2..b69e5a91294ca0142b2fa75433b9bc8b91e4a6ca 100644 --- a/Code/Mantid/Framework/MDEvents/src/ReflectometryTransformKiKf.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ReflectometryTransformKiKf.cpp @@ -1,15 +1,16 @@ -#include "MantidMDEvents/ReflectometryTransformKiKf.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidMDAlgorithms/ReflectometryTransformKiKf.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidGeometry/MDGeometry/MDHistoDimension.h" #include "MantidDataObjects/Workspace2D.h" #include <stdexcept> +using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Kernel; using namespace Mantid::Geometry; -using namespace Mantid::API; namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /* Constructor @@ -148,4 +149,4 @@ Mantid::API::MatrixWorkspace_sptr ReflectometryTransformKiKf::execute( } } // namespace Mantid -} // namespace MDEvents +} // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDEvents/src/ReflectometryTransformP.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ReflectometryTransformP.cpp similarity index 95% rename from Code/Mantid/Framework/MDEvents/src/ReflectometryTransformP.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/ReflectometryTransformP.cpp index 7f415f3c23afc5f005ecc52e7b3029fcad777d1a..f0b777a6e985985d77a95e4ffbe0903d3650e935 100644 --- a/Code/Mantid/Framework/MDEvents/src/ReflectometryTransformP.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ReflectometryTransformP.cpp @@ -1,16 +1,18 @@ -#include "MantidMDEvents/ReflectometryTransformP.h" -#include "MantidKernel/System.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidGeometry/MDGeometry/MDHistoDimension.h" +#include "MantidMDAlgorithms/ReflectometryTransformP.h" + +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidDataObjects/Workspace2D.h" -#include <stdexcept> +#include "MantidGeometry/MDGeometry/MDHistoDimension.h" +#include "MantidKernel/Exception.h" -using namespace Mantid::Kernel; using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; +using namespace Mantid::Kernel; namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /* Constructor @param pSumMin: p sum min value (extent) @@ -150,4 +152,4 @@ Mantid::API::MatrixWorkspace_sptr ReflectometryTransformP::execute( } } // namespace Mantid -} // namespace MDEvents +} // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDEvents/src/ReflectometryTransformQxQz.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ReflectometryTransformQxQz.cpp similarity index 96% rename from Code/Mantid/Framework/MDEvents/src/ReflectometryTransformQxQz.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/ReflectometryTransformQxQz.cpp index 74d4c49d0a340579aafad3f5d1fb5cf1584a4de5..6fdc53a4724e757fa0295bf4e3c1a7514120a1d7 100644 --- a/Code/Mantid/Framework/MDEvents/src/ReflectometryTransformQxQz.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ReflectometryTransformQxQz.cpp @@ -1,15 +1,16 @@ -#include "MantidMDEvents/ReflectometryTransformQxQz.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidMDAlgorithms/ReflectometryTransformQxQz.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidGeometry/MDGeometry/MDHistoDimension.h" #include "MantidDataObjects/Workspace2D.h" #include <stdexcept> -using namespace Mantid::Kernel; -using namespace Mantid::Geometry; using namespace Mantid::API; +using namespace Mantid::DataObjects; +using namespace Mantid::Geometry; +using namespace Mantid::Kernel; namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { //---------------------------------------------------------------------------------------------- /** Destructor @@ -154,4 +155,4 @@ ReflectometryTransformQxQz::execute(MatrixWorkspace_const_sptr inputWs) const { } } // namespace Mantid -} // namespace MDEvents +} // namespace MDAlgorithms diff --git a/Code/Mantid/Framework/MDEvents/src/SaveIsawQvector.cpp b/Code/Mantid/Framework/MDAlgorithms/src/SaveIsawQvector.cpp similarity index 97% rename from Code/Mantid/Framework/MDEvents/src/SaveIsawQvector.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/SaveIsawQvector.cpp index 327f45325c01ecb460714975abe91ca0841ecf94..46f3d0f66fea322d216dd1e1d4afe0431acf4214 100644 --- a/Code/Mantid/Framework/MDEvents/src/SaveIsawQvector.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/SaveIsawQvector.cpp @@ -1,19 +1,20 @@ -#include <iostream> +#include "MantidMDAlgorithms/SaveIsawQvector.h" + #include <fstream> + #include "MantidAPI/FileProperty.h" #include "MantidAPI/WorkspaceValidators.h" #include "MantidDataObjects/EventWorkspace.h" #include "MantidKernel/CompositeValidator.h" -#include "MantidMDEvents/MDTransfFactory.h" -#include "MantidMDEvents/UnitsConversionHelper.h" -#include "MantidMDEvents/SaveIsawQvector.h" +#include "MantidMDAlgorithms/MDTransfFactory.h" +#include "MantidMDAlgorithms/UnitsConversionHelper.h" using namespace Mantid::API; using namespace Mantid::Kernel; using namespace Mantid::DataObjects; namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(SaveIsawQvector) @@ -219,5 +220,5 @@ void SaveIsawQvector::initTargetWSDescr(EventWorkspace_sptr wksp) { m_targWSDescr.m_PreprDetTable = table; } -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid diff --git a/Code/Mantid/Framework/MDAlgorithms/src/SaveMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/SaveMD.cpp index e515be24ad82fb806d0619d9b4edafc24878a15a..0200c834d96546b539517a385f48774d87ebc731 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/SaveMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/SaveMD.cpp @@ -3,17 +3,17 @@ #include "MantidAPI/IMDEventWorkspace.h" #include "MantidKernel/Matrix.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDBoxIterator.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDBoxIterator.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidMDAlgorithms/SaveMD.h" -#include "MantidMDEvents/MDBox.h" +#include "MantidDataObjects/MDBox.h" #include "MantidAPI/Progress.h" #include "MantidKernel/EnabledWhenProperty.h" #include <Poco/File.h> -#include "MantidMDEvents/MDHistoWorkspace.h" -#include "MantidMDEvents/MDBoxFlatTree.h" -#include "MantidMDEvents/BoxControllerNeXusIO.h" +#include "MantidDataObjects/MDHistoWorkspace.h" +#include "MantidDataObjects/MDBoxFlatTree.h" +#include "MantidDataObjects/BoxControllerNeXusIO.h" #if defined(__GLIBCXX__) && __GLIBCXX__ >= 20100121 // libstdc++-4.4.3 typedef std::unique_ptr< ::NeXus::File> file_holder_type; @@ -23,7 +23,7 @@ typedef std::auto_ptr< ::NeXus::File> file_holder_type; using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { @@ -150,7 +150,7 @@ void SaveMD::doSaveEvents(typename MDEventWorkspace<MDE, nd>::sptr ws) { BoxFlatStruct.initFlatStructure(ws, filename); // create saver class auto Saver = boost::shared_ptr<API::IBoxControllerIO>( - new MDEvents::BoxControllerNeXusIO(bc.get())); + new DataObjects::BoxControllerNeXusIO(bc.get())); Saver->setDataType(sizeof(coord_t), MDE::getTypeName()); if (MakeFileBacked) { // store saver with box controller @@ -220,7 +220,7 @@ void SaveMD::doSaveEvents(typename MDEventWorkspace<MDE, nd>::sptr ws) { * * @param ws :: MDHistoWorkspace to save */ -void SaveMD::doSaveHisto(Mantid::MDEvents::MDHistoWorkspace_sptr ws) { +void SaveMD::doSaveHisto(Mantid::DataObjects::MDHistoWorkspace_sptr ws) { std::string filename = getPropertyValue("Filename"); // Erase the file if it exists @@ -321,4 +321,4 @@ void SaveMD::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDAlgorithms/src/SaveZODS.cpp b/Code/Mantid/Framework/MDAlgorithms/src/SaveZODS.cpp index df0b220d579988d682516f03cf06ccbb30d84e50..2abfa146132a8a38392c544e0e9d31ec69ca1de5 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/SaveZODS.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/SaveZODS.cpp @@ -2,13 +2,13 @@ #include "MantidAPI/IMDHistoWorkspace.h" #include "MantidKernel/System.h" #include "MantidMDAlgorithms/SaveZODS.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidGeometry/Crystal/OrientedLattice.h" using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/SetMDUsingMask.cpp b/Code/Mantid/Framework/MDAlgorithms/src/SetMDUsingMask.cpp index 2363f5970a63e89252ae26d1926b909fbc05c725..363f247e208c1e4b57cd3fe7663d88ede5900b4c 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/SetMDUsingMask.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/SetMDUsingMask.cpp @@ -2,12 +2,12 @@ #include "MantidKernel/System.h" #include "MantidAPI/IMDWorkspace.h" #include "MantidAPI/IMDHistoWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include <float.h> using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/SliceMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/SliceMD.cpp index 3519c4677ecaa8dcb17cd28e9dd6946f8547f368..ba99b4778f9be5073d0c9c815e38566392df9de9 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/SliceMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/SliceMD.cpp @@ -1,6 +1,6 @@ #include "MantidAPI/IMDEventWorkspace.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidMDAlgorithms/SliceMD.h" #include "MantidGeometry/MDGeometry/MDImplicitFunction.h" #include "MantidKernel/ThreadScheduler.h" @@ -13,7 +13,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { @@ -339,4 +339,4 @@ void SliceMD::exec() { } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp b/Code/Mantid/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp index 1b43dc6b046382eab236e5e4170bb7eb21514101..91dec0e942120bf8871144bf4a2a8150154b90fd 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp @@ -4,8 +4,8 @@ #include "MantidKernel/EnabledWhenProperty.h" #include "MantidKernel/Strings.h" #include "MantidKernel/System.h" -#include "MantidMDEvents/CoordTransformAffine.h" -#include "MantidMDEvents/CoordTransformAligned.h" +#include "MantidDataObjects/CoordTransformAffine.h" +#include "MantidDataObjects/CoordTransformAligned.h" #include "MantidKernel/ArrayProperty.h" #include "MantidKernel/VisibleWhenProperty.h" #include "MantidKernel/ArrayLengthValidator.h" @@ -390,16 +390,16 @@ void SlicingAlgorithm::createGeneralTransform() { // std::cout << m_inputMinPoint << " m_inputMinPoint " << std::endl; // Create the CoordTransformAffine for BINNING with these basis vectors - MDEvents::CoordTransformAffine *ct = - new MDEvents::CoordTransformAffine(inD, m_outD); + DataObjects::CoordTransformAffine *ct = + new DataObjects::CoordTransformAffine(inD, m_outD); // Note: the scaling makes the coordinate correspond to a bin index ct->buildOrthogonal(m_inputMinPoint, this->m_bases, VMD(this->m_binningScaling)); this->m_transform = ct; // Transformation original->binned - MDEvents::CoordTransformAffine *ctFrom = - new MDEvents::CoordTransformAffine(inD, m_outD); + DataObjects::CoordTransformAffine *ctFrom = + new DataObjects::CoordTransformAffine(inD, m_outD); ctFrom->buildOrthogonal(m_translation, this->m_bases, VMD(m_transformScaling)); m_transformFromOriginal = ctFrom; @@ -420,8 +420,8 @@ void SlicingAlgorithm::createGeneralTransform() { m_transformToOriginal = NULL; if (m_outD == inD) { // Can't reverse transform if you lost dimensions. - MDEvents::CoordTransformAffine *ctTo = - new MDEvents::CoordTransformAffine(inD, m_outD); + DataObjects::CoordTransformAffine *ctTo = + new DataObjects::CoordTransformAffine(inD, m_outD); Matrix<coord_t> fromMatrix = ctFrom->getMatrix(); Matrix<coord_t> toMatrix = fromMatrix; // Invert the affine matrix to get the reverse transformation @@ -573,13 +573,13 @@ void SlicingAlgorithm::createAlignedTransform() { } // Transform for binning - m_transform = new MDEvents::CoordTransformAligned( + m_transform = new DataObjects::CoordTransformAligned( m_inWS->getNumDims(), m_outD, m_dimensionToBinFrom, origin, scaling); // Transformation original->binned. There is no offset or scaling! std::vector<coord_t> unitScaling(m_outD, 1.0); std::vector<coord_t> zeroOrigin(m_outD, 0.0); - m_transformFromOriginal = new MDEvents::CoordTransformAligned( + m_transformFromOriginal = new DataObjects::CoordTransformAligned( inD, m_outD, m_dimensionToBinFrom, zeroOrigin, unitScaling); // Now the reverse transformation. @@ -588,8 +588,8 @@ void SlicingAlgorithm::createAlignedTransform() { // dimension index is that? Matrix<coord_t> mat = m_transformFromOriginal->makeAffineMatrix(); mat.Invert(); - MDEvents::CoordTransformAffine *tmp = - new MDEvents::CoordTransformAffine(inD, m_outD); + DataObjects::CoordTransformAffine *tmp = + new DataObjects::CoordTransformAffine(inD, m_outD); tmp->setMatrix(mat); m_transformToOriginal = tmp; } else @@ -642,8 +642,8 @@ void SlicingAlgorithm::createTransform() { m_inWS->getName() + " back to " + m_originalWS->getName() + "."); // Fail if the MDHistoWorkspace was modified by binary operation - MDEvents::MDHistoWorkspace_sptr inHisto = - boost::dynamic_pointer_cast<MDEvents::MDHistoWorkspace>(m_inWS); + DataObjects::MDHistoWorkspace_sptr inHisto = + boost::dynamic_pointer_cast<DataObjects::MDHistoWorkspace>(m_inWS); if (inHisto) { if (inHisto->getNumExperimentInfo() > 0) { const Run &run = inHisto->getExperimentInfo(0)->run(); @@ -701,12 +701,12 @@ void SlicingAlgorithm::createTransform() { Matrix<coord_t> matToIntermediate = matOriginalToIntermediate * matToOriginal; - m_transformToIntermediate = new MDEvents::CoordTransformAffine( + m_transformToIntermediate = new DataObjects::CoordTransformAffine( m_originalWS->getNumDims(), m_intermediateWS->getNumDims()); m_transformToIntermediate->setMatrix(matToIntermediate); // And now the reverse matToIntermediate.Invert(); - m_transformFromIntermediate = new MDEvents::CoordTransformAffine( + m_transformFromIntermediate = new DataObjects::CoordTransformAffine( m_intermediateWS->getNumDims(), m_originalWS->getNumDims()); m_transformFromIntermediate->setMatrix(matToIntermediate); } catch (std::runtime_error &) { @@ -995,4 +995,4 @@ SlicingAlgorithm::getImplicitFunctionForChunk(const size_t *const chunkMin, } } // namespace Mantid -} // namespace MDEvents +} // namespace DataObjects diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ThresholdMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ThresholdMD.cpp index bb03a8dfb78694e3d6e088580cd4f4c0c975bd5a..41e7566d90898e73f985dca9a6019bdcbf9eaa09 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ThresholdMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ThresholdMD.cpp @@ -1,6 +1,6 @@ #include "MantidMDAlgorithms/ThresholdMD.h" #include "MantidAPI/WorkspaceProperty.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidKernel/ListValidator.h" #include "MantidKernel/EnabledWhenProperty.h" #include "MantidKernel/MultiThreaded.h" @@ -10,7 +10,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { diff --git a/Code/Mantid/Framework/MDAlgorithms/src/TransformMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/TransformMD.cpp index 896c29c74d763ab9941a7c6961f02e0d2921b9fe..72480fa92253c6b91351ba1093bbb65702c6cc66 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/TransformMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/TransformMD.cpp @@ -1,15 +1,15 @@ #include "MantidMDAlgorithms/TransformMD.h" #include "MantidKernel/System.h" #include "MantidKernel/ArrayProperty.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventFactory.h" using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; -using Mantid::MDEvents::MDHistoWorkspace_sptr; +using namespace Mantid::DataObjects; +using Mantid::DataObjects::MDHistoWorkspace_sptr; namespace Mantid { namespace MDAlgorithms { @@ -69,7 +69,7 @@ void TransformMD::init() { */ template <typename MDE, size_t nd> void TransformMD::doTransform( - typename Mantid::MDEvents::MDEventWorkspace<MDE, nd>::sptr ws) { + typename Mantid::DataObjects::MDEventWorkspace<MDE, nd>::sptr ws) { std::vector<API::IMDNode *> boxes; // Get ALL the boxes, including MDGridBoxes. ws->getBox()->getBoxes(boxes, 1000, false); diff --git a/Code/Mantid/Framework/MDAlgorithms/src/UnaryOperationMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/UnaryOperationMD.cpp index 38862d9c2143761c691a9c815fd1333a13aa805c..cf04da6df00755ce518c61ba897fcb95e827d910 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/UnaryOperationMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/UnaryOperationMD.cpp @@ -3,12 +3,12 @@ #include "MantidAPI/IMDWorkspace.h" #include "MantidAPI/WorkspaceProperty.h" #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidAPI/MatrixWorkspace.h" using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { namespace MDAlgorithms { diff --git a/Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp b/Code/Mantid/Framework/MDAlgorithms/src/UnitsConversionHelper.cpp similarity index 99% rename from Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/UnitsConversionHelper.cpp index 8ae927468775706771aa13666b793b4bebb2188c..442c2416a54419096a9d21483f0fd81876eff5ff 100644 --- a/Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/UnitsConversionHelper.cpp @@ -1,11 +1,11 @@ -#include "MantidMDEvents/UnitsConversionHelper.h" +#include "MantidMDAlgorithms/UnitsConversionHelper.h" #include "MantidAPI/NumericAxis.h" #include "MantidKernel/UnitFactory.h" #include "MantidKernel/Strings.h" #include <boost/math/special_functions/fpclassify.hpp> namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { /** establish and initialize proper units conversion from input to output units @param UnitsFrom -- the ID of the units, which have to be converted from @@ -368,5 +368,5 @@ UnitsConversionHelper::UnitsConversionHelper() m_L1(1), m_Efix(1), m_TwoTheta(0), m_L2(1), m_pTwoThetas(NULL), m_pL2s(NULL), m_pEfixedArray(NULL){} -} // endNamespace MDEvents +} // endNamespace DataObjects } // endNamespace Mantid diff --git a/Code/Mantid/Framework/MDEvents/src/UserFunctionMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/UserFunctionMD.cpp similarity index 97% rename from Code/Mantid/Framework/MDEvents/src/UserFunctionMD.cpp rename to Code/Mantid/Framework/MDAlgorithms/src/UserFunctionMD.cpp index bb44a51918550e0c3b2755115afc41bbfa7da265..85c8cef79f22c666a5214e64969e1c693801f6e6 100644 --- a/Code/Mantid/Framework/MDEvents/src/UserFunctionMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/UserFunctionMD.cpp @@ -1,14 +1,14 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidMDEvents/UserFunctionMD.h" +#include "MantidMDAlgorithms/UserFunctionMD.h" #include "MantidAPI/FunctionFactory.h" #include "MantidKernel/MultiThreaded.h" #include <boost/tokenizer.hpp> namespace Mantid { -namespace MDEvents { +namespace MDAlgorithms { // Subscribe the function into the factory. DECLARE_FUNCTION(UserFunctionMD) @@ -150,5 +150,5 @@ void UserFunctionMD::setFormula() { m_parser.SetExpr(m_formula); } -} // namespace MDEvents +} // namespace MDAlgorithms } // namespace Mantid diff --git a/Code/Mantid/Framework/MDAlgorithms/src/WeightedMeanMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/WeightedMeanMD.cpp index 6be27f734faf66d24a9eb110ac91f3715fd65eff..d1d780dd4b1cc997e5aa2ec3d986e5e5ebc1a57f 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/WeightedMeanMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/WeightedMeanMD.cpp @@ -1,5 +1,5 @@ #include "MantidMDAlgorithms/WeightedMeanMD.h" -#include "MantidMDEvents/MDHistoWorkspaceIterator.h" +#include "MantidDataObjects/MDHistoWorkspaceIterator.h" #include "MantidKernel/System.h" using namespace Mantid::Kernel; @@ -37,9 +37,9 @@ void WeightedMeanMD::checkInputs() { //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand void WeightedMeanMD::execHistoHisto( - Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand) { - using MDEvents::MDHistoWorkspaceIterator; + Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand) { + using DataObjects::MDHistoWorkspaceIterator; MDHistoWorkspaceIterator *lhs_it = dynamic_cast<MDHistoWorkspaceIterator *>(out->createIterator()); MDHistoWorkspaceIterator *rhs_it = @@ -79,7 +79,7 @@ void WeightedMeanMD::execHistoHisto( //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output, scalar and operand void WeightedMeanMD::execHistoScalar( - Mantid::MDEvents::MDHistoWorkspace_sptr, + Mantid::DataObjects::MDHistoWorkspace_sptr, Mantid::DataObjects::WorkspaceSingleValue_const_sptr) { throw std::runtime_error( this->name() + " can only be run with two MDHistoWorkspaces as inputs"); diff --git a/Code/Mantid/Framework/MDAlgorithms/src/XorMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/XorMD.cpp index c960c27df589b49e574333d8b4f7707bf4c19f30..967705a433a46219b4c644d9b64190816960fc51 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/XorMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/XorMD.cpp @@ -30,8 +30,8 @@ int XorMD::version() const { return 1; } //---------------------------------------------------------------------------------------------- /// Run the algorithm with a MDHisotWorkspace as output and operand void -XorMD::execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, - Mantid::MDEvents::MDHistoWorkspace_const_sptr operand) { +XorMD::execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, + Mantid::DataObjects::MDHistoWorkspace_const_sptr operand) { out->operator^=(*operand); } diff --git a/Code/Mantid/Framework/MDAlgorithms/test/AndMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/AndMDTest.h index edf6430fc4e4b2c340913675ecbe65ecf7608fb9..83b4d4b4a3cab720629f76a5113e7332b9637896 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/AndMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/AndMDTest.h @@ -9,12 +9,12 @@ #include "MantidMDAlgorithms/AndMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" using namespace Mantid; using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using Mantid::MDEvents::MDHistoWorkspace_sptr; +using Mantid::DataObjects::MDHistoWorkspace_sptr; class AndMDTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDAlgorithms/test/BinMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/BinMDTest.h index c23b7c04e4c7bb3577691bf7a7d243d2537a08ba..41efb7d551f77af1dc3f14b7e77b0236e0fa2bd3 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/BinMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/BinMDTest.h @@ -2,43 +2,31 @@ #define MANTID_MDEVENTS_BINTOMDHISTOWORKSPACETEST_H_ #include "MantidAPI/IMDEventWorkspace.h" +#include "MantidAPI/FrameworkManager.h" +#include "MantidAPI/ImplicitFunctionBuilder.h" #include "MantidAPI/ImplicitFunctionFactory.h" -#include "MantidAPI/ImplicitFunctionParameter.h" -#include "MantidAPI/ImplicitFunctionParameterParserFactory.h" +#include "MantidAPI/ImplicitFunctionParser.h" #include "MantidAPI/ImplicitFunctionParameterParserFactory.h" -#include "MantidAPI/ImplicitFunctionParserFactory.h" -#include "MantidAPI/FrameworkManager.h" #include "MantidGeometry/MDGeometry/MDImplicitFunction.h" #include "MantidGeometry/MDGeometry/MDTypes.h" -#include "MantidKernel/ConfigService.h" -#include "MantidKernel/CPUTimer.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" #include "MantidMDAlgorithms/BinMD.h" +#include "MantidMDAlgorithms/CreateMDWorkspace.h" #include "MantidMDAlgorithms/FakeMDEventData.h" -#include "MantidMDEvents/CoordTransformAffine.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" #include "MantidTestHelpers/MDEventsTestHelper.h" + #include <boost/math/special_functions/fpclassify.hpp> + #include <cxxtest/TestSuite.h> + #include <gmock/gmock.h> #include <gtest/gtest.h> -#include <iomanip> -#include <iostream> -#include "MantidKernel/Strings.h" -#include "MantidKernel/VMD.h" -#include "MantidKernel/Utils.h" -#include "MantidMDEvents/MDHistoWorkspace.h" -#include "MantidMDAlgorithms/CreateMDWorkspace.h" -using namespace Mantid::MDEvents; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Kernel; +using namespace Mantid::MDAlgorithms; using Mantid::coord_t; - class BinMDTest : public CxxTest::TestSuite { @@ -88,16 +76,16 @@ private: { using namespace Mantid::API; AnalysisDataService::Instance().remove("3D_Workspace"); - IAlgorithm* create = FrameworkManager::Instance().createAlgorithm("CreateMDWorkspace"); - - create->initialize(); - create->setProperty("Dimensions", 3); - create->setPropertyValue("Extents","0,10,0,10,0,10"); - create->setPropertyValue("Names","x,y,z"); - create->setPropertyValue("Units","m,m,m"); - create->setPropertyValue("SplitInto","10"); - create->setPropertyValue("OutputWorkspace", "3D_Workspace"); - create->execute(); + CreateMDWorkspace create; + + create.initialize(); + create.setProperty("Dimensions", 3); + create.setPropertyValue("Extents","0,10,0,10,0,10"); + create.setPropertyValue("Names","x,y,z"); + create.setPropertyValue("Units","m,m,m"); + create.setPropertyValue("SplitInto","10"); + create.setPropertyValue("OutputWorkspace", "3D_Workspace"); + create.execute(); return AnalysisDataService::Instance().retrieve("3D_Workspace"); } @@ -1071,5 +1059,5 @@ private: }; -#endif /* MANTID_MDEVENTS_BINTOMDHISTOWORKSPACETEST_H_ */ +#endif /* MANTID_MDALGORITHMS_BINTOMDHISTOWORKSPACETEST_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/test/BinaryOperationMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/BinaryOperationMDTest.h index 6f09ca7f797e9d13cbec26fef8c3d16930d76052..35f1eb8b004d67fffcca405529117a6cfc12b868 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/BinaryOperationMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/BinaryOperationMDTest.h @@ -3,23 +3,19 @@ #include "MantidAPI/IMDEventWorkspace.h" #include "MantidDataObjects/WorkspaceSingleValue.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" #include "MantidMDAlgorithms/BinaryOperationMD.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" + #include <cxxtest/TestSuite.h> + #include <gmock/gmock.h> #include <gtest/gtest.h> -#include <iomanip> -#include <iostream> -using namespace Mantid; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; using namespace Mantid::DataObjects; -using namespace Mantid::MDEvents; +using namespace Mantid::MDAlgorithms; using namespace testing; class MockBinaryOperationMD : public BinaryOperationMD @@ -28,8 +24,8 @@ public: MOCK_CONST_METHOD0(commutative, bool()); MOCK_METHOD0(checkInputs, void()); MOCK_METHOD0(execEvent, void()); - MOCK_METHOD2(execHistoHisto, void(Mantid::MDEvents::MDHistoWorkspace_sptr, Mantid::MDEvents::MDHistoWorkspace_const_sptr)); - MOCK_METHOD2(execHistoScalar, void(Mantid::MDEvents::MDHistoWorkspace_sptr, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar)); + MOCK_METHOD2(execHistoHisto, void(Mantid::DataObjects::MDHistoWorkspace_sptr, Mantid::DataObjects::MDHistoWorkspace_const_sptr)); + MOCK_METHOD2(execHistoScalar, void(Mantid::DataObjects::MDHistoWorkspace_sptr, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar)); void exec() { BinaryOperationMD::exec(); } }; diff --git a/Code/Mantid/Framework/MDAlgorithms/test/BooleanBinaryOperationMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/BooleanBinaryOperationMDTest.h index adcdb43bfa543e0e19a2bd570733b415599cf96b..e976bf7225c1c7397911123527cb69939939e407 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/BooleanBinaryOperationMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/BooleanBinaryOperationMDTest.h @@ -1,25 +1,21 @@ #ifndef MANTID_MDALGORITHMS_BOOLEANBINARYOPERATIONMDTEST_H_ #define MANTID_MDALGORITHMS_BOOLEANBINARYOPERATIONMDTEST_H_ +#include "MantidMDAlgorithms/BooleanBinaryOperationMD.h" + #include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> #include <gmock/gmock.h> #include <gtest/gtest.h> -#include "MantidMDAlgorithms/BooleanBinaryOperationMD.h" -using namespace Mantid; + using namespace Mantid::MDAlgorithms; -using namespace Mantid::API; using namespace testing; class MockBooleanBinaryOperationMD : public BooleanBinaryOperationMD { public: MOCK_METHOD0(initExtraProperties, void()); - MOCK_METHOD2(execHistoHisto, void(Mantid::MDEvents::MDHistoWorkspace_sptr, Mantid::MDEvents::MDHistoWorkspace_const_sptr)); + MOCK_METHOD2(execHistoHisto, void(Mantid::DataObjects::MDHistoWorkspace_sptr, Mantid::DataObjects::MDHistoWorkspace_const_sptr)); }; diff --git a/Code/Mantid/Framework/MDEvents/test/BoxControllerSettingsAlgorithmTest.h b/Code/Mantid/Framework/MDAlgorithms/test/BoxControllerSettingsAlgorithmTest.h similarity index 96% rename from Code/Mantid/Framework/MDEvents/test/BoxControllerSettingsAlgorithmTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/BoxControllerSettingsAlgorithmTest.h index 3c2ab44f9f935972b1c6db19e828c7b9a3b77d5d..ff42d67e344ec700c4e3997a6e86582d96055f40 100644 --- a/Code/Mantid/Framework/MDEvents/test/BoxControllerSettingsAlgorithmTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/BoxControllerSettingsAlgorithmTest.h @@ -1,25 +1,22 @@ #ifndef MANTID_MDEVENTS_BOXCONTROLLERSETTINGSALGORITHMTEST_H_ #define MANTID_MDEVENTS_BOXCONTROLLERSETTINGSALGORITHMTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include "MantidAPI/FrameworkManager.h" -#include <iostream> -#include <iomanip> - -#include "MantidMDEvents/BoxControllerSettingsAlgorithm.h" -#include "MantidTestHelpers/WorkspaceCreationHelper.h" +#include "MantidAPI/FrameworkManager.h" #include "MantidDataHandling/LoadParameterFile.h" +#include "MantidMDAlgorithms/BoxControllerSettingsAlgorithm.h" #include "MantidTestHelpers/ComponentCreationHelper.h" -#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidTestHelpers/ScopedFileHelper.h" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" + #include <boost/format.hpp> +#include <cxxtest/TestSuite.h> + + using namespace Mantid; -using namespace Mantid::MDEvents; using namespace Mantid::API; +using namespace Mantid::MDAlgorithms; using ScopedFileHelper::ScopedFile; //------------------------------------------------------------------------------------------------ @@ -29,8 +26,8 @@ class BoxControllerSettingsAlgorithmImpl : public BoxControllerSettingsAlgorithm // Make all the members public so I can test them. friend class BoxControllerSettingsAlgorithmTest; public: - virtual const std::string name() const { return "BoxControllerSettingsAlgorithmImpl";}; - virtual int version() const { return 1;}; + virtual const std::string name() const { return "BoxControllerSettingsAlgorithmImpl";} + virtual int version() const { return 1;} virtual const std::string category() const { return "Testing";} virtual const std::string summary() const { return "Summary of this test."; } void init() {} diff --git a/Code/Mantid/Framework/MDAlgorithms/test/CMakeLists.txt b/Code/Mantid/Framework/MDAlgorithms/test/CMakeLists.txt index 1925dff30ee954097ab795d07c9dd0a98737a677..317646650271ea5a759791a4debd0eb60c41d41c 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/CMakeLists.txt +++ b/Code/Mantid/Framework/MDAlgorithms/test/CMakeLists.txt @@ -5,10 +5,14 @@ if ( CXXTEST_FOUND ) # This variable is used within the cxxtest_add_test macro to build these helper classes into the test executable. # It will go out of scope at the end of this file so doesn't need un-setting set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp + ../../TestHelpers/src/BinaryOperationMDTestHelper.cpp ../../TestHelpers/src/ComponentCreationHelper.cpp - ../../TestHelpers/src/WorkspaceCreationHelper.cpp + ../../TestHelpers/src/MDAlgorithmsTestHelper.cpp ../../TestHelpers/src/MDEventsTestHelper.cpp - ../../TestHelpers/src/BinaryOperationMDTestHelper.cpp ) + ../../TestHelpers/src/ScopedFileHelper.cpp + ../../TestHelpers/src/WorkspaceCreationHelper.cpp + ) + if ( GMOCK_FOUND AND GTEST_FOUND ) cxxtest_add_test ( MDAlgorithmsTest ${TEST_FILES} ${GMOCK_TEST_FILES}) target_link_libraries( MDAlgorithmsTest MDAlgorithms DataHandling CurveFitting Nexus ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES} ${NEXUS_LIBRARIES} ${HDF5_LIBRARIES} ) diff --git a/Code/Mantid/Framework/MDAlgorithms/test/CalculateCoverageDGSTest.h b/Code/Mantid/Framework/MDAlgorithms/test/CalculateCoverageDGSTest.h index a2ee213841b000a0d475a7031f872c3b4eaa5299..23fd733fb63cbd32bd3e0f6d001221846792e4b3 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/CalculateCoverageDGSTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/CalculateCoverageDGSTest.h @@ -1,24 +1,27 @@ #ifndef MANTID_MDALGORITHMS_CALCULATECOVERAGEDGSTEST_H_ #define MANTID_MDALGORITHMS_CALCULATECOVERAGEDGSTEST_H_ -#include <cxxtest/TestSuite.h> - -#include "MantidMDAlgorithms/CalculateCoverageDGS.h" -#include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidKernel/V3D.h" -#include "MantidKernel/Matrix.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidGeometry/Crystal/OrientedLattice.h" #include "MantidGeometry/Instrument/Goniometer.h" -#include <vector> -#include "MantidMDEvents/MDHistoWorkspace.h" -#include "MantidKernel/PhysicalConstants.h" #include "MantidGeometry/MDGeometry/MDTypes.h" +#include "MantidKernel/Matrix.h" +#include "MantidKernel/PhysicalConstants.h" +#include "MantidKernel/V3D.h" +#include "MantidMDAlgorithms/CalculateCoverageDGS.h" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" + +#include <cxxtest/TestSuite.h> + +#include <vector> + using Mantid::MDAlgorithms::CalculateCoverageDGS; using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Kernel; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; +using namespace Mantid::MDAlgorithms; class CalculateCoverageDGSTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDAlgorithms/test/CentroidPeaksMD2Test.h b/Code/Mantid/Framework/MDAlgorithms/test/CentroidPeaksMD2Test.h index 3adbed5c426d58efbcdce2c4186bd52e6cb8cdef..606a3efecc32d7d4fa4bf3f005965dc6707b373d 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/CentroidPeaksMD2Test.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/CentroidPeaksMD2Test.h @@ -1,17 +1,16 @@ #ifndef MANTID_MDEVENTS_MDCENTROIDPEAKS2TEST_H_ #define MANTID_MDEVENTS_MDCENTROIDPEAKS2TEST_H_ -#include "MantidMDAlgorithms/CentroidPeaksMD2.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/IMDEventWorkspace.h" #include "MantidDataObjects/PeaksWorkspace.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidGeometry/MDGeometry/MDHistoDimension.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidMDEvents/MDEventFactory.h" #include "MantidTestHelpers/ComponentCreationHelper.h" +#include "MantidMDAlgorithms/CentroidPeaksMD2.h" #include "MantidMDAlgorithms/CreateMDWorkspace.h" #include "MantidMDAlgorithms/FakeMDEventData.h" + #include <boost/math/distributions/normal.hpp> #include <boost/math/special_functions/fpclassify.hpp> #include <boost/math/special_functions/pow.hpp> @@ -20,16 +19,14 @@ #include <boost/random/uniform_int.hpp> #include <boost/random/uniform_real.hpp> #include <boost/random/variate_generator.hpp> + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using Mantid::API::AnalysisDataService; using Mantid::Geometry::MDHistoDimension; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; using namespace Mantid::MDAlgorithms; using Mantid::Kernel::V3D; diff --git a/Code/Mantid/Framework/MDAlgorithms/test/CentroidPeaksMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/CentroidPeaksMDTest.h index 445df41cf2d42c9a8a0407c4641b3edc02628fed..3c531874811581135431f44df8fc2b31f6b84359 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/CentroidPeaksMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/CentroidPeaksMDTest.h @@ -1,17 +1,16 @@ #ifndef MANTID_MDEVENTS_MDCENTROIDPEAKSTEST_H_ #define MANTID_MDEVENTS_MDCENTROIDPEAKSTEST_H_ -#include "MantidMDAlgorithms/CentroidPeaksMD.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/IMDEventWorkspace.h" #include "MantidDataObjects/PeaksWorkspace.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidGeometry/MDGeometry/MDHistoDimension.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidTestHelpers/ComponentCreationHelper.h" +#include "MantidMDAlgorithms/CentroidPeaksMD.h" #include "MantidMDAlgorithms/CreateMDWorkspace.h" #include "MantidMDAlgorithms/FakeMDEventData.h" +#include "MantidTestHelpers/ComponentCreationHelper.h" + #include <boost/math/distributions/normal.hpp> #include <boost/math/special_functions/fpclassify.hpp> #include <boost/math/special_functions/pow.hpp> @@ -20,16 +19,14 @@ #include <boost/random/uniform_int.hpp> #include <boost/random/uniform_real.hpp> #include <boost/random/variate_generator.hpp> + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using Mantid::API::AnalysisDataService; using Mantid::Geometry::MDHistoDimension; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; using namespace Mantid::MDAlgorithms; using Mantid::Kernel::V3D; diff --git a/Code/Mantid/Framework/MDAlgorithms/test/CloneMDWorkspaceTest.h b/Code/Mantid/Framework/MDAlgorithms/test/CloneMDWorkspaceTest.h index 29b5310340926c41d98ff6071cb50796f01636f1..e08d2b1ea40d81e6d6868c2eead4cd8b9f18779e 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/CloneMDWorkspaceTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/CloneMDWorkspaceTest.h @@ -2,21 +2,21 @@ #define MANTID_MDEVENTS_CLONEMDEVENTWORKSPACETEST_H_ #include "LoadMDTest.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidGeometry/MDGeometry/MDHistoDimension.h" #include "MantidMDAlgorithms/CloneMDWorkspace.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidTestHelpers/MDAlgorithmsTestHelper.h" #include "MantidTestHelpers/MDEventsTestHelper.h" + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> + #include <Poco/File.h> -#include "MantidGeometry/MDGeometry/MDHistoDimension.h" using namespace Mantid; -using namespace Mantid::MDEvents; using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; +using namespace Mantid::MDAlgorithms; class CloneMDWorkspaceTest : public CxxTest::TestSuite { @@ -62,7 +62,7 @@ public: std::string outWSName("CloneMDWorkspaceTest_OutputWS"); // Make a fake file-backed (or not) MDEW - MDEventWorkspace3Lean::sptr ws1 = MDEventsTestHelper::makeFileBackedMDEW("CloneMDWorkspaceTest_ws", fileBacked); + MDEventWorkspace3Lean::sptr ws1 = MDAlgorithmsTestHelper::makeFileBackedMDEW("CloneMDWorkspaceTest_ws", fileBacked); ws1->setFileNeedsUpdating( file_needs_updating ); CloneMDWorkspace alg; @@ -192,11 +192,11 @@ public: void test_MDHistoWorkspace_2D_uneven_bins() { // Make the number of bins uneven in both dimensions - Mantid::MDEvents::MDHistoWorkspace * ws = NULL; - ws = new Mantid::MDEvents::MDHistoWorkspace( + Mantid::DataObjects::MDHistoWorkspace * ws = NULL; + ws = new Mantid::DataObjects::MDHistoWorkspace( MDHistoDimension_sptr(new MDHistoDimension("x","x","m", 0.0, 10.0, 50)), MDHistoDimension_sptr(new MDHistoDimension("y","y","m", 0.0, 10.0, 100)) ); - Mantid::MDEvents::MDHistoWorkspace_sptr ws1(ws); + Mantid::DataObjects::MDHistoWorkspace_sptr ws1(ws); ws1->setTo(1.234, 5.678, 1.0); do_test_MDHisto(ws1); } diff --git a/Code/Mantid/Framework/MDAlgorithms/test/CompareMDWorkspacesTest.h b/Code/Mantid/Framework/MDAlgorithms/test/CompareMDWorkspacesTest.h index 6b57e95fb8855dbdf7e4f4c12cf587e051d8a377..7284e4be98d17dc57b06282a6aa29f895967062d 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/CompareMDWorkspacesTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/CompareMDWorkspacesTest.h @@ -1,25 +1,22 @@ #ifndef MANTID_MDALGORITHMS_COMPAREMDWORKSPACESTEST_H_ #define MANTID_MDALGORITHMS_COMPAREMDWORKSPACESTEST_H_ -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" #include "MantidAPI/FrameworkManager.h" -#include "MantidAPI/IMDWorkspace.h" #include "MantidAPI/IMDNode.h" -#include "MantidMDAlgorithms/CompareMDWorkspaces.h" +#include "MantidAPI/IMDWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidMDAlgorithms/CloneMDWorkspace.h" +#include "MantidMDAlgorithms/CompareMDWorkspaces.h" #include "MantidTestHelpers/MDEventsTestHelper.h" + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> -#include "MantidMDEvents/MDHistoWorkspace.h" using namespace Mantid; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using namespace Mantid::MDEvents; -using namespace Mantid::MDEvents::MDEventsTestHelper; -using Mantid::MDEvents::MDHistoWorkspace_sptr; +using namespace Mantid::DataObjects; +using namespace Mantid::MDAlgorithms; +using namespace Mantid::DataObjects::MDEventsTestHelper; +using Mantid::DataObjects::MDHistoWorkspace_sptr; class CompareMDWorkspacesTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDAlgorithms/test/ConvertEventsToMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ConvertEventsToMDTest.h index 4e57887770c5f0290f86aa49c9741bf4ae331e86..1b177495f817c162104dab5290eac4cb28e94a9f 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/ConvertEventsToMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ConvertEventsToMDTest.h @@ -1,27 +1,19 @@ #ifndef MANTID_MD_CONVEVENTS2_Q_NDANY_TEST_H_ #define MANTID_MD_CONVEVENTS2_Q_NDANY_TEST_H_ -#include "MantidDataObjects/EventWorkspace.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidAPI/TextAxis.h" #include "MantidAPI/FrameworkManager.h" #include "MantidMDAlgorithms/ConvertToMD.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidKernel/UnitFactory.h" -#include "MantidMDEvents/MDTransfFactory.h" + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::MDAlgorithms; -using namespace Mantid::MDEvents; class ConvertEvents2MDEvTestHelper: public ConvertToMD { @@ -57,10 +49,8 @@ void testEventWS() TS_ASSERT_THROWS_NOTHING(spws = AnalysisDataService::Instance().retrieve("testMDEvWorkspace")); TSM_ASSERT(" Worskpace should be retrieved",spws.get()); - boost::shared_ptr<MDEvents::MDEventWorkspace<MDEvents::MDEvent<3>,3> > ws = boost::dynamic_pointer_cast<MDEvents::MDEventWorkspace<MDEvents::MDEvent<3>,3> >(spws); + boost::shared_ptr<DataObjects::MDEventWorkspace<DataObjects::MDEvent<3>,3> > ws = boost::dynamic_pointer_cast<DataObjects::MDEventWorkspace<DataObjects::MDEvent<3>,3> >(spws); TSM_ASSERT("It shoudl be 3D MD workspace",ws.get()); - //boost::shared_ptr<MDEvents::MDEventWorkspace<MDEvents::MDEvent<2>,2> > ws = boost::dynamic_pointer_cast<MDEvents::MDEventWorkspace<MDEvents::MDEvent<2>,2> >(spws); - //TSM_ASSERT("It shoudl be 2D MD workspace",ws.get()); if(ws.get()){ diff --git a/Code/Mantid/Framework/Algorithms/test/ConvertMDHistoToMatrixWorkspaceTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ConvertMDHistoToMatrixWorkspaceTest.h similarity index 87% rename from Code/Mantid/Framework/Algorithms/test/ConvertMDHistoToMatrixWorkspaceTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/ConvertMDHistoToMatrixWorkspaceTest.h index c17b8cfb8e1e12ae63a4ccb1e05a7c973a0b7c40..26cda328e28f5d46246e1a4a395508e5332d7304 100644 --- a/Code/Mantid/Framework/Algorithms/test/ConvertMDHistoToMatrixWorkspaceTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ConvertMDHistoToMatrixWorkspaceTest.h @@ -11,8 +11,8 @@ #include <cxxtest/TestSuite.h> #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/FrameworkManager.h" -#include "MantidAlgorithms/ConvertMDHistoToMatrixWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidMDAlgorithms/ConvertMDHistoToMatrixWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -20,14 +20,20 @@ using namespace Mantid; using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Kernel; -using namespace Mantid::Algorithms; -using namespace Mantid::MDEvents; +using namespace Mantid::MDAlgorithms; + class ConvertMDHistoToMatrixWorkspaceTest : 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 ConvertMDHistoToMatrixWorkspaceTest *createSuite() { return new ConvertMDHistoToMatrixWorkspaceTest(); } + static void destroySuite( ConvertMDHistoToMatrixWorkspaceTest *suite ) { delete suite; } + MatrixWorkspace_sptr do_execute_on_1D_directly(const size_t n_dims, const double signal, const double error_sq, size_t* nbins, coord_t* min, coord_t* max) { IMDHistoWorkspace_sptr inWS = MDEventsTestHelper::makeFakeMDHistoWorkspaceGeneral(n_dims, signal, @@ -54,89 +60,36 @@ public: */ void do_test_2D_slice(size_t ndims, std::vector<size_t> nonIntegr) { - // prepare input workspace - // create an MD histo workspace size_t size = 1; // property values for CreateMDHistoWorkspace - std::vector<double> extents(ndims*2); - std::vector<int> numberOfBins(ndims); + std::vector<size_t> numberOfBins(ndims); std::vector<std::string> names(ndims); - std::vector<std::string> units(ndims); // property values for SliceMDHisto - std::vector<int> start(ndims); - std::vector<int> end(ndims); + std::vector<coord_t> start(ndims); + std::vector<coord_t> end(ndims); for(size_t i = 0; i < ndims; ++i) { - size_t nbins = 3 + i; - size *= nbins; - numberOfBins[i] = static_cast<int>(nbins); - extents[2*i] = 0.0; - extents[2*i+1] = static_cast<double>(nbins); names[i] = "x_" + boost::lexical_cast<std::string>(i); if ( nonIntegr.end() != std::find( nonIntegr.begin(), nonIntegr.end(), i) ) { + size_t nbins = 3 + i; + size *= nbins; + numberOfBins[i] = nbins; // if it's a non-integrated dimension - don't slice - end[i] = static_cast<int>(nbins); + end[i] = static_cast<coord_t>(nbins); } else { - end[i] = 1; + numberOfBins[i] = 1; } } - std::vector<signal_t> data(size); - std::vector<signal_t> error(size); - - auto alg = AlgorithmManager::Instance().create("CreateMDHistoWorkspace"); - alg->initialize(); - alg->setRethrows(true); - alg->setChild(true); - alg->setProperty("SignalInput", data); - alg->setProperty("ErrorInput", error); - alg->setProperty("Dimensionality", static_cast<int>(ndims)); - alg->setProperty("Extents", extents); - alg->setProperty("NumberOfBins", numberOfBins); - alg->setProperty("Names", names); - alg->setProperty("Units", units); - alg->setPropertyValue("OutputWorkspace", "_"); // Not really required for child algorithm - - try - { - alg->execute(); - } - catch(std::exception& e) - { - TS_FAIL(e.what()); - } - - // slice the md ws to make it acceptable by ConvertMDHistoToMatrixWorkspace - IMDHistoWorkspace_sptr ws = alg->getProperty("OutputWorkspace"); - TS_ASSERT( ws ); - - alg = AlgorithmManager::Instance().create("SliceMDHisto"); - alg->initialize(); - alg->setRethrows(true); - alg->setChild(true); - alg->setProperty("InputWorkspace", ws); - alg->setProperty("Start", start); - alg->setProperty("End", end); - alg->setPropertyValue("OutputWorkspace", "_1"); // Not really required for child algorithm - - try - { - alg->execute(); - } - catch(std::exception& e) - { - TS_FAIL(e.what()); - } - - IMDHistoWorkspace_sptr slice = alg->getProperty("OutputWorkspace"); - TS_ASSERT( slice ); + signal_t signal(0.f), error(0.f); + IMDHistoWorkspace_sptr slice = MDEventsTestHelper::makeFakeMDHistoWorkspaceGeneral(ndims, signal, + error, &numberOfBins.front(), &start.front(), &end.front(), names); // test ConvertMDHistoToMatrixWorkspace - - alg = AlgorithmManager::Instance().create("ConvertMDHistoToMatrixWorkspace"); + auto alg = AlgorithmManager::Instance().create("ConvertMDHistoToMatrixWorkspace"); alg->initialize(); alg->setRethrows(true); alg->setChild(true); @@ -188,16 +141,10 @@ public: } - AnalysisDataService::Instance().clear(); } public: - ConvertMDHistoToMatrixWorkspaceTest() - { - FrameworkManager::Instance(); - } - void test_input_workspace_must_be_imdhisto() { MatrixWorkspace_sptr ws = WorkspaceCreationHelper::Create1DWorkspaceConstant(1,1,0); diff --git a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToDetectorFaceMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToDetectorFaceMDTest.h index 2160fe8cbc39d205192d6696341b6f2faee7ef08..8cfc3e71f2631a2f8d348c0e2bed06bec5a21db1 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToDetectorFaceMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToDetectorFaceMDTest.h @@ -5,21 +5,17 @@ #include "MantidDataObjects/Events.h" #include "MantidDataObjects/EventWorkspace.h" #include "MantidGeometry/MDGeometry/IMDDimension.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" #include "MantidMDAlgorithms/ConvertToDetectorFaceMD.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::MDAlgorithms; using namespace Mantid::API; using namespace Mantid::DataObjects; -using namespace Mantid::MDEvents; using Mantid::Geometry::IMDDimension_const_sptr; class ConvertToDetectorFaceMDTest : public CxxTest::TestSuite diff --git a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToDiffractionMDWorkspace2Test.h b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToDiffractionMDWorkspace2Test.h index 0a4ddc7f678d528f726532aa5083446110edfd77..6d82899bf6a53e6d8f463aa121681cdc64988d98 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToDiffractionMDWorkspace2Test.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToDiffractionMDWorkspace2Test.h @@ -1,24 +1,20 @@ #ifndef MANTID_MDEVENTS_MAKEDIFFRACTIONMDEVENTWORKSPACETEST2_H_ #define MANTID_MDEVENTS_MAKEDIFFRACTIONMDEVENTWORKSPACETEST2_H_ -#include "MantidDataObjects/EventWorkspace.h" #include "MantidAPI/FrameworkManager.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" +#include "MantidAPI/IAlgorithm.h" +#include "MantidDataObjects/EventWorkspace.h" #include "MantidMDAlgorithms/ConvertToDiffractionMDWorkspace2.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> -#include "MantidAPI/IAlgorithm.h" using namespace Mantid; -using namespace Mantid::Kernel; using namespace Mantid::API; +using namespace Mantid::Kernel; using namespace Mantid::DataObjects; -using namespace Mantid::MDEvents; using namespace Mantid::MDAlgorithms; class ConvertToDiffractionMDWorkspace2Test : public CxxTest::TestSuite @@ -37,7 +33,7 @@ public: /** Test various combinations of OutputDimensions parameter */ void test_OutputDimensions_Parameter() { - EventWorkspace_sptr in_ws = Mantid::MDEvents::MDEventsTestHelper::createDiffractionEventWorkspace(10); + EventWorkspace_sptr in_ws = Mantid::DataObjects::MDEventsTestHelper::createDiffractionEventWorkspace(10); AnalysisDataService::Instance().addOrReplace("testInEW", in_ws); IAlgorithm_sptr alg; @@ -105,7 +101,7 @@ public: { int numEventsPer = 100; - EventWorkspace_sptr in_ws = Mantid::MDEvents::MDEventsTestHelper::createDiffractionEventWorkspace(numEventsPer); + EventWorkspace_sptr in_ws = Mantid::DataObjects::MDEventsTestHelper::createDiffractionEventWorkspace(numEventsPer); if (type == WEIGHTED) in_ws *= 2.0; if (type == WEIGHTED_NOTIME) diff --git a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToDiffractionMDWorkspaceTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToDiffractionMDWorkspaceTest.h index 99103b2d68fd01090d00a468fbe3faa638c48d11..ae323ce43165b6aa9914544e011cae085e7eb306 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToDiffractionMDWorkspaceTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToDiffractionMDWorkspaceTest.h @@ -1,24 +1,20 @@ #ifndef MANTID_MDEVENTS_MAKEDIFFRACTIONMDEVENTWORKSPACETEST_H_ #define MANTID_MDEVENTS_MAKEDIFFRACTIONMDEVENTWORKSPACETEST_H_ -#include "MantidDataObjects/EventWorkspace.h" #include "MantidAPI/FrameworkManager.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" +#include "MantidAPI/IAlgorithm.h" +#include "MantidDataObjects/EventWorkspace.h" #include "MantidMDAlgorithms/ConvertToDiffractionMDWorkspace.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> -#include "MantidAPI/IAlgorithm.h" using namespace Mantid; -using namespace Mantid::Kernel; using namespace Mantid::API; +using namespace Mantid::Kernel; using namespace Mantid::DataObjects; -using namespace Mantid::MDEvents; using namespace Mantid::MDAlgorithms; class ConvertToDiffractionMDWorkspaceTest : public CxxTest::TestSuite @@ -37,7 +33,7 @@ public: /** Test various combinations of OutputDimensions parameter */ void test_OutputDimensions_Parameter() { - EventWorkspace_sptr in_ws = Mantid::MDEvents::MDEventsTestHelper::createDiffractionEventWorkspace(10); + EventWorkspace_sptr in_ws = Mantid::DataObjects::MDEventsTestHelper::createDiffractionEventWorkspace(10); AnalysisDataService::Instance().addOrReplace("testInEW", in_ws); IAlgorithm* alg; @@ -103,7 +99,7 @@ public: { int numEventsPer = 100; - EventWorkspace_sptr in_ws = Mantid::MDEvents::MDEventsTestHelper::createDiffractionEventWorkspace(numEventsPer); + EventWorkspace_sptr in_ws = Mantid::DataObjects::MDEventsTestHelper::createDiffractionEventWorkspace(numEventsPer); if (type == WEIGHTED) in_ws *= 2.0; if (type == WEIGHTED_NOTIME) diff --git a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDComponentsTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDComponentsTest.h index 958d745759d7954e1b0103840f3f2312415bc926..56db98dc118a1acf223dabd86f285c2784113577 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDComponentsTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDComponentsTest.h @@ -2,28 +2,20 @@ #define MANTID_MDALGORITHM_CONVERT2MD_COMPONENTS_TEST_H // tests for different parts of ConvertToMD exec functions -#include "MantidDataObjects/EventWorkspace.h" #include "MantidAPI/FrameworkManager.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidAPI/TextAxis.h" #include "MantidMDAlgorithms/ConvertToMD.h" +#include "MantidMDAlgorithms/MDWSTransform.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidKernel/UnitFactory.h" -#include "MantidKernel/LibraryWrapper.h" -#include "MantidMDEvents/MDWSTransform.h" + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::MDAlgorithms; -using namespace Mantid::MDEvents; class Convert2MDComponentsTestHelper: public ConvertToMD { @@ -37,14 +29,14 @@ public: { this->m_InWS2D = InWS2D; // and create the class, which will deal with the target workspace - if(!this->m_OutWSWrapper) this->m_OutWSWrapper = boost::shared_ptr<MDEvents::MDEventWSWrapper>(new MDEvents::MDEventWSWrapper()); + if(!this->m_OutWSWrapper) this->m_OutWSWrapper = boost::shared_ptr<MDAlgorithms::MDEventWSWrapper>(new MDAlgorithms::MDEventWSWrapper()); } Convert2MDComponentsTestHelper() { ConvertToMD::initialize(); } bool buildTargetWSDescription(API::IMDEventWorkspace_sptr spws,const std::string &Q_mod_req,const std::string &dEModeRequested,const std::vector<std::string> &other_dim_names, - const std::string &QFrame,const std::string &convert_to_,MDEvents::MDWSDescription &targWSDescr) + const std::string &QFrame,const std::string &convert_to_,MDAlgorithms::MDWSDescription &targWSDescr) { std::vector<double> dimMin = this->getProperty("MinValues"); std::vector<double> dimMax = this->getProperty("MaxValues"); @@ -54,14 +46,14 @@ public: { ConvertToMD::copyMetaData(mdEventWS); } - void addExperimentInfo(API::IMDEventWorkspace_sptr mdEventWS, MDEvents::MDWSDescription &targWSDescr) const + void addExperimentInfo(API::IMDEventWorkspace_sptr mdEventWS, MDAlgorithms::MDWSDescription &targWSDescr) const { ConvertToMD::addExperimentInfo(mdEventWS,targWSDescr); }; - API::IMDEventWorkspace_sptr createNewMDWorkspace(const MDEvents::MDWSDescription &NewMDWSDescription) + API::IMDEventWorkspace_sptr createNewMDWorkspace(const MDAlgorithms::MDWSDescription &NewMDWSDescription) { return ConvertToMD::createNewMDWorkspace(NewMDWSDescription); } @@ -231,13 +223,13 @@ public: subAlgo.setPropertyValue("MaxValues","10"); bool createNewTargetWs(false); - std::vector<std::string> Q_modes = MDEvents::MDTransfFactory::Instance().getKeys(); + std::vector<std::string> Q_modes = MDAlgorithms::MDTransfFactory::Instance().getKeys(); std::string dE_mode = Kernel::DeltaEMode().asString(Kernel::DeltaEMode::Elastic); MDWSTransform QScl; std::vector<std::string> QScales = QScl.getQScalings(); std::vector<std::string> Frames = QScl.getTargetFrames(); - MDEvents::MDWSDescription targWSDescr; + MDAlgorithms::MDWSDescription targWSDescr; TS_ASSERT_THROWS_NOTHING(createNewTargetWs=subAlgo.buildTargetWSDescription(spws,Q_modes[0],dE_mode,std::vector<std::string>(), Frames[CnvrtToMD::AutoSelect],QScales[CnvrtToMD::NoScaling],targWSDescr)); diff --git a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTest.h index 72c7f6208b8408b236a32dc4e5cb2d5ed88f8a98..f112f167ca79e8cdcbf8b5a4b3fe7c7454fec50c 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTest.h @@ -1,29 +1,22 @@ #ifndef MANTID_MD_CONVERT2_Q_NDANY_TEST_H_ #define MANTID_MD_CONVERT2_Q_NDANY_TEST_H_ -#include "MantidDataObjects/EventWorkspace.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidAPI/TextAxis.h" #include "MantidAPI/BoxController.h" #include "MantidMDAlgorithms/ConvertToMD.h" +#include "MantidMDAlgorithms/ConvToMDSelector.h" +#include "MantidMDAlgorithms/PreprocessDetectorsToMD.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidKernel/UnitFactory.h" -#include "MantidMDEvents/ConvToMDSelector.h" -#include "MantidMDAlgorithms/PreprocessDetectorsToMD.h" + #include "MantidAPI/AlgorithmManager.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::MDAlgorithms; -using namespace Mantid::MDEvents; class Convert2AnyTestHelper: public ConvertToMD { @@ -362,7 +355,7 @@ class ConvertToMDTestPerformance : public CxxTest::TestSuite // pointer to mock algorithm to work with progress bar std::auto_ptr<WorkspaceCreationHelper::MockAlgorithm> pMockAlgorithm; - boost::shared_ptr<MDEvents::MDEventWSWrapper> pTargWS; + boost::shared_ptr<MDEventWSWrapper> pTargWS; public: static ConvertToMDTestPerformance *createSuite() { return new ConvertToMDTestPerformance(); } diff --git a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToQ3DdETest.h b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToQ3DdETest.h index b148da7fd1bec7ca7934d7a33b42c2ca06fd5ca2..30f12cf408355983b33ed728d3267ae1e4ec8ac2 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToQ3DdETest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToQ3DdETest.h @@ -1,19 +1,16 @@ #ifndef MANTID_MD_CONVERT2_QxyzDE_TEST_H_ #define MANTID_MD_CONVERT2_QxyzDE_TEST_H_ +#include "MantidAPI/FrameworkManager.h" #include "MantidDataObjects/EventWorkspace.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidMDAlgorithms/ConvertToMD.h" #include "MantidGeometry/Crystal/OrientedLattice.h" +#include "MantidMDAlgorithms/ConvertToMD.h" +#include "MantidMDAlgorithms/MDWSDescription.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidMDEvents/MDWSDescription.h" -#include "MantidAPI/FrameworkManager.h" + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; using namespace Mantid::Kernel; @@ -21,12 +18,11 @@ using Mantid::Geometry::OrientedLattice; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::MDAlgorithms; -using namespace Mantid::MDEvents; class ConvertTo3DdETestHelper: public ConvertToMD { public: - ConvertTo3DdETestHelper(){}; + ConvertTo3DdETestHelper(){} }; // Test is transformed from ConvetToQ3DdE but actually tests some aspects of ConvertToMD algorithm. diff --git a/Code/Mantid/Framework/MDEvents/test/ConvertToReflectometryQTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h similarity index 93% rename from Code/Mantid/Framework/MDEvents/test/ConvertToReflectometryQTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h index 23d5c82e284a72e8ef8a93b4fefdccfbe074c4da..7911e540c1d3f1dbd0d6ae9bb4cac486cfa85399 100644 --- a/Code/Mantid/Framework/MDEvents/test/ConvertToReflectometryQTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h @@ -1,24 +1,25 @@ #ifndef MANTID_MDEVENTS_CONVERTTOREFLECTOMETRYQTEST_H_ #define MANTID_MDEVENTS_CONVERTTOREFLECTOMETRYQTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> -#include "MantidGeometry/Instrument/ReferenceFrame.h" -#include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidMDEvents/ConvertToReflectometryQ.h" +#include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidAPI/NumericAxis.h" -#include "MantidAPI/IMDWorkspace.h" #include "MantidAPI/FrameworkManager.h" +#include "MantidAPI/NumericAxis.h" +#include "MantidAPI/WorkspaceGroup.h" +#include "MantidGeometry/Instrument/ReferenceFrame.h" +#include "MantidKernel/PropertyWithValue.h" +#include "MantidMDAlgorithms/ConvertToReflectometryQ.h" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" + #include <boost/assign.hpp> -using namespace Mantid; -using namespace Mantid::MDEvents; +#include <cxxtest/TestSuite.h> + using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; +using namespace Mantid::Kernel; +using namespace Mantid::MDAlgorithms; class ConvertToReflectometryQTest : public CxxTest::TestSuite { @@ -36,10 +37,10 @@ private: MatrixWorkspace_sptr in_ws = WorkspaceCreationHelper::create2DWorkspaceWithFullInstrument(10, 10); in_ws->getAxis(0)->setUnit("Wavelength"); - Kernel::PropertyWithValue<std::string>* testProperty = new Kernel::PropertyWithValue<std::string>("test_property", "test_value", Kernel::Direction::Input); + PropertyWithValue<std::string>* testProperty = new PropertyWithValue<std::string>("test_property", "test_value", Direction::Input); in_ws->mutableRun().addLogData(testProperty); - Mantid::API::NumericAxis* const newAxis = new Mantid::API::NumericAxis(in_ws->getAxis(1)->length()); + NumericAxis* const newAxis = new NumericAxis(in_ws->getAxis(1)->length()); in_ws->replaceAxis(1,newAxis); newAxis->unit() = boost::make_shared<Mantid::Kernel::Units::Degrees>(); @@ -274,7 +275,7 @@ public: specaxisalg->setPropertyValue("Target", "signed_theta"); specaxisalg->execute(); - ws = API::AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>("testws"); + ws = AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>("testws"); } @@ -290,7 +291,7 @@ public: alg.setProperty("IncidentTheta", 0.5); TS_ASSERT(alg.execute()); TS_ASSERT(alg.isExecuted()); - IMDWorkspace_sptr out = API::AnalysisDataService::Instance().retrieveWS<IMDWorkspace>("OutputTransformedWorkspace"); + IMDWorkspace_sptr out = AnalysisDataService::Instance().retrieveWS<IMDWorkspace>("OutputTransformedWorkspace"); TS_ASSERT(out != NULL); TS_ASSERT_EQUALS(out->getNumDims(), 2); } diff --git a/Code/Mantid/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h b/Code/Mantid/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h index 40b42e6b7e07a1ca830a37c106d5e5f64af7a591..3bfe22e06062366607d9a2775b3bb3c2eed3c3d4 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h @@ -10,7 +10,7 @@ #include "MantidMDAlgorithms/CreateMDHistoWorkspace.h" using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::MDAlgorithms; using namespace Mantid::API; diff --git a/Code/Mantid/Framework/MDAlgorithms/test/CreateMDWorkspaceTest.h b/Code/Mantid/Framework/MDAlgorithms/test/CreateMDWorkspaceTest.h index 7236b67f54a66b899287b43284a50b2529993b58..f6c85aaa406d6ac3ecc1455c7541eeb25f3493b2 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/CreateMDWorkspaceTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/CreateMDWorkspaceTest.h @@ -1,21 +1,23 @@ #ifndef MANTID_MDEVENTS_CREATEMDEVENTWORKSPACETEST_H_ #define MANTID_MDEVENTS_CREATEMDEVENTWORKSPACETEST_H_ -#include "MantidAPI/AnalysisDataService.h" -#include "MantidAPI/IMDEventWorkspace.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDAlgorithms/CreateMDWorkspace.h" #include "MantidAPI/FrameworkManager.h" +#include "MantidMDAlgorithms/CreateMDWorkspace.h" + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> + #include <Poco/File.h> +//#include "MantidAPI/AnalysisDataService.h" +//#include "MantidAPI/IMDEventWorkspace.h" +//#include "MantidKernel/System.h" +//#include "MantidKernel/Timer.h" +//#include "MantidDataObjects/MDEventFactory.h" + + using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; using namespace Mantid::MDAlgorithms; class CreateMDWorkspaceTest : public CxxTest::TestSuite diff --git a/Code/Mantid/Framework/MDAlgorithms/test/DivideMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/DivideMDTest.h index e19ff2a0c7e41a0ee8ee6966df64334a50f2c20e..28f9a6eccae9da69d7a477b2f53dbe0f7982befb 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/DivideMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/DivideMDTest.h @@ -9,12 +9,12 @@ #include "MantidMDAlgorithms/DivideMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" using namespace Mantid; using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using Mantid::MDEvents::MDHistoWorkspace_sptr; +using Mantid::DataObjects::MDHistoWorkspace_sptr; /** Note: More detailed tests for the underlying * operations are in BinaryOperationMDTest and diff --git a/Code/Mantid/Framework/MDAlgorithms/test/EqualToMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/EqualToMDTest.h index a84cf543682fe1aae8ea429f0d5aa104ed59030d..268261f02c4b0d683183fe6ab9c5b5bbf808d4a6 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/EqualToMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/EqualToMDTest.h @@ -1,20 +1,16 @@ #ifndef MANTID_MDALGORITHMS_EQUALTOMDTEST_H_ #define MANTID_MDALGORITHMS_EQUALTOMDTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> - #include "MantidMDAlgorithms/EqualToMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" + +#include <cxxtest/TestSuite.h> using namespace Mantid; using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using Mantid::MDEvents::MDHistoWorkspace_sptr; +using Mantid::DataObjects::MDHistoWorkspace_sptr; class EqualToMDTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDAlgorithms/test/ExponentialMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ExponentialMDTest.h index 83fc8d93cf7b32f559c6d872ec55fca167e851d3..780625109992a0f4b7bb64b4144f7d9f0ed5b2cc 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/ExponentialMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ExponentialMDTest.h @@ -9,12 +9,12 @@ #include "MantidMDAlgorithms/ExponentialMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" using namespace Mantid; using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using Mantid::MDEvents::MDHistoWorkspace_sptr; +using Mantid::DataObjects::MDHistoWorkspace_sptr; class ExponentialMDTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDAlgorithms/test/FakeMDEventDataTest.h b/Code/Mantid/Framework/MDAlgorithms/test/FakeMDEventDataTest.h index ce6bb23fd192dc56e0c9846301551d77c07470cd..be8687d2c2f6df023e3666cb72ec9bb6eaf94973 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/FakeMDEventDataTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/FakeMDEventDataTest.h @@ -2,20 +2,16 @@ #define MANTID_MDEVENTS_FAKEMDEVENTDATATEST_H_ #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidMDAlgorithms/FakeMDEventData.h" #include "MantidMDAlgorithms/BinMD.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> -using namespace Mantid::MDEvents; using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; using namespace Mantid::Kernel; using namespace Mantid::MDAlgorithms; diff --git a/Code/Mantid/Framework/MDAlgorithms/test/FindPeaksMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/FindPeaksMDTest.h index 48af2a583ff4053b24dc08892dbbe8b2673d9437..301b82f6760ebc9e1a1994e5e5aa0214b396da4e 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/FindPeaksMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/FindPeaksMDTest.h @@ -1,21 +1,17 @@ #ifndef MANTID_MDEVENTS_MDEWFINDPEAKSTEST_H_ #define MANTID_MDEVENTS_MDEWFINDPEAKSTEST_H_ +#include "MantidAPI/FrameworkManager.h" #include "MantidDataObjects/PeaksWorkspace.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" +#include "MantidKernel/PropertyWithValue.h" #include "MantidMDAlgorithms/FindPeaksMD.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidAPI/FrameworkManager.h" + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> -#include "MantidKernel/PropertyWithValue.h" -using namespace Mantid::MDEvents; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; +using namespace Mantid::MDAlgorithms; using namespace Mantid::DataObjects; using Mantid::Geometry::Instrument_sptr; using Mantid::Kernel::PropertyWithValue; diff --git a/Code/Mantid/Framework/MDEvents/test/FitMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/FitMDTest.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/test/FitMDTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/FitMDTest.h index 300fdf2bd4bec3a88fc69d13a67e768decbfecc5..c9ea6e1834abdde117f2da80c362413e65d22066 100644 --- a/Code/Mantid/Framework/MDEvents/test/FitMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/FitMDTest.h @@ -1,16 +1,17 @@ #ifndef CURVEFITTING_FITMDTEST_H_ #define CURVEFITTING_FITMDTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidTestHelpers/FakeObjects.h" #include "MantidAPI/AlgorithmManager.h" -#include "MantidAPI/IAlgorithm.h" #include "MantidAPI/FrameworkManager.h" +#include "MantidAPI/IAlgorithm.h" +#include "MantidAPI/IMDHistoWorkspace.h" #include "MantidAPI/IMDIterator.h" #include "MantidAPI/ITableWorkspace.h" -#include "MantidAPI/IMDHistoWorkspace.h" -#include "MantidMDEvents/UserFunctionMD.h" +#include "MantidMDAlgorithms/UserFunctionMD.h" +#include "MantidTestHelpers/FakeObjects.h" + +#include <cxxtest/TestSuite.h> #include <sstream> @@ -148,7 +149,7 @@ public: } } - API::IFunction_sptr fun(new Mantid::MDEvents::UserFunctionMD); + API::IFunction_sptr fun(new Mantid::MDAlgorithms::UserFunctionMD); fun->setAttributeValue("Formula","h + y + (s + 0.1*y) * x"); fun->setParameter("h",1.0); fun->setParameter("s",1.0); diff --git a/Code/Mantid/Framework/MDAlgorithms/test/GreaterThanMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/GreaterThanMDTest.h index c96946af1b01def928b3fe4fd84d97f6e405b3b1..47268a803b62fd8eac2e25ecb1fa52ec5a964189 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/GreaterThanMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/GreaterThanMDTest.h @@ -9,12 +9,12 @@ #include "MantidMDAlgorithms/GreaterThanMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" using namespace Mantid; using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using Mantid::MDEvents::MDHistoWorkspace_sptr; +using Mantid::DataObjects::MDHistoWorkspace_sptr; class GreaterThanMDTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDEvents/test/ImportMDEventWorkspaceTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ImportMDEventWorkspaceTest.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/test/ImportMDEventWorkspaceTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/ImportMDEventWorkspaceTest.h index 9656a9f6cd916cf37d72df93ebf33342a78f5edf..33bb0ef8664458ae7610eb15b2fb4ff783a1c501 100644 --- a/Code/Mantid/Framework/MDEvents/test/ImportMDEventWorkspaceTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ImportMDEventWorkspaceTest.h @@ -1,22 +1,21 @@ #ifndef MANTID_MDEVENTS_IMPORTMDEVENTWORKSPACETEST_H_ #define MANTID_MDEVENTS_IMPORTMDEVENTWORKSPACETEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" #include "MantidGeometry/MDGeometry/IMDDimension.h" -#include <iostream> -#include <fstream> -#include <iomanip> -#include "MantidMDEvents/ImportMDEventWorkspace.h" +#include "MantidMDAlgorithms/ImportMDEventWorkspace.h" #include "MantidKernel/ConfigService.h" + +#include <cxxtest/TestSuite.h> + #include <Poco/Path.h> +#include <fstream> + using namespace Mantid; -using namespace Mantid::MDEvents; using namespace Mantid::API; using namespace Mantid::Geometry; +using namespace Mantid::MDAlgorithms; /* This builder type provides a convenient way to create and change the contents of a virtual file of the type expected diff --git a/Code/Mantid/Framework/MDEvents/test/ImportMDHistoWorkspaceTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ImportMDHistoWorkspaceTest.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/test/ImportMDHistoWorkspaceTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/ImportMDHistoWorkspaceTest.h index 76c55f517523d474b4846dbc48b3cfa14e32fc14..31073920e2b1298a188fbf5c1295bf97056ea863 100644 --- a/Code/Mantid/Framework/MDEvents/test/ImportMDHistoWorkspaceTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ImportMDHistoWorkspaceTest.h @@ -1,20 +1,20 @@ #ifndef MANTID_MDEVENTS_IMPORTMDHISTOWORKSPACETEST_H_ #define MANTID_MDEVENTS_IMPORTMDHISTOWORKSPACETEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> -#include <fstream> -#include "MantidMDEvents/ImportMDHistoWorkspace.h" #include "MantidAPI/IMDHistoWorkspace.h" #include "MantidKernel/ConfigService.h" +#include "MantidMDAlgorithms/ImportMDHistoWorkspace.h" + +#include <cxxtest/TestSuite.h> + #include <Poco/Path.h> +#include <fstream> + using namespace Mantid; -using namespace Mantid::MDEvents; using namespace Mantid::API; +using namespace Mantid::Kernel; +using namespace Mantid::MDAlgorithms; /** Helper type. Creates a test file, and also manages the resource to ensure that the file is closed and removed, no matter what the outcome of the test. diff --git a/Code/Mantid/Framework/MDEvents/test/Integrate3DEventsTest.h b/Code/Mantid/Framework/MDAlgorithms/test/Integrate3DEventsTest.h similarity index 94% rename from Code/Mantid/Framework/MDEvents/test/Integrate3DEventsTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/Integrate3DEventsTest.h index 687180da609242c80a19dbf888d0ac394441bcf9..0847a05d3600e12020fc8a955c58591dc3f2507a 100644 --- a/Code/Mantid/Framework/MDEvents/test/Integrate3DEventsTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/Integrate3DEventsTest.h @@ -1,20 +1,16 @@ #ifndef MANTID_MDEVENTS_INTEGRATE_3D_EVENTS_TEST_H_ #define MANTID_MDEVENTS_INTEGRATE_3D_EVENTS_TEST_H_ -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" +#include "MantidMDAlgorithms/Integrate3DEvents.h" #include "MantidKernel/V3D.h" #include "MantidDataObjects/PeakShapeEllipsoid.h" -#include "MantidMDEvents/Integrate3DEvents.h" + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> using namespace Mantid; -using namespace Mantid::MDEvents; -using Mantid::Kernel::V3D; - -//typedef Mantid::Kernel::Matrix<double> DblMatrix; +using namespace Mantid::DataObjects; +using namespace Mantid::Kernel; +using namespace Mantid::MDAlgorithms; class Integrate3DEventsTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDEvents/test/IntegrateEllipsoidsTest.h b/Code/Mantid/Framework/MDAlgorithms/test/IntegrateEllipsoidsTest.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/test/IntegrateEllipsoidsTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/IntegrateEllipsoidsTest.h index 7c9aa8c5f194a9b85e8b736e5443cbb28f7b32f8..feceab27592e4fe8e315b8f138b94d3c2bd11415 100644 --- a/Code/Mantid/Framework/MDEvents/test/IntegrateEllipsoidsTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/IntegrateEllipsoidsTest.h @@ -1,5 +1,5 @@ #include <cxxtest/TestSuite.h> -#include "MantidMDEvents/IntegrateEllipsoids.h" +#include "MantidMDAlgorithms/IntegrateEllipsoids.h" #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidTestHelpers/ComponentCreationHelper.h" @@ -12,7 +12,7 @@ #include <boost/tuple/tuple.hpp> using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::MDAlgorithms; using namespace Mantid::Kernel; using namespace Mantid::Geometry; using namespace Mantid::DataObjects; @@ -184,7 +184,7 @@ public: } void test_init() { - Mantid::MDEvents::IntegrateEllipsoids alg; + Mantid::MDAlgorithms::IntegrateEllipsoids alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); } diff --git a/Code/Mantid/Framework/MDAlgorithms/test/IntegratePeaksMD2Test.h b/Code/Mantid/Framework/MDAlgorithms/test/IntegratePeaksMD2Test.h index f83bbdd97a973797691f3b2780156a9f18e2b7d3..22f3a3b79691b65bab19075ece0214e8bd527e09 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/IntegratePeaksMD2Test.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/IntegratePeaksMD2Test.h @@ -1,19 +1,19 @@ #ifndef MANTID_MDAGORITHMS_MDEWPEAKINTEGRATION2TEST_H_ #define MANTID_MDAGORITHMS_MDEWPEAKINTEGRATION2TEST_H_ + #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/FrameworkManager.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidDataObjects/PeaksWorkspace.h" #include "MantidDataObjects/PeakShapeSpherical.h" #include "MantidGeometry/MDGeometry/MDHistoDimension.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDAlgorithms/IntegratePeaksMD2.h" #include "MantidMDAlgorithms/CreateMDWorkspace.h" #include "MantidMDAlgorithms/FakeMDEventData.h" +#include "MantidMDAlgorithms/IntegratePeaksMD2.h" #include "MantidTestHelpers/ComponentCreationHelper.h" + #include <boost/math/distributions/normal.hpp> #include <boost/math/special_functions/fpclassify.hpp> #include <boost/math/special_functions/pow.hpp> @@ -22,18 +22,16 @@ #include <boost/random/uniform_int.hpp> #include <boost/random/uniform_real.hpp> #include <boost/random/variate_generator.hpp> + #include <cxxtest/TestSuite.h> -#include <Poco/File.h> -#include <iomanip> -#include <iostream> +#include <Poco/File.h> using Mantid::API::AnalysisDataService; using Mantid::Geometry::MDHistoDimension; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; using namespace Mantid::MDAlgorithms; using Mantid::Kernel::V3D; diff --git a/Code/Mantid/Framework/MDAlgorithms/test/IntegratePeaksMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/IntegratePeaksMDTest.h index d9fb8208c5facc43d091c0733aced090725164ad..3ce141ec8b54b153cfd12de95cc05674276e6d7f 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/IntegratePeaksMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/IntegratePeaksMDTest.h @@ -4,16 +4,15 @@ #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/FrameworkManager.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidDataObjects/PeaksWorkspace.h" #include "MantidDataObjects/PeakShapeSpherical.h" #include "MantidGeometry/MDGeometry/MDHistoDimension.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidMDEvents/MDEventFactory.h" #include "MantidMDAlgorithms/IntegratePeaksMD.h" #include "MantidMDAlgorithms/CreateMDWorkspace.h" #include "MantidMDAlgorithms/FakeMDEventData.h" #include "MantidTestHelpers/ComponentCreationHelper.h" + #include <boost/math/distributions/normal.hpp> #include <boost/math/special_functions/fpclassify.hpp> #include <boost/math/special_functions/pow.hpp> @@ -22,17 +21,15 @@ #include <boost/random/uniform_int.hpp> #include <boost/random/uniform_real.hpp> #include <boost/random/variate_generator.hpp> + #include <cxxtest/TestSuite.h> + #include <Poco/File.h> -#include <iomanip> -#include <iostream> -using Mantid::API::AnalysisDataService; using Mantid::Geometry::MDHistoDimension; using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; using namespace Mantid::MDAlgorithms; using Mantid::Kernel::V3D; diff --git a/Code/Mantid/Framework/MDAlgorithms/test/LessThanMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/LessThanMDTest.h index 4706f2dfd804f7844fa51e41a58607c262d5d1c3..a236d2145739da1b9a2b0ff1e538c2a463cc8ec6 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/LessThanMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/LessThanMDTest.h @@ -2,19 +2,15 @@ #define MANTID_MDALGORITHMS_LESSTHANMDTEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidMDAlgorithms/LessThanMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidMDEvents/MDHistoWorkspace.h" using namespace Mantid; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using Mantid::MDEvents::MDHistoWorkspace_sptr; +using namespace Mantid::MDAlgorithms; +using Mantid::DataObjects::MDHistoWorkspace_sptr; class LessThanMDTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDAlgorithms/test/LoadMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/LoadMDTest.h index 179d58265ca6704dfe4c59f8712424d346009bd6..25c23a4ac3cf6d4ec05be270cc249fef0e99da82 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/LoadMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/LoadMDTest.h @@ -1,26 +1,23 @@ #ifndef MANTID_MDALGORITHMS_LOADMDEWTEST_H_ #define MANTID_MDALGORITHMS_LOADMDEWTEST_H_ -#include "MantidAPI/IMDEventWorkspace.h" -#include "MantidKernel/CPUTimer.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidMDEvents/MDBox.h" -#include "MantidMDEvents/MDGridBox.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/BoxControllerNeXusIO.h" #include "SaveMDTest.h" -#include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> + +#include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/ExperimentInfo.h" +#include "MantidDataObjects/MDBox.h" +#include "MantidDataObjects/MDGridBox.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/BoxControllerNeXusIO.h" #include "MantidMDAlgorithms/LoadMD.h" +#include <cxxtest/TestSuite.h> + #include <hdf5.h> using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::MDAlgorithms; using namespace Mantid::API; using namespace Mantid::Kernel; @@ -217,8 +214,6 @@ public: // Name of the output workspace. std::string outWSName("LoadMDTest_OutputWS"); - CPUTimer tim; - LoadMD alg; TS_ASSERT_THROWS_NOTHING( alg.initialize() ) TS_ASSERT( alg.isInitialized() ) @@ -231,17 +226,14 @@ public: TS_ASSERT_THROWS_NOTHING( alg.execute(); ); TS_ASSERT( alg.isExecuted() ); - std::cout << tim << " to do the entire MDEW loading." << std::endl; - // Retrieve the workspace from data service. IMDEventWorkspace_sptr iws; TS_ASSERT_THROWS_NOTHING( iws = AnalysisDataService::Instance().retrieveWS<IMDEventWorkspace>(outWSName) ); TS_ASSERT(iws); if (!iws) return; - - boost::shared_ptr<MDEventWorkspace<MDE,nd> > ws = boost::dynamic_pointer_cast<MDEventWorkspace<MDLeanEvent<nd>,nd> >(iws); - + // Perform the full comparison + auto ws = boost::dynamic_pointer_cast<MDEventWorkspace<MDLeanEvent<nd>,nd> >(iws); do_compare_MDEW(ws, ws1, BoxStructureOnly); // Look for the not-disk-cached-cause-they-are-too-small diff --git a/Code/Mantid/Framework/MDAlgorithms/test/LoadSQWTest.h b/Code/Mantid/Framework/MDAlgorithms/test/LoadSQWTest.h index 1642548fccfbef847ce759eb3f42a2b8da321b4b..8726c68cbb63016b0744afb8c03625cc15a3d936 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/LoadSQWTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/LoadSQWTest.h @@ -1,13 +1,14 @@ #ifndef MANTID_MDEVENTS_LOAD_SQW_TEST_H_ #define MANTID_MDEVENTS_LOAD_SQW_TEST_H_ -#include <cxxtest/TestSuite.h> #include "MantidMDAlgorithms/LoadSQW.h" #include "MantidGeometry/Crystal/OrientedLattice.h" -#include "MantidMDEvents/MDBoxBase.h" -#include <boost/shared_ptr.hpp> +#include "MantidDataObjects/MDBoxBase.h" + +#include <cxxtest/TestSuite.h> + -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::MDAlgorithms; using Mantid::Geometry::OrientedLattice; diff --git a/Code/Mantid/Framework/MDAlgorithms/test/LogarithmMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/LogarithmMDTest.h index ad0dd5d378832d577e81ed8facb5d33763a19823..0e0cb104a331be783af6676cd9a4fdbebc4902cd 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/LogarithmMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/LogarithmMDTest.h @@ -8,13 +8,13 @@ #include <iomanip> #include "MantidMDAlgorithms/LogarithmMD.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" using namespace Mantid; using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using Mantid::MDEvents::MDHistoWorkspace_sptr; +using Mantid::DataObjects::MDHistoWorkspace_sptr; class LogarithmMDTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDEvents/test/MDEventWSWrapperTest.h b/Code/Mantid/Framework/MDAlgorithms/test/MDEventWSWrapperTest.h similarity index 97% rename from Code/Mantid/Framework/MDEvents/test/MDEventWSWrapperTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/MDEventWSWrapperTest.h index 994b0e521d2f45e62ac96657d5fc6be21f67ff9d..7bcd2b04c4fe8bb07caf5bb397e8b29744be2041 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDEventWSWrapperTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/MDEventWSWrapperTest.h @@ -1,15 +1,16 @@ #ifndef MANTID_MDEVENTS_WSWRAPPERTEST_H_ #define MANTID_MDEVENTS_WSWRAPPERTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidMDEvents/MDEventWSWrapper.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidGeometry/MDGeometry/MDTypes.h" +#include "MantidMDAlgorithms/MDEventWSWrapper.h" + +#include <cxxtest/TestSuite.h> -using namespace Mantid::MDEvents; using namespace Mantid::API; using namespace Mantid::Kernel; +using namespace Mantid::MDAlgorithms; class MDEventWSWrapperTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDEvents/test/MDTransfAxisNamesTest.h b/Code/Mantid/Framework/MDAlgorithms/test/MDTransfAxisNamesTest.h similarity index 94% rename from Code/Mantid/Framework/MDEvents/test/MDTransfAxisNamesTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/MDTransfAxisNamesTest.h index 6d28cf7b23826ebb4314b867130364cd90479896..ea082398493d56f64abacb7373735d7274d928dd 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDTransfAxisNamesTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/MDTransfAxisNamesTest.h @@ -1,11 +1,12 @@ #ifndef MANTID_MDWS_DESCRIPTION_H_ #define MANTID_MDWS_DESCRIPTION_H_ +#include "MantidMDAlgorithms/MDTransfAxisNames.h" + #include <cxxtest/TestSuite.h> -#include "MantidMDEvents/MDTransfAxisNames.h" -using namespace Mantid::MDEvents; using namespace Mantid::Kernel; +using namespace Mantid::MDAlgorithms; class MDTransfAxisNamesTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDEvents/test/MDTransfFactoryTest.h b/Code/Mantid/Framework/MDAlgorithms/test/MDTransfFactoryTest.h similarity index 82% rename from Code/Mantid/Framework/MDEvents/test/MDTransfFactoryTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/MDTransfFactoryTest.h index 1324f4242ec482c3cd120b8f7cc2f5c8ac2b9ac8..44bc9dbaadf40aeb09f9d1ab441a10e0b14e94e2 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDTransfFactoryTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/MDTransfFactoryTest.h @@ -1,22 +1,18 @@ #ifndef MANTID_MD_CONVERT2_MDEV_FACTORY_TEST_H_ #define MANTID_MD_CONVERT2_MDEV_FACTORY_TEST_H_ -#include "MantidDataObjects/EventWorkspace.h" -#include "MantidKernel/System.h" #include "MantidAPI/FrameworkManager.h" -#include "MantidMDEvents/MDTransfFactory.h" -#include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> +#include "MantidDataObjects/EventWorkspace.h" +#include "MantidMDAlgorithms/MDTransfFactory.h" -#include "MantidMDEvents/MDTransfNoQ.h" -#include "MantidMDEvents/MDTransfModQ.h" -#include "MantidMDEvents/MDTransfQ3D.h" +#include "MantidMDAlgorithms/MDTransfModQ.h" +#include "MantidMDAlgorithms/MDTransfNoQ.h" +#include "MantidMDAlgorithms/MDTransfQ3D.h" +#include <cxxtest/TestSuite.h> using namespace Mantid; -using namespace Mantid::MDEvents; - +using namespace Mantid::MDAlgorithms; // class MDTransfFactoryTest : public CxxTest::TestSuite @@ -57,7 +53,7 @@ void testGetAlg() // MDTransfFactoryTest() { - API::FrameworkManager::Instance(); + API::FrameworkManager::Instance(); } }; diff --git a/Code/Mantid/Framework/MDEvents/test/MDTransfModQTest.h b/Code/Mantid/Framework/MDAlgorithms/test/MDTransfModQTest.h similarity index 98% rename from Code/Mantid/Framework/MDEvents/test/MDTransfModQTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/MDTransfModQTest.h index 05215b3fa0676ad95253953d31e6ae87102b3dcf..3008ba1ca96a21dce7b5906406e5d2c25d2c5b02 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDTransfModQTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/MDTransfModQTest.h @@ -1,15 +1,14 @@ #ifndef MANTID_MDEVENTS_MDTRANSF_MODQTEST_H_ #define MANTID_MDEVENTS_MDTRANSF_MODQTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidMDEvents/MDTransfQ3D.h" -#include "MantidTestHelpers/WorkspaceCreationHelper.h" -//#include "MantidMDEvents/MDTransfDEHelper.h" +#include "MantidMDAlgorithms/MDTransfQ3D.h" #include "MantidKernel/DeltaEMode.h" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" +#include <cxxtest/TestSuite.h> using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::MDAlgorithms; // @@ -205,4 +204,4 @@ public: } }; -#endif \ No newline at end of file +#endif diff --git a/Code/Mantid/Framework/MDEvents/test/MDTransfQ3DTest.h b/Code/Mantid/Framework/MDAlgorithms/test/MDTransfQ3DTest.h similarity index 86% rename from Code/Mantid/Framework/MDEvents/test/MDTransfQ3DTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/MDTransfQ3DTest.h index 37d72b98a9382fe8a78554493eeec94a2ba3c56c..da9279dd435b9296989e116b7a08d862cdd2197c 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDTransfQ3DTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/MDTransfQ3DTest.h @@ -1,15 +1,16 @@ -#ifndef MANTID_MDEVENTS_MDTRANSFQ3D_H_ -#define MANTID_MDEVENTS_MDTRANSFQ3D_H_ +#ifndef MANTID_MDALGORITHMS_MDTRANSFQ3D_H_ +#define MANTID_MDALGORITHMS_MDTRANSFQ3D_H_ -#include <cxxtest/TestSuite.h> -#include "MantidMDEvents/MDTransfQ3D.h" -#include "MantidTestHelpers/WorkspaceCreationHelper.h" -//#include "MantidMDEvents/MDTransfDEHelper.h" #include "MantidKernel/DeltaEMode.h" +#include "MantidMDAlgorithms/MDTransfQ3D.h" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" + +#include <cxxtest/TestSuite.h> +using namespace Mantid::Kernel; +using namespace Mantid::MDAlgorithms; -using namespace Mantid; -using namespace Mantid::MDEvents; +using Mantid::coord_t; class MDTransfQ3DTestHelper: public MDTransfQ3D { @@ -34,23 +35,23 @@ void testWSDescriptionPart() MDTransfQ3D Q3DTransformer; TS_ASSERT_EQUALS("Q3D",Q3DTransformer.transfID()); - TS_ASSERT_EQUALS(4,Q3DTransformer.getNMatrixDimensions(Kernel::DeltaEMode::Direct)); - TS_ASSERT_EQUALS(3,Q3DTransformer.getNMatrixDimensions(Kernel::DeltaEMode::Elastic)); - TS_ASSERT_EQUALS(4,Q3DTransformer.getNMatrixDimensions(Kernel::DeltaEMode::Indirect)); + TS_ASSERT_EQUALS(4,Q3DTransformer.getNMatrixDimensions(DeltaEMode::Direct)); + TS_ASSERT_EQUALS(3,Q3DTransformer.getNMatrixDimensions(DeltaEMode::Elastic)); + TS_ASSERT_EQUALS(4,Q3DTransformer.getNMatrixDimensions(DeltaEMode::Indirect)); } void testWSDescrUnitsPart() { MDTransfQ3D Q3DTransformer; std::vector<std::string> outputDimUnits; - TS_ASSERT_THROWS_NOTHING(outputDimUnits=Q3DTransformer.outputUnitID(Kernel::DeltaEMode::Direct)); + TS_ASSERT_THROWS_NOTHING(outputDimUnits=Q3DTransformer.outputUnitID(DeltaEMode::Direct)); TS_ASSERT_EQUALS(4,outputDimUnits.size()); TS_ASSERT_EQUALS("MomentumTransfer",outputDimUnits[0]); TS_ASSERT_EQUALS("MomentumTransfer",outputDimUnits[1]); TS_ASSERT_EQUALS("MomentumTransfer",outputDimUnits[2]); TS_ASSERT_EQUALS("DeltaE",outputDimUnits[3]); - TS_ASSERT_THROWS_NOTHING(outputDimUnits=Q3DTransformer.outputUnitID(Kernel::DeltaEMode::Elastic)); + TS_ASSERT_THROWS_NOTHING(outputDimUnits=Q3DTransformer.outputUnitID(DeltaEMode::Elastic)); TS_ASSERT_EQUALS(3,outputDimUnits.size()); } void testWSDescrIDPart() @@ -58,14 +59,14 @@ void testWSDescrIDPart() MDTransfQ3D Q3DTransformer; std::vector<std::string> outputDimID; - TS_ASSERT_THROWS_NOTHING(outputDimID=Q3DTransformer.getDefaultDimID(Kernel::DeltaEMode::Direct)); + TS_ASSERT_THROWS_NOTHING(outputDimID=Q3DTransformer.getDefaultDimID(DeltaEMode::Direct)); TS_ASSERT_EQUALS(4,outputDimID.size()); TS_ASSERT_EQUALS("Q1",outputDimID[0]); TS_ASSERT_EQUALS("Q2",outputDimID[1]); TS_ASSERT_EQUALS("Q3",outputDimID[2]); TS_ASSERT_EQUALS("DeltaE",outputDimID[3]); - TS_ASSERT_THROWS_NOTHING(outputDimID=Q3DTransformer.getDefaultDimID(Kernel::DeltaEMode::Elastic)); + TS_ASSERT_THROWS_NOTHING(outputDimID=Q3DTransformer.getDefaultDimID(DeltaEMode::Elastic)); TS_ASSERT_EQUALS(3,outputDimID.size()); TS_ASSERT_EQUALS("Q1",outputDimID[0]); TS_ASSERT_EQUALS("Q2",outputDimID[1]); @@ -77,13 +78,13 @@ void testWSDescrInputUnitID() MDTransfQ3D Q3DTransformer; std::string inputUnitID; - TS_ASSERT_THROWS_NOTHING(inputUnitID=Q3DTransformer.inputUnitID(Kernel::DeltaEMode::Direct)); + TS_ASSERT_THROWS_NOTHING(inputUnitID=Q3DTransformer.inputUnitID(DeltaEMode::Direct)); TS_ASSERT_EQUALS("DeltaE",inputUnitID); - TS_ASSERT_THROWS_NOTHING(inputUnitID=Q3DTransformer.inputUnitID(Kernel::DeltaEMode::Indirect)); + TS_ASSERT_THROWS_NOTHING(inputUnitID=Q3DTransformer.inputUnitID(DeltaEMode::Indirect)); TS_ASSERT_EQUALS("DeltaE",inputUnitID); - TS_ASSERT_THROWS_NOTHING(inputUnitID=Q3DTransformer.inputUnitID(Kernel::DeltaEMode::Elastic)); + TS_ASSERT_THROWS_NOTHING(inputUnitID=Q3DTransformer.inputUnitID(DeltaEMode::Elastic)); TS_ASSERT_EQUALS("Momentum",inputUnitID); @@ -98,7 +99,7 @@ void testISLorents() MDWSDescription WSDescr(5); std::string QMode = Q3DTransf.transfID(); - std::string dEMode= Kernel::DeltaEMode::asString(Kernel::DeltaEMode::Elastic); + std::string dEMode= DeltaEMode::asString(DeltaEMode::Elastic); std::vector<std::string> dimPropNames(2,"T"); dimPropNames[1]="Ei"; @@ -158,4 +159,4 @@ MDTransfQ3DTest() } }; -#endif \ No newline at end of file +#endif diff --git a/Code/Mantid/Framework/MDEvents/test/MDWSDescriptionTest.h b/Code/Mantid/Framework/MDAlgorithms/test/MDWSDescriptionTest.h similarity index 92% rename from Code/Mantid/Framework/MDEvents/test/MDWSDescriptionTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/MDWSDescriptionTest.h index 9ac56a7215bb4bc4b7c530d925c359356f0e42ad..62b329b2fa9eed99e2e7c0fd448b81c74461ddd8 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDWSDescriptionTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/MDWSDescriptionTest.h @@ -1,18 +1,20 @@ #ifndef MDEVENTS_MDWSDESCRIPTION_TEST_H #define MDEVENTS_MDWSDESCRIPTION_TEST_H -#include "MantidMDEvents/MDWSDescription.h" -#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidKernel/SpecialCoordinateSystem.h" #include "MantidKernel/Exception.h" +#include "MantidMDAlgorithms/MDWSDescription.h" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" + #include <cxxtest/TestSuite.h> -using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::API; +using namespace Mantid::Kernel; +using namespace Mantid::MDAlgorithms; class MDWSDescriptionTest : public CxxTest::TestSuite { - Mantid::API::MatrixWorkspace_sptr ws2D; + Mantid::API::MatrixWorkspace_sptr ws2D; public: static MDWSDescriptionTest *createSuite() { return new MDWSDescriptionTest(); } @@ -62,7 +64,7 @@ public: std::vector<std::string> PropNamews(2,"Ei"); PropNamews[1]="P"; // no property named "P" is attached to workspace - TS_ASSERT_THROWS(WSD.buildFromMatrixWS(ws2D,"|Q|","Direct",PropNamews),Kernel::Exception::NotFoundError); + TS_ASSERT_THROWS(WSD.buildFromMatrixWS(ws2D,"|Q|","Direct",PropNamews), Exception::NotFoundError); // H is attached PropNamews[1]="H"; @@ -98,10 +100,10 @@ public: } void testGetWS4DimIDFine() { - Mantid::API::MatrixWorkspace_sptr ws2D =WorkspaceCreationHelper::createProcessedWorkspaceWithCylComplexInstrument(4,10,true); + MatrixWorkspace_sptr ws2D = WorkspaceCreationHelper::createProcessedWorkspaceWithCylComplexInstrument(4,10,true); ws2D->mutableRun().addProperty("Ei",12.,"meV",true); - MDEvents::MDWSDescription TWS; + MDWSDescription TWS; std::vector<double> min(4,-10),max(4,10); TWS.setMinMax(min,max); @@ -135,7 +137,6 @@ public: void test_setCoordinateSystem() { - using namespace Mantid::Kernel; const SpecialCoordinateSystem expectedResult = QSample; MDWSDescription description; diff --git a/Code/Mantid/Framework/MDEvents/test/MDWSTransfTest.h b/Code/Mantid/Framework/MDAlgorithms/test/MDWSTransfTest.h similarity index 95% rename from Code/Mantid/Framework/MDEvents/test/MDWSTransfTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/MDWSTransfTest.h index f449888ae5b7bff2473bfa0a6c9abf6db3cd1fb7..1c7c8b1e05897a4f563a5f9c6f5297eed65ab308 100644 --- a/Code/Mantid/Framework/MDEvents/test/MDWSTransfTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/MDWSTransfTest.h @@ -1,26 +1,27 @@ #ifndef MANTID_MDWS_SLICE_H_ #define MANTID_MDWS_SLICE_H_ -#include <cxxtest/TestSuite.h> -#include "MantidMDEvents/MDTransfAxisNames.h" -#include "MantidMDEvents/MDWSDescription.h" -#include "MantidMDEvents/MDWSTransform.h" -#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidGeometry/Crystal/OrientedLattice.h" +#include "MantidMDAlgorithms/MDTransfAxisNames.h" +#include "MantidMDAlgorithms/MDWSDescription.h" +#include "MantidMDAlgorithms/MDWSTransform.h" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" + +#include <cxxtest/TestSuite.h> using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::MDAlgorithms; using namespace Mantid::Kernel; class MDWSTransformTestHelper: public MDWSTransform { public: - std::vector<double> getTransfMatrix(MDEvents::MDWSDescription &TargWSDescription,CnvrtToMD::TargetFrame frames,CnvrtToMD::CoordScaling scaling)const + std::vector<double> getTransfMatrix(MDWSDescription &TargWSDescription,CnvrtToMD::TargetFrame frames,CnvrtToMD::CoordScaling scaling)const { CnvrtToMD::CoordScaling inScaling(scaling); return MDWSTransform::getTransfMatrix(TargWSDescription,frames,inScaling); } - CnvrtToMD::TargetFrame findTargetFrame(MDEvents::MDWSDescription &TargWSDescription)const + CnvrtToMD::TargetFrame findTargetFrame(MDWSDescription &TargWSDescription)const { return MDWSTransform::findTargetFrame(TargWSDescription); } @@ -49,7 +50,7 @@ public: void testFindTargetFrame() { - MDEvents::MDWSDescription TargWSDescription; + MDWSDescription TargWSDescription; Mantid::API::MatrixWorkspace_sptr spws =WorkspaceCreationHelper::Create2DWorkspaceBinned(10,10); //Mantid::API::MatrixWorkspace_sptr spws =WorkspaceCreationHelper::createProcessedWorkspaceWithCylComplexInstrument(4,10,true); std::vector<double> minVal(4,-3),maxVal(4,3); @@ -71,7 +72,7 @@ void testFindTargetFrame() } void testForceTargetFrame() { - MDEvents::MDWSDescription TargWSDescription; + MDWSDescription TargWSDescription; Mantid::API::MatrixWorkspace_sptr spws =WorkspaceCreationHelper::Create2DWorkspaceBinned(10,10); std::vector<double> minVal(4,-3),maxVal(4,3); @@ -99,7 +100,7 @@ void testForceTargetFrame() void test_buildDimNames(){ - MDEvents::MDWSDescription TargWSDescription; + MDWSDescription TargWSDescription; std::vector<double> minVal(4,-3),maxVal(4,3); TargWSDescription.setMinMax(minVal,maxVal); @@ -132,7 +133,7 @@ void testCoplanarProjections() void testTransfMat1() { std::vector<std::string> dimNames; - MDEvents::MDWSDescription TWS; + MDWSDescription TWS; std::vector<double> minVal(4,-3),maxVal(4,3); TWS.setMinMax(minVal,maxVal); @@ -200,7 +201,7 @@ void testTransfMat1() void testTransf2HoraceQinA() { - MDEvents::MDWSDescription TWS; + MDWSDescription TWS; std::vector<double> minVal(4,-3),maxVal(4,3); TWS.setMinMax(minVal,maxVal); Geometry::OrientedLattice latt(5*M_PI,M_PI,2*M_PI, 90., 90., 90.); @@ -293,7 +294,7 @@ void testTransf2HoraceQinA() } void testTransf2HKL() { - MDEvents::MDWSDescription TWS; + MDWSDescription TWS; std::vector<double> minVal(4,-3),maxVal(4,3); TWS.setMinMax(minVal,maxVal); @@ -332,7 +333,7 @@ void testTransf2HKL() void testModQAnyLattice() { - MDEvents::MDWSDescription TWS; + MDWSDescription TWS; std::vector<double> rot,sample(9,0); Mantid::API::MatrixWorkspace_sptr spws =WorkspaceCreationHelper::Create2DWorkspaceBinned(10,10); diff --git a/Code/Mantid/Framework/MDAlgorithms/test/MaskMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/MaskMDTest.h index 77ad167dcf8f48c8549a749497f7a903866fffe7..2199abc9269f4a5d81833479e4e63330c190b203 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/MaskMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/MaskMDTest.h @@ -1,20 +1,14 @@ #ifndef MANTID_MDALGORITHMS_MASKMDTEST_H_ #define MANTID_MDALGORITHMS_MASKMDTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" +#include "MantidMDAlgorithms/MaskMD.h" #include "MantidTestHelpers/MDEventsTestHelper.h" -#include <iostream> -#include <iomanip> -#include "MantidMDAlgorithms/MaskMD.h" +#include <cxxtest/TestSuite.h> -using namespace Mantid; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using namespace Mantid::MDEvents; -using namespace Mantid::MDEvents::MDEventsTestHelper; +using namespace Mantid::DataObjects; +using namespace Mantid::MDAlgorithms; class MaskMDTest : public CxxTest::TestSuite { @@ -23,7 +17,7 @@ private: void do_exec(const std::string& dimensionString, const std::string& extentsString, size_t expectedNMasked) { std::string wsName = "test_workspace"; - makeAnyMDEW<MDEvent<3>, 3>(10, 0, 10, 1, wsName); + MDEventsTestHelper::makeAnyMDEW<MDEvent<3>, 3>(10, 0, 10, 1, wsName); MaskMD alg; TS_ASSERT_THROWS_NOTHING( alg.initialize() ) @@ -91,7 +85,7 @@ public: void test_throw_if_dimension_cardinality_wrong() { std::string wsName = "test_workspace"; - makeAnyMDEW<MDEvent<3>, 3>(10, 0, 10, 1, wsName); + MDEventsTestHelper::makeAnyMDEW<MDEvent<3>, 3>(10, 0, 10, 1, wsName); MaskMD alg; alg.initialize(); @@ -105,7 +99,7 @@ public: void test_throw_if_extent_cardinality_wrong() { std::string wsName = "test_workspace"; - makeAnyMDEW<MDEvent<3>, 3>(10, 0, 10, 1, wsName); + MDEventsTestHelper::makeAnyMDEW<MDEvent<3>, 3>(10, 0, 10, 1, wsName); MaskMD alg; alg.setRethrows(true); @@ -119,7 +113,7 @@ public: void test_throw_if_min_greater_than_max_anywhere() { std::string wsName = "test_workspace"; - makeAnyMDEW<MDEvent<3>, 3>(10, 0, 10, 1, wsName); + MDEventsTestHelper::makeAnyMDEW<MDEvent<3>, 3>(10, 0, 10, 1, wsName); MaskMD alg; alg.setRethrows(true); @@ -133,7 +127,7 @@ public: void test_fall_back_to_dimension_names() { std::string wsName = "test_workspace"; - makeAnyMDEW<MDEvent<3>, 3>(10, 0, 10, 1, wsName, "AxisName%d"); //Dimension names = AxisName%d, default dimension ids are AxisId%d + MDEventsTestHelper::makeAnyMDEW<MDEvent<3>, 3>(10, 0, 10, 1, wsName, "AxisName%d"); //Dimension names = AxisName%d, default dimension ids are AxisId%d MaskMD alg; alg.setRethrows(true); @@ -147,7 +141,7 @@ public: void test_throws_if_unknown_dimension_names() { std::string wsName = "test_workspace"; - makeAnyMDEW<MDEvent<3>, 3>(10, 0, 10, 1, wsName); + MDEventsTestHelper::makeAnyMDEW<MDEvent<3>, 3>(10, 0, 10, 1, wsName); MaskMD alg; alg.setRethrows(true); @@ -191,4 +185,4 @@ public: }; -#endif /* MANTID_MDALGORITHMS_MASKMDTEST_H_ */ \ No newline at end of file +#endif /* MANTID_MDALGORITHMS_MASKMDTEST_H_ */ diff --git a/Code/Mantid/Framework/MDAlgorithms/test/MergeMDFilesTest.h b/Code/Mantid/Framework/MDAlgorithms/test/MergeMDFilesTest.h index e4e4d932672d69ada816168c75b9cfe0d5a8c5d8..ceb68d7a26aeada365961d329a8adb10426a99bb 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/MergeMDFilesTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/MergeMDFilesTest.h @@ -1,21 +1,17 @@ #ifndef MANTID_MDEVENTS_MERGEMDEWTEST_H_ #define MANTID_MDEVENTS_MERGEMDEWTEST_H_ +#include "MantidMDAlgorithms/MergeMDFiles.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidTestHelpers/MDAlgorithmsTestHelper.h" + #include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> -#include "MantidMDAlgorithms/MergeMDFiles.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidTestHelpers/MDEventsTestHelper.h" #include <Poco/File.h> -using namespace Mantid; -using namespace Mantid::MDEvents; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; +using namespace Mantid::DataObjects; +using namespace Mantid::MDAlgorithms; class MergeMDFilesTest : public CxxTest::TestSuite { @@ -57,8 +53,7 @@ public: std::ostringstream mess; mess << "MergeMDFilesTestInput" << i; MDEventWorkspace3Lean::sptr ws = - MDEventsTestHelper::makeFileBackedMDEW(mess.str(), true,-nFileEvents, appliedCoord); - + MDAlgorithmsTestHelper::makeFileBackedMDEW(mess.str(), true,-nFileEvents,appliedCoord); inWorkspaces.push_back(ws); filenames.push_back(std::vector<std::string>(1,ws->getBoxController()->getFilename())); } diff --git a/Code/Mantid/Framework/MDAlgorithms/test/MergeMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/MergeMDTest.h index d201794efe1720eb41262376a2504b666d261d3f..0708bd34b040e9eebeb9c800bcb0e22bd6d1fd9c 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/MergeMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/MergeMDTest.h @@ -1,23 +1,22 @@ #ifndef MANTID_MDALGORITHMS_MERGEMDTEST_H_ #define MANTID_MDALGORITHMS_MERGEMDTEST_H_ -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" #include "MantidMDAlgorithms/MergeMD.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidGeometry/MDGeometry/IMDDimension.h" #include "MantidTestHelpers/MDEventsTestHelper.h" + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> + #include <Poco/File.h> -#include "MantidGeometry/MDGeometry/IMDDimension.h" using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; using namespace Mantid::MDAlgorithms; -using namespace Mantid::API; -using Mantid::MDEvents::MDEventsTestHelper::makeAnyMDEW; + +using Mantid::DataObjects::MDEventsTestHelper::makeAnyMDEW; class MergeMDTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDAlgorithms/test/MinusMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/MinusMDTest.h index f1b2d91360713616c7f075bb0b5e2f00175104ea..5e814d34c592a0875e8a157dac57bac0f16c5358 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/MinusMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/MinusMDTest.h @@ -1,22 +1,18 @@ #ifndef MANTID_MDALGORITHMS_MINUSMDTEST_H_ #define MANTID_MDALGORITHMS_MINUSMDTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> - +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidMDAlgorithms/MinusMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidMDEvents/MDHistoWorkspace.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidTestHelpers/MDAlgorithmsTestHelper.h" #include "MantidTestHelpers/MDEventsTestHelper.h" -using namespace Mantid; -using namespace Mantid::MDEvents; -using namespace Mantid::MDAlgorithms; +#include <cxxtest/TestSuite.h> + using namespace Mantid::API; +using namespace Mantid::DataObjects; +using namespace Mantid::MDAlgorithms; class MinusMDTest : public CxxTest::TestSuite { @@ -50,8 +46,8 @@ public: { AnalysisDataService::Instance().clear(); // Make two input workspaces - MDEventWorkspace3Lean::sptr lhs = MDEventsTestHelper::makeFileBackedMDEW("MinusMDTest_lhs", lhs_file); - MDEventWorkspace3Lean::sptr rhs = MDEventsTestHelper::makeFileBackedMDEW("MinusMDTest_rhs", rhs_file); + MDEventWorkspace3Lean::sptr lhs = MDAlgorithmsTestHelper::makeFileBackedMDEW("MinusMDTest_lhs", lhs_file); + MDEventWorkspace3Lean::sptr rhs = MDAlgorithmsTestHelper::makeFileBackedMDEW("MinusMDTest_rhs", rhs_file); std::string outWSName = "MinusMDTest_out"; if (inPlace == 1) outWSName = "MinusMDTest_lhs"; diff --git a/Code/Mantid/Framework/MDAlgorithms/test/MultiplyMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/MultiplyMDTest.h index 4d224332ea08d6a58b860d28f19c08be18a89807..5cf194ee00c58b2bcb890d9bd73c06c4756b2d88 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/MultiplyMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/MultiplyMDTest.h @@ -1,20 +1,18 @@ #ifndef MANTID_MDALGORITHMS_MULTIPLYMDTEST_H_ #define MANTID_MDALGORITHMS_MULTIPLYMDTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> - +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidMDAlgorithms/MultiplyMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidMDEvents/MDHistoWorkspace.h" -using namespace Mantid; -using namespace Mantid::MDAlgorithms; +#include <cxxtest/TestSuite.h> + using namespace Mantid::API; -using Mantid::MDEvents::MDHistoWorkspace_sptr; +using namespace Mantid::MDAlgorithms; +using Mantid::DataObjects::MDHistoWorkspace_sptr; + +using Mantid::coord_t; +using Mantid::signal_t; /** Note: More detailed tests for the underlying * operations are in BinaryOperationMDTest and diff --git a/Code/Mantid/Framework/MDAlgorithms/test/NotMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/NotMDTest.h index e4ea5e62514fdae84c7c9a152853b2322c118a79..7dad3b3e6a36de2b1e679a6847e85be514f72736 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/NotMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/NotMDTest.h @@ -1,20 +1,16 @@ #ifndef MANTID_MDALGORITHMS_NOTMDTEST_H_ #define MANTID_MDALGORITHMS_NOTMDTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> - #include "MantidMDAlgorithms/NotMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" + +#include <cxxtest/TestSuite.h> using namespace Mantid; using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using Mantid::MDEvents::MDHistoWorkspace_sptr; +using Mantid::DataObjects::MDHistoWorkspace_sptr; class NotMDTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDEvents/test/OneStepMDEWTest.h b/Code/Mantid/Framework/MDAlgorithms/test/OneStepMDEWTest.h similarity index 75% rename from Code/Mantid/Framework/MDEvents/test/OneStepMDEWTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/OneStepMDEWTest.h index 6f9c971be39ad357a07e140c14be63fd6b9c0686..7028b3b29d381ec74d50926a731455f0079e9568 100644 --- a/Code/Mantid/Framework/MDEvents/test/OneStepMDEWTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/OneStepMDEWTest.h @@ -2,18 +2,13 @@ #define MANTID_MDEVENTS_ONESTEPMDEWTEST_H_ #include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> -#include "MantidMDEvents/OneStepMDEW.h" -#include "MantidMDEvents/MDEventWorkspace.h" #include "MantidAPI/IMDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidMDAlgorithms/OneStepMDEW.h" -using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::MDAlgorithms; class OneStepMDEWTest : public CxxTest::TestSuite { @@ -29,8 +24,6 @@ public: void test_exec() { - ConfigService::Instance().setString("default.facility", "SNS"); - OneStepMDEW alg; TS_ASSERT_THROWS_NOTHING( alg.initialize() ) TS_ASSERT( alg.isInitialized() ) diff --git a/Code/Mantid/Framework/MDAlgorithms/test/OrMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/OrMDTest.h index bb1427ea3f87ede4349841b5c4d68ada9ef97e5f..7b005f4287419dda618d00319687a9cea070583f 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/OrMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/OrMDTest.h @@ -1,20 +1,16 @@ #ifndef MANTID_MDALGORITHMS_ORMDTEST_H_ #define MANTID_MDALGORITHMS_ORMDTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> - +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidMDAlgorithms/OrMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidMDEvents/MDHistoWorkspace.h" + +#include <cxxtest/TestSuite.h> using namespace Mantid; using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using Mantid::MDEvents::MDHistoWorkspace_sptr; +using Mantid::DataObjects::MDHistoWorkspace_sptr; class OrMDTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDAlgorithms/test/PlusMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/PlusMDTest.h index a22f07be8da8b4f4a39a4e3db45772e132cd5095..992059a8bedc856c7350ae146ccb0cc90e95a7cc 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/PlusMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/PlusMDTest.h @@ -1,24 +1,19 @@ #ifndef MANTID_MDEVENTS_PLUSMDEWTEST_H_ #define MANTID_MDEVENTS_PLUSMDEWTEST_H_ -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidAPI/AnalysisDataService.h" +#include "MantidAPI/FrameworkManager.h" +#include "MantidDataObjects/BoxControllerNeXusIO.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidMDAlgorithms/PlusMD.h" -#include <nexus/NeXusFile.hpp> -#include "MantidTestHelpers/MDEventsTestHelper.h" -#include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> -#include <Poco/File.h> #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidAPI/FrameworkManager.h" -#include "MantidMDEvents/BoxControllerNeXusIO.h" +#include "MantidTestHelpers/MDAlgorithmsTestHelper.h" + +#include <Poco/File.h> -using namespace Mantid; -using namespace Mantid::MDEvents; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; +using namespace Mantid::DataObjects; +using namespace Mantid::MDAlgorithms; class PlusMDTest : public CxxTest::TestSuite { @@ -28,16 +23,16 @@ public: void test_Init() { PlusMD alg; - TS_ASSERT_THROWS_NOTHING( alg.initialize() ) - TS_ASSERT( alg.isInitialized() ) + TS_ASSERT_THROWS_NOTHING( alg.initialize() ); + TS_ASSERT( alg.isInitialized() ); } void do_test(bool lhs_file, bool rhs_file, int inPlace, bool deleteFile=true) { AnalysisDataService::Instance().clear(); // Make two input workspaces - MDEventWorkspace3Lean::sptr lhs = MDEventsTestHelper::makeFileBackedMDEW("PlusMDTest_lhs", lhs_file); - MDEventWorkspace3Lean::sptr rhs = MDEventsTestHelper::makeFileBackedMDEW("PlusMDTest_rhs", rhs_file); + MDEventWorkspace3Lean::sptr lhs = MDAlgorithmsTestHelper::makeFileBackedMDEW("PlusMDTest_lhs", lhs_file); + MDEventWorkspace3Lean::sptr rhs = MDAlgorithmsTestHelper::makeFileBackedMDEW("PlusMDTest_rhs", rhs_file); std::string outWSName = "PlusMDTest_out"; if (inPlace == 1) outWSName = "PlusMDTest_lhs"; @@ -81,7 +76,7 @@ public: Mantid::API::BoxController_sptr bc = ws->getBoxController(); std::cout << bc->getFileIO()->getFreeSpaceMap().size() << " entries in the free space map" << std::endl; - auto loader = dynamic_cast<MDEvents::BoxControllerNeXusIO *>( bc->getFileIO()); + auto loader = dynamic_cast<BoxControllerNeXusIO *>( bc->getFileIO()); TS_ASSERT(loader); if(!loader)return; std::vector<uint64_t> freeSpaceMap; diff --git a/Code/Mantid/Framework/MDAlgorithms/test/PowerMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/PowerMDTest.h index 86cdbbab9e37ea56bda38cc649a5f63819075707..30b59033ac767efa735ed06da559910c334e6f3e 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/PowerMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/PowerMDTest.h @@ -9,12 +9,12 @@ #include "MantidMDAlgorithms/PowerMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" using namespace Mantid; using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using Mantid::MDEvents::MDHistoWorkspace_sptr; +using Mantid::DataObjects::MDHistoWorkspace_sptr; class PowerMDTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDEvents/test/QueryMDWorkspaceTest.h b/Code/Mantid/Framework/MDAlgorithms/test/QueryMDWorkspaceTest.h similarity index 97% rename from Code/Mantid/Framework/MDEvents/test/QueryMDWorkspaceTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/QueryMDWorkspaceTest.h index e512e94cc596399c51c67a3af22f320cb409be36..e2e8992c482d67d477fb87b07c1b3de4db7f22ec 100644 --- a/Code/Mantid/Framework/MDEvents/test/QueryMDWorkspaceTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/QueryMDWorkspaceTest.h @@ -1,23 +1,18 @@ #ifndef MANTID_MDEVENTS_QUERYMDWORKSPACETEST_H_ #define MANTID_MDEVENTS_QUERYMDWORKSPACETEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> -#include <boost/shared_ptr.hpp> -#include "MantidTestHelpers/MDEventsTestHelper.h" -#include "MantidMDEvents/QueryMDWorkspace.h" +#include "MantidAPI/AlgorithmManager.h" +#include "MantidAPI/FrameworkManager.h" #include "MantidAPI/ITableWorkspace.h" +#include "MantidMDAlgorithms/QueryMDWorkspace.h" +#include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidDataObjects/TableWorkspace.h" -#include "MantidAPI/FrameworkManager.h" -#include "MantidAPI/AlgorithmManager.h" -using namespace Mantid; -using namespace Mantid::MDEvents; +#include <cxxtest/TestSuite.h> + using namespace Mantid::API; using namespace Mantid::DataObjects; +using namespace Mantid::MDAlgorithms; class QueryMDWorkspaceTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformKiKfTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ReflectometryTransformKiKfTest.h similarity index 94% rename from Code/Mantid/Framework/MDEvents/test/ReflectometryTransformKiKfTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/ReflectometryTransformKiKfTest.h index 0623b8459d0dbff806f4d9a1e1d653adf0c8d785..55a9a02bc881dc451152188c97d21c8c01192e25 100644 --- a/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformKiKfTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ReflectometryTransformKiKfTest.h @@ -1,18 +1,13 @@ #ifndef MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMKIKFTEST_H_ #define MANTID_MDEVENTS_REFLECTOMETRYTRANSFORMKIKFTEST_H_ +#include "MantidMDAlgorithms/ReflectometryTransformKiKf.h" + #include <cxxtest/TestSuite.h> #include <cmath> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> - -#include "MantidMDEvents/ReflectometryTransformKiKf.h" - -using namespace Mantid::MDEvents; using namespace Mantid::API; +using namespace Mantid::MDAlgorithms; class ReflectometryTransformKiKfTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformPTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h similarity index 97% rename from Code/Mantid/Framework/MDEvents/test/ReflectometryTransformPTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h index 16869709c7c40310b3260692f88085d0bde2bb81..5d030ed664e22788134f238293c08c7972bfc32c 100644 --- a/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformPTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h @@ -7,10 +7,9 @@ #include "MantidKernel/System.h" #include <iostream> #include <iomanip> -#include "MantidMDEvents/ReflectometryTransformP.h" +#include "MantidMDAlgorithms/ReflectometryTransformP.h" -using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::MDAlgorithms; using namespace Mantid::API; class ReflectometryTransformPTest : public CxxTest::TestSuite diff --git a/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformQxQzTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ReflectometryTransformQxQzTest.h similarity index 96% rename from Code/Mantid/Framework/MDEvents/test/ReflectometryTransformQxQzTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/ReflectometryTransformQxQzTest.h index 7447313ccaed0a2261267b02e9fdfa377dcef0f5..2815fa4ab28ab693e1bdc986a4d0c8efeb739b75 100644 --- a/Code/Mantid/Framework/MDEvents/test/ReflectometryTransformQxQzTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ReflectometryTransformQxQzTest.h @@ -1,18 +1,15 @@ #ifndef MANTID_MDEVENTS_REFLECTOMETRYTRANFORMQXQZTEST_H_ #define MANTID_MDEVENTS_REFLECTOMETRYTRANFORMQXQZTEST_H_ -#include <cxxtest/TestSuite.h> -#include <cmath> -#include "MantidKernel/Timer.h" #include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> +#include "MantidMDAlgorithms/ReflectometryTransformQxQz.h" -#include "MantidMDEvents/ReflectometryTransformQxQz.h" +#include <cxxtest/TestSuite.h> + +#include <cmath> -using namespace Mantid; -using namespace Mantid::MDEvents; using namespace Mantid::API; +using namespace Mantid::MDAlgorithms; class ReflectometryTransformQxQzTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDAlgorithms/test/ResolutionConvolvedCrossSectionTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ResolutionConvolvedCrossSectionTest.h index 0ca38ff54ea36708cc98f5b682183cea0c945812..1d8be84fc1b51bb34b1decea6cd05229b79fdba6 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/ResolutionConvolvedCrossSectionTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ResolutionConvolvedCrossSectionTest.h @@ -1,20 +1,20 @@ #ifndef RESOLUTIONCONVOLVEDCROSSSECTIONTEST_H_ #define RESOLUTIONCONVOLVEDCROSSSECTIONTEST_H_ -#include "MantidMDAlgorithms/Quantification/ResolutionConvolvedCrossSection.h" -#include "MantidMDAlgorithms/Quantification/MDResolutionConvolution.h" -#include "MantidMDAlgorithms/Quantification/MDResolutionConvolutionFactory.h" -#include "MantidMDAlgorithms/Quantification/ForegroundModel.h" -#include "MantidMDAlgorithms/Quantification/ForegroundModelFactory.h" -#include "MDFittingTestHelpers.h" - #include "MantidAPI/FunctionDomainMD.h" #include "MantidAPI/FunctionValues.h" +#include "MantidMDAlgorithms/Quantification/ForegroundModel.h" +#include "MantidMDAlgorithms/Quantification/ForegroundModelFactory.h" +#include "MantidMDAlgorithms/Quantification/MDResolutionConvolution.h" +#include "MantidMDAlgorithms/Quantification/MDResolutionConvolutionFactory.h" +#include "MantidMDAlgorithms/Quantification/ResolutionConvolvedCrossSection.h" #include "MantidTestHelpers/MDEventsTestHelper.h" +#include "MDFittingTestHelpers.h" + #include <cxxtest/TestSuite.h> -#include <gmock/gmock.h> +#include <gmock/gmock.h> class ResolutionConvolvedCrossSectionTest : public CxxTest::TestSuite { @@ -132,7 +132,7 @@ private: */ Mantid::API::IMDWorkspace_sptr createTestMDWorkspace() { - using namespace Mantid::MDEvents; + using namespace Mantid::DataObjects; // 4 dims, 3 boxes and 1 event per box = 81 events boost::shared_ptr<MDEventWorkspace<MDEvent<4>,4> > testWS = diff --git a/Code/Mantid/Framework/MDEvents/test/SaveIsawQvectorTest.h b/Code/Mantid/Framework/MDAlgorithms/test/SaveIsawQvectorTest.h similarity index 89% rename from Code/Mantid/Framework/MDEvents/test/SaveIsawQvectorTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/SaveIsawQvectorTest.h index a2281c58d89052f90fa779c1373b3c35e19d9a3a..b59c0a1c41724aba76919834548cc2e58d8915d8 100644 --- a/Code/Mantid/Framework/MDEvents/test/SaveIsawQvectorTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/SaveIsawQvectorTest.h @@ -1,15 +1,16 @@ #ifndef MANTID_MDEVENTS_SAVEISAWQVECTORTEST_H_ #define MANTID_MDEVENTS_SAVEISAWQVECTORTEST_H_ -#include <cxxtest/TestSuite.h> -#include <Poco/File.h> #include "MantidAPI/AnalysisDataService.h" #include "MantidDataObjects/EventWorkspace.h" -#include "MantidMDEvents/SaveIsawQvector.h" +#include "MantidMDAlgorithms/SaveIsawQvector.h" #include "MantidTestHelpers/MDEventsTestHelper.h" +#include <cxxtest/TestSuite.h> +#include <Poco/File.h> + using Mantid::API::AnalysisDataService; -using Mantid::MDEvents::SaveIsawQvector; +using Mantid::MDAlgorithms::SaveIsawQvector; class SaveIsawQvectorTest : public CxxTest::TestSuite { @@ -35,7 +36,7 @@ public: // create the test workspace int numEventsPer = 100; - Mantid::DataObjects::EventWorkspace_sptr inputW = Mantid::MDEvents::MDEventsTestHelper::createDiffractionEventWorkspace(numEventsPer); + Mantid::DataObjects::EventWorkspace_sptr inputW = Mantid::DataObjects::MDEventsTestHelper::createDiffractionEventWorkspace(numEventsPer); AnalysisDataService::Instance().addOrReplace(inWSName, inputW); size_t nevents = inputW->getNumberEvents(); diff --git a/Code/Mantid/Framework/MDAlgorithms/test/SaveMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/SaveMDTest.h index d7461367b6de6e3382ce6fb36fc86d61a0ebdc1d..b107e968efcf4750f68a95a89c8c8e55e7e42155 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/SaveMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/SaveMDTest.h @@ -1,26 +1,20 @@ #ifndef MANTID_MDEVENTS_SAVEMDEWTEST_H_ #define MANTID_MDEVENTS_SAVEMDEWTEST_H_ -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidAPI/IMDEventWorkspace.h" +#include "MantidAPI/FrameworkManager.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidMDAlgorithms/BinMD.h" #include "MantidMDAlgorithms/SaveMD.h" #include "MantidTestHelpers/MDEventsTestHelper.h" -#include "MantidAPI/FrameworkManager.h" -#include "MantidAPI/IMDEventWorkspace.h" #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> -#include "MantidKernel/CPUTimer.h" -#include <Poco/File.h> +#include <Poco/File.h> -using namespace Mantid::MDEvents; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using Mantid::Kernel::CPUTimer; +using namespace Mantid::DataObjects; +using namespace Mantid::MDAlgorithms; class SaveMDTester: public SaveMD { @@ -85,8 +79,6 @@ public: IMDEventWorkspace_sptr iws = ws; - CPUTimer tim; - SaveMD alg; TS_ASSERT_THROWS_NOTHING( alg.initialize() ) TS_ASSERT( alg.isInitialized() ) @@ -102,8 +94,6 @@ public: alg.execute(); TS_ASSERT( alg.isExecuted() ); - std::cout << tim << " to save " << ws->getBoxController()->getMaxId() << " boxes." << std::endl; - std::string this_filename = alg.getProperty("Filename"); TSM_ASSERT( "File was indeed created", Poco::File(this_filename).exists()); @@ -193,8 +183,6 @@ public: IMDEventWorkspace_sptr iws = ws; - CPUTimer tim; - SaveMD alg; TS_ASSERT_THROWS_NOTHING( alg.initialize() ) TS_ASSERT( alg.isInitialized() ) @@ -268,8 +256,6 @@ public: doTestHisto(ws); } - - }; @@ -280,8 +266,6 @@ public: MDEventWorkspace3Lean::sptr ws; void setUp() { - CPUTimer tim; - // Make a 1D MDEventWorkspace ws = MDEventsTestHelper::makeMDEW<3>(10, 0.0, 10.0, 0); ws->getBoxController()->setSplitInto(5); @@ -292,19 +276,11 @@ public: FrameworkManager::Instance().exec("FakeMDEventData", 4, "InputWorkspace", "SaveMDTestPerformance_ws", "UniformParams", "10000000"); - std::cout << tim << " to fake the data." << std::endl; ws->refreshCache(); - std::cout << tim << " to refresh cache." << std::endl; - -// // There are this many boxes, so this is the max ID. -// TS_ASSERT_EQUALS( ws->getBoxController()->getMaxId(), 11111); - } void test_exec_3D() { - CPUTimer tim; - SaveMD alg; TS_ASSERT_THROWS_NOTHING( alg.initialize() ) TS_ASSERT( alg.isInitialized() ) @@ -312,8 +288,6 @@ public: TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("Filename", "SaveMDTestPerformance.nxs") ); alg.execute(); TS_ASSERT( alg.isExecuted() ); - - std::cout << tim << " to save " << ws->getBoxController()->getMaxId() << " boxes with " << double(ws->getNPoints())/1e6 << " million events." << std::endl; } diff --git a/Code/Mantid/Framework/MDAlgorithms/test/SaveZODSTest.h b/Code/Mantid/Framework/MDAlgorithms/test/SaveZODSTest.h index 360f965445745c1f83775d8ce6052d56904dcfc5..80bb0dc092aee39f262990dd059abcfe4f573b79 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/SaveZODSTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/SaveZODSTest.h @@ -1,20 +1,18 @@ #ifndef MANTID_MDALGORITHMS_SAVEZODSTEST_H_ #define MANTID_MDALGORITHMS_SAVEZODSTEST_H_ +#include "MantidMDAlgorithms/SaveZODS.h" +#include "MantidTestHelpers/MDEventsTestHelper.h" + #include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> -#include "MantidMDAlgorithms/SaveZODS.h" #include <Poco/File.h> -#include "MantidTestHelpers/MDEventsTestHelper.h" -using namespace Mantid; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; +using namespace Mantid::MDAlgorithms; + +using Mantid::coord_t; class SaveZODSTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDAlgorithms/test/SetMDUsingMaskTest.h b/Code/Mantid/Framework/MDAlgorithms/test/SetMDUsingMaskTest.h index 1be83d0d1e30b2b005206e5eb12b268bb1e8661c..7550cb32cb918016f09e95578b623aedff21657e 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/SetMDUsingMaskTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/SetMDUsingMaskTest.h @@ -3,19 +3,15 @@ #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/IMDHistoWorkspace.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidMDAlgorithms/SetMDUsingMask.h" -#include "MantidMDEvents/MDHistoWorkspace.h" #include "MantidTestHelpers/MDEventsTestHelper.h" + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> -using namespace Mantid; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; +using namespace Mantid::MDAlgorithms; class SetMDUsingMaskTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDAlgorithms/test/SliceMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/SliceMDTest.h index a02607812cd8f5fb7ff57d99bd67a527f2747267..686d1d946cca71cc33101472628ad5e434b4e526 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/SliceMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/SliceMDTest.h @@ -1,24 +1,19 @@ #ifndef MANTID_MDEVENTS_SLICEMDTEST_H_ #define MANTID_MDEVENTS_SLICEMDTEST_H_ -#include "MantidKernel/Strings.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidKernel/VMD.h" -#include "MantidMDEvents/CoordTransformAffine.h" +#include "MantidAPI/FrameworkManager.h" #include "MantidMDAlgorithms/SliceMD.h" +#include "MantidDataObjects/CoordTransformAffine.h" #include "MantidTestHelpers/MDEventsTestHelper.h" -#include "MantidAPI/FrameworkManager.h" + #include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> -#include <Poco/File.h> -using namespace Mantid; -using namespace Mantid::MDEvents; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Kernel; +using namespace Mantid::MDAlgorithms; + +using Mantid::coord_t; class SliceMDTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h b/Code/Mantid/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h index 6224fc2f9b7183bdff326dde4bdde6f8eb5cf0c5..0488069da4e8d809a4f173d40551619ac33dc625 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h @@ -1,25 +1,23 @@ #ifndef MANTID_MDEVENTS_SLICINGALGORITHMTEST_H_ #define MANTID_MDEVENTS_SLICINGALGORITHMTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> - -#include "MantidMDAlgorithms/SlicingAlgorithm.h" -#include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidKernel/VMD.h" #include "MantidGeometry/MDGeometry/IMDDimension.h" #include "MantidGeometry/MDGeometry/MDImplicitFunction.h" +#include "MantidMDAlgorithms/SlicingAlgorithm.h" +#include "MantidTestHelpers/MDEventsTestHelper.h" + +#include <cxxtest/TestSuite.h> + +#include <iomanip> -using namespace Mantid; -using namespace Mantid::MDEvents; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using namespace Mantid::Kernel; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; +using namespace Mantid::Kernel; +using namespace Mantid::MDAlgorithms; +using Mantid::coord_t; //------------------------------------------------------------------------------------------------ /** Concrete declaration of SlicingAlgorithm for testing */ @@ -28,8 +26,8 @@ class SlicingAlgorithmImpl : public SlicingAlgorithm // Make all the members public so I can test them. friend class SlicingAlgorithmTest; public: - virtual const std::string name() const { return "SlicingAlgorithmImpl";}; - virtual int version() const { return 1;}; + virtual const std::string name() const { return "SlicingAlgorithmImpl";} + virtual int version() const { return 1;} virtual const std::string category() const { return "Testing";} virtual const std::string summary() const { return "Summary of this test."; } void init() {} diff --git a/Code/Mantid/Framework/MDAlgorithms/test/ThresholdMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ThresholdMDTest.h index 5dc515e6b5a770f83356c5682ae42f5a3a6b30fc..a4ec7ee9c939239f74c571dec11cfb09958c109f 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/ThresholdMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ThresholdMDTest.h @@ -1,18 +1,20 @@ #ifndef MANTID_MDALGORITHMS_THRESHOLDMDTEST_H_ #define MANTID_MDALGORITHMS_THRESHOLDMDTEST_H_ -#include <cxxtest/TestSuite.h> - -#include "MantidMDAlgorithms/ThresholdMD.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidGeometry/MDGeometry/MDHistoDimension.h" #include "MantidGeometry/MDGeometry/MDTypes.h" +#include "MantidMDAlgorithms/ThresholdMD.h" + +#include <cxxtest/TestSuite.h> -using namespace Mantid; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; -using Mantid::MDAlgorithms::ThresholdMD; +using namespace Mantid::MDAlgorithms; + +using Mantid::coord_t; +using Mantid::signal_t; class ThresholdMDTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDAlgorithms/test/TransformMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/TransformMDTest.h index af31ee935eb677ed6c69028e953baf5c83eb63f3..ef40db0d11226e93991a835951ed1ee0cc5e1c8e 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/TransformMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/TransformMDTest.h @@ -1,20 +1,18 @@ #ifndef MANTID_MDALGORITHMS_TRANSFORMMDTEST_H_ #define MANTID_MDALGORITHMS_TRANSFORMMDTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> - +#include "MantidDataObjects/MDEventFactory.h" #include "MantidMDAlgorithms/TransformMD.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidTestHelpers/MDAlgorithmsTestHelper.h" #include "MantidTestHelpers/MDEventsTestHelper.h" +#include <cxxtest/TestSuite.h> + using namespace Mantid; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; +using namespace Mantid::MDAlgorithms; + class TransformMDTest : public CxxTest::TestSuite { @@ -51,7 +49,7 @@ public: if (inPlace) outWSName = inWSName; // Make a fake file-backed (or not) MDEW - MDEventWorkspace3Lean::sptr ws1 = MDEventsTestHelper::makeFileBackedMDEW(inWSName, fileBacked); + MDEventWorkspace3Lean::sptr ws1 = MDAlgorithmsTestHelper::makeFileBackedMDEW(inWSName, fileBacked); TransformMD alg; TS_ASSERT_THROWS_NOTHING( alg.initialize() ) diff --git a/Code/Mantid/Framework/MDAlgorithms/test/UnaryOperationMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/UnaryOperationMDTest.h index 432ee28937ef303e38e291a9e25f906f31b9bd0e..3413c8ada7dfb1302afc8d7bf7e2e7711c784dcf 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/UnaryOperationMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/UnaryOperationMDTest.h @@ -2,25 +2,22 @@ #define MANTID_MDALGORITHMS_UNARYOPERATIONMDTEST_H_ #include "MantidAPI/IMDEventWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidDataObjects/WorkspaceSingleValue.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" #include "MantidMDAlgorithms/UnaryOperationMD.h" #include "MantidMDAlgorithms/BinaryOperationMD.h" -#include "MantidMDEvents/MDHistoWorkspace.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" + #include <cxxtest/TestSuite.h> + #include <gmock/gmock.h> #include <gtest/gtest.h> -#include <iomanip> -#include <iostream> using namespace Mantid; -using namespace Mantid::MDAlgorithms; using namespace Mantid::API; using namespace Mantid::DataObjects; -using namespace Mantid::MDEvents; +using namespace Mantid::MDAlgorithms; using namespace testing; class MockUnaryOperationMD : public UnaryOperationMD @@ -28,7 +25,7 @@ class MockUnaryOperationMD : public UnaryOperationMD public: MOCK_METHOD1(execEvent, void(Mantid::API::IMDEventWorkspace_sptr)); MOCK_METHOD0(checkInputs, void()); - MOCK_METHOD1(execHisto, void(Mantid::MDEvents::MDHistoWorkspace_sptr)); + MOCK_METHOD1(execHisto, void(Mantid::DataObjects::MDHistoWorkspace_sptr)); void exec() { UnaryOperationMD::exec(); } }; diff --git a/Code/Mantid/Framework/MDEvents/test/UnitsConversionHelperTest.h b/Code/Mantid/Framework/MDAlgorithms/test/UnitsConversionHelperTest.h similarity index 89% rename from Code/Mantid/Framework/MDEvents/test/UnitsConversionHelperTest.h rename to Code/Mantid/Framework/MDAlgorithms/test/UnitsConversionHelperTest.h index 24bf81fb1035cddcfd4a95f2fecb7f037ea8ee85..3b5fadabd635abb38588919c6fbd34c7d327be6f 100644 --- a/Code/Mantid/Framework/MDEvents/test/UnitsConversionHelperTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/UnitsConversionHelperTest.h @@ -1,23 +1,22 @@ #ifndef CONVERT2_MDEVENTS_UNITS_CONVERSION_TEST_H_ #define CONVERT2_MDEVENTS_UNITS_CONVERSION_TEST_H_ -#include <cxxtest/TestSuite.h> -#include <cmath> #include "MantidAPI/FrameworkManager.h" -#include "MantidKernel/UnitFactory.h" - #include "MantidAPI/NumericAxis.h" +#include "MantidKernel/UnitFactory.h" +#include "MantidMDAlgorithms/MDWSDescription.h" +#include "MantidMDAlgorithms/UnitsConversionHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidAPI/Progress.h" -#include "MantidMDEvents/UnitsConversionHelper.h" -#include "MantidMDEvents/MDWSDescription.h" +#include <cxxtest/TestSuite.h> + +#include <cmath> -using namespace Mantid; using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; - +using namespace Mantid::Kernel; +using namespace Mantid::MDAlgorithms; class UnitsConversionHelperTest : public CxxTest::TestSuite { @@ -34,15 +33,15 @@ public: { double factor,power; - const Kernel::Unit_sptr pThisUnit=Kernel::UnitFactory::Instance().create("Wavelength"); + const auto pThisUnit = UnitFactory::Instance().create("Wavelength"); TS_ASSERT(!pThisUnit->quickConversion("MomentumTransfer",factor,power)); } void testTOFConversionRuns() { - Kernel::Unit_sptr pSourceWSUnit = Kernel::UnitFactory::Instance().create("Wavelength"); - Kernel::Unit_sptr pWSUnit = Kernel::UnitFactory::Instance().create("MomentumTransfer"); + auto pSourceWSUnit = UnitFactory::Instance().create("Wavelength"); + auto pWSUnit = UnitFactory::Instance().create("MomentumTransfer"); double delta; double L1(10),L2(10),TwoTheta(0.1),efix(10); int emode(0); @@ -73,7 +72,7 @@ public: // initialize peculiar conversion from ws units to DeltaE_inWavenumber TS_ASSERT_THROWS_NOTHING(Conv.initialize(WSD,"DeltaE_inWavenumber")); - const MantidVec& X = ws2D->readX(0); + const auto& X = ws2D->readX(0); size_t n_bins = X.size()-1; for(size_t i=0;i<n_bins;i++) { @@ -118,8 +117,8 @@ public: double t_4 = Conv.convertUnits(-100); double t_lim = Conv.convertUnits(-DBL_MAX); - const MantidVec& X = ws2D->readX(0); - MantidVec E_storage(X.size()); + const auto& X = ws2D->readX(0); + Mantid::MantidVec E_storage(X.size()); TS_ASSERT_THROWS_NOTHING(Conv.updateConversion(0)); size_t n_bins = X.size(); @@ -131,9 +130,9 @@ public: } // Let WS know that it is in TOF now (one column) - MantidVec& T = ws2D->dataX(0); + auto& T = ws2D->dataX(0); - NumericAxis *pAxis0 = new NumericAxis(n_bins-1); + auto *pAxis0 = new NumericAxis(n_bins-1); for(size_t i=0; i < n_bins-1; i++){ double Tm =0.5*(TOFS[i]+TOFS[i+1]); pAxis0->setValue(i,Tm); @@ -181,15 +180,15 @@ public: { // Modify input workspace to be elastic workspace - const MantidVec& X = ws2D->readX(0); - MantidVec E_storage(X.size()); + const auto& X = ws2D->readX(0); + Mantid::MantidVec E_storage(X.size()); size_t n_bins = X.size(); for(size_t i=0;i<n_bins;i++) { E_storage[i]=-0.1+0.1*static_cast<double>(i); } - NumericAxis *pAxis0 = new NumericAxis(n_bins-1); + auto *pAxis0 = new NumericAxis(n_bins-1); pAxis0->setUnit("Energy"); ws2D->replaceAxis(0,pAxis0); @@ -255,7 +254,7 @@ public: UnitsConversionHelperTest() { - API::FrameworkManager::Instance(); + FrameworkManager::Instance(); std::vector<double> L2(5,5); std::vector<double> polar(5,(30./180.)*M_PI); diff --git a/Code/Mantid/Framework/MDAlgorithms/test/WeightedMeanMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/WeightedMeanMDTest.h index 7ef1e56809f5023b23c988e7f13c1f7fef3a0b74..9f2b529037b13bc27a75cce7cd6cc79199e39fbb 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/WeightedMeanMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/WeightedMeanMDTest.h @@ -1,22 +1,18 @@ #ifndef MANTID_MDALGORITHMS_WEIGHTEDMEANMDTEST_H_ #define MANTID_MDALGORITHMS_WEIGHTEDMEANMDTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <cmath> -#include <iostream> -#include <iomanip> -#include "MantidTestHelpers/MDEventsTestHelper.h" -#include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidMDEvents/MDHistoWorkspace.h" -#include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/FrameworkManager.h" +#include "MantidAPI/MatrixWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidMDAlgorithms/WeightedMeanMD.h" +#include "MantidTestHelpers/BinaryOperationMDTestHelper.h" +#include "MantidTestHelpers/MDEventsTestHelper.h" + +#include <cxxtest/TestSuite.h> -using namespace Mantid::MDAlgorithms; -using namespace Mantid::MDEvents; using namespace Mantid::API; +using namespace Mantid::DataObjects; +using namespace Mantid::MDAlgorithms; class WeightedMeanMDTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDAlgorithms/test/XorMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/XorMDTest.h index a0dd0c6ccb12e161b179af5c4799044c813c91bb..cf19e29782b7310ac8db90ebf0bdbe91fb176385 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/XorMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/XorMDTest.h @@ -1,20 +1,14 @@ #ifndef MANTID_MDALGORITHMS_XORMDTEST_H_ #define MANTID_MDALGORITHMS_XORMDTEST_H_ -#include <cxxtest/TestSuite.h> -#include "MantidKernel/Timer.h" -#include "MantidKernel/System.h" -#include <iostream> -#include <iomanip> - #include "MantidMDAlgorithms/XorMD.h" #include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" + +#include <cxxtest/TestSuite.h> -using namespace Mantid; using namespace Mantid::MDAlgorithms; -using namespace Mantid::API; -using Mantid::MDEvents::MDHistoWorkspace_sptr; +using Mantid::DataObjects::MDHistoWorkspace_sptr; class XorMDTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/MDEvents/CMakeLists.txt b/Code/Mantid/Framework/MDEvents/CMakeLists.txt deleted file mode 100644 index 7ef89d372bb7d429ce2a6967781efc6b3b0c3331..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/CMakeLists.txt +++ /dev/null @@ -1,211 +0,0 @@ -# Source files -set ( SRC_FILES - # - src/AffineMatrixParameter.cpp - src/AffineMatrixParameterParser.cpp - src/BoxControllerNeXusIO.cpp - src/BoxControllerSettingsAlgorithm.cpp - src/CalculateReflectometryQBase.cpp - src/ConvToMDBase.cpp - src/ConvToMDEventsWS.cpp - src/ConvToMDHistoWS.cpp - src/ConvToMDSelector.cpp - src/ConvertToReflectometryQ.cpp - src/CoordTransformAffine.cpp - src/CoordTransformAffineParser.cpp - src/CoordTransformAligned.cpp - src/CoordTransformDistance.cpp - src/CoordTransformDistanceParser.cpp - src/FitMD.cpp - src/ImportMDEventWorkspace.cpp - src/ImportMDHistoWorkspace.cpp - src/ImportMDHistoWorkspaceBase.cpp - src/MDBin.cpp - src/MDBox.cpp - src/MDBoxBase.cpp - src/MDBoxIterator.cpp - src/MDBoxFlatTree.cpp - src/MDBoxSaveable.cpp - src/MDEventFactory.cpp - src/MDEventWSWrapper.cpp - src/MDEventWorkspace.cpp - src/MDGridBox.cpp - src/MDHistoWorkspace.cpp - src/MDHistoWorkspaceIterator.cpp - src/MDLeanEvent.cpp - src/MDTransfAxisNames.cpp - src/MDTransfFactory.cpp - src/MDTransfModQ.cpp - src/MDTransfNoQ.cpp - src/MDTransfQ3D.cpp - src/MDWSDescription.cpp - src/MDWSTransform.cpp - src/OneStepMDEW.cpp - src/QueryMDWorkspace.cpp - src/ReflectometryTransform.cpp - src/ReflectometryTransformKiKf.cpp - src/ReflectometryTransformP.cpp - src/ReflectometryTransformQxQz.cpp - src/Integrate3DEvents.cpp - src/IntegrateEllipsoids.cpp - src/SaveIsawQvector.cpp - src/UnitsConversionHelper.cpp - src/UserFunctionMD.cpp -) - -set ( SRC_UNITY_IGNORE_FILES - src/MDBoxBase.cpp - src/MDBin.cpp - src/MDBox.cpp - src/MDBoxIterator.cpp - src/MDEventWorkspace.cpp - src/MDGridBox.cpp -) - -# Header files -set ( INC_FILES - # - inc/MantidMDEvents/AffineMatrixParameter.h - inc/MantidMDEvents/AffineMatrixParameterParser.h - inc/MantidMDEvents/BoxControllerNeXusIO.h - inc/MantidMDEvents/BoxControllerSettingsAlgorithm.h - inc/MantidMDEvents/CalculateReflectometryQBase.h - inc/MantidMDEvents/ConvToMDBase.h - inc/MantidMDEvents/ConvToMDEventsWS.h - inc/MantidMDEvents/ConvToMDHistoWS.h - inc/MantidMDEvents/ConvToMDSelector.h - inc/MantidMDEvents/ConvertToReflectometryQ.h - inc/MantidMDEvents/CoordTransformAffine.h - inc/MantidMDEvents/CoordTransformAffineParser.h - inc/MantidMDEvents/CoordTransformAligned.h - inc/MantidMDEvents/CoordTransformDistance.h - inc/MantidMDEvents/CoordTransformDistanceParser.h - inc/MantidMDEvents/FitMD.h - inc/MantidMDEvents/ImportMDEventWorkspace.h - inc/MantidMDEvents/ImportMDHistoWorkspace.h - inc/MantidMDEvents/ImportMDHistoWorkspaceBase.h - inc/MantidMDEvents/MDBin.h - inc/MantidMDEvents/MDBox.h - inc/MantidMDEvents/MDBoxBase.h - inc/MantidMDEvents/MDBoxIterator.h - inc/MantidMDEvents/MDBoxFlatTree.h - inc/MantidMDEvents/MDBoxSaveable.h - inc/MantidMDEvents/MDDimensionStats.h - inc/MantidMDEvents/MDEvent.h - inc/MantidMDEvents/MDEventFactory.h - inc/MantidMDEvents/MDEventInserter.h - inc/MantidMDEvents/MDEventWSWrapper.h - inc/MantidMDEvents/MDEventWorkspace.h - inc/MantidMDEvents/MDGridBox.h - inc/MantidMDEvents/MDHistoWorkspace.h - inc/MantidMDEvents/MDHistoWorkspaceIterator.h - inc/MantidMDEvents/MDLeanEvent.h - inc/MantidMDEvents/MDTransfAxisNames.h - inc/MantidMDEvents/MDTransfFactory.h - inc/MantidMDEvents/MDTransfInterface.h - inc/MantidMDEvents/MDTransfModQ.h - inc/MantidMDEvents/MDTransfNoQ.h - inc/MantidMDEvents/MDTransfQ3D.h - inc/MantidMDEvents/MDWSDescription.h - inc/MantidMDEvents/MDWSTransform.h - inc/MantidMDEvents/OneStepMDEW.h - inc/MantidMDEvents/QueryMDWorkspace.h - inc/MantidMDEvents/ReflectometryTransform.h - inc/MantidMDEvents/ReflectometryTransformKiKf.h - inc/MantidMDEvents/ReflectometryTransformP.h - inc/MantidMDEvents/ReflectometryTransformQxQz.h - inc/MantidMDEvents/Integrate3DEvents.h - inc/MantidMDEvents/IntegrateEllipsoids.h - inc/MantidMDEvents/SaveIsawQvector.h - inc/MantidMDEvents/SkippingPolicy.h - inc/MantidMDEvents/UnitsConversionHelper.h - inc/MantidMDEvents/UserFunctionMD.h -) - -# Test files. -set ( TEST_FILES - AffineMatrixParameterParserTest.h - AffineMatrixParameterTest.h - BoxControllerNeXusIOTest.h - BoxControllerSettingsAlgorithmTest.h - ConvertToReflectometryQTest.h - CoordTransformAffineParserTest.h - CoordTransformAffineTest.h - CoordTransformAlignedTest.h - CoordTransformDistanceParserTest.h - CoordTransformDistanceTest.h - FitMDTest.h - IntegrateEllipsoidsTest.h - ImportMDEventWorkspaceTest.h - ImportMDHistoWorkspaceTest.h - MDBinTest.h - MDBoxBaseTest.h - MDBoxIteratorTest.h - MDBoxFlatTreeTest.h - MDBoxTest.h - MDBoxSaveableTest.h - MDDimensionStatsTest.h - MDEventFactoryTest.h - MDEventInserterTest.h - MDEventTest.h - MDEventWSWrapperTest.h - MDEventWorkspaceTest.h - MDGridBoxTest.h - MDHistoWorkspaceIteratorTest.h - MDHistoWorkspaceTest.h - MDLeanEventTest.h - MDTransfAxisNamesTest.h - MDTransfFactoryTest.h - MDTransfQ3DTest.h - MDTransfModQTest.h - MDWSDescriptionTest.h - MDWSTransfTest.h - OneStepMDEWTest.h - QueryMDWorkspaceTest.h - ReflectometryTransformQxQzTest.h - ReflectometryTransformPTest.h - ReflectometryTransformKiKfTest.h - Integrate3DEventsTest.h - SaveIsawQvectorTest.h - SkippingPolicyTest.h - UnitsConversionHelperTest.h -) - - -if(UNITY_BUILD) - include(UnityBuild) - enable_unity_build(MDEvents SRC_FILES SRC_UNITY_IGNORE_FILES 10) -endif(UNITY_BUILD) - -# Use a precompiled header where they are supported -enable_precompiled_headers( inc/MantidMDEvents/PrecompiledHeader.h SRC_FILES ) -# Add the target for this directory -add_library ( MDEvents ${SRC_FILES} ${INC_FILES}) -# Set the name of the generated library -set_target_properties ( MDEvents PROPERTIES OUTPUT_NAME MantidMDEvents - COMPILE_DEFINITIONS IN_MANTID_MDEVENT ) - -if (OSX_VERSION VERSION_GREATER 10.8) - set_target_properties ( MDEvents PROPERTIES INSTALL_RPATH "@loader_path/../MacOS") -endif () - -# Intensive use of templated libaries can cause large objects to be generated. These require -# an additional flag in MSVC. -if ( MSVC ) - set_target_properties ( MDEvents PROPERTIES COMPILE_FLAGS "/bigobj" ) -endif () - -# Add to the 'Framework' group in VS -set_property ( TARGET MDEvents PROPERTY FOLDER "MantidFramework" ) - -include_directories( inc ) -target_link_libraries ( MDEvents ${MANTIDLIBS} ) - -# Add the unit tests directory -add_subdirectory ( test ) - -########################################################################### -# Installation settings -########################################################################### - -install ( TARGETS MDEvents ${SYSTEM_PACKAGE_TARGET} DESTINATION ${LIB_DIR} ) diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDDimensionExtents.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDDimensionExtents.h deleted file mode 100644 index d7422af03284b445dce88c97227bfd0c903fd275..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDDimensionExtents.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef MDDIMENSIONEXTENTS_H_ -#define MDDIMENSIONEXTENTS_H_ - -/* - * MDDimensionExtents.h - * - * Created on: Jan 14, 2011 - * Author: Janik Zikovsky - */ -#include "MantidKernel/System.h" -#include <limits> - -namespace Mantid { -namespace MDEvents { - -//=============================================================================================== -/** Simple class that holds the extents (min/max) - * of a given dimension in a MD workspace or MDBox - */ -class DLLExport MDDimensionExtents { -public: - /** Empty constructor - reset everything. - * */ - MDDimensionExtents() - : min(std::numeric_limits<coord_t>::max()), - max(-std::numeric_limits<coord_t>::max()) {} - - // ---- Public members ---------- - /// Extent: minimum value in that dimension - coord_t min; - /// Extent: maximum value in that dimension - coord_t max; -}; - -} // namespace MDEvents - -} // namespace Mantid - -#endif /* MDDIMENSIONEXTENTS_H_ */ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/PrecompiledHeader.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/PrecompiledHeader.h deleted file mode 100644 index 1c58fffbcfa816b44aea3860df0902363d83c35d..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/PrecompiledHeader.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef MANTID_MDEVENTS_PRECOMPILEDHEADER_H_ -#define MANTID_MDEVENTS_PRECOMPILEDHEADER_H_ - -// Mantid -#include "MantidKernel/System.h" -#include "MantidGeometry/MDGeometry/IMDDimension.h" -#include "MantidAPI/Algorithm.h" - -// STL -#include <vector> -#include <map> -#include <cmath> - -#endif // MANTID_MDEVENTS_PRECOMPILEDHEADER_H_ \ No newline at end of file diff --git a/Code/Mantid/Framework/MDEvents/src/MDEventInserter.cpp b/Code/Mantid/Framework/MDEvents/src/MDEventInserter.cpp deleted file mode 100644 index 7ba27724d16ceeb76a5a1391a00900d09424f552..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/src/MDEventInserter.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "MantidMDEvents/MDEventInserter.h" -#include "MantidKernel/System.h" - -using namespace Mantid::Kernel; -using namespace Mantid::API; - -namespace Mantid { -namespace MDEvents { - -//---------------------------------------------------------------------------------------------- -/** Constructor - */ -MDEventInserter::MDEventInserter() {} - -} // namespace Mantid -} // namespace MDEvents diff --git a/Code/Mantid/Framework/MDEvents/src/MDLeanEvent.cpp b/Code/Mantid/Framework/MDEvents/src/MDLeanEvent.cpp deleted file mode 100644 index 6d6932e850ac868fd081c289a347f429ff4176a7..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/src/MDLeanEvent.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "MantidMDEvents/MDLeanEvent.h" -#include "MantidKernel/System.h" - -namespace Mantid { -namespace MDEvents {} // namespace Mantid -} // namespace MDEvents diff --git a/Code/Mantid/Framework/MDEvents/test/CMakeLists.txt b/Code/Mantid/Framework/MDEvents/test/CMakeLists.txt deleted file mode 100644 index 4f5e1f00754894738f76f6ccab054c48dc4d2ac6..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/test/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -if ( CXXTEST_FOUND ) - include_directories ( SYSTEM ${CXXTEST_INCLUDE_DIR} ${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR} ) - - include_directories ( ../../TestHelpers/inc ../../DataHandling/inc ) - # This variable is used within the cxxtest_add_test macro to build these helper classes into the test executable. - # It will go out of scope at the end of this file so doesn't need un-setting - set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp - ../../TestHelpers/src/ComponentCreationHelper.cpp - ../../TestHelpers/src/WorkspaceCreationHelper.cpp - ../../TestHelpers/src/MDEventsTestHelper.cpp - ../../TestHelpers/src/ScopedFileHelper.cpp - ../../TestHelpers/src/BoxControllerDummyIO.cpp - ) - - if ( GMOCK_FOUND AND GTEST_FOUND ) - cxxtest_add_test ( MDEventsTest ${TEST_FILES} ${GMOCK_TEST_FILES} ) - target_link_libraries( MDEventsTest MDEvents ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES} DataHandling ) - else () - cxxtest_add_test ( MDEventsTest ${TEST_FILES} ) - target_link_libraries( MDEventsTest MDEvents DataHandling) - endif () - - add_dependencies ( FrameworkTests MDEventsTest ) - # Test data - add_dependencies ( MDEventsTest StandardTestData ) - - # Add to the 'FrameworkTests' group in VS - set_property ( TARGET MDEventsTest PROPERTY FOLDER "UnitTests" ) - -endif () - diff --git a/Code/Mantid/Framework/MDEvents/test/ConvToMDBaseTest.h b/Code/Mantid/Framework/MDEvents/test/ConvToMDBaseTest.h deleted file mode 100644 index 7338733713f4d9bcc06e264e9727a0df8338747c..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/test/ConvToMDBaseTest.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef MDEVENTS_CONV2_MDBASE_TEST_H_ -#define MDEVENTS_CONV2_MDBASE_TEST_H_ - -#include <cxxtest/TestSuite.h> -#include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidMDEvents/ConvToMDBase.h" -#include "MantidMDEvents/MDEventWSWrapper.h" -//#include "MantidMDEvents/MDTransfDEHelper.h" - -using namespace Mantid; -using namespace Mantid::MDEvents; -using namespace Mantid::API; - -// TEST HELPER -class ConvToMDBaseTestHelper : public ConvToMDBase -{ - size_t conversionChunk(size_t ){return 0;} -public: - void runConversion(API::Progress *){}; - int getNumThreads(){return m_NumThreads;} - -}; - -// The test -class ConvToMDBaseTest : public CxxTest::TestSuite, public WorkspaceCreationHelper::MockAlgorithm -{ - // Matrix workspace description; - MDWSDescription WSD; - // matrix ws, sometimes can be obtained from description as a const pointer, but better not to do it for modifications - Mantid::API::MatrixWorkspace_sptr ws2D; - // the shared pointer to the expected taget Event ws; Not used here, just set up - boost::shared_ptr<MDEventWSWrapper> outWSWrapper; - // preprocessed detectors location (emulates static algorithm variable) - MDEvents::ConvToMDPreprocDet DetLoc; -public: -static ConvToMDBaseTest *createSuite() { - return new ConvToMDBaseTest(); -} -static void destroySuite(ConvToMDBaseTest * suite) { delete suite; } - -void testConstructor() -{ - boost::scoped_ptr<ConvToMDBaseTestHelper> pConvToMDBase; - TS_ASSERT_THROWS_NOTHING(pConvToMDBase.reset(new ConvToMDBaseTestHelper())); - TSM_ASSERT_EQUALS("uninitiated num threads parameter should be equal -1",-1,pConvToMDBase->getNumThreads()); - -} -void testInitAndSetNumThreads() -{ - ConvToMDBaseTestHelper testClass; - TS_ASSERT_THROWS_NOTHING(outWSWrapper->createEmptyMDWS(WSD)); - - TSM_ASSERT_THROWS("Should throw if detectors prepositions are not initiated ",testClass.initialize(WSD,outWSWrapper),std::runtime_error); - // should calculate the detectors info for WDS - this->buildDetInfo(ws2D); - - TS_ASSERT_THROWS_NOTHING(testClass.initialize(WSD,outWSWrapper)); - TSM_ASSERT_EQUALS("uninitiated num threads parameter should be still equal -1",-1,testClass.getNumThreads()); - - std::string QMode = WSD.getQMode(); - std::string dEMode = WSD.getEModeStr(); - ws2D->mutableRun().addProperty("NUM_THREADS",0.); - - WSD.buildFromMatrixWS(ws2D,QMode,dEMode); - this->buildDetInfo(ws2D); - - TS_ASSERT_THROWS_NOTHING(testClass.initialize(WSD,outWSWrapper)); - TSM_ASSERT_EQUALS("Initialized above num threads parameter should be equal to 0 (which would disable multithreading)",0,testClass.getNumThreads()); - ws2D->mutableRun().removeProperty("NUM_THREADS"); - - // and this should let us run 2 thread program - ws2D->mutableRun().addProperty("NUM_THREADS",2.); - WSD.buildFromMatrixWS(ws2D,QMode,dEMode); - this->buildDetInfo(ws2D); - - TS_ASSERT_THROWS_NOTHING(testClass.initialize(WSD,outWSWrapper)); - TSM_ASSERT_EQUALS("Initialized above num threads parameter should be equal to 2:",2,testClass.getNumThreads()); - - // avoid side effects of this test to possible others; - ws2D->mutableRun().removeProperty("NUM_THREADS"); - -} -private: - ConvToMDBaseTest() - { - ws2D =WorkspaceCreationHelper::createProcessedWorkspaceWithCylComplexInstrument(4,10,true); - // rotate the crystal by twenty degrees back; - ws2D->mutableRun().mutableGoniometer().setRotationAngle(0,20); - // add workspace energy - ws2D->mutableRun().addProperty("Ei",13.,"meV",true); - // ADD time series property - ws2D->mutableRun().addProperty("H",10.,"Gs"); - - std::vector<double> dimMin(4,-10); - std::vector<double> dimMax(4, 20); - std::vector<std::string> PropNamews; - WSD.setMinMax(dimMin,dimMax); - WSD.buildFromMatrixWS(ws2D,"Q3D","Direct",PropNamews); - - outWSWrapper = boost::shared_ptr<MDEventWSWrapper>(new MDEventWSWrapper()); - } - // helper function to build the detector info - void buildDetInfo( Mantid::API::MatrixWorkspace_sptr spWS) - { - WSD.m_PreprDetTable = WorkspaceCreationHelper::buildPreprocessedDetectorsWorkspace(spWS); - } - -}; - - -#endif \ No newline at end of file diff --git a/Code/Mantid/Framework/MDEvents/test/ConvToMDEventsVSHistoTest.h b/Code/Mantid/Framework/MDEvents/test/ConvToMDEventsVSHistoTest.h deleted file mode 100644 index 44ee713423582f49f517c8648d1e93ccc30a1ef3..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/test/ConvToMDEventsVSHistoTest.h +++ /dev/null @@ -1,323 +0,0 @@ -#ifndef CONVERT2_MDEVENTS_METHODS_TEST_H_ -#define CONVERT2_MDEVENTS_METHODS_TEST_H_ - -#include <cxxtest/TestSuite.h> -#include <cmath> - -#include "MantidKernel/UnitFactory.h" -#include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidAPI/Progress.h" -#include "MantidAPI/FrameworkManager.h" - -#include "MantidMDEvents/MDBoxIterator.h" - -// stuff for convertToEventWorkspace ChildAlgorithm -#include "MantidDataObjects/Events.h" -#include "MantidDataObjects/Workspace2D.h" -#include "MantidDataObjects/EventWorkspace.h" -#include "MantidDataObjects/TableWorkspace.h" - -// -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/ConvToMDBase.h" -#include "MantidMDEvents/ConvToMDSelector.h" - - - -using namespace Mantid; -using namespace Mantid::API; -using namespace Mantid::Geometry; -using namespace Mantid::DataObjects; -using namespace Mantid::MDEvents; - - - -class ConvToMDEventsVSHistoTest : public CxxTest::TestSuite -{ - // matrix ws and event ws which contains the same data - Mantid::API::MatrixWorkspace_sptr ws2D; - Mantid::API::MatrixWorkspace_sptr ws_events; - - // MD ws obtained from histo and MD ws obtained from events, which should be again similar - boost::shared_ptr<MDEvents::MDEventWSWrapper> pHistoMDWSWrapper; - boost::shared_ptr<MDEvents::MDEventWSWrapper> pEventMDWSWrapper; - - // preprocessed detectors positions and target ws description - DataObjects::TableWorkspace_sptr detLoc; - MDEvents::MDWSDescription TestWS; - - std::auto_ptr<ConvToMDBase> pConvMethods; - - // class which would select the solver as function of ws type - ConvToMDSelector WSAlgoSelector; - - // the helper claa which woudl provide log and progress --> algorithm's properties - WorkspaceCreationHelper::MockAlgorithm logProvider; - -public: -static ConvToMDEventsVSHistoTest *createSuite() { - return new ConvToMDEventsVSHistoTest(); -} -static void destroySuite(ConvToMDEventsVSHistoTest * suite) { delete suite; } - - -void test_TwoTransfMethods() -{ - - // define the parameters of the conversion - std::vector<std::string> dimProperyNames; //--- empty property names - TS_ASSERT_THROWS_NOTHING(TestWS.buildFromMatrixWS(ws2D,"Q3D","Direct",dimProperyNames)); - TestWS.m_PreprDetTable = detLoc; - - std::vector<double> dimMin(4,-3); - std::vector<double> dimMax(4, 3); - TS_ASSERT_THROWS_NOTHING(TestWS.setMinMax(dimMin,dimMax)); - - // define transformation - TestWS.m_RotMatrix.assign(9,0); - TestWS.m_RotMatrix[0]=1; - TestWS.m_RotMatrix[4]=1; - TestWS.m_RotMatrix[8]=1; - - // create target md workspace - pHistoMDWSWrapper = boost::shared_ptr<MDEvents::MDEventWSWrapper>(new MDEvents::MDEventWSWrapper()); - pHistoMDWSWrapper->createEmptyMDWS(TestWS); - - Mantid::API::BoxController_sptr bc=pHistoMDWSWrapper->pWorkspace()->getBoxController(); - bc->setSplitThreshold(5); - bc->setMaxDepth(100); - bc->setSplitInto(5); - - // initialize solver converting from Matrix ws to md ws - boost::shared_ptr<ConvToMDBase> pSolver; - TS_ASSERT_THROWS_NOTHING(pSolver = WSAlgoSelector.convSelector(ws2D,pSolver)); - TS_ASSERT_THROWS_NOTHING(pSolver->initialize(TestWS,pHistoMDWSWrapper)); - - logProvider.resetProgress(4); - TS_ASSERT_THROWS_NOTHING(pSolver->runConversion(logProvider.getProgress())); - - TS_ASSERT_EQUALS(50,pHistoMDWSWrapper->pWorkspace()->getNPoints()); - -} -void test_buildFromEWS() -{ - // create empty target ws - pEventMDWSWrapper = boost::shared_ptr<MDEvents::MDEventWSWrapper>(new MDEvents::MDEventWSWrapper()); - pEventMDWSWrapper->createEmptyMDWS(TestWS); - // convert initial matrix ws into event ws - DataObjects::Workspace2D_const_sptr inWS = boost::static_pointer_cast<const DataObjects::Workspace2D>(ws2D); - EventWorkspace_sptr outWS = convertToEvents(inWS); - - // build ws description from event ws - std::vector<std::string> dimProperyNames; //--- empty property names - TS_ASSERT_THROWS_NOTHING(TestWS.buildFromMatrixWS(outWS,"Q3D","Direct",dimProperyNames)); - TestWS.m_PreprDetTable = detLoc; - - ws_events =boost::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(outWS); - if (!ws_events){ - throw std::runtime_error("Error in ConvertToEventWorkspace. Cannot proceed."); - } - - // create target md workspace wrapper - pEventMDWSWrapper = boost::shared_ptr<MDEvents::MDEventWSWrapper>(new MDEvents::MDEventWSWrapper()); - pEventMDWSWrapper->createEmptyMDWS(TestWS); - - Mantid::API::BoxController_sptr bc=pEventMDWSWrapper->pWorkspace()->getBoxController(); - bc->setSplitThreshold(5); - bc->setMaxDepth(100); - bc->setSplitInto(5); - - // initialize solver converting from Event ws to md ws - boost::shared_ptr<ConvToMDBase> pTOFConv; - TS_ASSERT_THROWS_NOTHING(pTOFConv = WSAlgoSelector.convSelector(outWS)); - TS_ASSERT_THROWS_NOTHING(pTOFConv->initialize(TestWS,pEventMDWSWrapper)); - - logProvider.resetProgress(4); - TS_ASSERT_THROWS_NOTHING(pTOFConv->runConversion(logProvider.getProgress())); - TS_ASSERT_EQUALS(50,pEventMDWSWrapper->pWorkspace()->getNPoints()); - - -} - -void test_compareTwoConversions() -{ - - MDEvents::MDEventWorkspace<MDEvents::MDEvent<4>,4> * pMatrWs = dynamic_cast<MDEvents::MDEventWorkspace<MDEvents::MDEvent<4>,4> *>(this->pHistoMDWSWrapper->pWorkspace().get()); - MDEvents::MDEventWorkspace<MDEvents::MDEvent<4>,4> * pEvntWs = dynamic_cast<MDEvents::MDEventWorkspace<MDEvents::MDEvent<4>,4> *>(this->pEventMDWSWrapper->pWorkspace().get()); - if(!pMatrWs){ - TS_FAIL(" can not retrieve workspace obtained from matrix WS"); - return; - } - if(!pEvntWs){ - TS_FAIL(" can not retrieve workspace obtained from event WS"); - return; - } - // Get all the MDBoxes contained - //MDBoxBase<MDE,nd> * parentBox = ws->getBox(); - //std::vector<MDBoxBase<MDE,nd> *> boxes; - //parentBox->getBoxes(boxes, 1000, true); - - MDBoxBase<MDEvent<4> ,4> * parentBox = pMatrWs->getBox(); - std::vector<MDBoxBase<MDEvent<4>,4> *> boxesM; - parentBox->getBoxes(boxesM, 1000, true); - - parentBox = pEvntWs->getBox(); - std::vector<MDBoxBase<MDEvent<4>,4> *> boxesE; - parentBox->getBoxes(boxesE, 1000, true); - - - for (size_t i=0; i<boxesM.size(); i++){ - MDBox<MDEvent<4>,4> * boxM = dynamic_cast<MDBox<MDEvent<4>,4> *>(boxesM[i]); - if (boxM){ - MDBox<MDEvent<4>,4> * boxE = dynamic_cast<MDBox<MDEvent<4>,4> *>(boxesE[i]); - - std::vector<MDEvent<4> > & eventsM = boxM->getEvents(); - std::vector<MDEvent<4> > & eventsE = boxE->getEvents(); - if(eventsM.size()!=eventsE.size()) - { - TS_FAIL(" sizes of the boxes, obtained from matrix workspace="+boost::lexical_cast<std::string>(eventsM.size())+" and from event worskpace="+boost::lexical_cast<std::string>(eventsE.size())+" and are different"); - return; - } - - - std::vector<MDEvent<4> >::iterator itM = eventsM.begin(); - std::vector<MDEvent<4> >::iterator itE = eventsE.begin(); - std::vector<MDEvent<4> >::iterator it_end = eventsM.end(); - - for (; itM != it_end; itM++){ - - float Signal1 = itM->getSignal(); - float Signal2 = itE->getSignal(); - TS_ASSERT_DELTA(Signal1,Signal2,1.e-5); - float Err1 = itM->getErrorSquared(); - float Err2 = itE->getErrorSquared(); - TS_ASSERT_DELTA(Err1,Err2,1.e-5); - - for(size_t j=0;i<4;i++){ - TS_ASSERT_DELTA(itM->getCenter(j),itE->getCenter(j),1.e-4); - } - TS_ASSERT_EQUALS(itM->getDetectorID(),itE->getDetectorID()); - TS_ASSERT_EQUALS(itM->getRunIndex(),itE->getRunIndex()); - itE++; - } - boxE->releaseEvents(); - boxM->releaseEvents(); - } - } - -} - -// constructor: -ConvToMDEventsVSHistoTest(): -TestWS(4), -logProvider(100) -{ - API::FrameworkManager::Instance(); - - std::vector<double> L2(5,5); - std::vector<double> polar(5,(30./180.)*M_PI); - polar[0]=0; - std::vector<double> azimutal(5,0); - azimutal[1]=(45./180.)*M_PI; - azimutal[2]=(90./180.)*M_PI; - azimutal[3]=(135./180.)*M_PI; - azimutal[4]=(180./180.)*M_PI; - - int numBins=10; - ws2D =WorkspaceCreationHelper::createProcessedInelasticWS(L2, polar, azimutal,numBins,-1,3,3); - // this should disable multithreading - ws2D->mutableRun().addProperty("NUM_THREADS",0); - - detLoc = WorkspaceCreationHelper::buildPreprocessedDetectorsWorkspace(ws2D); - -} -// function repeats convert to events algorithm which for some mysterious reasons do not work here as ChildAlgorithm. -EventWorkspace_sptr convertToEvents(DataObjects::Workspace2D_const_sptr inWS) -{ - - // set up conversion to Time of flight - UnitsConversionHelper TOFCONV; - - TOFCONV.initialize(TestWS,"TOF"); - - //Create the event workspace - EventWorkspace_sptr outWS = boost::dynamic_pointer_cast<EventWorkspace>( - API::WorkspaceFactory::Instance().create("EventWorkspace", inWS->getNumberHistograms(), inWS->blocksize()+1, inWS->blocksize())); - - //Copy geometry, etc. over. - API::WorkspaceFactory::Instance().initializeFromParent(inWS, outWS, false); - - // Cached values for later checks - double inf = std::numeric_limits<double>::infinity(); - double ninf = -inf; - - logProvider.resetProgress(inWS->getNumberHistograms()); - Progress *prog = logProvider.getProgress(); - //PARALLEL_FOR1(inWS) - for (int iwi=0; iwi<int(inWS->getNumberHistograms()); iwi++) - { - //PARALLEL_START_INTERUPT_REGION - size_t wi = size_t(iwi); - // The input spectrum (a histogram) - const ISpectrum * inSpec = inWS->getSpectrum(wi); - const MantidVec & X = inSpec->readX(); - const MantidVec & Y = inSpec->readY(); - const MantidVec & E = inSpec->readE(); - - TOFCONV.updateConversion(iwi); - - // The output event list - EventList & el = outWS->getEventList(wi); - // Copy detector IDs and spectra - el.copyInfoFrom( *inSpec ); - // We need weights but have no way to set the time. So use weighted, no time - el.switchTo(WEIGHTED_NOTIME); - - for (size_t i=0; i<X.size()-1; i++) - { - double weight = Y[i]; - if ((weight != 0.0) && (weight == weight) /*NAN check*/ - && (weight != inf) && (weight != ninf)) - { - double error = E[i]; - // Also check that the error is not a bad number - if ((error == error) /*NAN check*/ - && (error != inf) && (error != ninf)) - { - // --------- Single event per bin ---------- - // TOF = midpoint of the bin - double tof = (X[i] + X[i+1]) / 2.0; - // Error squared is carried in the event - double errorSquared = E[i]; - errorSquared *= errorSquared; - // Create and add the event - el.addEventQuickly( WeightedEventNoTime(TOFCONV.convertUnits(tof), weight, errorSquared) ); - - } // error is nont NAN or infinite - } // weight is non-zero, not NAN, and non-infinite - } // (each bin) - - // Set the X binning parameters - el.setX( inSpec->ptrX() ); - // Manually set that this is sorted by TOF, since it is. This will make it "threadSafe" in other algos. - el.setSortOrder( TOF_SORT ); - - prog->report("Converting"); - // PARALLEL_END_INTERUPT_REGION - } - // PARALLEL_CHECK_INTERUPT_REGION - NumericAxis *pAxis0 = new NumericAxis(2); - pAxis0->setUnit("TOF"); - outWS->replaceAxis(0,pAxis0); - - return outWS; - // Set the output - //setProperty("OutputWorkspace", outWS); -} - -}; - - - -#endif diff --git a/Code/Mantid/Framework/MDEvents/test/MDBoxToChangeTest.h b/Code/Mantid/Framework/MDEvents/test/MDBoxToChangeTest.h deleted file mode 100644 index 61849871bb1ada22b416c497a2a5e3d46bd50025..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/test/MDBoxToChangeTest.h +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef MANTID_MDEVENTS_MDBOX_TOCHANGEETEST_H_ -#define MANTID_MDEVENTS_MDBOX_TOCHANGEETEST_H_ - -#include "MantidMDEvents/MDBoxToChange.h" -#include "MantidMDEvents/../../src/MDBoxToChange.cpp" -#include "MantidMDEvents/MDEvent.h" -#include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> - -using namespace Mantid; -using namespace API; -using namespace Mantid::MDEvents; - - -class MDBoxToChangeTest : public CxxTest::TestSuite -{ - - BoxController_sptr splitter; - MDBoxBase<MDEvent<2>,2>* rootBox; - -public: -static MDBoxToChangeTest *createSuite() { return new MDBoxToChangeTest(); } -static void destroySuite(MDBoxToChangeTest * suite) { delete suite; } - -void testConstructor() -{ - rootBox = makeMDBox2(); - MDBoxToChange<MDEvent<2>,2> * pBoxChanger(NULL); - TS_ASSERT_THROWS_NOTHING((pBoxChanger = new MDBoxToChange<MDEvent<2> , 2>())); - delete pBoxChanger; - TS_ASSERT_THROWS_NOTHING((pBoxChanger = new MDBoxToChange<MDEvent<2> , 2>(dynamic_cast<MDBox<MDEvent<2>,2>*>(rootBox),0))); - - delete pBoxChanger; - -} - -void testSplitRootToGridbox() -{ - MDBoxToChange<MDEvent<2>,2> BoxToSplit(dynamic_cast<MDBox<MDEvent<2>,2>*>(rootBox),0); - - TSM_ASSERT("root box at this stage has to be an MDBox:",(dynamic_cast<MDBox<MDEvent<2>,2>*>(rootBox))); - - TS_ASSERT_THROWS_NOTHING(rootBox=BoxToSplit.splitToGridBox()); - TSM_ASSERT("root box at this stage has to be an MDGridBox:",(dynamic_cast<MDGridBox<MDEvent<2>,2>*>(rootBox))); - - TSM_ASSERT("root box and internal box for this stuff should be equal :",rootBox == BoxToSplit.getParent()); -} - -void testSplitAMemberToGridbox() -{ - API::IMDNode * aChildBox(NULL); - TS_ASSERT_THROWS_NOTHING(aChildBox = rootBox->getChild(10)); - - MDBoxToChange<MDEvent<2>,2> BoxToSplit(dynamic_cast<MDBox<MDEvent<2>,2>*>(aChildBox),10); - - TSM_ASSERT("parent for the box to split should be rootbox: ",(BoxToSplit.getParent() == rootBox)); - - MDBoxBase<MDEvent<2>,2>* aGridBox(NULL); - TS_ASSERT_THROWS_NOTHING(aGridBox=BoxToSplit.splitToGridBox()); - - TSM_ASSERT("This should be a grid box",(dynamic_cast<MDGridBox<MDEvent<2>,2>*>(aGridBox))); - TSM_ASSERT("and this grid box siting in place 10 of the root grid-box:",((dynamic_cast<MDGridBox<MDEvent<2>,2>*>(aGridBox))==dynamic_cast<MDGridBox<MDEvent<2>,2>*>(rootBox->getChild(10)))); - - -} - -MDBoxToChangeTest() -{ - splitter = BoxController_sptr(new BoxController(2)); -} - -private: - /** Generate an MDBox , 10x10*/ -MDBox<MDEvent<2>,2> * makeMDBox2() -{ - - splitter->setSplitThreshold(5); - // Splits into 10 boxes - splitter->setSplitInto(10); - // Set the size - MDBox<MDEvent<2>,2> * out = new MDBox<MDEvent<2>,2>(splitter.get()); - out->setExtents(0, 0.0, 10.0); - out->setExtents(1, 0.0, 10.0); - out->calcVolume(); - // Fill events that are more spread in dimension 1. - for (double x=40; x<60; x++) //20 - for (double y=20; y<80; y++) //60 - { - coord_t centers[2] = {coord_t(x*0.1),coord_t(y*0.1 + 0.05)}; - out->addEvent( MDEvent<2>(2.0, 2.0, centers) ); - } - - return out; -} - - -}; - -#endif diff --git a/Code/Mantid/Framework/MDEvents/test/MDWSTransfDescrTest.h b/Code/Mantid/Framework/MDEvents/test/MDWSTransfDescrTest.h deleted file mode 100644 index 7974b7f83196c2a44ff687e4f591732b64846a71..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/test/MDWSTransfDescrTest.h +++ /dev/null @@ -1,136 +0,0 @@ -#ifndef MANTID_MDWS_AXIS_NAMES_TEST_H_ -#define MANTID_MDWS_AXIS_NAMES_TEST_H_ - -#include <cxxtest/TestSuite.h> -#include "MantidMDEvents/MDTransfAxisNames.h" - -using namespace Mantid; -using namespace Mantid::MDEvents; -using namespace Mantid::Kernel; - - - - -class MDWSTransfAxisTest : public CxxTest::TestSuite -{ - //MDWSSliceTest slice; -public: - // This pair of boilerplate methods prevent the suite being created statically - // This means the constructor isn't called when running other tests - static MDWSTransfAxisTest *createSuite() { return new MDWSTransfAxisTest(); } - static void destroySuite( MDWSTransfAxisTest *suite ) { delete suite; } - - void test_name() - { - V3D dir1(1,0,0); - std::string name; - - std::vector<std::string> Names(3,""); - Names[0]="Q1"; - Names[1]="Q2"; - Names[2]="Q3"; - - TS_ASSERT_THROWS_NOTHING(name=makeAxisName(dir1,Names)); - TS_ASSERT_EQUALS("[Q1,0,0]",name); - - TS_ASSERT_THROWS_NOTHING(name=makeAxisName(V3D(-1,0.99,-1.001),Names)); - TS_ASSERT_EQUALS("[-Q3,0.99Q3,-Q3]",name); - - TS_ASSERT_THROWS_NOTHING(name=makeAxisName(V3D(-1,0.9999,-1.001),Names)); - TS_ASSERT_EQUALS("[-Q3,Q3,-Q3]",name); - - TS_ASSERT_THROWS_NOTHING(name=makeAxisName(V3D(-1,0.999,-1.01),Names)); - TS_ASSERT_EQUALS("[-Q3,0.999Q3,-1.01Q3]",name); - - TS_ASSERT_THROWS_NOTHING(name=makeAxisName(V3D(2.01,0.9,-1.01),Names)); - TS_ASSERT_EQUALS("[2.01Q1,0.9Q1,-1.01Q1]",name); - - TS_ASSERT_THROWS_NOTHING(name=makeAxisName(V3D(0.2,0.9,-1),Names)); - TS_ASSERT_EQUALS("[0.2Q3,0.9Q3,-Q3]",name); - } - -void test_buildDimNames() -{ - - MDEvents::MDWSDescription TargWSDescription(4); - - TargWSDescription.emode = 1; - TargWSDescription.convert_to_factor=NoScaling; - MDWSTransfDescr MsliceTransf; - - TS_ASSERT_THROWS_NOTHING(MsliceTransf.setQ3DDimensionsNames(TargWSDescription)); - - - TS_ASSERT_EQUALS("[H,0,0]",TargWSDescription.dimNames[0]); - TS_ASSERT_EQUALS("[0,K,0]",TargWSDescription.dimNames[1]); - TS_ASSERT_EQUALS("[0,0,L]",TargWSDescription.dimNames[2]); - TS_ASSERT_EQUALS("DeltaE",TargWSDescription.dimNames[3]); - - -} - -void testCoplanarProjections() -{ - MDEvents::MDWSDescription TWS(4); - TWS.pLatt = std::auto_ptr<Geometry::OrientedLattice>(new Geometry::OrientedLattice(5*M_PI,M_PI,2*M_PI, 90., 90., 90.)); - TWS.emode=1; - TWS.convert_to_factor=HKLScale; - std::vector<double> u(3,0); - std::vector<double> v(3,0); - std::vector<double> w(3,0); - u[0]=1; - v[2]=1; - w[2]=-1; - MDWSTransfDescr MsliceTransf; - TS_ASSERT_THROWS_ANYTHING(MsliceTransf.getUVsettings(u,v,w)); -} - -void testTransfMat1() -{ - MDEvents::MDWSDescription TWS(4); - TWS.pLatt = std::auto_ptr<Geometry::OrientedLattice>(new Geometry::OrientedLattice(5*M_PI,M_PI,2*M_PI, 90., 90., 90.)); - TWS.emode=1; - TWS.convert_to_factor=HKLScale; - std::vector<double> u(3,0); - std::vector<double> v(3,0); - std::vector<double> w(3,0); - u[0]=1; - v[2]=1; - w[1]=-1; - std::vector<double> rot; - - MDWSTransfDescr MsliceTransf; - MsliceTransf.getUVsettings(u,v,w); - - - TS_ASSERT_THROWS_NOTHING(rot=MsliceTransf.getTransfMatrix("someDodgyWS",TWS,false)); - TS_ASSERT_THROWS_NOTHING(MsliceTransf.setQ3DDimensionsNames(TWS)); - - TS_ASSERT_EQUALS("[H,0,0]",TWS.dimNames[0]); - TS_ASSERT_EQUALS("[0,0,L]",TWS.dimNames[1]); - TS_ASSERT_EQUALS("[0,-K,0]",TWS.dimNames[2]); - TS_ASSERT_EQUALS("DeltaE",TWS.dimNames[3]); - - TWS.convert_to_factor=OrthogonalHKLScale; - std::vector<double> rot1; - TS_ASSERT_THROWS_NOTHING(rot1=MsliceTransf.getTransfMatrix("someDodgyWS",TWS,false)); - TS_ASSERT_THROWS_NOTHING(MsliceTransf.setQ3DDimensionsNames(TWS)); - - TS_ASSERT_EQUALS("[H,0,0]",TWS.dimNames[0]); - TS_ASSERT_EQUALS("[0,0,L]",TWS.dimNames[1]); - TS_ASSERT_EQUALS("[0,-K,0]",TWS.dimNames[2]); - TS_ASSERT_EQUALS("DeltaE",TWS.dimNames[3]); - - TSM_ASSERT_DELTA(" element 1 should be a/2Pi",TWS.pLatt->a1()/(2*M_PI),rot[0],1.e-6); - TSM_ASSERT_DELTA(" element 2 should be -b/2Pi",-TWS.pLatt->a2()/(2*M_PI),rot[7],1.e-6); - TSM_ASSERT_DELTA(" element 3 should be c/2Pi",TWS.pLatt->a3()/(2*M_PI),rot[5],1.e-6); - - for(int i=0;i<9;i++){ - TSM_ASSERT_DELTA(" element: "+boost::lexical_cast<std::string>(i)+" wrong",rot[i],rot1[i],1.e-6); - } -} - - - -}; -#endif diff --git a/Code/Mantid/Framework/MDEvents/test/PrecompiledHeader.h b/Code/Mantid/Framework/MDEvents/test/PrecompiledHeader.h deleted file mode 100644 index 529a6de1e6adbcf74bcfdc707b5a04ed7ae7265c..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/test/PrecompiledHeader.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef MANTID_MDEVENTSTEST_PRECOMPILED_HEADER_H_ -#define MANTID_MDEVENTSTEST_PRECOMPILED_HEADER_H_ - -// cxxtest -#include <cxxtest/WrappedTestSuite.h> - -// STL -#include <vector> -#include <set> -#include <string> - -#endif //MANTID_MDEVENTSTEST_PRECOMPILED_HEADER_H_ \ No newline at end of file diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/LoadDNSLegacy.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/LoadDNSLegacy.py index 62b8cc71d145baab36164ae0dd180e608fa212be..110ffd12c23a30d12c394ab5fc0297ea1c87583d 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/LoadDNSLegacy.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/LoadDNSLegacy.py @@ -9,6 +9,8 @@ sys.path.insert(0, os.path.dirname(__file__)) from dnsdata import DNSdata sys.path.pop(0) +POLARISATIONS = ['0', 'x', 'y', 'z', '-x', '-y', '-z'] + class LoadDNSLegacy(PythonAlgorithm): """ Load the DNS Legacy data file to the mantid workspace @@ -35,7 +37,9 @@ class LoadDNSLegacy(PythonAlgorithm): self.declareProperty(WorkspaceProperty("OutputWorkspace", \ "", direction=Direction.Output), \ doc="Name of the workspace to store the experimental data.") - + self.declareProperty("Polarisation", "0", \ + StringListValidator(POLARISATIONS), \ + doc="Type of polarisation. Valid values: %s" % str(POLARISATIONS)) return @@ -43,6 +47,7 @@ class LoadDNSLegacy(PythonAlgorithm): # Input filename = self.getPropertyValue("Filename") outws = self.getPropertyValue("OutputWorkspace") + pol = self.getPropertyValue("Polarisation") # load data array from the given file data_array = np.loadtxt(filename) @@ -61,17 +66,28 @@ class LoadDNSLegacy(PythonAlgorithm): run = __temporary_workspace__.mutableRun() run.setStartAndEndTime(DateAndTime(metadata.start_time), \ DateAndTime(metadata.end_time)) + # add name of file as a run title + fname = os.path.splitext(os.path.split(filename)[1])[0] + run.addProperty('run_title', fname, True) + #run.addProperty('dur_secs', str(metadata.duration), True) # rotate the detector bank to the proper position api.RotateInstrumentComponent(__temporary_workspace__, \ "bank0", X=0, Y=1, Z=0, Angle=metadata.deterota) - # add sample log Ei - energy = get_energy(metadata.wavelength) + # add sample log Ei and wavelength + api.AddSampleLog(__temporary_workspace__, \ + 'Ei', LogText=str(metadata.incident_energy), \ + LogType='Number') api.AddSampleLog(__temporary_workspace__, \ - 'Ei', LogText=str(energy), LogType='Number') + 'wavelength', LogText=str(metadata.wavelength), \ + LogType='Number') # add other sample logs api.AddSampleLog(__temporary_workspace__, 'deterota', \ LogText=str(metadata.deterota), LogType='Number') + api.AddSampleLog(__temporary_workspace__, 'mon_sum', \ + LogText=str(metadata.monitor_counts), LogType='Number') + api.AddSampleLog(__temporary_workspace__, 'duration', \ + LogText=str(metadata.duration), LogType='Number') api.AddSampleLog(__temporary_workspace__, 'huber', \ LogText=str(metadata.huber), LogType='Number') api.AddSampleLog(__temporary_workspace__, 'T1', \ @@ -80,6 +96,28 @@ class LoadDNSLegacy(PythonAlgorithm): LogText=str(metadata.t2), LogType='Number') api.AddSampleLog(__temporary_workspace__, 'Tsp', \ LogText=str(metadata.tsp), LogType='Number') + # flipper + api.AddSampleLog(__temporary_workspace__, 'flipper_precession', \ + LogText=str(metadata.flipper_precession_current), LogType='Number') + api.AddSampleLog(__temporary_workspace__, 'flipper_z_compensation', \ + LogText=str(metadata.flipper_z_compensation_current), LogType='Number') + flipper_status = 'OFF' + if abs(metadata.flipper_precession_current) > sys.float_info.epsilon: + flipper_status = 'ON' + api.AddSampleLog(__temporary_workspace__, 'flipper', \ + LogText=flipper_status, LogType='String') + # coil currents + api.AddSampleLog(__temporary_workspace__, 'C_a', \ + LogText=str(metadata.a_coil_current), LogType='Number') + api.AddSampleLog(__temporary_workspace__, 'C_b', \ + LogText=str(metadata.b_coil_current), LogType='Number') + api.AddSampleLog(__temporary_workspace__, 'C_c', \ + LogText=str(metadata.c_coil_current), LogType='Number') + api.AddSampleLog(__temporary_workspace__, 'C_z', \ + LogText=str(metadata.z_coil_current), LogType='Number') + # type of polarisation + api.AddSampleLog(__temporary_workspace__, 'polarisation', \ + LogText=pol, LogType='String') self.setProperty("OutputWorkspace", __temporary_workspace__) self.log().debug('LoadDNSLegacy: OK') diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/CreateMD.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/CreateMD.py new file mode 100644 index 0000000000000000000000000000000000000000..0690abf6dfb94aed28e132ba1e27a5689c99906b --- /dev/null +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/CreateMD.py @@ -0,0 +1,232 @@ +#pylint: disable=invalid-name,no-init +from mantid.kernel import * +from mantid.api import * +from mantid.simpleapi import * +import numpy as np +import __builtin__ + + +class CreateMD(DataProcessorAlgorithm): + + def _possible_emodes(self): + return ['Elastic', 'Direct', 'Indirect'] + + def _add_sample_log(self, workspace, log_name, log_number): + add_log = self.createChildAlgorithm('AddSampleLog') + add_log.setProperty('Workspace', workspace) + add_log.setProperty('LogName', str(log_name)) + add_log.setProperty('LogText', str(log_number)) + add_log.setProperty('LogType', 'Number') + add_log.execute() + + def _set_goniometer(self, workspace): + + axis0 = ','.join(map(str, ['gl', 0, 0, 1, 1])) + axis1 = ','.join(map(str, ['gs', 1, 0, 0, 1])) + axis2 = ','.join(map(str, ['psi', 0, 1, 0, 1])) + + set_goniometer = self.createChildAlgorithm('SetGoniometer') + set_goniometer.setProperty('Workspace', workspace) + set_goniometer.setProperty('Axis0', axis0) + set_goniometer.setProperty('Axis1', axis1) + set_goniometer.setProperty('Axis2', axis2) + set_goniometer.execute() + + def _set_ub(self, workspace, a, b, c, alpha, beta, gamma, u, v): + set_ub = self.createChildAlgorithm('SetUB') + set_ub.setProperty('Workspace', workspace) + set_ub.setProperty('a', a) + set_ub.setProperty('b', b) + set_ub.setProperty('c', c) + set_ub.setProperty('alpha', alpha) + set_ub.setProperty('beta', beta) + set_ub.setProperty('gamma', gamma) + set_ub.setProperty('u', u) + set_ub.setProperty('v', v) + set_ub.execute() + + def _convert_to_md(self, workspace, analysis_mode): + + # Find the Min Max extents + min_max_alg = self.createChildAlgorithm('ConvertToMDMinMaxGlobal') + min_max_alg.setProperty('InputWorkspace', workspace) + min_max_alg.setProperty('QDimensions', 'Q3D') + min_max_alg.setProperty('dEAnalysisMode', analysis_mode) + min_max_alg.execute() + min_values = min_max_alg.getProperty('MinValues').value + max_values = min_max_alg.getProperty('MaxValues').value + + # Convert to MD + convert_alg = self.createChildAlgorithm('ConvertToMD') + convert_alg.setProperty('InputWorkspace', workspace) + convert_alg.setPropertyValue('OutputWorkspace', 'dummy') + convert_alg.setProperty('QDimensions', 'Q3D') + convert_alg.setProperty('QConversionScales', 'HKL') + convert_alg.setProperty('dEAnalysisMode', analysis_mode) + convert_alg.setProperty('MinValues', min_values) + convert_alg.setProperty('MaxValues', max_values) + convert_alg.execute() + return convert_alg.getProperty('OutputWorkspace').value + + def _merge_runs(self, to_merge): + + merge_alg = self.createChildAlgorithm('MergeMD') + merge_alg.setProperty('InputWorkspaces', to_merge) + merge_alg.setPropertyValue('OutputWorkspace', 'dummy') + merge_alg.execute() + return merge_alg.getProperty('OutputWorkspace').value + + def _single_run(self, input_workspace, emode, psi, gl, gs, alatt=None, angdeg=None, u=None, v=None,): + import numpy as np + ub_params = map(any, [alatt, angdeg, u, v]) + goniometer_params = [psi, gl, gs] + if any(ub_params) and not all(ub_params): + raise ValueError("Either specify all of alatt, angledeg, u, v or none of them") + elif all(ub_params): + if input_workspace.sample().hasOrientedLattice(): + logger.warning("Sample already has a UB. This will not be overwritten by %s. Use ClearUB and re-run."%self.name()) + else: + self._set_ub(workspace=input_workspace, a=alatt[0], b=alatt[1], c=alatt[2], alpha=angdeg[0], beta=angdeg[1], gamma=angdeg[2], u=u, v=v) + + if any(goniometer_params): + self._add_sample_log(workspace=input_workspace, log_name='gl', log_number=gl) + self._add_sample_log(workspace=input_workspace, log_name='gs', log_number=gs) + self._add_sample_log(workspace=input_workspace, log_name='psi', log_number=psi) + self._set_goniometer(workspace=input_workspace) + + output_run = self._convert_to_md(workspace=input_workspace, analysis_mode=emode) + return output_run + + + def category(self): + return 'MDAlgorithms' + + def summary(self): + return 'Creates a mutlidimensional workspace by transforming and combining individual runs.' + + def PyInit(self): + self.declareProperty(StringArrayProperty('InputWorkspaces', values=[], direction=Direction.Input, validator=StringArrayMandatoryValidator()), + doc='Matrix workspace to slice') + + self.declareProperty('Emode', defaultValue='Direct', validator=StringListValidator(self._possible_emodes()), direction=Direction.Input, doc='Analysis mode ' + str(self._possible_emodes()) ) + + self.declareProperty(FloatArrayProperty('Alatt', values=[], validator=FloatArrayMandatoryValidator(), direction=Direction.Input ), doc='Lattice parameters' ) + + self.declareProperty(FloatArrayProperty('Angdeg', values=[], validator=FloatArrayMandatoryValidator(), direction=Direction.Input ), doc='Lattice angles' ) + + self.declareProperty(FloatArrayProperty('u', values=[], validator=FloatArrayMandatoryValidator(), direction=Direction.Input ), doc='Lattice vector parallel to neutron beam' ) + + self.declareProperty(FloatArrayProperty('v', values=[], validator=FloatArrayMandatoryValidator(), direction=Direction.Input ), doc='Lattice vector perpendicular to neutron beam in the horizontal plane' ) + + self.declareProperty(FloatArrayProperty('Psi', values=[], direction=Direction.Input), doc='Psi rotation in degrees. Optional or one entry per run.' ) + + self.declareProperty(FloatArrayProperty('Gl', values=[], direction=Direction.Input), doc='gl rotation in degrees. Optional or one entry per run.' ) + + self.declareProperty(FloatArrayProperty('Gs', values=[], direction=Direction.Input), doc='gs rotation in degrees. Optional or one entry per run.' ) + + self.declareProperty(IMDWorkspaceProperty('OutputWorkspace', '', direction=Direction.Output ), doc='Output MDWorkspace') + + def _validate_inputs(self): + + emode = self.getProperty('Emode').value + alatt = self.getProperty('Alatt').value + angdeg = self.getProperty('Angdeg').value + u = self.getProperty('u').value + v = self.getProperty('v').value + psi = self.getProperty('Psi').value + gl = self.getProperty('Gl').value + gs = self.getProperty('Gs').value + + input_workspaces = self.getProperty("InputWorkspaces").value + + ws_entries = len(input_workspaces) + + if ws_entries < 1: + raise ValueError("Need one or more input workspace") + + if len(u) != 3: + raise ValueError("u must have 3 components") + + if len(v) != 3: + raise ValueError("v must have 3 components") + + if len(alatt) != 3: + raise ValueError("lattice parameters must have 3 components") + + if len(angdeg) != 3: + raise ValueError("Angle must have 3 components") + + if not emode in self._possible_emodes(): + raise ValueError("Unknown emode %s Allowed values are %s" % (emode, self._possible_emodes())) + + if len(psi) > 0 and len(psi) != ws_entries: + raise ValueError("If Psi is given a entry should be provided for every input workspace") + + if len(gl) > 0 and len(gl) != ws_entries: + raise ValueError("If Gl is given a entry should be provided for every input workspace") + + if len(gs) > 0 and len(gs) != ws_entries: + raise ValueError("If Gs is given a entry should be provided for every input workspace") + + + def PyExec(self): + + logger.warning('You are running algorithm %s that is the beta stage of development' % (self.name())) + + emode = self.getProperty('Emode').value + alatt = self.getProperty('Alatt').value + angdeg = self.getProperty('Angdeg').value + u = self.getProperty('u').value + v = self.getProperty('v').value + psi = self.getProperty('Psi').value + gl = self.getProperty('Gl').value + gs = self.getProperty('Gs').value + + input_workspaces = self.getProperty("InputWorkspaces").value + + ws_entries = len(input_workspaces) + + self._validate_inputs() + + if len(psi) == 0: + psi = [0.0] * ws_entries + + if len(gl) == 0: + gl = [0.0] * ws_entries + + if len(gs) == 0: + gs = [0.0] * ws_entries + + output_workspace = None + run_md = None + + to_merge_names = list() + + run_data = zip(input_workspaces, psi, gl, gs) + for run_entry in run_data: + ws_name, psi_entry, gl_entry, gs_entry = run_entry + ws = AnalysisDataService.retrieve(ws_name) + run_md = self._single_run(input_workspace=ws, emode=emode, alatt=alatt, angdeg=angdeg, u=u, v=v, psi=psi_entry, gl=gl_entry, gs=gs_entry) + to_merge_name = ws_name + "_md" + AnalysisDataService.addOrReplace(to_merge_name, run_md) + to_merge_names.append(to_merge_name) + + if len(to_merge_names) > 1: + output_workspace = self._merge_runs(to_merge_names) + else: + output_workspace = AnalysisDataService.retrieve(to_merge_names[0]) + + # Clear out temporary workspaces. + for ws in to_merge_names: + DeleteWorkspace(ws) + + self.setProperty("OutputWorkspace", output_workspace) + + + + + + + + +AlgorithmFactory.subscribe(CreateMD) diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py index b5778fa9c80e0380cd9dc4d1d3b331c64c17f2f9..537d76c3e484a58abd12dd3fa5486188bb8f664c 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py @@ -150,6 +150,9 @@ class ElasticWindowMultiple(DataProcessorAlgorithm): temp = self._get_temperature(input_ws) if temp is not None: temperatures.append(temp) + else: + # No need to output a tmperature workspace if there are no temperatures + self._elt_workspace = '' logger.information('Creating Q and Q^2 workspaces') @@ -328,16 +331,19 @@ class ElasticWindowMultiple(DataProcessorAlgorithm): # Get temperature from log file LoadLog(Workspace=ws_name, Filename=log_path) run_logs = mtd[ws_name].getRun() - tmp = run_logs[self._sample_log_name].value - temp = tmp[len(tmp) - 1] - logger.debug('Temperature %d K found for run: %s' % (temp, run_name)) - return temp - + if self._sample_log_name in run_logs: + tmp = run_logs[self._sample_log_name].value + temp = tmp[len(tmp) - 1] + logger.debug('Temperature %d K found for run: %s' % (temp, run_name)) + return temp + else: + logger.warning('Log entry %s for run %s not found' % (self._sample_log_name, run_name)) else: - # Can't find log file logger.warning('Log file for run %s not found' % run_name) - logger.warning('No temperature found for run: %s' % run_name) - return None + + # Can't find log file + logger.warning('No temperature found for run: %s' % run_name) + return None # Register algorithm with Mantid diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/Fury.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TransformToIqt.py similarity index 87% rename from Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/Fury.py rename to Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TransformToIqt.py index ab8aff547bafaa64f74b506e7e0a53a778fd6715..ab2d4a4c5129930c1eb751de12641d099251eecf 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/Fury.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TransformToIqt.py @@ -7,7 +7,7 @@ import math import os -class Fury(PythonAlgorithm): +class TransformToIqt(PythonAlgorithm): _sample = None _resolution = None @@ -21,29 +21,35 @@ class Fury(PythonAlgorithm): _save = None _dry_run = None + def category(self): - return "Workflow\\MIDAS;PythonAlgorithms" + return "Workflow\\Inelastic;PythonAlgorithms" + + + def summary(self): + return 'Transforms an inelastic reduction to I(Q, t)' + def PyInit(self): - self.declareProperty(MatrixWorkspaceProperty('Sample', '',\ + self.declareProperty(MatrixWorkspaceProperty('SampleWorkspace', '',\ optional=PropertyMode.Mandatory, direction=Direction.Input), - doc="Name for the Sample workspace.") + doc="Name for the sample workspace.") - self.declareProperty(MatrixWorkspaceProperty('Resolution', '',\ + self.declareProperty(MatrixWorkspaceProperty('ResolutionWorkspace', '',\ optional=PropertyMode.Mandatory, direction=Direction.Input), - doc="Name for the Resolution workspace.") + doc="Name for the resolution workspace.") self.declareProperty(name='EnergyMin', defaultValue=-0.5, doc='Minimum energy for fit. Default=-0.5') self.declareProperty(name='EnergyMax', defaultValue=0.5, doc='Maximum energy for fit. Default=0.5') - self.declareProperty(name='NumBins', defaultValue=1, + self.declareProperty(name='BinReductionFactor', defaultValue=10.0, doc='Decrease total number of spectrum points by this ratio through merging of ' 'intensities from neighbouring bins. Default=1') self.declareProperty(MatrixWorkspaceProperty('ParameterWorkspace', '',\ direction=Direction.Output, optional=PropertyMode.Optional), - doc='Table workspace for saving Fury properties') + doc='Table workspace for saving TransformToIqt properties') self.declareProperty(MatrixWorkspaceProperty('OutputWorkspace', '',\ direction=Direction.Output, optional=PropertyMode.Optional), @@ -76,7 +82,7 @@ class Fury(PythonAlgorithm): if self._plot: self._plot_output() else: - logger.information('Dry run, will not run Fury') + logger.information('Dry run, will not run TransformToIqt') self.setProperty('ParameterWorkspace', self._parameter_table) self.setProperty('OutputWorkspace', self._output_workspace) @@ -88,16 +94,16 @@ class Fury(PythonAlgorithm): """ from IndirectCommon import getWSprefix - self._sample = self.getPropertyValue('Sample') - self._resolution = self.getPropertyValue('Resolution') + self._sample = self.getPropertyValue('SampleWorkspace') + self._resolution = self.getPropertyValue('ResolutionWorkspace') self._e_min = self.getProperty('EnergyMin').value self._e_max = self.getProperty('EnergyMax').value - self._number_points_per_bin = self.getProperty('NumBins').value + self._number_points_per_bin = self.getProperty('BinReductionFactor').value self._parameter_table = self.getPropertyValue('ParameterWorkspace') if self._parameter_table == '': - self._parameter_table = getWSprefix(self._sample) + 'FuryParameters' + self._parameter_table = getWSprefix(self._sample) + 'TransformToIqtParameters' self._output_workspace = self.getPropertyValue('OutputWorkspace') if self._output_workspace == '': @@ -128,13 +134,13 @@ class Fury(PythonAlgorithm): def _calculate_parameters(self): """ - Calculates the Fury parameters and saves in a table workspace. + Calculates the TransformToIqt parameters and saves in a table workspace. """ - CropWorkspace(InputWorkspace=self._sample, OutputWorkspace='__Fury_sample_cropped', + CropWorkspace(InputWorkspace=self._sample, OutputWorkspace='__TransformToIqt_sample_cropped', Xmin=self._e_min, Xmax=self._e_max) - x_data = mtd['__Fury_sample_cropped'].readX(0) + x_data = mtd['__TransformToIqt_sample_cropped'].readX(0) number_input_points = len(x_data) - 1 - num_bins = number_input_points / self._number_points_per_bin + num_bins = int(number_input_points / self._number_points_per_bin) self._e_width = (abs(self._e_min) + abs(self._e_max)) / num_bins try: @@ -167,7 +173,7 @@ class Fury(PythonAlgorithm): param_table = CreateEmptyTableWorkspace(OutputWorkspace=self._parameter_table) param_table.addColumn('int', 'SampleInputBins') - param_table.addColumn('int', 'NumberBins') + param_table.addColumn('float', 'BinReductionFactor') param_table.addColumn('int', 'SampleOutputBins') param_table.addColumn('float', 'EnergyMin') param_table.addColumn('float', 'EnergyMax') @@ -179,7 +185,7 @@ class Fury(PythonAlgorithm): self._e_min, self._e_max, self._e_width, resolution, resolution_bins]) - DeleteWorkspace('__Fury_sample_cropped') + DeleteWorkspace('__TransformToIqt_sample_cropped') self.setProperty('ParameterWorkspace', param_table) @@ -212,7 +218,7 @@ class Fury(PythonAlgorithm): def _fury(self): """ - Run Fury. + Run TransformToIqt. """ from IndirectCommon import CheckHistZero, CheckHistSame, CheckAnalysers @@ -261,4 +267,4 @@ class Fury(PythonAlgorithm): # Register algorithm with Mantid -AlgorithmFactory.subscribe(Fury) +AlgorithmFactory.subscribe(TransformToIqt) diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/dnsdata.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/dnsdata.py index 97f14ac5e68d1f33ac83c597dc64808f1980f0f3..755c4925c6bda6c9d113c1c7bd19de2574b1eb8e 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/dnsdata.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/dnsdata.py @@ -15,6 +15,7 @@ class DNSdata: self.duration = None self.deterota = 0 self.wavelength = None # Angstrom + self.incident_energy = None # meV self.ndet = 24 self.sample_name = "" self.userid = "" @@ -113,6 +114,7 @@ class DNSdata: line = b2splitted[2].split() self.monochromator_angle = float(line[2]) self.wavelength = float(line[3])*10.0 + self.incident_energy = float(line[4]) # parse block 3 (motors position) b3splitted = map(str.strip, blocks[3].split('#')) diff --git a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt index f1582a8b2e1e9be6eb6563f424cb8d6990f0c5dc..77b67b9edc8f9142c083ae3d3004f4ffe577537f 100644 --- a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt +++ b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt @@ -55,6 +55,7 @@ set ( TEST_PY_FILES UpdatePeakParameterTableValueTest.py SANSSubtractTest.py TimeSliceTest.py + TransformToIqtTest.py ExportSampleLogsToCSVFileTest.py ExportExperimentLogTest.py PoldiMergeTest.py diff --git a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/CreateMDTest.py b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/CreateMDTest.py new file mode 100644 index 0000000000000000000000000000000000000000..956a403cbc20c915352c84b3f13c5a85af40a59e --- /dev/null +++ b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/CreateMDTest.py @@ -0,0 +1,134 @@ +import unittest +import testhelpers +import numpy as np +from mantid.simpleapi import * +from mantid.api import AlgorithmManager, IMDHistoWorkspace, IMDEventWorkspace + + +class CreateMDTest(unittest.TestCase): + + def test_init(self): + alg = AlgorithmManager.create("CreateMD") + alg.initialize() + + def test_must_have_more_than_one_input_workspace(self): + alg = AlgorithmManager.create("CreateMD") + alg.setRethrows(True) + alg.initialize() + self.assertRaises(ValueError, alg.setProperty, "InputWorkspaces", []) + + def test_set_up_madatory(self): + + alg = AlgorithmManager.create("CreateMD") + alg.setRethrows(True) + alg.initialize() + alg.setPropertyValue("OutputWorkspace", "mdworkspace") + alg.setProperty("InputWorkspaces", ['a', 'b']) + alg.setProperty("Emode", "Direct") + alg.setProperty("Alatt", [1,1,1]) + alg.setProperty("Angdeg", [90,90,90]) + alg.setProperty("u", [0,0,1]) + alg.setProperty("v", [1,0,0]) + + def test_psi_right_size(self): + + input_workspace = CreateSampleWorkspace(NumBanks=1, BinWidth=2000) + AddSampleLog(input_workspace, LogName='Ei', LogText='12.0', LogType='Number') + + alg = AlgorithmManager.create("CreateMD") + alg.setRethrows(True) + alg.initialize() + alg.setPropertyValue("OutputWorkspace", "mdworkspace") + alg.setProperty("InputWorkspaces", ['input_workspace']) + alg.setProperty("Emode", "Direct") + alg.setProperty("Alatt", [1,1,1]) + alg.setProperty("Angdeg", [90,90,90]) + alg.setProperty("u", [0,0,1]) + alg.setProperty("v", [1,0,0]) + alg.setProperty("Psi", [0, 0, 0]) # Too large + alg.setProperty("Gl", [0]) # Right size + alg.setProperty("Gs", [0]) # Right size + self.assertRaises(RuntimeError, alg.execute) + DeleteWorkspace(input_workspace) + + def test_gl_right_size(self): + + input_workspace = CreateSampleWorkspace(NumBanks=1, BinWidth=2000) + AddSampleLog(input_workspace, LogName='Ei', LogText='12.0', LogType='Number') + + alg = AlgorithmManager.create("CreateMD") + alg.setRethrows(True) + alg.initialize() + alg.setPropertyValue("OutputWorkspace", "mdworkspace") + alg.setProperty("InputWorkspaces", ['input_workspace']) + alg.setProperty("Emode", "Direct") + alg.setProperty("Alatt", [1,1,1]) + alg.setProperty("Angdeg", [90,90,90]) + alg.setProperty("u", [0,0,1]) + alg.setProperty("v", [1,0,0]) + alg.setProperty("Psi", [0]) # Right size + alg.setProperty("Gl", [0, 0]) # Too many + alg.setProperty("Gs", [0]) # Right size + self.assertRaises(RuntimeError, alg.execute) + DeleteWorkspace(input_workspace) + + def test_gs_right_size(self): + + input_workspace = CreateSampleWorkspace(NumBanks=1, BinWidth=2000) + AddSampleLog(input_workspace, LogName='Ei', LogText='12.0', LogType='Number') + + alg = AlgorithmManager.create("CreateMD") + alg.setRethrows(True) + alg.initialize() + alg.setPropertyValue("OutputWorkspace", "mdworkspace") + alg.setProperty("InputWorkspaces", ['input_workspace']) + alg.setProperty("Emode", "Direct") + alg.setProperty("Alatt", [1,1,1]) + alg.setProperty("Angdeg", [90,90,90]) + alg.setProperty("u", [0,0,1]) + alg.setProperty("v", [1,0,0]) + alg.setProperty("Psi", [0]) # Right size + alg.setProperty("Gl", [0]) # Right size + alg.setProperty("Gs", [0,0]) # Too large + self.assertRaises(RuntimeError, alg.execute) + DeleteWorkspace(input_workspace) + + + def test_execute_single_workspace(self): + + input_workspace = CreateSampleWorkspace(NumBanks=1, BinWidth=2000) + AddSampleLog(input_workspace, LogName='Ei', LogText='12.0', LogType='Number') + + alg = AlgorithmManager.create("CreateMD") + alg.setRethrows(True) + alg.initialize() + alg.setPropertyValue("OutputWorkspace", "mdworkspace") + alg.setProperty("InputWorkspaces", ['input_workspace']) + alg.setProperty("Alatt", [1,1,1]) + alg.setProperty("Angdeg", [90,90,90]) + alg.setProperty("u", [0,0,1]) + alg.setProperty("v", [1,0,0]) + alg.execute() + out_ws = AnalysisDataService.retrieve("mdworkspace") + + self.assertTrue(isinstance(out_ws, IMDEventWorkspace), "Expected an MDEventWorkspace back") + DeleteWorkspace(input_workspace) + + + + + + + + + + + + + + + + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/LoadDNSLegacyTest.py b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/LoadDNSLegacyTest.py index bf8977363dcbcd8fb2e2e425c124506a69166619..d9c5c6df681ff99db6dc698d0bf7e8b3a2a56dc4 100644 --- a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/LoadDNSLegacyTest.py +++ b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/LoadDNSLegacyTest.py @@ -12,7 +12,7 @@ class LoadDNSLegacyTest(unittest.TestCase): outputWorkspaceName = "LoadDNSLegacyTest_Test1" filename = "dn134011vana.d_dat" alg_test = run_algorithm("LoadDNSLegacy", Filename = filename, \ - OutputWorkspace = outputWorkspaceName) + OutputWorkspace = outputWorkspaceName, Polarisation='y') self.assertTrue(alg_test.isExecuted()) @@ -25,14 +25,13 @@ class LoadDNSLegacyTest(unittest.TestCase): self.assertEqual(31461, ws.readY(1)) self.assertEqual(13340, ws.readY(23)) # sample logs - logs = ws.getRun().getLogData() - self.assertEqual('deterota', logs[4].name) - self.assertEqual(-8.54, logs[4].value) + run = ws.getRun() + self.assertEqual(-8.54, run.getProperty('deterota').value) + self.assertEqual(8332872, run.getProperty('mon_sum').value) + self.assertEqual('y', run.getProperty('polarisation').value) # check whether detector bank is rotated - samplePos = ws.getInstrument().getSample().getPos() - beamDirection = V3D(0,0,1) det = ws.getDetector(1) - self.assertAlmostEqual(8.54, det.getTwoTheta(samplePos, beamDirection)*180/pi) + self.assertAlmostEqual(8.54, ws.detectorSignedTwoTheta(det)*180/pi) run_algorithm("DeleteWorkspace", Workspace = outputWorkspaceName) return diff --git a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/TransformToIqtTest.py b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/TransformToIqtTest.py new file mode 100644 index 0000000000000000000000000000000000000000..ac64daa184372cf0ff5cdb01be99549a8036cff2 --- /dev/null +++ b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/TransformToIqtTest.py @@ -0,0 +1,60 @@ +import unittest +from mantid.simpleapi import * +from mantid.api import * + + +class TransformToIqtTest(unittest.TestCase): + + + def setUp(self): + """ + Generate reference result param table. + """ + + CreateEmptyTableWorkspace(OutputWorkspace='__TransformToIqtTest_param') + self._param_table = mtd['__TransformToIqtTest_param'] + + self._param_table.addColumn('int', 'SampleInputBins') + self._param_table.addColumn('float', 'BinReductionFactor') + self._param_table.addColumn('int', 'SampleOutputBins') + self._param_table.addColumn('float', 'EnergyMin') + self._param_table.addColumn('float', 'EnergyMax') + self._param_table.addColumn('float', 'EnergyWidth') + self._param_table.addColumn('float', 'Resolution') + self._param_table.addColumn('int', 'ResolutionBins') + + self._param_table.addRow([1725, 10.0, 172, -0.5, 0.5, 0.00581395, 0.0175, 6]) + + + def test_with_can_reduction(self): + """ + Tests running using the container reduction as a resolution. + """ + + sample = Load('irs26176_graphite002_red') + can = Load('irs26173_graphite002_red') + + params, iqt = TransformToIqt(SampleWorkspace=sample, + ResolutionWorkspace=can, + BinReductionFactor=10) + + self.assertEqual(CheckWorkspacesMatch(params, self._param_table), "Success!") + + + def test_with_resolution_reduction(self): + """ + Tests running using the instrument resolution workspace. + """ + + sample = Load('irs26176_graphite002_red') + resolution = Load('irs26173_graphite002_res') + + params, iqt = TransformToIqt(SampleWorkspace=sample, + ResolutionWorkspace=resolution, + BinReductionFactor=10) + + self.assertEqual(CheckWorkspacesMatch(params, self._param_table), "Success!") + + +if __name__ == '__main__': + unittest.main() diff --git a/Code/Mantid/Framework/PythonInterface/test/testhelpers/CMakeLists.txt b/Code/Mantid/Framework/PythonInterface/test/testhelpers/CMakeLists.txt index 8db79e4b0cec9c095b59655d80d158bc0074fb36..2b4c450e367550a6b658224a4f6832de28493281 100644 --- a/Code/Mantid/Framework/PythonInterface/test/testhelpers/CMakeLists.txt +++ b/Code/Mantid/Framework/PythonInterface/test/testhelpers/CMakeLists.txt @@ -18,7 +18,7 @@ copy_files_to_dir ( "${PY_FILES}" ${CMAKE_CURRENT_SOURCE_DIR} ${OUTPUT_DIR} ############################################################################################# set ( FRAMEWORK_DIR ../../.. ) include_directories ( ${FRAMEWORK_DIR}/CurveFitting/inc ${FRAMEWORK_DIR}/DataHandling/inc ${FRAMEWORK_DIR}/DataObjects/inc - ${FRAMEWORK_DIR}/Nexus/inc ${FRAMEWORK_DIR}/TestHelpers/inc ${FRAMEWORK_DIR}/MDEvents/inc ) + ${FRAMEWORK_DIR}/Nexus/inc ${FRAMEWORK_DIR}/TestHelpers/inc ) # WorkspaceCreationHelper set ( SRC_FILES @@ -32,7 +32,7 @@ set_python_properties( PythonWorkspaceCreationHelper WorkspaceCreationHelper ) set_target_output_directory ( PythonWorkspaceCreationHelper ${OUTPUT_DIR} .pyd ) # Override folder set_property ( TARGET PythonWorkspaceCreationHelper PROPERTY FOLDER "UnitTests/Python" ) -target_link_libraries ( PythonWorkspaceCreationHelper PythonAPIModule DataObjects MDEvents DataHandling ) +target_link_libraries ( PythonWorkspaceCreationHelper PythonAPIModule DataObjects DataHandling ) # Overall testhelpers target add_custom_target ( testhelpers DEPENDS PythonWorkspaceCreationHelper ) diff --git a/Code/Mantid/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp b/Code/Mantid/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp index 0ae46ae1427422bbed19e4acaa778ab12322118a..1e243777f94a463c133dc2a4ba523b62544103a3 100644 --- a/Code/Mantid/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp +++ b/Code/Mantid/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp @@ -14,7 +14,7 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" using namespace WorkspaceCreationHelper; -using namespace Mantid::MDEvents::MDEventsTestHelper; +using namespace Mantid::DataObjects::MDEventsTestHelper; BOOST_PYTHON_FUNCTION_OVERLOADS(create2DWorkspaceWithFullInstrument_overloads, create2DWorkspaceWithFullInstrument, 2, 4) diff --git a/Code/Mantid/Framework/SINQ/CMakeLists.txt b/Code/Mantid/Framework/SINQ/CMakeLists.txt index 8782dbda641ce168a47541186b0fc9ee8c6a7aa6..eca5e9872469ab76fc6665f55709fd70f607c36d 100644 --- a/Code/Mantid/Framework/SINQ/CMakeLists.txt +++ b/Code/Mantid/Framework/SINQ/CMakeLists.txt @@ -143,9 +143,9 @@ endif () # Add to the 'Framework' group in VS set_property ( TARGET SINQ PROPERTY FOLDER "MantidFramework" ) -include_directories ( inc ../MDEvents/inc ) +include_directories ( inc ) -target_link_libraries ( SINQ ${MANTIDLIBS} MDEvents ) +target_link_libraries ( SINQ ${MANTIDLIBS} ) # Add the unit tests directory add_subdirectory ( test ) diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/InvertMDDim.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/InvertMDDim.h index e92ed7537fdafa367e6497958660d668c7382c0e..f6fd6b666e7b0fcadf0ffd4688abbf48f2b7a94b 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/InvertMDDim.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/InvertMDDim.h @@ -31,7 +31,7 @@ #include "MantidSINQ/DllConfig.h" #include "MantidAPI/Algorithm.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidAPI/IMDHistoWorkspace.h" class MANTID_SINQ_DLL InvertMDDim : public Mantid::API::Algorithm { public: diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/MDHistoToWorkspace2D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/MDHistoToWorkspace2D.h index 71a473cdadee11a0a9354e82f9d892c6d29e9ae4..b1ce4050dc790dd5f150f06432547624c8bf2970 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/MDHistoToWorkspace2D.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/MDHistoToWorkspace2D.h @@ -31,7 +31,7 @@ #include "MantidSINQ/DllConfig.h" #include "MantidAPI/Algorithm.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidAPI/IMDHistoWorkspace.h" #include "MantidGeometry/MDGeometry/MDTypes.h" #include "MantidDataObjects/Workspace2D.h" diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/ProjectMD.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/ProjectMD.h index fd786e84432e6185f8447d0cf2dc7f95dfe2c2ae..0ce6a5a1783ef1229cafbe526d25bc389157fbd3 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/ProjectMD.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/ProjectMD.h @@ -30,7 +30,7 @@ #include "MantidSINQ/DllConfig.h" #include "MantidAPI/Algorithm.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidAPI/IMDHistoWorkspace.h" class MANTID_SINQ_DLL ProjectMD : public Mantid::API::Algorithm { public: diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/SINQTranspose3D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/SINQTranspose3D.h index 9814e69252cc62ab6e24f22b34550ea3756702f1..4f256ae119238191270dcb276567f727c89b81e9 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/SINQTranspose3D.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/SINQTranspose3D.h @@ -37,7 +37,7 @@ #include "MantidSINQ/DllConfig.h" #include "MantidAPI/Algorithm.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidAPI/IMDHistoWorkspace.h" class MANTID_SINQ_DLL SINQTranspose3D : public Mantid::API::Algorithm { public: diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/SliceMDHisto.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/SliceMDHisto.h index 480f88dfcbb2af782be1ba632b7478880be40d40..3484d4d0ceee38ad6b69d757f9a124ef5ba3380a 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/SliceMDHisto.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/SliceMDHisto.h @@ -30,7 +30,7 @@ #include "MantidSINQ/DllConfig.h" #include "MantidAPI/Algorithm.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidAPI/IMDHistoWorkspace.h" class MANTID_SINQ_DLL SliceMDHisto : public Mantid::API::Algorithm { public: diff --git a/Code/Mantid/Framework/SINQ/src/InvertMDDim.cpp b/Code/Mantid/Framework/SINQ/src/InvertMDDim.cpp index e7b31cc18f3a80884919319f57b10871ea20381c..80ee9f461f40cc94f19fbf7de32f2a281ef335f9 100644 --- a/Code/Mantid/Framework/SINQ/src/InvertMDDim.cpp +++ b/Code/Mantid/Framework/SINQ/src/InvertMDDim.cpp @@ -8,6 +8,7 @@ * Mark Koennecke, Dezember 2012 */ #include "MantidSINQ/InvertMDDim.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidGeometry/MDGeometry/MDTypes.h" // Register the algorithm into the AlgorithmFactory @@ -16,7 +17,7 @@ DECLARE_ALGORITHM(InvertMDDim) using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid; // A reference to the logger is provided by the base class, it is called g_log. diff --git a/Code/Mantid/Framework/SINQ/src/LoadFlexiNexus.cpp b/Code/Mantid/Framework/SINQ/src/LoadFlexiNexus.cpp index 68dd92f657b1ebd8b275aabe29839cacdc999ab0..716363c687947d65214aa06ac73fd1c47cbdc8e1 100644 --- a/Code/Mantid/Framework/SINQ/src/LoadFlexiNexus.cpp +++ b/Code/Mantid/Framework/SINQ/src/LoadFlexiNexus.cpp @@ -3,7 +3,7 @@ #include "MantidKernel/ArrayProperty.h" #include "MantidKernel/ArrayProperty.h" #include "MantidGeometry/MDGeometry/MDTypes.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidKernel/Utils.h" #include <iostream> #include <fstream> @@ -17,7 +17,7 @@ using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace ::NeXus; // A reference to the logger is provided by the base class, it is called g_log. diff --git a/Code/Mantid/Framework/SINQ/src/ProjectMD.cpp b/Code/Mantid/Framework/SINQ/src/ProjectMD.cpp index ce15f12aa165226fc3ae35ad36cf0a0b11a33b2c..bbdc8f6e6bdab750637ab28fed45f8b78b2ef506 100644 --- a/Code/Mantid/Framework/SINQ/src/ProjectMD.cpp +++ b/Code/Mantid/Framework/SINQ/src/ProjectMD.cpp @@ -1,7 +1,7 @@ #include "MantidSINQ/ProjectMD.h" #include "MantidKernel/ListValidator.h" #include "MantidGeometry/MDGeometry/MDTypes.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #define MAXDIM 10 @@ -11,7 +11,7 @@ DECLARE_ALGORITHM(ProjectMD) using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; // A reference to the logger is provided by the base class, it is called g_log. // It is used to print out information, warning and error messages diff --git a/Code/Mantid/Framework/SINQ/src/SINQHMListener.cpp b/Code/Mantid/Framework/SINQ/src/SINQHMListener.cpp index 1ed6b59a3b1735b33c856707f277ed1b42c50a92..b460e9e5d3f177512d1bbe37b1a695f574cc3a2a 100644 --- a/Code/Mantid/Framework/SINQ/src/SINQHMListener.cpp +++ b/Code/Mantid/Framework/SINQ/src/SINQHMListener.cpp @@ -6,7 +6,7 @@ */ #include "MantidSINQ/SINQHMListener.h" #include "MantidAPI/LiveListenerFactory.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include <Poco/Net/HTTPRequest.h> #include <Poco/Net/HTTPBasicCredentials.h> @@ -19,9 +19,9 @@ #include <sstream> using namespace Mantid::API; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; using namespace Mantid; -using namespace Mantid::MDEvents; using namespace Poco::Net; using namespace Poco::XML; diff --git a/Code/Mantid/Framework/SINQ/src/SINQTranspose3D.cpp b/Code/Mantid/Framework/SINQ/src/SINQTranspose3D.cpp index 79151885fad71b71e677a51837c7f62cf663d469..d3d1aa7561649c5ccef726bc68d14b5f8d0a0a71 100644 --- a/Code/Mantid/Framework/SINQ/src/SINQTranspose3D.cpp +++ b/Code/Mantid/Framework/SINQ/src/SINQTranspose3D.cpp @@ -1,7 +1,7 @@ #include "MantidSINQ/SINQTranspose3D.h" #include "MantidKernel/ListValidator.h" #include "MantidGeometry/MDGeometry/MDTypes.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" // Register the algorithm into the AlgorithmFactory DECLARE_ALGORITHM(SINQTranspose3D) @@ -9,7 +9,7 @@ DECLARE_ALGORITHM(SINQTranspose3D) using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; // A reference to the logger is provided by the base class, it is called g_log. // It is used to print out information, warning and error messages diff --git a/Code/Mantid/Framework/SINQ/src/SliceMDHisto.cpp b/Code/Mantid/Framework/SINQ/src/SliceMDHisto.cpp index 4e245d8fbbae6afe16d5e8b009b0212d1c75cacf..ed8aa53fa6617eca5f741a64f2fa3cca8f7ff4ae 100644 --- a/Code/Mantid/Framework/SINQ/src/SliceMDHisto.cpp +++ b/Code/Mantid/Framework/SINQ/src/SliceMDHisto.cpp @@ -5,7 +5,7 @@ * Mark Koennecke, November 2012 */ #include "MantidSINQ/SliceMDHisto.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidGeometry/MDGeometry/MDTypes.h" #include "MantidKernel/ArrayProperty.h" @@ -15,7 +15,7 @@ DECLARE_ALGORITHM(SliceMDHisto) using namespace Mantid::Kernel; using namespace Mantid::API; using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid; // A reference to the logger is provided by the base class, it is called g_log. diff --git a/Code/Mantid/Framework/SINQ/test/CMakeLists.txt b/Code/Mantid/Framework/SINQ/test/CMakeLists.txt index c80d743e04f457053bc2fecce45c3cb17ade1909..4e822b7d72d697774698f4f75d32b4956d9ddf55 100644 --- a/Code/Mantid/Framework/SINQ/test/CMakeLists.txt +++ b/Code/Mantid/Framework/SINQ/test/CMakeLists.txt @@ -1,7 +1,7 @@ if ( CXXTEST_FOUND ) include_directories ( SYSTEM ${CXXTEST_INCLUDE_DIR} ${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR} ) - include_directories ( ../../CurveFitting/inc ../../MDEvents/inc ../../MDAlgorithms/inc ../../Nexus/inc ../../NexusCPP/inc ../../TestHelpers/inc) + include_directories ( ../../CurveFitting/inc ../../MDAlgorithms/inc ../../Nexus/inc ../../NexusCPP/inc ../../TestHelpers/inc) set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp ../../TestHelpers/src/ComponentCreationHelper.cpp @@ -9,10 +9,10 @@ if ( CXXTEST_FOUND ) if ( GMOCK_FOUND AND GTEST_FOUND ) cxxtest_add_test ( PSISINQTest ${TEST_FILES} ${GMOCK_TEST_FILES}) - target_link_libraries ( PSISINQTest SINQ CurveFitting ${MANTIDLIBS} MDEvents ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES} ) + target_link_libraries ( PSISINQTest SINQ CurveFitting ${MANTIDLIBS} ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES} ) else () cxxtest_add_test ( PSISINQTest ${TEST_FILES} ) - target_link_libraries ( PSISINQTest SINQ CurveFitting ${MANTIDLIBS} MDEvents ) + target_link_libraries ( PSISINQTest SINQ CurveFitting ${MANTIDLIBS} ) endif() # Test data add_dependencies ( PSISINQTest StandardTestData ) diff --git a/Code/Mantid/Framework/SINQ/test/InvertMDDimTest.h b/Code/Mantid/Framework/SINQ/test/InvertMDDimTest.h index 16530d57525079e2cb4fb598805249679bd14053..9f3c35d4fbb622dfd4d43a4751b4de096d7614d3 100644 --- a/Code/Mantid/Framework/SINQ/test/InvertMDDimTest.h +++ b/Code/Mantid/Framework/SINQ/test/InvertMDDimTest.h @@ -9,13 +9,13 @@ #include "MantidAPI/Run.h" #include "MantidKernel/Property.h" #include "MantidKernel/cow_ptr.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid::Kernel; using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; class InvertMDDimTest: public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/SINQ/test/MDHistoToWorkspace2DTest.h b/Code/Mantid/Framework/SINQ/test/MDHistoToWorkspace2DTest.h index f6058e2b17660c5463115215890d744b10c49c22..dba5f40f2166866eb94668d3e69185816e856318 100644 --- a/Code/Mantid/Framework/SINQ/test/MDHistoToWorkspace2DTest.h +++ b/Code/Mantid/Framework/SINQ/test/MDHistoToWorkspace2DTest.h @@ -9,13 +9,13 @@ #include "MantidAPI/Run.h" #include "MantidKernel/Property.h" #include "MantidKernel/cow_ptr.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid::Kernel; using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; class MDHistoToWorkspace2DTest: public CxxTest::TestSuite { public: diff --git a/Code/Mantid/Framework/SINQ/test/ProjectMDTest.h b/Code/Mantid/Framework/SINQ/test/ProjectMDTest.h index 5c4a6665118a46affe5dd45e34160afc45444e1b..38dba8df0fa9eac639ace53155c67e3b421de976 100644 --- a/Code/Mantid/Framework/SINQ/test/ProjectMDTest.h +++ b/Code/Mantid/Framework/SINQ/test/ProjectMDTest.h @@ -9,13 +9,13 @@ #include "MantidAPI/Run.h" #include "MantidKernel/Property.h" #include "MantidKernel/cow_ptr.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid::Kernel; using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; class ProjectMDTest: public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/SINQ/test/SliceMDHistoTest.h b/Code/Mantid/Framework/SINQ/test/SliceMDHistoTest.h index 962d5505bb97143cddc300daf34947656a764d21..f3891bf236ecd008cc7063c1815ca5f539075f41 100644 --- a/Code/Mantid/Framework/SINQ/test/SliceMDHistoTest.h +++ b/Code/Mantid/Framework/SINQ/test/SliceMDHistoTest.h @@ -10,13 +10,13 @@ #include "MantidAPI/Run.h" #include "MantidKernel/Property.h" #include "MantidKernel/cow_ptr.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid::Kernel; using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; class SliceMDHistoTest: public CxxTest::TestSuite { public: diff --git a/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/BinaryOperationMDTestHelper.h b/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/BinaryOperationMDTestHelper.h index 5bccc36be4531d2b31ff62edff4695d20e8259e6..d28995bc17017c20f601178cde34b7c94c444b77 100644 --- a/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/BinaryOperationMDTestHelper.h +++ b/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/BinaryOperationMDTestHelper.h @@ -6,11 +6,11 @@ #ifndef MANTID_MDALGORITHMS_BINARYOPERATIONMDTESTHELPER_H_ #define MANTID_MDALGORITHMS_BINARYOPERATIONMDTESTHELPER_H_ -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" namespace BinaryOperationMDTestHelper { /// Run a binary algorithm. -DLLExport Mantid::MDEvents::MDHistoWorkspace_sptr +DLLExport Mantid::DataObjects::MDHistoWorkspace_sptr doTest(std::string algoName, std::string lhs, std::string rhs, std::string outName, bool succeeds = true, std::string otherProp = "", std::string otherPropValue = ""); @@ -19,7 +19,7 @@ doTest(std::string algoName, std::string lhs, std::string rhs, namespace UnaryOperationMDTestHelper { /// Run a unary algorithm. -DLLExport Mantid::MDEvents::MDHistoWorkspace_sptr +DLLExport Mantid::DataObjects::MDHistoWorkspace_sptr doTest(std::string algoName, std::string inName, std::string outName, bool succeeds = true, std::string otherProp = "", std::string otherPropValue = ""); diff --git a/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/MDAlgorithmsTestHelper.h b/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/MDAlgorithmsTestHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..3de9dc1e8dfe47ea227ac98aa2f3b13698b6e866 --- /dev/null +++ b/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/MDAlgorithmsTestHelper.h @@ -0,0 +1,24 @@ +/********************************************************************************* + * PLEASE READ THIS!!!!!!! + * + * This header MAY ONLY be included in the MDalgorithms package + *********************************************************************************/ +#ifndef MDALGORITHMSTESTHELPER_H +#define MDALGORITHMSTESTHELPER_H + +#include "MantidDataObjects/MDEventFactory.h" + +namespace Mantid { +namespace MDAlgorithms { + +namespace MDAlgorithmsTestHelper { + +DataObjects::MDEventWorkspace3Lean::sptr +makeFileBackedMDEW(const std::string &wsName, bool fileBacked, + long numEvents = 10000, Kernel::SpecialCoordinateSystem coord = Kernel::None); + +} // namespace +} +} + +#endif diff --git a/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/MDEventsTestHelper.h b/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/MDEventsTestHelper.h index f8a69de9bc935c4dbc9c5d2d8eb30a4c3b164dea..e3135117444b5e963deb5c5a4f2717f1eab51c51 100644 --- a/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/MDEventsTestHelper.h +++ b/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/MDEventsTestHelper.h @@ -3,24 +3,23 @@ * * This header MAY NOT be included in any test from a package below the level *of - * MDEvents (e.g. Kernel, Geometry, API, DataObjects). + * DataObjects (e.g. Kernel, Geometry, API). *********************************************************************************/ #ifndef MDEVENTSTEST_HELPER_H #define MDEVENTSTEST_HELPER_H -#include "MantidDataObjects/EventWorkspace.h" -#include "MantidKernel/DateAndTime.h" -#include "MantidKernel/Utils.h" #include "MantidAPI/BoxController.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDLeanEvent.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidKernel/SingletonHolder.h" +#include "MantidDataObjects/EventWorkspace.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDLeanEvent.h" +#include "MantidKernel/DateAndTime.h" +#include "MantidKernel/Utils.h" namespace Mantid { -namespace MDEvents { +namespace DataObjects { /** Set of helper methods for testing MDEventWorkspace things * @@ -46,22 +45,22 @@ createDiffractionEventWorkspace(int numEvents, int numPixels = 400, * @param fileBacked :: true for file-backed * @return MDEW sptr */ -Mantid::MDEvents::MDEventWorkspace3Lean::sptr -makeFileBackedMDEW(std::string wsName, bool fileBacked, long numEvents = 10000, - Kernel::SpecialCoordinateSystem coord = Kernel::None); +MDEventWorkspace3Lean::sptr +makeFakeMDEventWorkspace(const std::string & wsName, long numEvents = 10000, + Kernel::SpecialCoordinateSystem coord = Kernel::None); /// Make a fake n-dimensional MDHistoWorkspace -Mantid::MDEvents::MDHistoWorkspace_sptr +MDHistoWorkspace_sptr makeFakeMDHistoWorkspace(double signal, size_t numDims, size_t numBins = 10, coord_t max = 10.0, double errorSquared = 1.0, std::string name = "", double numEvents = 1.0); /// More general fake n-dimensionsal MDHistoWorkspace -Mantid::MDEvents::MDHistoWorkspace_sptr makeFakeMDHistoWorkspaceGeneral( +Mantid::DataObjects::MDHistoWorkspace_sptr makeFakeMDHistoWorkspaceGeneral( size_t numDims, double signal, double errorSquared, size_t *numBins, coord_t *min, coord_t *max, std::string name = ""); /// More general fake n-dimensionsal MDHistoWorkspace -Mantid::MDEvents::MDHistoWorkspace_sptr makeFakeMDHistoWorkspaceGeneral( +Mantid::DataObjects::MDHistoWorkspace_sptr makeFakeMDHistoWorkspaceGeneral( size_t numDims, double signal, double errorSquared, size_t *numBins, coord_t *min, coord_t *max, std::vector<std::string> names, std::string name = ""); @@ -82,13 +81,13 @@ Mantid::MDEvents::MDHistoWorkspace_sptr makeFakeMDHistoWorkspaceGeneral( * @return shared ptr to the created workspace */ template <typename MDE, size_t nd> -boost::shared_ptr<Mantid::MDEvents::MDEventWorkspace<MDE, nd>> +boost::shared_ptr<Mantid::DataObjects::MDEventWorkspace<MDE, nd>> makeAnyMDEW(size_t splitInto, coord_t min, coord_t max, size_t numEventsPerBox = 0, std::string wsName = "", std::string axisNameFormat = "Axis%d", std::string axisIdFormat = "Axis%d") { - boost::shared_ptr<Mantid::MDEvents::MDEventWorkspace<MDE, nd>> out( - new Mantid::MDEvents::MDEventWorkspace<MDE, nd>()); + boost::shared_ptr<Mantid::DataObjects::MDEventWorkspace<MDE, nd>> out( + new Mantid::DataObjects::MDEventWorkspace<MDE, nd>()); Mantid::API::BoxController_sptr bc = out->getBoxController(); bc->setSplitThreshold(100); bc->setSplitInto(splitInto); @@ -141,22 +140,22 @@ makeAnyMDEW(size_t splitInto, coord_t min, coord_t max, /** Make a MDEventWorkspace with MDLeanEvents */ template <size_t nd> boost::shared_ptr< - Mantid::MDEvents::MDEventWorkspace<Mantid::MDEvents::MDLeanEvent<nd>, nd>> + MDEventWorkspace<MDLeanEvent<nd>, nd>> makeMDEW(size_t splitInto, coord_t min, coord_t max, size_t numEventsPerBox = 0) { - return makeAnyMDEW<Mantid::MDEvents::MDLeanEvent<nd>, nd>(splitInto, min, max, - numEventsPerBox); + return makeAnyMDEW<MDLeanEvent<nd>, nd>(splitInto, min, max, + numEventsPerBox); } /** Make a MDEventWorkspace with MDEvents - updated to split dims by splitInto, * not 10 */ template <size_t nd> boost::shared_ptr< - Mantid::MDEvents::MDEventWorkspace<Mantid::MDEvents::MDEvent<nd>, nd>> + MDEventWorkspace<MDEvent<nd>, nd>> makeMDEWFull(size_t splitInto, coord_t min, coord_t max, size_t numEventsPerBox = 0) { - return makeAnyMDEW<Mantid::MDEvents::MDEvent<nd>, nd>(splitInto, min, max, - numEventsPerBox); + return makeAnyMDEW<MDEvent<nd>, nd>(splitInto, min, max, + numEventsPerBox); } //===================================================================================== diff --git a/Code/Mantid/Framework/TestHelpers/src/BinaryOperationMDTestHelper.cpp b/Code/Mantid/Framework/TestHelpers/src/BinaryOperationMDTestHelper.cpp index 211733c0a6caa003a0bf6e7252c1c2a2ecdb4629..2ce5c6d1ca51f8d0a936e3716e82575e0448957f 100644 --- a/Code/Mantid/Framework/TestHelpers/src/BinaryOperationMDTestHelper.cpp +++ b/Code/Mantid/Framework/TestHelpers/src/BinaryOperationMDTestHelper.cpp @@ -3,25 +3,21 @@ * * These functions MAY ONLY be used in a test in the MDAlgorithms package. *********************************************************************************/ +#include "MantidTestHelpers/BinaryOperationMDTestHelper.h" + #include "MantidAPI/IMDEventWorkspace.h" +#include "MantidAPI/FrameworkManager.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidDataObjects/WorkspaceSingleValue.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" #include "MantidMDAlgorithms/BinaryOperationMD.h" -#include "MantidMDEvents/MDHistoWorkspace.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidTestHelpers/BinaryOperationMDTestHelper.h" -#include "MantidAPI/FrameworkManager.h" -#include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> + using namespace Mantid; using namespace Mantid::MDAlgorithms; using namespace Mantid::API; using namespace Mantid::DataObjects; -using namespace Mantid::MDEvents; namespace BinaryOperationMDTestHelper { diff --git a/Code/Mantid/Framework/TestHelpers/src/MDAlgorithmsTestHelper.cpp b/Code/Mantid/Framework/TestHelpers/src/MDAlgorithmsTestHelper.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c00f8a21afa317cc3c95ccf38bcc56d2df6a1ad9 --- /dev/null +++ b/Code/Mantid/Framework/TestHelpers/src/MDAlgorithmsTestHelper.cpp @@ -0,0 +1,65 @@ +/********************************************************************************* + * PLEASE READ THIS!!!!!!! + * + * This collection of functions MAY ONLY be used in packages above MDAlgorithms + *********************************************************************************/ +#include "MantidTestHelpers/MDAlgorithmsTestHelper.h" + +#include "MantidAPI/AnalysisDataService.h" +#include "MantidAPI/FrameworkManager.h" +#include "MantidTestHelpers/MDEventsTestHelper.h" + +namespace Mantid { +using namespace API; +using namespace DataObjects; + +namespace MDAlgorithms { + +/** Set of helper methods for testing MDEventWorkspace things + * + * */ +namespace MDAlgorithmsTestHelper { + +/** Make a (optionally) file backed MDEventWorkspace with nEvents fake data + *points + * the points are randomly distributed within the box (nEvents>0) or + *homoheneously and regularly spread through the box (nEvents<0) + * + * @param wsName :: name of the workspace in ADS + * @param fileBacked :: true for file-backed + * @param numEvents :: number of events in the target workspace distributed + *randomly if numEvents>0 or regularly & homogeneously if numEvents<0 + * coord :: Required coordinate system + * @return MDEW sptr + */ +DataObjects::MDEventWorkspace3Lean::sptr +makeFileBackedMDEW(const std::string &wsName, bool fileBacked, long numEvents, + Kernel::SpecialCoordinateSystem coord) { + // ---------- Make a file-backed MDEventWorkspace ----------------------- + std::string snEvents = boost::lexical_cast<std::string>(numEvents); + MDEventWorkspace3Lean::sptr ws1 = + MDEventsTestHelper::makeMDEW<3>(10, 0.0, 10.0, 0); + ws1->getBoxController()->setSplitThreshold(100); + ws1->setCoordinateSystem(coord); + Mantid::API::AnalysisDataService::Instance().addOrReplace( + wsName, boost::dynamic_pointer_cast<Mantid::API::IMDEventWorkspace>(ws1)); + FrameworkManager::Instance().exec("FakeMDEventData", 6, "InputWorkspace", + wsName.c_str(), "UniformParams", + snEvents.c_str(), "RandomizeSignal", "1"); + if (fileBacked) { + std::string filename = wsName + ".nxs"; + auto saver = FrameworkManager::Instance().exec( + "SaveMD", 4, "InputWorkspace", wsName.c_str(), "Filename", + filename.c_str()); + FrameworkManager::Instance().exec( + "LoadMD", 8, "OutputWorkspace", wsName.c_str(), "Filename", + saver->getPropertyValue("Filename").c_str(), "FileBackEnd", "1", + "Memory", "0"); + } + return boost::dynamic_pointer_cast<MDEventWorkspace3Lean>( + Mantid::API::AnalysisDataService::Instance().retrieve(wsName)); +} + +} // namespace +} +} diff --git a/Code/Mantid/Framework/TestHelpers/src/MDEventsTestHelper.cpp b/Code/Mantid/Framework/TestHelpers/src/MDEventsTestHelper.cpp index 6fa5be11b7fcf19742f7bfd2dfcb6770dc9845be..9edf6de4d8ca28c4ebde00cdc653684a0e648d5f 100644 --- a/Code/Mantid/Framework/TestHelpers/src/MDEventsTestHelper.cpp +++ b/Code/Mantid/Framework/TestHelpers/src/MDEventsTestHelper.cpp @@ -5,37 +5,44 @@ *below * the level of MDEvents (e.g. Kernel, Geometry, API, DataObjects). *********************************************************************************/ - +#include "MantidAPI/BoxController.h" +#include "MantidAPI/ExperimentInfo.h" +#include "MantidAPI/FileFinder.h" +#include "MantidAPI/FrameworkManager.h" #include "MantidAPI/MatrixWorkspace.h" -#include "MantidDataHandling/LoadInstrument.h" + #include "MantidDataObjects/EventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" + #include "MantidGeometry/Instrument.h" +#include "MantidGeometry/Instrument/InstrumentDefinitionParser.h" +#include "MantidGeometry/MDGeometry/MDHistoDimension.h" #include "MantidGeometry/MDGeometry/MDTypes.h" + #include "MantidKernel/cow_ptr.h" #include "MantidKernel/DateAndTime.h" +#include "MantidKernel/Strings.h" #include "MantidKernel/Utils.h" -#include "MantidAPI/BoxController.h" -#include "MantidMDEvents/MDEventWorkspace.h" + #include "MantidTestHelpers/FacilityHelper.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidAPI/FrameworkManager.h" -#include "MantidGeometry/MDGeometry/MDHistoDimension.h" -#include "MantidAPI/ExperimentInfo.h" + #include <boost/make_shared.hpp> + #include <Poco/File.h> +namespace Mantid { +namespace DataObjects { + +using namespace Mantid::API; using Mantid::DataObjects::EventWorkspace_sptr; -using Mantid::Kernel::DateAndTime; -using Mantid::DataHandling::LoadInstrument; using Mantid::DataObjects::EventWorkspace; -using Mantid::API::FrameworkManager; +using Mantid::Geometry::InstrumentDefinitionParser; using Mantid::Geometry::MDHistoDimension_sptr; using Mantid::Geometry::MDHistoDimension; -using namespace Mantid::API; - -namespace Mantid { -namespace MDEvents { +using Mantid::Kernel::DateAndTime; +namespace Strings = Mantid::Kernel::Strings; /** Set of helper methods for testing MDEventWorkspace things * @@ -53,25 +60,19 @@ namespace MDEventsTestHelper { */ EventWorkspace_sptr createDiffractionEventWorkspace(int numEvents, int numPixels, int numBins) { - FacilityHelper::ScopedFacilities loadTESTFacility( - "IDFs_for_UNIT_TESTING/UnitTestFacilities.xml", "TEST"); - double binDelta = 10.0; EventWorkspace_sptr retVal(new EventWorkspace); retVal->initialize(numPixels, 1, 1); // --------- Load the instrument ----------- - LoadInstrument *loadInst = new LoadInstrument(); - loadInst->initialize(); - loadInst->setPropertyValue("Filename", - "IDFs_for_UNIT_TESTING/MINITOPAZ_Definition.xml"); - loadInst->setProperty<Mantid::API::MatrixWorkspace_sptr>("Workspace", retVal); - loadInst->execute(); - delete loadInst; - // Populate the instrument parameters in this workspace - this works around a - // bug + const std::string filename = FileFinder::Instance().getFullPath( + "IDFs_for_UNIT_TESTING/MINITOPAZ_Definition.xml"); + InstrumentDefinitionParser parser; + parser.initialize(filename, "MINITOPAZ", Strings::loadFile(filename)); + auto instrument = parser.parseXML(NULL); retVal->populateInstrumentParameters(); + retVal->setInstrument(instrument); DateAndTime run_start("2010-01-01T00:00:00"); @@ -116,43 +117,32 @@ createDiffractionEventWorkspace(int numEvents, int numPixels, int numBins) { } //===================================================================================== -/** Make a (optionally) file backed MDEventWorkspace with nEvents fake data +/** Make an MDEventWorkspace with nEvents fake data *points * the points are randomly distributed within the box (nEvents>0) or *homoheneously and regularly spread through the box (nEvents<0) * * @param wsName :: name of the workspace in ADS - * @param fileBacked :: true for file-backed * @param numEvents :: number of events in the target workspace distributed *randomly if numEvents>0 or regularly & homogeneously if numEvents<0 + * coord :: Required coordinate system * @return MDEW sptr */ -MDEventWorkspace3Lean::sptr -makeFileBackedMDEW(std::string wsName, bool fileBacked, long numEvents, - Kernel::SpecialCoordinateSystem coord) { +MDEventWorkspace3Lean::sptr makeFakeMDEventWorkspace(const std::string &wsName, + long numEvents, Kernel::SpecialCoordinateSystem coord) { // ---------- Make a file-backed MDEventWorkspace ----------------------- std::string snEvents = boost::lexical_cast<std::string>(numEvents); MDEventWorkspace3Lean::sptr ws1 = MDEventsTestHelper::makeMDEW<3>(10, 0.0, 10.0, 0); ws1->setCoordinateSystem(coord); ws1->getBoxController()->setSplitThreshold(100); - Mantid::API::AnalysisDataService::Instance().addOrReplace( + API::AnalysisDataService::Instance().addOrReplace( wsName, boost::dynamic_pointer_cast<Mantid::API::IMDEventWorkspace>(ws1)); FrameworkManager::Instance().exec("FakeMDEventData", 6, "InputWorkspace", wsName.c_str(), "UniformParams", snEvents.c_str(), "RandomizeSignal", "1"); - if (fileBacked) { - std::string filename = wsName + ".nxs"; - Mantid::API::IAlgorithm_sptr saver = FrameworkManager::Instance().exec( - "SaveMD", 4, "InputWorkspace", wsName.c_str(), "Filename", - filename.c_str()); - FrameworkManager::Instance().exec( - "LoadMD", 8, "OutputWorkspace", wsName.c_str(), "Filename", - saver->getPropertyValue("Filename").c_str(), "FileBackEnd", "1", - "Memory", "0"); - } return boost::dynamic_pointer_cast<MDEventWorkspace3Lean>( - Mantid::API::AnalysisDataService::Instance().retrieve(wsName)); + API::AnalysisDataService::Instance().retrieve(wsName)); } //------------------------------------------------------------------------------------- @@ -222,30 +212,28 @@ std::vector<MDLeanEvent<1>> makeMDEvents1(size_t num) { * @param numEvents :: optional number of events in each bin. Default 1.0 * @return the MDHisto */ -Mantid::MDEvents::MDHistoWorkspace_sptr +Mantid::DataObjects::MDHistoWorkspace_sptr makeFakeMDHistoWorkspace(double signal, size_t numDims, size_t numBins, coord_t max, double errorSquared, std::string name, double numEvents) { - Mantid::MDEvents::MDHistoWorkspace *ws = NULL; + MDHistoWorkspace *ws = NULL; if (numDims == 1) { - ws = new Mantid::MDEvents::MDHistoWorkspace(MDHistoDimension_sptr( + ws = new MDHistoWorkspace(MDHistoDimension_sptr( new MDHistoDimension("x", "x", "m", 0.0, max, numBins))); } else if (numDims == 2) { - ws = new Mantid::MDEvents::MDHistoWorkspace( - MDHistoDimension_sptr( - new MDHistoDimension("x", "x", "m", 0.0, max, numBins)), - MDHistoDimension_sptr( - new MDHistoDimension("y", "y", "m", 0.0, max, numBins))); + ws = new MDHistoWorkspace(MDHistoDimension_sptr(new MDHistoDimension( + "x", "x", "m", 0.0, max, numBins)), + MDHistoDimension_sptr(new MDHistoDimension( + "y", "y", "m", 0.0, max, numBins))); } else if (numDims == 3) { - ws = new Mantid::MDEvents::MDHistoWorkspace( - MDHistoDimension_sptr( - new MDHistoDimension("x", "x", "m", 0.0, max, numBins)), - MDHistoDimension_sptr( - new MDHistoDimension("y", "y", "m", 0.0, max, numBins)), - MDHistoDimension_sptr( - new MDHistoDimension("z", "z", "m", 0.0, max, numBins))); + ws = new MDHistoWorkspace(MDHistoDimension_sptr(new MDHistoDimension( + "x", "x", "m", 0.0, max, numBins)), + MDHistoDimension_sptr(new MDHistoDimension( + "y", "y", "m", 0.0, max, numBins)), + MDHistoDimension_sptr(new MDHistoDimension( + "z", "z", "m", 0.0, max, numBins))); } else if (numDims == 4) { - ws = new Mantid::MDEvents::MDHistoWorkspace( + ws = new MDHistoWorkspace( MDHistoDimension_sptr( new MDHistoDimension("x", "x", "m", 0.0, max, numBins)), MDHistoDimension_sptr( @@ -260,7 +248,7 @@ makeFakeMDHistoWorkspace(double signal, size_t numDims, size_t numBins, throw std::runtime_error( " invalid or unsupported number of dimensions given"); - Mantid::MDEvents::MDHistoWorkspace_sptr ws_sptr(ws); + MDHistoWorkspace_sptr ws_sptr(ws); ws_sptr->setTo(signal, errorSquared, numEvents); ws_sptr->addExperimentInfo(ExperimentInfo_sptr(new ExperimentInfo())); if (!name.empty()) @@ -281,7 +269,7 @@ makeFakeMDHistoWorkspace(double signal, size_t numDims, size_t numBins, * @param name :: optional name * @return the MDHisto */ -Mantid::MDEvents::MDHistoWorkspace_sptr +MDHistoWorkspace_sptr makeFakeMDHistoWorkspaceGeneral(size_t numDims, double signal, double errorSquared, size_t *numBins, coord_t *min, coord_t *max, std::string name) { @@ -296,9 +284,9 @@ makeFakeMDHistoWorkspaceGeneral(size_t numDims, double signal, dimensions.push_back(MDHistoDimension_sptr(new MDHistoDimension( names[d], names[d], "m", min[d], max[d], numBins[d]))); - Mantid::MDEvents::MDHistoWorkspace *ws = NULL; - ws = new Mantid::MDEvents::MDHistoWorkspace(dimensions); - Mantid::MDEvents::MDHistoWorkspace_sptr ws_sptr(ws); + MDHistoWorkspace *ws = NULL; + ws = new MDHistoWorkspace(dimensions); + MDHistoWorkspace_sptr ws_sptr(ws); ws_sptr->setTo(signal, errorSquared, 1.0 /* num events */); if (!name.empty()) AnalysisDataService::Instance().addOrReplace(name, ws_sptr); @@ -319,7 +307,7 @@ makeFakeMDHistoWorkspaceGeneral(size_t numDims, double signal, * @param name :: optional name * @return the MDHisto */ -Mantid::MDEvents::MDHistoWorkspace_sptr makeFakeMDHistoWorkspaceGeneral( +MDHistoWorkspace_sptr makeFakeMDHistoWorkspaceGeneral( size_t numDims, double signal, double errorSquared, size_t *numBins, coord_t *min, coord_t *max, std::vector<std::string> names, std::string name) { @@ -328,9 +316,9 @@ Mantid::MDEvents::MDHistoWorkspace_sptr makeFakeMDHistoWorkspaceGeneral( dimensions.push_back(MDHistoDimension_sptr(new MDHistoDimension( names[d], names[d], "m", min[d], max[d], numBins[d]))); - Mantid::MDEvents::MDHistoWorkspace *ws = NULL; - ws = new Mantid::MDEvents::MDHistoWorkspace(dimensions); - Mantid::MDEvents::MDHistoWorkspace_sptr ws_sptr(ws); + MDHistoWorkspace *ws = NULL; + ws = new MDHistoWorkspace(dimensions); + MDHistoWorkspace_sptr ws_sptr(ws); ws_sptr->setTo(signal, errorSquared, 1.0 /* num events */); if (!name.empty()) AnalysisDataService::Instance().addOrReplace(name, ws_sptr); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt b/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt index 48369aceee03cb65bee5900a628675b844836fea..1526855475ab4ea071b8cc85c0426944c839a817 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt +++ b/Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt @@ -2,6 +2,7 @@ set ( SRC_FILES src/DataComparison.cpp src/DirectConvertToEnergy.cpp src/Homer.cpp + src/Indirect/AbsorptionCorrections.cpp src/Indirect/ApplyCorr.cpp src/Indirect/CalcCorr.cpp src/Indirect/ConvFit.cpp @@ -84,6 +85,7 @@ set ( INC_FILES inc/MantidQtCustomInterfaces/DllConfig.h inc/MantidQtCustomInterfaces/Homer.h inc/MantidQtCustomInterfaces/Indirect/IDATab.h + inc/MantidQtCustomInterfaces/Indirect/AbsorptionCorrections.h inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h inc/MantidQtCustomInterfaces/Indirect/ConvFit.h @@ -173,6 +175,7 @@ set ( MOC_FILES inc/MantidQtCustomInterfaces/Background.h inc/MantidQtCustomInterfaces/DirectConvertToEnergy.h inc/MantidQtCustomInterfaces/Homer.h inc/MantidQtCustomInterfaces/Indirect/IDATab.h + inc/MantidQtCustomInterfaces/Indirect/AbsorptionCorrections.h inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h inc/MantidQtCustomInterfaces/Indirect/ConvFit.h @@ -241,6 +244,7 @@ set ( MOC_FILES inc/MantidQtCustomInterfaces/Background.h set ( UI_FILES inc/MantidQtCustomInterfaces/AddWorkspace.ui inc/MantidQtCustomInterfaces/DataComparison.ui inc/MantidQtCustomInterfaces/DirectConvertToEnergy.ui + inc/MantidQtCustomInterfaces/Indirect/AbsorptionCorrections.ui inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.ui inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui inc/MantidQtCustomInterfaces/Indirect/ConvFit.ui diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/AbsorptionCorrections.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/AbsorptionCorrections.h new file mode 100644 index 0000000000000000000000000000000000000000..629776a10e7a3753cebfbedfdb1f1f86d145cbc1 --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/AbsorptionCorrections.h @@ -0,0 +1,41 @@ +#ifndef MANTIDQTCUSTOMINTERFACESIDA_ABSORPTIONCORRECTIONS_H_ +#define MANTIDQTCUSTOMINTERFACESIDA_ABSORPTIONCORRECTIONS_H_ + +#include "ui_AbsorptionCorrections.h" +#include "IDATab.h" + +namespace MantidQt +{ +namespace CustomInterfaces +{ +namespace IDA +{ + class DLLExport AbsorptionCorrections : public IDATab + { + Q_OBJECT + + public: + AbsorptionCorrections(QWidget * parent = 0); + + private: + virtual void setup(); + virtual void run(); + virtual bool validate(); + virtual void loadSettings(const QSettings & settings); + + private slots: + virtual void algorithmComplete(bool error); + + private: + void addSaveWorkspace(QString wsName); + void addShapeSpecificSampleOptions(Mantid::API::IAlgorithm_sptr alg, QString shape); + void addShapeSpecificCanOptions(Mantid::API::IAlgorithm_sptr alg, QString shape); + + Ui::AbsorptionCorrections m_uiForm; + + }; +} // namespace IDA +} // namespace CustomInterfaces +} // namespace MantidQt + +#endif /* MANTIDQTCUSTOMINTERFACESIDA_ABSORPTIONCORRECTIONS_H_ */ diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/AbsorptionCorrections.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/AbsorptionCorrections.ui new file mode 100644 index 0000000000000000000000000000000000000000..c9e9ff8fb9e108f882c33110dd9311acbab49d8a --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/AbsorptionCorrections.ui @@ -0,0 +1,745 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>AbsorptionCorrections</class> + <widget class="QWidget" name="AbsorptionCorrections"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>575</width> + <height>488</height> + </rect> + </property> + <property name="windowTitle"> + <string>Absoprtion Corrections</string> + </property> + <layout class="QVBoxLayout" name="loAbsorptionCorrections"> + <item> + <widget class="QGroupBox" name="gbInput"> + <property name="title"> + <string>Input</string> + </property> + <layout class="QGridLayout" name="gridLayout_11"> + <item row="1" column="0"> + <widget class="QCheckBox" name="ckUseCan"> + <property name="text"> + <string>Use Container:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="MantidQt::MantidWidgets::DataSelector" name="dsSampleInput" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoLoad" stdset="0"> + <bool>true</bool> + </property> + <property name="workspaceSuffixes" stdset="0"> + <stringlist> + <string>_red</string> + <string>_sqw</string> + </stringlist> + </property> + <property name="fileBrowserSuffixes" stdset="0"> + <stringlist> + <string>_red.nxs</string> + <string>_sqw.nxs</string> + </stringlist> + </property> + <property name="showLoad" stdset="0"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="lbSampleInput"> + <property name="text"> + <string>Sample Input:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="MantidQt::MantidWidgets::DataSelector" name="dsCanInput" native="true"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoLoad" stdset="0"> + <bool>true</bool> + </property> + <property name="workspaceSuffixes" stdset="0"> + <stringlist> + <string>_red</string> + <string>_sqw</string> + </stringlist> + </property> + <property name="fileBrowserSuffixes" stdset="0"> + <stringlist> + <string>_red.nxs</string> + <string>_sqw.nxs</string> + </stringlist> + </property> + <property name="showLoad" stdset="0"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="gbShapeDetails"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Shape Details</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_9"> + <item> + <layout class="QHBoxLayout" name="loShape"> + <item> + <widget class="QLabel" name="lbShape"> + <property name="text"> + <string>Shape:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="cbShape"> + <item> + <property name="text"> + <string>Flat Plate</string> + </property> + </item> + <item> + <property name="text"> + <string>Annulus</string> + </property> + </item> + <item> + <property name="text"> + <string>Cylinder</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QStackedWidget" name="swShapeDetails"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="pgAbsCorFlatPlate"> + <layout class="QGridLayout" name="loFlatPlate"> + <property name="margin"> + <number>0</number> + </property> + <item row="3" column="0"> + <widget class="QLabel" name="lbFlatCanFrontThickness"> + <property name="text"> + <string>Container Front Thickness:</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lbFlatSampleWidth"> + <property name="text"> + <string>Sample Width:</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QDoubleSpinBox" name="spFlatElementSize"> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> + <property name="value"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QDoubleSpinBox" name="spFlatCanFrontThickness"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QDoubleSpinBox" name="spFlatSampleHeight"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="lbFlatElementSize"> + <property name="text"> + <string>Element Size:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QDoubleSpinBox" name="spFlatSampleWidth"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QDoubleSpinBox" name="spFlatSampleThickness"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="lbFlatSampleThickness"> + <property name="text"> + <string>Sample Thickness:</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="lbFlatSampleHeight"> + <property name="text"> + <string>Sample Height:</string> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QDoubleSpinBox" name="spFlatCanBackThickness"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QLabel" name="lbFlatCanBackThickness"> + <property name="text"> + <string>Container Back Thickness:</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="pgAbsCorAnnulus"> + <layout class="QGridLayout" name="loAnnulus"> + <property name="margin"> + <number>0</number> + </property> + <item row="1" column="1"> + <widget class="QDoubleSpinBox" name="spAnnSampleInnerRadius"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="lbAnnSampleOuterRadius"> + <property name="text"> + <string>Sample Outer Radius:</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QSpinBox" name="spAnnEvents"> + <property name="maximum"> + <number>1000000</number> + </property> + <property name="singleStep"> + <number>10</number> + </property> + <property name="value"> + <number>5000</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lbAnnSampleInnerRadius"> + <property name="text"> + <string>Sample Inner Radius:</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="lbCylEvents"> + <property name="text"> + <string>Neutron Events:</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QDoubleSpinBox" name="spAnnSampleOuterRadius"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QDoubleSpinBox" name="spAnnCanOuterRadius"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QLabel" name="lbAnnCanOuterRadius"> + <property name="text"> + <string>Container Outer Radius:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QDoubleSpinBox" name="spAnnCanInnerRadius"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="lbAnnCanInnerRadius"> + <property name="text"> + <string>Container Inner Radius:</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="pgAbsCorCylinder"> + <layout class="QGridLayout" name="loCylinder"> + <property name="margin"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="lbCylSampleRadius"> + <property name="text"> + <string>Sample Radius:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="spCylEvents"> + <property name="maximum"> + <number>1000000</number> + </property> + <property name="singleStep"> + <number>10</number> + </property> + <property name="value"> + <number>5000</number> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="lbAnnEvents"> + <property name="text"> + <string>Neutron Events:</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="lbCylCanRadius"> + <property name="text"> + <string>Container Radius:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QDoubleSpinBox" name="spCylSampleRadius"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QDoubleSpinBox" name="spCylCanRadius"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="gbSampleDetails"> + <property name="title"> + <string>Sample Details</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="1"> + <widget class="QDoubleSpinBox" name="spSampleNumberDensity"> + <property name="suffix"> + <string> A^-3</string> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + <property name="value"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="lbSampleChemicalFormula"> + <property name="text"> + <string>Chemical Formula:</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="lbSampleNumberDensity"> + <property name="text"> + <string>Number Density: </string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLineEdit" name="leSampleChemicalFormula"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="gbContainerDetails"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="title"> + <string>Container Details</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="2" column="0"> + <widget class="QCheckBox" name="ckUseCanCorrections"> + <property name="text"> + <string>Use Container Corrections</string> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QLabel" name="lbCanChemicalFormula"> + <property name="text"> + <string>Chemical Formula:</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="lbCanNumberDensity"> + <property name="text"> + <string>Number Density:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QDoubleSpinBox" name="spCanNumberDensity"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="suffix"> + <string> A^-3</string> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + <property name="value"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QLineEdit" name="leCanChemicalFormula"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QDoubleSpinBox" name="spCanScale"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QCheckBox" name="ckScaleCan"> + <property name="text"> + <string>Scale:</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="gbOutput"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Output Options</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QCheckBox" name="ckKeepFactors"> + <property name="text"> + <string>Keep Correction Factors</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="ckPlot"> + <property name="text"> + <string>Plot Result</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="ckSave"> + <property name="text"> + <string>Save Result</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>MantidQt::MantidWidgets::DataSelector</class> + <extends>QWidget</extends> + <header>MantidQtMantidWidgets/DataSelector.h</header> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>ckUseCan</tabstop> + <tabstop>cbShape</tabstop> + <tabstop>spFlatSampleWidth</tabstop> + <tabstop>spFlatSampleHeight</tabstop> + <tabstop>spFlatSampleThickness</tabstop> + <tabstop>spFlatCanFrontThickness</tabstop> + <tabstop>spFlatCanBackThickness</tabstop> + <tabstop>spFlatElementSize</tabstop> + <tabstop>spAnnSampleInnerRadius</tabstop> + <tabstop>spAnnSampleOuterRadius</tabstop> + <tabstop>spAnnCanInnerRadius</tabstop> + <tabstop>spAnnCanOuterRadius</tabstop> + <tabstop>spAnnEvents</tabstop> + <tabstop>spCylSampleRadius</tabstop> + <tabstop>spCylCanRadius</tabstop> + <tabstop>spCylEvents</tabstop> + <tabstop>spSampleNumberDensity</tabstop> + <tabstop>leSampleChemicalFormula</tabstop> + <tabstop>ckUseCanCorrections</tabstop> + <tabstop>ckScaleCan</tabstop> + <tabstop>spCanScale</tabstop> + <tabstop>spCanNumberDensity</tabstop> + <tabstop>leCanChemicalFormula</tabstop> + <tabstop>ckKeepFactors</tabstop> + <tabstop>ckPlot</tabstop> + <tabstop>ckSave</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>cbShape</sender> + <signal>currentIndexChanged(int)</signal> + <receiver>swShapeDetails</receiver> + <slot>setCurrentIndex(int)</slot> + <hints> + <hint type="sourcelabel"> + <x>436</x> + <y>160</y> + </hint> + <hint type="destinationlabel"> + <x>296</x> + <y>185</y> + </hint> + </hints> + </connection> + <connection> + <sender>ckScaleCan</sender> + <signal>toggled(bool)</signal> + <receiver>spCanScale</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>156</x> + <y>91</y> + </hint> + <hint type="destinationlabel"> + <x>436</x> + <y>92</y> + </hint> + </hints> + </connection> + <connection> + <sender>ckUseCan</sender> + <signal>toggled(bool)</signal> + <receiver>dsCanInput</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>156</x> + <y>65</y> + </hint> + <hint type="destinationlabel"> + <x>436</x> + <y>65</y> + </hint> + </hints> + </connection> + <connection> + <sender>ckUseCan</sender> + <signal>toggled(bool)</signal> + <receiver>gbContainerDetails</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>156</x> + <y>65</y> + </hint> + <hint type="destinationlabel"> + <x>296</x> + <y>327</y> + </hint> + </hints> + </connection> + <connection> + <sender>ckUseCanCorrections</sender> + <signal>toggled(bool)</signal> + <receiver>leCanChemicalFormula</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>156</x> + <y>447</y> + </hint> + <hint type="destinationlabel"> + <x>436</x> + <y>528</y> + </hint> + </hints> + </connection> + <connection> + <sender>ckUseCanCorrections</sender> + <signal>toggled(bool)</signal> + <receiver>spCanNumberDensity</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>156</x> + <y>447</y> + </hint> + <hint type="destinationlabel"> + <x>436</x> + <y>501</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h index f7d9256f52b6ec503b209092ba0c9da007140816..015811dba57e556e49ac774eadc2099b465600b8 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyCorr.h @@ -25,20 +25,27 @@ namespace IDA void newData(const QString &dataName); /// Updates the preview mini plot void plotPreview(int specIndex); + /// Handle algorithm completion + void algorithmComplete(bool error); private: virtual void setup(); virtual void run(); virtual bool validate(); virtual void loadSettings(const QSettings & settings); - /// ask the user if they wish to rebin the can - bool requireCanRebin(); + + void addRebinStep(QString toRebin, QString toMatch); + void addInterpolationStep(Mantid::API::MatrixWorkspace_sptr toInterpolate, std::string toMatch); Ui::ApplyCorr m_uiForm; - /// Pointer to the result workspace (for plotting) - Mantid::API::MatrixWorkspace_sptr m_outputWs; + + /// Name of sample workspace (for plotting) + std::string m_sampleWsName; + /// Name of container workspace (for plotting) + std::string m_canWsName; }; + } // namespace IDA } // namespace CustomInterfaces } // namespace MantidQt diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h index bbc3c670a3db4cbfdfedaf49612940108cab0407..2ecba2fd9edd8a7037f03939ab1894ee14023f37 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.h @@ -23,18 +23,20 @@ namespace IDA virtual bool validate(); virtual void loadSettings(const QSettings & settings); + bool doValidation(bool silent = false); + private slots: - void shape(int index); - void useCanChecked(bool checked); - void tcSync(); - void getBeamWidthFromWorkspace(const QString& wsname); + void algorithmComplete(bool error); + void getBeamWidthFromWorkspace(const QString& wsName); private: + void addShapeSpecificSampleOptions(Mantid::API::IAlgorithm_sptr alg, QString shape); + void addShapeSpecificCanOptions(Mantid::API::IAlgorithm_sptr alg, QString shape); + Ui::CalcCorr m_uiForm; - QDoubleValidator * m_dblVal; - QDoubleValidator * m_posDblVal; }; + } // namespace IDA } // namespace CustomInterfaces } // namespace MantidQt diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui index 6ec1670e1868361294f35eff5b84a65fd214d164..5a46cbc78a9517965a05f2e60f66ecdf6fbb775a 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/CalcCorr.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>661</width> - <height>504</height> + <height>462</height> </rect> </property> <property name="windowTitle"> @@ -21,7 +21,7 @@ </property> <layout class="QGridLayout" name="gridLayout_11"> <item row="1" column="1"> - <widget class="MantidQt::MantidWidgets::DataSelector" name="dsCanInput" native="true"> + <widget class="MantidQt::MantidWidgets::DataSelector" name="dsContainer" native="true"> <property name="enabled"> <bool>false</bool> </property> @@ -59,7 +59,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="MantidQt::MantidWidgets::DataSelector" name="dsSampleInput" native="true"> + <widget class="MantidQt::MantidWidgets::DataSelector" name="dsSample" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -87,7 +87,7 @@ </widget> </item> <item row="0" column="0"> - <widget class="QLabel" name="label"> + <widget class="QLabel" name="lbInputType"> <property name="text"> <string>Input type:</string> </property> @@ -109,31 +109,19 @@ </property> <layout class="QVBoxLayout" name="verticalLayout_9"> <item> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> + <layout class="QHBoxLayout" name="loSampleShape"> + <item> <widget class="QLabel" name="lbSampleShape"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="text"> <string>Sample Shape:</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QComboBox" name="cbShape"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> + <item> + <widget class="QComboBox" name="cbSampleShape"> <item> <property name="text"> - <string>Flat</string> + <string>Flat Plate</string> </property> </item> <item> @@ -143,336 +131,222 @@ </item> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="lbWidth"> - <property name="text"> - <string>Beam Width:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="leavar"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="lbAvar"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Sample Angle:</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="valAvar"> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="lewidth"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QLabel" name="valWidth"> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - <item row="1" column="0" colspan="3"> - <widget class="QStackedWidget" name="swShapeDetails"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="lineWidth"> - <number>1</number> + </layout> + </item> + <item> + <widget class="QStackedWidget" name="swShapeOptions"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="pgFlatPlate"> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="margin"> + <number>0</number> </property> - <property name="currentIndex"> + <item row="0" column="2"> + <widget class="QLabel" name="lbFlatSampleAngle"> + <property name="text"> + <string>Sample Angle:</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="lbFlatCanFrontThickness"> + <property name="text"> + <string>Container Front Thickness:</string> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QLabel" name="lbFlatCanBackThickness"> + <property name="text"> + <string>Container Back Thickness:</string> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QDoubleSpinBox" name="spFlatCanBackThickness"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="lbFlatSampleThickness"> + <property name="text"> + <string>Sample Thickness:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QDoubleSpinBox" name="spFlatCanFrontThickness"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QDoubleSpinBox" name="spFlatSampleAngle"> + <property name="decimals"> + <number>3</number> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QDoubleSpinBox" name="spFlatSampleThickness"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="pgCylinder"> + <layout class="QGridLayout" name="gridLayout_4"> + <property name="margin"> <number>0</number> </property> - <widget class="QWidget" name="pageFlat"> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <property name="margin"> - <number>0</number> + <item row="5" column="3"> + <widget class="QDoubleSpinBox" name="spCylBeamWidth"> + <property name="decimals"> + <number>3</number> </property> - <item> - <layout class="QGridLayout" name="gridLayout_5_thickness" columnminimumwidth="97,0,0,0,0,0,0,0,0"> - <item row="0" column="2"> - <widget class="QLabel" name="valts"> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - <item row="0" column="5"> - <widget class="QLabel" name="valtc1"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>9</width> - <height>24</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - <item row="0" column="8"> - <widget class="QLabel" name="valtc2"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>9</width> - <height>24</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - <item row="0" column="7"> - <widget class="QLineEdit" name="letc2"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="6"> - <widget class="QLabel" name="lbtc2"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Can Back Thickness:</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLabel" name="lbtc1"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Can Front Thickness:</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="lbts"> - <property name="text"> - <string>Thickness:</string> - </property> - </widget> - </item> - <item row="0" column="4"> - <widget class="QLineEdit" name="letc1"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="lets"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="pageCylinder"> - <layout class="QVBoxLayout" name="cylinder_layout"> - <property name="margin"> - <number>0</number> + <property name="singleStep"> + <double>0.100000000000000</double> </property> - <item> - <layout class="QGridLayout" name="gridLayout_3" columnminimumwidth="0,97,0,0,0,0,0,0,0,0"> - <item row="0" column="1"> - <widget class="QLabel" name="lbR1"> - <property name="text"> - <string>Radius 1:</string> - </property> - </widget> - </item> - <item row="0" column="4"> - <widget class="QLabel" name="lbR2"> - <property name="text"> - <string>Radius 2:</string> - </property> - </widget> - </item> - <item row="0" column="8"> - <widget class="QLineEdit" name="ler3"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="6"> - <widget class="QLabel" name="valR2"> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLabel" name="valR1"> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLineEdit" name="ler1"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="9"> - <widget class="QLabel" name="valR3"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>9</width> - <height>0</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - <item row="0" column="7"> - <widget class="QLabel" name="lbR3"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Can Radius:</string> - </property> - </widget> - </item> - <item row="0" column="5"> - <widget class="QLineEdit" name="ler2"> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - </item> - </layout> + </widget> + </item> + <item row="5" column="2"> + <widget class="QLabel" name="lbCylBeamWidth"> + <property name="text"> + <string>Beam Width:</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="lbCylBeamHeight"> + <property name="text"> + <string>Beam Height:</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QDoubleSpinBox" name="spCylBeamHeight"> + <property name="decimals"> + <number>3</number> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="lbCylStepSize"> + <property name="text"> + <string>Step Size:</string> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="QDoubleSpinBox" name="spCylStepSize"> + <property name="decimals"> + <number>4</number> + </property> + <property name="singleStep"> + <double>0.001000000000000</double> + </property> + <property name="value"> + <double>0.002000000000000</double> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="lbCylSampleInnerRadius"> + <property name="text"> + <string>Sample Inner Radius:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QDoubleSpinBox" name="spCylSampleInnerRadius"> + <property name="decimals"> + <number>3</number> + </property> + <property name="maximum"> + <double>9999.989999999999782</double> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QDoubleSpinBox" name="spCylSampleOuterRadius"> + <property name="decimals"> + <number>3</number> + </property> + <property name="maximum"> + <double>9999.989999999999782</double> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="lbCylSampleOuterRadius"> + <property name="text"> + <string>Sample Outer Radius:</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lbCylCanOuterRadius"> + <property name="text"> + <string>Container Outer Radius:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QDoubleSpinBox" name="spCylCanOuterRadius"> + <property name="decimals"> + <number>3</number> + </property> + <property name="maximum"> + <double>9999.989999999999782</double> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </widget> </item> </layout> </widget> </item> <item> - <widget class="QGroupBox" name="gbSample"> + <widget class="QGroupBox" name="gbSampleDetails"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -482,217 +356,64 @@ <property name="title"> <string>Sample Details</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_13"> - <item> - <layout class="QGridLayout" name="gridLayout_9" columnminimumwidth="0,0,0,0,0,9"> - <item row="0" column="0"> - <widget class="QLabel" name="lbsamden"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Number Density:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="abs_lblSampleInputType"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Cross Sections From:</string> - </property> - </widget> - </item> - <item row="1" column="4" colspan="2"> - <widget class="QStackedWidget" name="swSampleInputType"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="pgSampleChemicalFormula"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <layout class="QVBoxLayout" name="verticalLayout_17"> - <property name="margin"> - <number>0</number> - </property> - <item> - <layout class="QGridLayout" name="gridLayout_12" columnminimumwidth="0,9"> - <item row="0" column="0"> - <widget class="QLineEdit" name="leSampleFormula"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="valSampleFormula"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="pgSampleCrossSections"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <layout class="QVBoxLayout" name="verticalLayout_16"> - <property name="margin"> - <number>0</number> - </property> - <item> - <layout class="QGridLayout" name="gridLayout_8" columnminimumwidth="0,0,0,0,0,9"> - <item row="0" column="4"> - <widget class="QLineEdit" name="lesamsiga"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="lbsamsigs"> - <property name="text"> - <string>Scattering cross-section:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="lesamsigs"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLabel" name="lbsamsiga"> - <property name="text"> - <string>Absorption cross-section:</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="valSamsigs"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - <item row="0" column="5"> - <widget class="QLabel" name="valSamsiga"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - </item> - <item row="0" column="5"> - <widget class="QLabel" name="valSamden"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - <item row="0" column="1" colspan="4"> - <widget class="QLineEdit" name="lesamden"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="1" colspan="3"> - <widget class="QComboBox" name="cbSampleInputType"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <item> - <property name="text"> - <string>Formula</string> - </property> - </item> - <item> - <property name="text"> - <string>Input</string> - </property> - </item> - </widget> - </item> - </layout> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="1"> + <widget class="QDoubleSpinBox" name="spSampleNumberDensity"> + <property name="maximum"> + <double>9999.989999999999782</double> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="lbSampleNumberDensity"> + <property name="text"> + <string>Number Density:</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="lbSampleChemicalFormula"> + <property name="text"> + <string>Chemical Formula:</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLineEdit" name="leSampleChemicalFormula"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="0" column="4"> + <widget class="QLabel" name="valSampleChemicalFormula"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> </item> </layout> </widget> </item> <item> - <widget class="QGroupBox" name="gbCan"> + <widget class="QGroupBox" name="gbCanDetails"> <property name="enabled"> - <bool>true</bool> + <bool>false</bool> </property> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> @@ -703,238 +424,53 @@ <property name="title"> <string>Can Details</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_12"> - <item> - <layout class="QGridLayout" name="gridLayout_6" columnminimumwidth="0,0,0,0,9"> - <item row="0" column="0"> - <widget class="QLabel" name="lbCanden"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Number Density:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblInputType"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Cross Sections From:</string> - </property> - </widget> - </item> - <item row="1" column="3" colspan="2"> - <widget class="QStackedWidget" name="swCanInputType"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="pgCanChemicalFormula"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <layout class="QVBoxLayout" name="verticalLayout_15"> - <property name="margin"> - <number>0</number> - </property> - <item> - <layout class="QGridLayout" name="gridLayout_10" columnminimumwidth="0,9"> - <item row="0" column="0"> - <widget class="QLineEdit" name="leCanFormula"/> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="valCanFormula"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="pgCanCrossSections"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <layout class="QVBoxLayout" name="verticalLayout_14"> - <property name="margin"> - <number>0</number> - </property> - <item> - <layout class="QGridLayout" name="gridLayout_7" columnminimumwidth="0,0,0,0,0,0,9"> - <item row="0" column="0"> - <widget class="QLabel" name="lbCansigs"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Scattering cross-section:</string> - </property> - </widget> - </item> - <item row="0" column="1" colspan="2"> - <widget class="QLineEdit" name="lecansigs"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLabel" name="valCansigs"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - <item row="0" column="5"> - <widget class="QLineEdit" name="lecansiga"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="6"> - <widget class="QLabel" name="valCansiga"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - <item row="0" column="4"> - <widget class="QLabel" name="lbCansiga"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Absorption cross-section:</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - </item> - <item row="0" column="4"> - <widget class="QLabel" name="valCanden"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>*</string> - </property> - </widget> - </item> - <item row="0" column="1" colspan="3"> - <widget class="QLineEdit" name="lecanden"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="1" colspan="2"> - <widget class="QComboBox" name="cbCanInputType"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <item> - <property name="text"> - <string>Formula</string> - </property> - </item> - <item> - <property name="text"> - <string>Input</string> - </property> - </item> - </widget> - </item> - </layout> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="lbCanNumberDensity"> + <property name="text"> + <string>Number Density:</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLineEdit" name="leCanChemicalFormula"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QDoubleSpinBox" name="spCanNumberDensity"> + <property name="maximum"> + <double>9999.989999999999782</double> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="lbCanChemicalFormula"> + <property name="text"> + <string>Chemical Formula:</string> + </property> + </widget> + </item> + <item row="0" column="4"> + <widget class="QLabel" name="valCanChemicalFormula"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> </item> </layout> </widget> @@ -950,67 +486,33 @@ <property name="title"> <string>Output Options</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_11"> + <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <item> - <widget class="QLabel" name="lbPlotOutput"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Plot Output</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="cbPlotOutput"> - <item> - <property name="text"> - <string>None</string> - </property> - </item> - <item> - <property name="text"> - <string>Wavelength</string> - </property> - </item> - <item> - <property name="text"> - <string>Angle</string> - </property> - </item> - <item> - <property name="text"> - <string>Both</string> - </property> - </item> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_12"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QCheckBox" name="ckSave"> - <property name="text"> - <string>Save Result</string> - </property> - </widget> - </item> - </layout> + <widget class="QCheckBox" name="ckPlotOutput"> + <property name="text"> + <string>Plot Output</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="ckSave"> + <property name="text"> + <string>Save Result</string> + </property> + </widget> </item> </layout> </widget> @@ -1026,59 +528,71 @@ </customwidgets> <tabstops> <tabstop>ckUseCan</tabstop> - <tabstop>cbShape</tabstop> - <tabstop>lets</tabstop> - <tabstop>letc1</tabstop> - <tabstop>letc2</tabstop> - <tabstop>ler1</tabstop> - <tabstop>ler2</tabstop> - <tabstop>ler3</tabstop> - <tabstop>leavar</tabstop> - <tabstop>lewidth</tabstop> - <tabstop>lesamden</tabstop> - <tabstop>cbSampleInputType</tabstop> - <tabstop>lesamsigs</tabstop> - <tabstop>lesamsiga</tabstop> - <tabstop>leSampleFormula</tabstop> - <tabstop>lecanden</tabstop> - <tabstop>cbCanInputType</tabstop> - <tabstop>lecansigs</tabstop> - <tabstop>lecansiga</tabstop> - <tabstop>leCanFormula</tabstop> - <tabstop>cbPlotOutput</tabstop> + <tabstop>cbSampleShape</tabstop> + <tabstop>spFlatSampleThickness</tabstop> + <tabstop>spFlatSampleAngle</tabstop> + <tabstop>spFlatCanFrontThickness</tabstop> + <tabstop>spFlatCanBackThickness</tabstop> + <tabstop>spCylSampleInnerRadius</tabstop> + <tabstop>spCylSampleOuterRadius</tabstop> + <tabstop>spCylCanOuterRadius</tabstop> + <tabstop>spCylBeamHeight</tabstop> + <tabstop>spCylBeamWidth</tabstop> + <tabstop>spCylStepSize</tabstop> + <tabstop>spSampleNumberDensity</tabstop> + <tabstop>leSampleChemicalFormula</tabstop> + <tabstop>spCanNumberDensity</tabstop> + <tabstop>leCanChemicalFormula</tabstop> + <tabstop>ckPlotOutput</tabstop> <tabstop>ckSave</tabstop> </tabstops> <resources/> <connections> <connection> - <sender>cbCanInputType</sender> + <sender>cbSampleShape</sender> <signal>currentIndexChanged(int)</signal> - <receiver>swCanInputType</receiver> + <receiver>swShapeOptions</receiver> <slot>setCurrentIndex(int)</slot> <hints> <hint type="sourcelabel"> - <x>193</x> - <y>405</y> + <x>486</x> + <y>130</y> </hint> <hint type="destinationlabel"> - <x>440</x> - <y>405</y> + <x>330</x> + <y>239</y> </hint> </hints> </connection> <connection> - <sender>cbSampleInputType</sender> - <signal>currentIndexChanged(int)</signal> - <receiver>swSampleInputType</receiver> - <slot>setCurrentIndex(int)</slot> + <sender>ckUseCan</sender> + <signal>toggled(bool)</signal> + <receiver>gbCanDetails</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>173</x> + <y>65</y> + </hint> + <hint type="destinationlabel"> + <x>330</x> + <y>481</y> + </hint> + </hints> + </connection> + <connection> + <sender>ckUseCan</sender> + <signal>toggled(bool)</signal> + <receiver>dsContainer</receiver> + <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>193</x> - <y>310</y> + <x>173</x> + <y>65</y> </hint> <hint type="destinationlabel"> - <x>440</x> - <y>310</y> + <x>487</x> + <y>65</y> </hint> </hints> </connection> diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h index ada19ebb3932a29bb482160e46fd776f1786d4fc..c77d08e199d9d2412386fae92872bbe59e5caa18 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IDATab.h @@ -67,6 +67,8 @@ namespace IDA /// Check the binning between two workspaces match bool checkWorkspaceBinningMatches(Mantid::API::MatrixWorkspace_const_sptr left, Mantid::API::MatrixWorkspace_const_sptr right); + /// Adds a conversion to wavelength step to the algorithm queue + std::string addConvertToWavelengthStep(Mantid::API::MatrixWorkspace_sptr ws); /// DoubleEditorFactory DoubleEditorFactory* m_dblEdFac; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.h index 79115a03c214798875ebc8938a0d24cd0b27e54f..5ddb491ba82239fb9034180b3890db35adf09198 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.h @@ -31,7 +31,8 @@ namespace IDA FURY_FIT, CONV_FIT, CALC_CORR, - APPLY_CORR + APPLY_CORR, + ABSORPTION_CORRECTIONS }; // Number of decimal places in property browsers. diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui index bd992c015b9ecb9fb1e30ecfa32edfd6b369442c..d5dee6ffa715539633279184c1b38f51b9efa666 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectDataAnalysis.ui @@ -14,153 +14,157 @@ <string>Indirect Data Analysis</string> </property> <widget class="QWidget" name="centralwidget"> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QTabWidget" name="twIDATabs"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="tabShape"> - <enum>QTabWidget::Rounded</enum> - </property> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tabElwin"> - <attribute name="title"> - <string>Elwin</string> - </attribute> - </widget> - <widget class="QWidget" name="tabMSD"> - <attribute name="title"> - <string>MSD Fit</string> - </attribute> - </widget> - <widget class="QWidget" name="tabFury"> - <attribute name="title"> - <string>Fury</string> - </attribute> - </widget> - <widget class="QWidget" name="tabFuryFit"> - <attribute name="title"> - <string>FuryFit</string> - </attribute> - </widget> - <widget class="QWidget" name="tabConvFit"> - <attribute name="title"> - <string>ConvFit</string> - </attribute> - </widget> - <widget class="QWidget" name="tabCalcCorr"> - <attribute name="title"> - <string>Calculate Corrections</string> - </attribute> - </widget> - <widget class="QWidget" name="tabApplyCorr"> - <attribute name="title"> - <string>Apply Corrections</string> - </attribute> - </widget> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="layout_bottom"> - <item> - <widget class="QPushButton" name="pbHelp"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Open interface help page in your web browser.</string> - </property> - <property name="maximumSize"> - <size> - <width>25</width> - <height>25</height> - </size> - </property> - <property name="text"> - <string>?</string> - </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QTabWidget" name="twIDATabs"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="tabShape"> + <enum>QTabWidget::Rounded</enum> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tabElwin"> + <attribute name="title"> + <string>Elwin</string> + </attribute> + </widget> + <widget class="QWidget" name="tabMSD"> + <attribute name="title"> + <string>MSD Fit</string> + </attribute> + </widget> + <widget class="QWidget" name="tabFury"> + <attribute name="title"> + <string>Fury</string> + </attribute> </widget> - </item> - <item> - <widget class="QPushButton" name="pbPythonExport"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Export a Python script for the algorithms run on this tab.</string> - </property> - <property name="maximumSize"> - <size> - <width>30</width> - <height>25</height> - </size> - </property> - <property name="text"> - <string>Py</string> - </property> + <widget class="QWidget" name="tabFuryFit"> + <attribute name="title"> + <string>FuryFit</string> + </attribute> </widget> - </item> - <item> - <spacer name="horizontalSpacer_14"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="pbRun"> - <property name="text"> - <string>Run</string> - </property> + <widget class="QWidget" name="tabConvFit"> + <attribute name="title"> + <string>ConvFit</string> + </attribute> </widget> - </item> - <item> - <spacer name="horizontalSpacer_11"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="pbManageDirs"> - <property name="text"> - <string>Manage Directories</string> - </property> + <widget class="QWidget" name="tabCalcCorr"> + <attribute name="title"> + <string>Calculate Corrections</string> + </attribute> </widget> - </item> - </layout> - </item> - </layout> + <widget class="QWidget" name="tabApplyCorr"> + <attribute name="title"> + <string>Apply Corrections</string> + </attribute> + </widget> + <widget class="QWidget" name="tabAbsorptionCorrections"> + <attribute name="title"> + <string>Absorption Corrections</string> + </attribute> + </widget> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="layout_bottom"> + <item> + <widget class="QPushButton" name="pbHelp"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>25</width> + <height>25</height> + </size> + </property> + <property name="toolTip"> + <string>Open interface help page in your web browser.</string> + </property> + <property name="text"> + <string>?</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pbPythonExport"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>30</width> + <height>25</height> + </size> + </property> + <property name="toolTip"> + <string>Export a Python script for the algorithms run on this tab.</string> + </property> + <property name="text"> + <string>Py</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_14"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="pbRun"> + <property name="text"> + <string>Run</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_11"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="pbManageDirs"> + <property name="text"> + <string>Manage Directories</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> </widget> </widget> - <customwidgets/> <tabstops> <tabstop>twIDATabs</tabstop> <tabstop>pbHelp</tabstop> diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTab.h index 2664203f1fc7f8d0aa4341d4e4a5a252938ae462..802933488db6fcc51f853c00fb460f630bb6abe4 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTab.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTab.h @@ -91,6 +91,16 @@ namespace CustomInterfaces /// Run the load algorithm with the given file name, output name and spectrum range bool loadFile(const QString& filename, const QString& outputName, const int specMin = -1, const int specMax = -1); + /// Add a SaveNexusProcessed step to the batch queue + void addSaveWorkspaceToQueue(const QString & wsName, const QString & filename = ""); + + /// Plot a spectrum plot given a list of workspace names + void plotSpectrum(const QStringList & workspaceNames, int specIndex = 0); + void plotSpectrum(const QString & workspaceName, int specIndex = 0); + + /// Plot a contour plot of a given workspace + void plotContour(const QString & workspaceName); + /// Function to set the range limits of the plot void setPlotPropertyRange(MantidQt::MantidWidgets::RangeSelector * rs, QtProperty* min, QtProperty* max, @@ -100,6 +110,12 @@ namespace CustomInterfaces QtProperty* lower, QtProperty* upper, const QPair<double, double> & bounds); + /// Function to get energy mode from a workspace + std::string getEMode(Mantid::API::MatrixWorkspace_sptr ws); + + /// Function to get eFixed from a workspace + double getEFixed(Mantid::API::MatrixWorkspace_sptr ws); + /// Function to run an algorithm on a seperate thread void runAlgorithm(const Mantid::API::IAlgorithm_sptr algorithm); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/UserInputValidator.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/UserInputValidator.h index 0a9c44070a14577104100b20edbdb997477b56c0..8af0cac0c12fd3ab881f32b17dbdfde7cfad8000 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/UserInputValidator.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/UserInputValidator.h @@ -54,9 +54,9 @@ namespace MantidQt UserInputValidator(); /// Check that the given QLineEdit field is not empty. - bool checkFieldIsNotEmpty(const QString & name, QLineEdit * field, QLabel * errorLabel); + bool checkFieldIsNotEmpty(const QString & name, QLineEdit * field, QLabel * errorLabel = NULL); /// Check that the given QLineEdit field is valid as per any validators it might have. - bool checkFieldIsValid(const QString & errorMessage, QLineEdit * field, QLabel * errorLabel); + bool checkFieldIsValid(const QString & errorMessage, QLineEdit * field, QLabel * errorLabel = NULL); /// Check that the given WorkspaceSelector is not empty. bool checkWorkspaceSelectorIsNotEmpty(const QString & name, WorkspaceSelector * workspaceSelector); /// Check that the given MWRunFiles widget has valid files. diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/AbsorptionCorrections.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/AbsorptionCorrections.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2b9d6abbe276be9ae8ea472dc4fa3fd9f602e6c7 --- /dev/null +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/AbsorptionCorrections.cpp @@ -0,0 +1,279 @@ +#include "MantidKernel/Unit.h" + +#include "MantidQtCustomInterfaces/Indirect/AbsorptionCorrections.h" +#include "MantidQtCustomInterfaces/UserInputValidator.h" + +#include <QRegExpValidator> + +using namespace Mantid::API; + +namespace +{ + Mantid::Kernel::Logger g_log("AbsorptionCorrections"); +} + +namespace MantidQt +{ +namespace CustomInterfaces +{ +namespace IDA +{ + AbsorptionCorrections::AbsorptionCorrections(QWidget * parent) : + IDATab(parent) + { + m_uiForm.setupUi(parent); + + QRegExp regex("[A-Za-z0-9\\-\\(\\)]*"); + QValidator *formulaValidator = new QRegExpValidator(regex, this); + m_uiForm.leSampleChemicalFormula->setValidator(formulaValidator); + m_uiForm.leCanChemicalFormula->setValidator(formulaValidator); + + // Handle algorithm completion + connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), + this, SLOT(algorithmComplete(bool))); + } + + + void AbsorptionCorrections::setup() + { + } + + + void AbsorptionCorrections::run() + { + // Get correct corrections algorithm + QString sampleShape = m_uiForm.cbShape->currentText().replace(" ", ""); + QString algorithmName = "Indirect" + sampleShape + "Absorption"; + + IAlgorithm_sptr absCorAlgo = AlgorithmManager::Instance().create(algorithmName.toStdString()); + absCorAlgo->initialize(); + + // Sample details + QString sampleWsName = m_uiForm.dsSampleInput->getCurrentDataName(); + absCorAlgo->setProperty("SampleWorkspace", sampleWsName.toStdString()); + + double sampleNumberDensity = m_uiForm.spSampleNumberDensity->value(); + absCorAlgo->setProperty("SampleNumberDensity", sampleNumberDensity); + + QString sampleChemicalFormula = m_uiForm.leSampleChemicalFormula->text(); + absCorAlgo->setProperty("SampleChemicalFormula", sampleChemicalFormula.toStdString()); + + addShapeSpecificSampleOptions(absCorAlgo, sampleShape); + + // Can details + bool useCan = m_uiForm.ckUseCan->isChecked(); + if(useCan) + { + QString canWsName = m_uiForm.dsCanInput->getCurrentDataName(); + absCorAlgo->setProperty("CanWorkspace", canWsName.toStdString()); + + bool useCanCorrections = m_uiForm.ckUseCanCorrections->isChecked(); + absCorAlgo->setProperty("UseCanCorrections", useCanCorrections); + + if(useCanCorrections) + { + double canNumberDensity = m_uiForm.spCanNumberDensity->value(); + absCorAlgo->setProperty("CanNumberDensity", canNumberDensity); + + QString canChemicalFormula = m_uiForm.leCanChemicalFormula->text(); + absCorAlgo->setProperty("CanChemicalFormula", canChemicalFormula.toStdString()); + } + + addShapeSpecificCanOptions(absCorAlgo, sampleShape); + } + + bool plot = m_uiForm.ckPlot->isChecked(); + absCorAlgo->setProperty("Plot", plot); + + // Generate workspace names + int nameCutIndex = sampleWsName.lastIndexOf("_"); + if(nameCutIndex == -1) + nameCutIndex = sampleWsName.length(); + + QString outputBaseName = sampleWsName.left(nameCutIndex); + + QString outputWsName = outputBaseName + "_" + sampleShape + "_Corrected"; + absCorAlgo->setProperty("OutputWorkspace", outputWsName.toStdString()); + + // Set the correction workspace to keep the factors if desired + bool keepCorrectionFactors = m_uiForm.ckKeepFactors->isChecked(); + QString outputFactorsWsName = outputBaseName + "_" + sampleShape + "_Factors"; + if(keepCorrectionFactors) + absCorAlgo->setProperty("CorrectionsWorkspace", outputFactorsWsName.toStdString()); + + // Add correction algorithm to batch + m_batchAlgoRunner->addAlgorithm(absCorAlgo); + + // Add save algorithms if needed + bool save = m_uiForm.ckSave->isChecked(); + if(save) + { + addSaveWorkspace(outputWsName); + if(keepCorrectionFactors) + addSaveWorkspace(outputFactorsWsName); + } + + // Run algorithm batch + m_batchAlgoRunner->executeBatchAsync(); + + // Set the result workspace for Python script export + m_pythonExportWsName = outputWsName.toStdString(); + } + + + /** + * Configures the SaveNexusProcessed algorithm to save a workspace in the default + * save directory and adds the algorithm to the batch queue. + * + * @param wsName Name of workspace to save + */ + void AbsorptionCorrections::addSaveWorkspace(QString wsName) + { + QString filename = wsName + ".nxs"; + + // Setup the input workspace property + API::BatchAlgorithmRunner::AlgorithmRuntimeProps saveProps; + saveProps["InputWorkspace"] = wsName.toStdString(); + + // Setup the algorithm + IAlgorithm_sptr saveAlgo = AlgorithmManager::Instance().create("SaveNexusProcessed"); + saveAlgo->initialize(); + saveAlgo->setProperty("Filename", filename.toStdString()); + + // Add the save algorithm to the batch + m_batchAlgoRunner->addAlgorithm(saveAlgo, saveProps); + } + + + /** + * Sets algorithm properties specific to the sample for a given shape. + * + * @param alg Algorithm to set properties of + * @param shape Sample shape + */ + void AbsorptionCorrections::addShapeSpecificSampleOptions(IAlgorithm_sptr alg, QString shape) + { + if(shape == "FlatPlate") + { + double sampleHeight = m_uiForm.spFlatSampleHeight->value(); + alg->setProperty("SampleHeight", sampleHeight); + + double sampleWidth = m_uiForm.spFlatSampleWidth->value(); + alg->setProperty("SampleWidth", sampleWidth); + + double sampleThickness = m_uiForm.spFlatSampleThickness->value(); + alg->setProperty("SampleThickness", sampleThickness); + + double elementSize = m_uiForm.spFlatElementSize->value(); + alg->setProperty("ElementSize", elementSize); + } + else if(shape == "Annulus") + { + double sampleInnerRadius = m_uiForm.spAnnSampleInnerRadius->value(); + alg->setProperty("SampleInnerRadius", sampleInnerRadius); + + double sampleOuterRadius = m_uiForm.spAnnSampleOuterRadius->value(); + alg->setProperty("SampleOuterRadius", sampleOuterRadius); + + double canInnerRadius = m_uiForm.spAnnCanInnerRadius->value(); + alg->setProperty("CanInnerRadius", canInnerRadius); + + double canOuterRadius = m_uiForm.spAnnCanOuterRadius->value(); + alg->setProperty("CanOuterRadius", canOuterRadius); + + long events = static_cast<long>(m_uiForm.spAnnEvents->value()); + alg->setProperty("Events", events); + } + else if(shape == "Cylinder") + { + double sampleRadius = m_uiForm.spCylSampleRadius->value(); + alg->setProperty("SampleRadius", sampleRadius); + + long events = static_cast<long>(m_uiForm.spCylEvents->value()); + alg->setProperty("Events", events); + } + } + + + /** + * Sets algorithm properties specific to the can for a given shape. + * + * All options for Annulus are added in addShapeSpecificSampleOptions. + * + * @param alg Algorithm to set properties of + * @param shape Sample shape + */ + void AbsorptionCorrections::addShapeSpecificCanOptions(IAlgorithm_sptr alg, QString shape) + { + if(shape == "FlatPlate") + { + double canFrontThickness = m_uiForm.spFlatCanFrontThickness->value(); + alg->setProperty("CanFrontThickness", canFrontThickness); + + double canBackThickness = m_uiForm.spFlatCanBackThickness->value(); + alg->setProperty("CanBackThickness", canBackThickness); + } + else if(shape == "Cylinder") + { + double canRadius = m_uiForm.spCylCanRadius->value(); + alg->setProperty("CanRadius", canRadius); + } + } + + + bool AbsorptionCorrections::validate() + { + UserInputValidator uiv; + + uiv.checkDataSelectorIsValid("Sample", m_uiForm.dsSampleInput); + + if(uiv.checkFieldIsNotEmpty("Sample Chemical Formula", m_uiForm.leSampleChemicalFormula)) + uiv.checkFieldIsValid("Sample Chamical Formula", m_uiForm.leSampleChemicalFormula); + + bool useCan = m_uiForm.ckUseCan->isChecked(); + if(useCan) + { + uiv.checkDataSelectorIsValid("Container", m_uiForm.dsCanInput); + + bool useCanCorrections = m_uiForm.ckUseCanCorrections->isChecked(); + if(useCanCorrections) + { + if(uiv.checkFieldIsNotEmpty("Container Chamical Formula", m_uiForm.leCanChemicalFormula)) + uiv.checkFieldIsValid("Container Chamical Formula", m_uiForm.leCanChemicalFormula); + } + } + + // Give error for failed validation + if(!uiv.isAllInputValid()) + { + QString error = uiv.generateErrorMessage(); + showMessageBox(error); + } + + return uiv.isAllInputValid(); + } + + + void AbsorptionCorrections::loadSettings(const QSettings & settings) + { + m_uiForm.dsSampleInput->readSettings(settings.group()); + m_uiForm.dsCanInput->readSettings(settings.group()); + } + + + /** + * Handle completion of the absorption correction algorithm. + * + * @param error True if algorithm has failed. + */ + void AbsorptionCorrections::algorithmComplete(bool error) + { + if(error) + { + emit showMessageBox("Could not run absorption corrections.\nSee Results Log for details."); + } + } + +} // namespace IDA +} // namespace CustomInterfaces +} // namespace MantidQt diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp index 7ca36c482874d676f761e9e0ecc0eb0b3fd60361..1e3827e19558474516d9681fce45fb28f2c72278 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ApplyCorr.cpp @@ -1,9 +1,11 @@ #include "MantidQtCustomInterfaces/Indirect/ApplyCorr.h" +#include "MantidQtCustomInterfaces/UserInputValidator.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/TextAxis.h" #include <QStringList> + using namespace Mantid::API; namespace @@ -21,10 +23,8 @@ namespace IDA IDATab(parent) { m_uiForm.setupUi(parent); - } - void ApplyCorr::setup() - { + connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmComplete(bool))); connect(m_uiForm.cbGeometry, SIGNAL(currentIndexChanged(int)), this, SLOT(handleGeometryChange(int))); connect(m_uiForm.dsSample, SIGNAL(dataReady(const QString&)), this, SLOT(newData(const QString&))); connect(m_uiForm.spPreviewSpec, SIGNAL(valueChanged(int)), this, SLOT(plotPreview(int))); @@ -33,6 +33,12 @@ namespace IDA m_uiForm.spPreviewSpec->setMaximum(0); } + + void ApplyCorr::setup() + { + } + + /** * Disables corrections when using S(Q, w) as input data. * @@ -48,155 +54,301 @@ namespace IDA m_uiForm.ppPreview->addSpectrum("Sample", sampleWs, 0, Qt::black); } + void ApplyCorr::run() { - QString geom = m_uiForm.cbGeometry->currentText(); - if ( geom == "Flat" ) + API::BatchAlgorithmRunner::AlgorithmRuntimeProps absCorProps; + IAlgorithm_sptr applyCorrAlg = AlgorithmManager::Instance().create("ApplyPaalmanPingsCorrection"); + applyCorrAlg->initialize(); + + QString sampleWsName = m_uiForm.dsSample->getCurrentDataName(); + MatrixWorkspace_sptr sampleWs = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(sampleWsName.toStdString()); + Mantid::Kernel::Unit_sptr sampleXUnit = sampleWs->getAxis(0)->unit(); + + // If not in wavelength then do conversion + if(sampleXUnit->caption() != "Wavelength") { - geom = "flt"; + g_log.information("Sample workspace not in wavelength, need to convert to continue."); + absCorProps["SampleWorkspace"] = addConvertToWavelengthStep(sampleWs); } - else if ( geom == "Cylinder" ) + else { - geom = "cyl"; + absCorProps["SampleWorkspace"] = sampleWsName.toStdString(); } - QString pyInput = "from IndirectDataAnalysis import abscorFeeder\n"; - - QString sample = m_uiForm.dsSample->getCurrentDataName(); - MatrixWorkspace_const_sptr sampleWs = AnalysisDataService::Instance().retrieveWS<const MatrixWorkspace>(sample.toStdString()); - - pyInput += "sample = '"+sample+"'\n"; - pyInput += "rebin_can = False\n"; - bool noContainer = false; - bool useCan = m_uiForm.ckUseCan->isChecked(); if(useCan) { - QString container = m_uiForm.dsContainer->getCurrentDataName(); - MatrixWorkspace_const_sptr canWs = AnalysisDataService::Instance().retrieveWS<const MatrixWorkspace>(container.toStdString()); + QString canWsName = m_uiForm.dsContainer->getCurrentDataName(); + MatrixWorkspace_sptr canWs = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(canWsName.toStdString()); - if (!checkWorkspaceBinningMatches(sampleWs, canWs)) + // If not in wavelength then do conversion + Mantid::Kernel::Unit_sptr canXUnit = canWs->getAxis(0)->unit(); + if(canXUnit->caption() != "Wavelength") { - if (requireCanRebin()) + g_log.information("Container workspace not in wavelength, need to convert to continue."); + absCorProps["CanWorkspace"] = addConvertToWavelengthStep(canWs); + } + else + { + absCorProps["CanWorkspace"] = canWsName.toStdString(); + } + + bool useCanScale = m_uiForm.ckScaleCan->isChecked(); + if(useCanScale) + { + double canScaleFactor = m_uiForm.spCanScale->value(); + applyCorrAlg->setProperty("CanScaleFactor", canScaleFactor); + } + + // Check for same binning across sample and container + if(!checkWorkspaceBinningMatches(sampleWs, canWs)) + { + QString text = "Binning on sample and container does not match." + "Would you like to rebin the sample to match the container?"; + + int result = QMessageBox::question(NULL, tr("Rebin sample?"), tr(text), + QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton); + + if(result == QMessageBox::Yes) { - pyInput += "rebin_can = True\n"; + addRebinStep(sampleWsName, canWsName); } else { - //user clicked cancel and didn't want to rebin, so just do nothing. + m_batchAlgoRunner->clearQueue(); + g_log.error("Cannot apply absorption corrections using a sample and container with different binning."); return; } } - - pyInput += "container = '" + container + "'\n"; } - else - { - pyInput += "container = ''\n"; - noContainer = true; - } - - pyInput += "geom = '" + geom + "'\n"; - if( m_uiForm.ckUseCorrections->isChecked() ) - { - pyInput += "useCor = True\n"; - QString corrections = m_uiForm.dsCorrections->getCurrentDataName(); - pyInput += "corrections = '" + corrections + "'\n"; - } - else + bool useCorrections = m_uiForm.ckUseCorrections->isChecked(); + if(useCorrections) { - pyInput += "useCor = False\n"; - pyInput += "corrections = ''\n"; + QString correctionsWsName = m_uiForm.dsCorrections->getCurrentDataName(); - // if we have no container and no corrections then abort - if(noContainer) + WorkspaceGroup_sptr corrections = AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>(correctionsWsName.toStdString()); + bool interpolateAll = false; + for(size_t i = 0; i < corrections->size(); i++) { - showMessageBox("Apply Corrections requires either a can file or a corrections file."); - return; + MatrixWorkspace_sptr factorWs = boost::dynamic_pointer_cast<MatrixWorkspace>(corrections->getItem(i)); + + // Check for matching binning + if(sampleWs && (sampleWs->blocksize() != factorWs->blocksize())) + { + int result; + if(interpolateAll) + { + result = QMessageBox::Yes; + } + else + { + QString text = "Number of bins on sample and " + + QString::fromStdString(factorWs->name()) + + " workspace does not match.\n" + + "Would you like to interpolate this workspace to match the sample?"; + + result = QMessageBox::question(NULL, tr("Interpolate corrections?"), tr(text), + QMessageBox::YesToAll, QMessageBox::Yes, QMessageBox::No); + } + + switch(result) + { + case QMessageBox::YesToAll: + interpolateAll = true; + case QMessageBox::Yes: + addInterpolationStep(factorWs, absCorProps["SampleWorkspace"]); + break; + default: + m_batchAlgoRunner->clearQueue(); + g_log.error("ApplyCorr cannot run with corrections that do not match sample binning."); + return; + } + } } - } - QString ScalingFactor = "1.0\n"; - QString ScaleOrNot = "False\n"; + applyCorrAlg->setProperty("CorrectionsWorkspace", correctionsWsName.toStdString()); + } - pyInput += m_uiForm.ckScaleCan->isChecked() ? "True\n" : "False\n"; + // Generate output workspace name + int nameCutIndex = sampleWsName.lastIndexOf("_"); + if(nameCutIndex == -1) + nameCutIndex = sampleWsName.length(); - if ( m_uiForm.ckScaleCan->isChecked() ) + QString correctionType; + switch(m_uiForm.cbGeometry->currentIndex()) { - ScalingFactor = m_uiForm.spCanScale->text(); - ScaleOrNot = "True\n"; + case 0: + correctionType = "flt"; + break; + case 1: + correctionType = "cyl"; + break; } + const QString outputWsName = sampleWsName.left(nameCutIndex) + + "_" + correctionType + "_Corrected"; - pyInput += "scale = " + ScaleOrNot + "\n"; - pyInput += "scaleFactor = " + ScalingFactor + "\n"; + applyCorrAlg->setProperty("OutputWorkspace", outputWsName.toStdString()); - if ( m_uiForm.ckSave->isChecked() ) pyInput += "save = True\n"; - else pyInput += "save = False\n"; + // Add corrections algorithm to queue + m_sampleWsName = absCorProps["SampleWorkspace"]; + m_canWsName = absCorProps["CanWorkspace"]; + m_batchAlgoRunner->addAlgorithm(applyCorrAlg, absCorProps); - QString plotResult = m_uiForm.cbPlotOutput->currentText(); - if ( plotResult == "Contour" ) - { - plotResult = "Contour"; - } - else if ( plotResult == "Spectra" ) - { - plotResult = "Spectrum"; - } - else if ( plotResult == "Both" ) - { - plotResult = "Both"; - } + // Add save algorithms if required + bool save = m_uiForm.ckSave->isChecked(); + if(save) + addSaveWorkspaceToQueue(outputWsName); - pyInput += "plotResult = '" + plotResult + "'\n"; - pyInput += "print abscorFeeder(sample, container, geom, useCor, corrections, RebinCan=rebin_can, ScaleOrNotToScale=scale, factor=scaleFactor, Save=save, PlotResult=plotResult)\n"; + // Run algorithm queue + m_batchAlgoRunner->executeBatchAsync(); - QString pyOutput = runPythonCode(pyInput).trimmed(); + // Set the result workspace for Python script export + m_pythonExportWsName = outputWsName.toStdString(); + } - m_outputWs = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(pyOutput.toStdString()); - plotPreview(m_uiForm.spPreviewSpec->value()); - // Set the result workspace for Python script export - m_pythonExportWsName = pyOutput.toStdString(); + /** + * Adds a rebin to workspace step to the calculation for when using a sample and container that + * have different binning. + * + * @param toRebin + * @param toMatch + */ + void ApplyCorr::addRebinStep(QString toRebin, QString toMatch) + { + API::BatchAlgorithmRunner::AlgorithmRuntimeProps rebinProps; + rebinProps["WorkspaceToMatch"] = toMatch.toStdString(); + + IAlgorithm_sptr rebinAlg = AlgorithmManager::Instance().create("RebinToWorkspace"); + rebinAlg->initialize(); + + rebinAlg->setProperty("WorkspaceToRebin", toRebin.toStdString()); + rebinAlg->setProperty("OutputWorkspace", toRebin.toStdString()); + + m_batchAlgoRunner->addAlgorithm(rebinAlg, rebinProps); } + /** - * Ask the user is they wish to rebin the can to the sample. - * @return whether a rebin of the can workspace is required. + * Adds a spline interpolation as a step in the calculation for using legacy correction factor + * workspaces. + * + * @param toInterpolate Pointer to the workspace to interpolate + * @param toMatch Name of the workspace to match */ - bool ApplyCorr::requireCanRebin() + void ApplyCorr::addInterpolationStep(MatrixWorkspace_sptr toInterpolate, std::string toMatch) { - QString message = "The sample and can energy ranges do not match, this is not recommended." - "\n\n Click OK to rebin the can to match the sample and continue or Cancel to abort applying corrections."; - QMessageBox::StandardButton reply = QMessageBox::warning(m_parentWidget, "Energy Ranges Do Not Match", - message, QMessageBox::Ok|QMessageBox::Cancel); - return (reply == QMessageBox::Ok); + API::BatchAlgorithmRunner::AlgorithmRuntimeProps interpolationProps; + interpolationProps["WorkspaceToMatch"] = toMatch; + + IAlgorithm_sptr interpolationAlg = AlgorithmManager::Instance().create("SplineInterpolation"); + interpolationAlg->initialize(); + + interpolationAlg->setProperty("WorkspaceToInterpolate", toInterpolate->name()); + interpolationAlg->setProperty("OutputWorkspace", toInterpolate->name()); + + m_batchAlgoRunner->addAlgorithm(interpolationAlg, interpolationProps); + } + + + /** + * Handles completion of the algorithm. + * + * @param error True if algorithm failed. + */ + void ApplyCorr::algorithmComplete(bool error) + { + if(error) + { + emit showMessageBox("Unable to apply corrections.\nSee Results Log for more details."); + return; + } + + // Handle preview plot + plotPreview(m_uiForm.spPreviewSpec->value()); + + // Handle Mantid plotting + QString plotType = m_uiForm.cbPlotOutput->currentText(); + + if(plotType == "Spectra" || plotType == "Both") + plotSpectrum(QString::fromStdString(m_pythonExportWsName)); + + if(plotType == "Contour" || plotType == "Both") + plotContour(QString::fromStdString(m_pythonExportWsName)); } + bool ApplyCorr::validate() { + UserInputValidator uiv; + + uiv.checkDataSelectorIsValid("Sample", m_uiForm.dsSample); + + MatrixWorkspace_sptr sampleWs; + bool useCan = m_uiForm.ckUseCan->isChecked(); + bool useCorrections = m_uiForm.ckUseCorrections->isChecked(); + + if(!(useCan || useCorrections)) + uiv.addErrorMessage("Must use either container subtraction or corrections"); if(useCan) { + uiv.checkDataSelectorIsValid("Container", m_uiForm.dsContainer); + + // Check can and sample workspaces are the same "type" (reduced or S(Q, w)) QString sample = m_uiForm.dsSample->getCurrentDataName(); QString sampleType = sample.right(sample.length() - sample.lastIndexOf("_")); QString container = m_uiForm.dsContainer->getCurrentDataName(); QString containerType = container.right(container.length() - container.lastIndexOf("_")); g_log.debug() << "Sample type is: " << sampleType.toStdString() << std::endl; - g_log.debug() << "Container type is: " << containerType.toStdString() << std::endl; + g_log.debug() << "Can type is: " << containerType.toStdString() << std::endl; if(containerType != sampleType) + uiv.addErrorMessage("Sample and can workspaces must contain the same type of data."); + } + + if(useCorrections) + { + uiv.checkDataSelectorIsValid("Corrections", m_uiForm.dsCorrections); + + QString correctionsWsName = m_uiForm.dsCorrections->getCurrentDataName(); + WorkspaceGroup_sptr corrections = AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>(correctionsWsName.toStdString()); + for(size_t i = 0; i < corrections->size(); i++) { - g_log.error("Must use the same type of files for sample and container inputs."); - return false; + // Check it is a MatrixWorkspace + MatrixWorkspace_sptr factorWs = boost::dynamic_pointer_cast<MatrixWorkspace>(corrections->getItem(i)); + if(!factorWs) + { + QString msg = "Correction factor workspace " + + QString::number(i) + + " is not a MatrixWorkspace"; + uiv.addErrorMessage(msg); + continue; + } + + // Check X unit is wavelength + Mantid::Kernel::Unit_sptr xUnit = factorWs->getAxis(0)->unit(); + if(xUnit->caption() != "Wavelength") + { + QString msg = "Correction factor workspace " + + QString::fromStdString(factorWs->name()) + + " is not in wavelength"; + uiv.addErrorMessage(msg); + } } } - return true; + // Show errors if there are any + if(!uiv.isAllInputValid()) + emit showMessageBox(uiv.generateErrorMessage()); + + return uiv.isAllInputValid(); } + void ApplyCorr::loadSettings(const QSettings & settings) { m_uiForm.dsCorrections->readSettings(settings.group()); @@ -204,6 +356,7 @@ namespace IDA m_uiForm.dsSample->readSettings(settings.group()); } + /** * Handles when the type of geometry changes * @@ -229,6 +382,7 @@ namespace IDA } } + /** * Replots the preview plot. * @@ -241,25 +395,19 @@ namespace IDA m_uiForm.ppPreview->clear(); // Plot sample - const QString sample = m_uiForm.dsSample->getCurrentDataName(); - if(AnalysisDataService::Instance().doesExist(sample.toStdString())) - { - m_uiForm.ppPreview->addSpectrum("Sample", sample, specIndex, Qt::black); - } + if(AnalysisDataService::Instance().doesExist(m_sampleWsName)) + m_uiForm.ppPreview->addSpectrum("Sample", QString::fromStdString(m_sampleWsName), + specIndex, Qt::black); // Plot result - if(m_outputWs) - { - m_uiForm.ppPreview->addSpectrum("Corrected", m_outputWs, specIndex, Qt::green); - } + if(!m_pythonExportWsName.empty()) + m_uiForm.ppPreview->addSpectrum("Corrected", QString::fromStdString(m_pythonExportWsName), + specIndex, Qt::green); // Plot can - if(useCan) - { - QString container = m_uiForm.dsContainer->getCurrentDataName(); - const MatrixWorkspace_sptr canWs = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(container.toStdString()); - m_uiForm.ppPreview->addSpectrum("Can", canWs, specIndex, Qt::red); - } + if(useCan && AnalysisDataService::Instance().doesExist(m_canWsName)) + m_uiForm.ppPreview->addSpectrum("Can", QString::fromStdString(m_canWsName), + specIndex, Qt::red); } } // namespace IDA diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/CalcCorr.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/CalcCorr.cpp index 2f19360e2dff1c784596a81c776ef7d29e670985..8e42432f024c3da5660c3cfe8b55d071367764f0 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/CalcCorr.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/CalcCorr.cpp @@ -3,86 +3,13 @@ #include "MantidQtCustomInterfaces/UserInputValidator.h" #include "MantidQtMantidWidgets/WorkspaceSelector.h" - #include <QLineEdit> #include <QList> #include <QValidator> #include <QDoubleValidator> #include <QRegExpValidator> -class QDoubleMultiRangeValidator : public QValidator -{ -public: - /** - * Constructor. - * - * @param ranges :: a set of pairs of doubles representing the valid ranges of the input - * @param parent :: the parent QObject of this QObject. - */ - QDoubleMultiRangeValidator(std::set<std::pair<double, double>> ranges, QObject * parent) : - QValidator(parent), m_ranges(ranges), m_slaveVal(NULL) - { - m_slaveVal = new QDoubleValidator(this); - } - - ~QDoubleMultiRangeValidator() {} - - /** - * Reimplemented from QValidator::validate(). - * - * Returns Acceptable if the string input contains a double that is within at least one - * of the ranges and is in the correct format. - * - * Else returns Intermediate if input contains a double that is outside the ranges or is in - * the wrong format; e.g. with too many digits after the decimal point or is empty. - * - * Else returns Invalid - i.e. the input is not a double. - * - * @param input :: the input string to validate - * @param pos :: not used. - */ - virtual QValidator::State validate( QString & input, int & pos ) const - { - UNUSED_ARG(pos); - - if( m_ranges.empty() ) - return Intermediate; - - bool acceptable = false; - bool intermediate = false; - - // For each range in the list, use the slave QDoubleValidator to find out the state. - for( auto range = m_ranges.begin(); range != m_ranges.end(); ++ range ) - { - if(range->first >= range->second) - throw std::runtime_error("Invalid range"); - - m_slaveVal->setBottom(range->first); - m_slaveVal->setTop(range->second); - - QValidator::State rangeState = m_slaveVal->validate(input, pos); - - if( rangeState == Acceptable ) - acceptable = true; - else if( rangeState == Intermediate ) - intermediate = true; - } - - if( acceptable ) - return Acceptable; - if( intermediate ) - return Intermediate; - - return Invalid; - } - -private: - /// Disallow default constructor. - QDoubleMultiRangeValidator(); - - std::set<std::pair<double, double>> m_ranges; - QDoubleValidator * m_slaveVal; -}; +using namespace Mantid::API; namespace { @@ -96,419 +23,296 @@ namespace CustomInterfaces namespace IDA { CalcCorr::CalcCorr(QWidget * parent) : - IDATab(parent), m_dblVal(NULL), m_posDblVal(NULL) + IDATab(parent) { m_uiForm.setupUi(parent); - m_dblVal = new QDoubleValidator(this); - m_posDblVal = new QDoubleValidator(this); - m_posDblVal->setBottom(0.0); + connect(m_uiForm.dsSample, SIGNAL(dataReady(const QString&)), this, SLOT(getBeamWidthFromWorkspace(const QString&))); + connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmComplete(bool))); + + QRegExp regex("[A-Za-z0-9\\-\\(\\)]*"); + QValidator *formulaValidator = new QRegExpValidator(regex, this); + m_uiForm.leSampleChemicalFormula->setValidator(formulaValidator); + m_uiForm.leCanChemicalFormula->setValidator(formulaValidator); } + void CalcCorr::setup() { - // set signals and slot connections for F2Py Absorption routine - connect(m_uiForm.cbShape, SIGNAL(currentIndexChanged(int)), this, SLOT(shape(int))); - connect(m_uiForm.ckUseCan, SIGNAL(toggled(bool)), this, SLOT(useCanChecked(bool))); - connect(m_uiForm.letc1, SIGNAL(editingFinished()), this, SLOT(tcSync())); - connect(m_uiForm.dsSampleInput, SIGNAL(dataReady(const QString&)), this, SLOT(getBeamWidthFromWorkspace(const QString&))); - - // Sort the fields into various lists. - - QList<QLineEdit*> allFields; - QList<QLineEdit*> doubleFields; - QList<QLineEdit*> positiveDoubleFields; - - positiveDoubleFields += m_uiForm.lets; // Thickness - positiveDoubleFields += m_uiForm.letc1; // Front Thickness - positiveDoubleFields += m_uiForm.letc2; // Back Thickness + doValidation(true); + } - positiveDoubleFields += m_uiForm.ler1; // Radius 1 - positiveDoubleFields += m_uiForm.ler2; // Radius 2 - positiveDoubleFields += m_uiForm.ler3; // Radius 3 - positiveDoubleFields += m_uiForm.lewidth; // Beam Width + void CalcCorr::run() + { + // Get correct corrections algorithm + QString sampleShape = m_uiForm.cbSampleShape->currentText(); + QString algorithmName = sampleShape.replace(" ", "") + "PaalmanPingsCorrection"; - positiveDoubleFields += m_uiForm.lesamden; // Sample Number Density - positiveDoubleFields += m_uiForm.lesamsigs; // Sample Scattering Cross-Section - positiveDoubleFields += m_uiForm.lesamsiga; // Sample Absorption Cross-Section + API::BatchAlgorithmRunner::AlgorithmRuntimeProps absCorProps; + IAlgorithm_sptr absCorAlgo = AlgorithmManager::Instance().create(algorithmName.toStdString()); + absCorAlgo->initialize(); - positiveDoubleFields += m_uiForm.lecanden; // Can Number Density - positiveDoubleFields += m_uiForm.lecansigs; // Can Scattering Cross-Section - positiveDoubleFields += m_uiForm.lecansiga; // Can Absorption Cross-Section + // Sample details + QString sampleWsName = m_uiForm.dsSample->getCurrentDataName(); + MatrixWorkspace_sptr sampleWs = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(sampleWsName.toStdString()); - // Set appropriate validators. - foreach(QLineEdit * positiveDoubleField, positiveDoubleFields) + // If not in wavelength then do conversion + Mantid::Kernel::Unit_sptr sampleXUnit = sampleWs->getAxis(0)->unit(); + if(sampleXUnit->caption() != "Wavelength") { - positiveDoubleField->setValidator(m_posDblVal); + g_log.information("Sample workspace not in wavelength, need to convert to continue."); + absCorProps["SampleWorkspace"] = addConvertToWavelengthStep(sampleWs); + } + else + { + absCorProps["SampleWorkspace"] = sampleWsName.toStdString(); } - // Deal with the slightly more complex multi-range "Can Angle to Beam" field. - std::set<std::pair<double, double>> angleRanges; - angleRanges.insert(std::make_pair(-180, -100)); - angleRanges.insert(std::make_pair(-80, 80)); - angleRanges.insert(std::make_pair(100, 180)); - QDoubleMultiRangeValidator * angleValidator = new QDoubleMultiRangeValidator(angleRanges, this); - m_uiForm.leavar->setValidator(angleValidator); // Can Angle to Beam - - allFields = positiveDoubleFields; - allFields += m_uiForm.leavar; - - QRegExp regex("[A-Za-z0-9\\-\\(\\)]*"); - QValidator *formulaValidator = new QRegExpValidator(regex, this); - m_uiForm.leSampleFormula->setValidator(formulaValidator); - m_uiForm.leCanFormula->setValidator(formulaValidator); - - // "Nudge" color of title of QGroupBox to change. - useCanChecked(m_uiForm.ckUseCan->isChecked()); - } + double sampleNumberDensity = m_uiForm.spSampleNumberDensity->value(); + absCorAlgo->setProperty("SampleNumberDensity", sampleNumberDensity); - void CalcCorr::run() - { - QString pyInput = "import IndirectAbsCor\n"; + QString sampleChemicalFormula = m_uiForm.leSampleChemicalFormula->text(); + absCorAlgo->setProperty("SampleChemicalFormula", sampleChemicalFormula.toStdString()); - QString geom; - QString size; + addShapeSpecificSampleOptions(absCorAlgo, sampleShape); - if ( m_uiForm.cbShape->currentText() == "Flat" ) - { - geom = "flt"; - if ( m_uiForm.ckUseCan->isChecked() ) - { - size = "[" + m_uiForm.lets->text() + ", " + - m_uiForm.letc1->text() + ", " + - m_uiForm.letc2->text() + "]"; - } - else - { - size = "[" + m_uiForm.lets->text() + ", 0.0, 0.0]"; - } - } - else if ( m_uiForm.cbShape->currentText() == "Cylinder" ) + // Can details + bool useCan = m_uiForm.ckUseCan->isChecked(); + if(useCan) { - geom = "cyl"; + QString canWsName = m_uiForm.dsContainer->getCurrentDataName(); + MatrixWorkspace_sptr canWs = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(canWsName.toStdString()); - // R3 only populated when using can. R4 is fixed to 0.0 - if ( m_uiForm.ckUseCan->isChecked() ) + // If not in wavelength then do conversion + Mantid::Kernel::Unit_sptr canXUnit = canWs->getAxis(0)->unit(); + if(canXUnit->caption() != "Wavelength") { - size = "[" + m_uiForm.ler1->text() + ", " + - m_uiForm.ler2->text() + ", " + - m_uiForm.ler3->text() + ", 0.0 ]"; + g_log.information("Container workspace not in wavelength, need to convert to continue."); + absCorProps["CanWorkspace"] = addConvertToWavelengthStep(canWs); } else { - size = "[" + m_uiForm.ler1->text() + ", " + - m_uiForm.ler2->text() + ", 0.0, 0.0 ]"; + absCorProps["CanWorkspace"] = canWsName.toStdString(); } - } - - //get beam width - QString width = m_uiForm.lewidth->text(); - if (width.isEmpty()) { width = "None"; } - //get sample workspace. Load from if needed. - QString sampleWs = m_uiForm.dsSampleInput->getCurrentDataName(); - pyInput += "inputws = '" + sampleWs + "'\n"; + double canNumberDensity = m_uiForm.spCanNumberDensity->value(); + absCorAlgo->setProperty("CanNumberDensity", canNumberDensity); - //sample absorption and scattering x sections. - QString sampleScatteringXSec = m_uiForm.lesamsigs->text(); - QString sampleAbsorptionXSec = m_uiForm.lesamsiga->text(); + QString canChemicalFormula = m_uiForm.leCanChemicalFormula->text(); + absCorAlgo->setProperty("CanChemicalFormula", canChemicalFormula.toStdString()); - if ( sampleScatteringXSec.isEmpty() ) { sampleScatteringXSec = "0.0"; } - if ( sampleAbsorptionXSec.isEmpty() ) { sampleAbsorptionXSec = "0.0"; } + addShapeSpecificCanOptions(absCorAlgo, sampleShape); + } - //can and sample formulas - QString sampleFormula = m_uiForm.leSampleFormula->text(); - QString canFormula = m_uiForm.leCanFormula->text(); + std::string eMode = getEMode(sampleWs); + absCorAlgo->setProperty("EMode", eMode); + if(eMode == "Indirect") + absCorAlgo->setProperty("EFixed", getEFixed(sampleWs)); - if ( sampleFormula.isEmpty() ) - { - sampleFormula = "None"; - } - else - { - sampleFormula = "'" + sampleFormula + "'"; - } + // Generate workspace names + int nameCutIndex = sampleWsName.lastIndexOf("_"); + if(nameCutIndex == -1) + nameCutIndex = sampleWsName.length(); - if ( canFormula.isEmpty() ) - { - canFormula = "None"; - } - else + QString correctionType; + switch(m_uiForm.cbSampleShape->currentIndex()) { - canFormula = "'" + canFormula + "'"; + case 0: + correctionType = "flt"; + break; + case 1: + correctionType = "cyl"; + break; } - //create python string to execute - if ( m_uiForm.ckUseCan->isChecked() ) - { - //get sample workspace. Load from if needed. - QString canWs = m_uiForm.dsCanInput->getCurrentDataName(); - pyInput += "canws = '" + canWs + "'\n"; - - //can absoprtion and scattering x section. - QString canScatteringXSec = m_uiForm.lecansigs->text(); - QString canAbsorptionXSec = m_uiForm.lecansiga->text(); - - if ( canScatteringXSec.isEmpty() ) { canScatteringXSec = "0.0"; } - if ( canAbsorptionXSec.isEmpty() ) { canAbsorptionXSec = "0.0"; } - - pyInput += - "ncan = 2\n" - "density = [" + m_uiForm.lesamden->text() + ", " + m_uiForm.lecanden->text() + ", " + m_uiForm.lecanden->text() + "]\n" - "sigs = [" + sampleScatteringXSec + "," + canScatteringXSec + "," + canScatteringXSec + "]\n" - "siga = [" + sampleAbsorptionXSec + "," + canAbsorptionXSec + "," + canAbsorptionXSec + "]\n"; - } - else - { - pyInput += - "ncan = 1\n" - "density = [" + m_uiForm.lesamden->text() + ", 0.0, 0.0 ]\n" - "sigs = [" + sampleScatteringXSec + ", 0.0, 0.0]\n" - "siga = [" + sampleAbsorptionXSec + ", 0.0, 0.0]\n" - "canws = None\n"; - } + const QString outputWsName = sampleWsName.left(nameCutIndex) + "_" + correctionType + "_abs"; + absCorAlgo->setProperty("OutputWorkspace", outputWsName.toStdString()); - //Output options - if ( m_uiForm.ckSave->isChecked() ) pyInput += "save = True\n"; - else pyInput += "save = False\n"; + // Add corrections algorithm to queue + m_batchAlgoRunner->addAlgorithm(absCorAlgo, absCorProps); - pyInput += - "geom = '" + geom + "'\n" - "beam = " + width + "\n" - "size = " + size + "\n" - "avar = " + m_uiForm.leavar->text() + "\n" - "plotOpt = '" + m_uiForm.cbPlotOutput->currentText() + "'\n" - "sampleFormula = " + sampleFormula + "\n" - "canFormula = " + canFormula + "\n" - "print IndirectAbsCor.AbsRunFeeder(inputws, canws, geom, ncan, size, avar, density, beam, sampleFormula, canFormula, sigs, siga, plot_opt=plotOpt, save=save)\n"; + // Add save algorithms if required + bool save = m_uiForm.ckSave->isChecked(); + if(save) + addSaveWorkspaceToQueue(outputWsName); - QString pyOutput = runPythonCode(pyInput); + // Run algorithm queue + m_batchAlgoRunner->executeBatchAsync(); // Set the result workspace for Python script export - m_pythonExportWsName = pyOutput.trimmed().toStdString(); + m_pythonExportWsName = outputWsName.toStdString(); } + bool CalcCorr::validate() + { + return doValidation(); + } + + + /** + * Does validation on the user input. + * + * @param silent Set to true to avoid creating an error message + * @return True if all user input is valid + */ + bool CalcCorr::doValidation(bool silent) { UserInputValidator uiv; - bool useCan = m_uiForm.ckUseCan->isChecked(); - // Input files/workspaces - uiv.checkDataSelectorIsValid("Sample", m_uiForm.dsSampleInput); - if (useCan) + uiv.checkDataSelectorIsValid("Sample", m_uiForm.dsSample); + + // Validate chemical formula + if(uiv.checkFieldIsNotEmpty("Sample Chemical Formula", m_uiForm.leSampleChemicalFormula, m_uiForm.valSampleChemicalFormula)) + uiv.checkFieldIsValid("Sample Chemical Formula", m_uiForm.leSampleChemicalFormula, m_uiForm.valSampleChemicalFormula); + + bool useCan = m_uiForm.ckUseCan->isChecked(); + if(useCan) { - uiv.checkDataSelectorIsValid("Can", m_uiForm.dsCanInput); + uiv.checkDataSelectorIsValid("Can", m_uiForm.dsContainer); - QString sample = m_uiForm.dsSampleInput->getCurrentDataName(); - QString sampleType = sample.right(sample.length() - sample.lastIndexOf("_")); - QString container = m_uiForm.dsCanInput->getCurrentDataName(); - QString containerType = container.right(container.length() - container.lastIndexOf("_")); + // Validate chemical formula + if(uiv.checkFieldIsNotEmpty("Can Chemical Formula", m_uiForm.leCanChemicalFormula, m_uiForm.valCanChemicalFormula)) + uiv.checkFieldIsValid("Can Chemical Formula", m_uiForm.leCanChemicalFormula, m_uiForm.valCanChemicalFormula); + + // Ensure sample and container are the same kind of data + QString sampleWsName = m_uiForm.dsSample->getCurrentDataName(); + QString sampleType = sampleWsName.right(sampleWsName.length() - sampleWsName.lastIndexOf("_")); + QString containerWsName = m_uiForm.dsContainer->getCurrentDataName(); + QString containerType = containerWsName.right(containerWsName.length() - containerWsName.lastIndexOf("_")); g_log.debug() << "Sample type is: " << sampleType.toStdString() << std::endl; g_log.debug() << "Can type is: " << containerType.toStdString() << std::endl; if(containerType != sampleType) - { uiv.addErrorMessage("Sample and can workspaces must contain the same type of data."); - } } - uiv.checkFieldIsValid("Beam Width", m_uiForm.lewidth, m_uiForm.valWidth); - - if ( m_uiForm.cbShape->currentText() == "Flat" ) - { - // Flat Geometry - uiv.checkFieldIsValid("Thickness", m_uiForm.lets, m_uiForm.valts); + // Show error mssage if needed + if(!uiv.isAllInputValid() && !silent) + emit showMessageBox(uiv.generateErrorMessage()); - if ( useCan ) - { - uiv.checkFieldIsValid("Front Thickness", m_uiForm.letc1, m_uiForm.valtc1); - uiv.checkFieldIsValid("Back Thickness", m_uiForm.letc2, m_uiForm.valtc2); - } + return uiv.isAllInputValid(); + } - uiv.checkFieldIsValid("Can Angle to Beam must be in the range [-180 to -100], [-80 to 80] or [100 to 180].", m_uiForm.leavar, m_uiForm.valAvar); - } - if ( m_uiForm.cbShape->currentText() == "Cylinder" ) + /** + * Handles completion of the correction algorithm. + * + * @param error True of the algorithm failed + */ + void CalcCorr::algorithmComplete(bool error) + { + if(error) { - // Cylinder geometry - uiv.checkFieldIsValid("Radius 1", m_uiForm.ler1, m_uiForm.valR1); - uiv.checkFieldIsValid("Radius 2", m_uiForm.ler2, m_uiForm.valR2); - - double radius1 = m_uiForm.ler1->text().toDouble(); - double radius2 = m_uiForm.ler2->text().toDouble(); - if( radius1 >= radius2 ) - uiv.addErrorMessage("Radius 1 should be less than Radius 2."); - - // R3 only relevant when using can - if ( useCan ) - { - uiv.checkFieldIsValid("Radius 3", m_uiForm.ler3, m_uiForm.valR3); + emit showMessageBox("Absorption correction calculation failed.\nSee Results Log for more details."); + return; + } - double radius3 = m_uiForm.ler3->text().toDouble(); - if( radius2 >= radius3 ) - uiv.addErrorMessage("Radius 2 should be less than Radius 3."); + // Handle Mantid plotting + bool plot = m_uiForm.ckPlotOutput->isChecked(); + if(plot) + plotSpectrum(QString::fromStdString(m_pythonExportWsName)); + } - } - uiv.checkFieldIsValid("Step Size", m_uiForm.leavar, m_uiForm.valAvar); + void CalcCorr::loadSettings(const QSettings & settings) + { + m_uiForm.dsSample->readSettings(settings.group()); + m_uiForm.dsContainer->readSettings(settings.group()); + } - double stepSize = m_uiForm.leavar->text().toDouble(); - if( stepSize >= (radius2 - radius1) ) - uiv.addErrorMessage("Step size should be less than (Radius 2 - Radius 1)."); - } - // Sample details - uiv.checkFieldIsValid("Sample Number Density", m_uiForm.lesamden, m_uiForm.valSamden); + /** + * Gets the beam width from the instrument parameters on a given workspace + * and update the relevant options on the UI. + * + * @param wsName Name of the workspace + */ + void CalcCorr::getBeamWidthFromWorkspace(const QString& wsName) + { + auto ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(wsName.toStdString()); - switch(m_uiForm.cbSampleInputType->currentIndex()) + if(!ws) { - case 0: - //input using formula - uiv.checkFieldIsValid("Sample Formula", m_uiForm.leSampleFormula, m_uiForm.valSampleFormula); - break; - case 1: - //using direct input - uiv.checkFieldIsValid("Sample Scattering Cross-Section", m_uiForm.lesamsigs, m_uiForm.valSamsigs); - uiv.checkFieldIsValid("Sample Absorption Cross-Section", m_uiForm.lesamsiga, m_uiForm.valSamsiga); - break; + g_log.warning() << "Failed to find workspace " << wsName.toStdString() << std::endl; + return; } + std::string paramName = "Workflow.beam-width"; + auto instrument = ws->getInstrument(); - // Can details (only test if "Use Can" is checked) - if ( m_uiForm.ckUseCan->isChecked() ) + if(instrument->hasParameter(paramName)) { - QString canFile = m_uiForm.dsCanInput->getCurrentDataName(); - if(canFile.isEmpty()) - { - uiv.addErrorMessage("You must select a Sample file or workspace."); - } - - uiv.checkFieldIsValid("Can Number Density",m_uiForm.lecanden,m_uiForm.valCanden); - - switch(m_uiForm.cbCanInputType->currentIndex()) - { - case 0: - //input using formula - uiv.checkFieldIsValid("Can Formula", m_uiForm.leCanFormula, m_uiForm.valCanFormula); - break; - case 1: - // using direct input - uiv.checkFieldIsValid("Can Scattering Cross-Section", m_uiForm.lecansigs, m_uiForm.valCansigs); - uiv.checkFieldIsValid("Can Absorption Cross-Section", m_uiForm.lecansiga, m_uiForm.valCansiga); - break; - } + QString beamWidth = QString::fromStdString(instrument->getStringParameter(paramName)[0]); + double beamWidthValue = beamWidth.toDouble(); + m_uiForm.spCylBeamWidth->setValue(beamWidthValue); + m_uiForm.spCylBeamHeight->setValue(beamWidthValue); } - - QString error = uiv.generateErrorMessage(); - showMessageBox(error); - - return error.isEmpty(); } - void CalcCorr::loadSettings(const QSettings & settings) - { - m_uiForm.dsSampleInput->readSettings(settings.group()); - m_uiForm.dsCanInput->readSettings(settings.group()); - } - void CalcCorr::shape(int index) - { - m_uiForm.swShapeDetails->setCurrentIndex(index); - // Meaning of the "avar" variable changes depending on shape selection - if ( index == 0 ) { m_uiForm.lbAvar->setText("Sample Angle:"); } - else if ( index == 1 ) { m_uiForm.lbAvar->setText("Step Size:"); } - } - - void CalcCorr::useCanChecked(bool checked) + /** + * Sets algorithm properties specific to the sample for a given shape. + * + * @param alg Algorithm to set properties of + * @param shape Sample shape + */ + void CalcCorr::addShapeSpecificSampleOptions(IAlgorithm_sptr alg, QString shape) { - - // Disable "Can Details" group and asterisks. - m_uiForm.gbCan->setEnabled(checked); - m_uiForm.valCanden->setVisible(checked); - m_uiForm.lbtc1->setEnabled(checked); - m_uiForm.lbtc2->setEnabled(checked); - m_uiForm.letc1->setEnabled(checked); - m_uiForm.letc2->setEnabled(checked); - m_uiForm.lbR3->setEnabled(checked); - m_uiForm.ler3->setEnabled(checked); - - QString value; - (checked ? value = "*" : value = " "); - - m_uiForm.valCansigs->setText(value); - m_uiForm.valCansiga->setText(value); - m_uiForm.valCanFormula->setText(value); - - // Disable thickness fields/labels/asterisks. - m_uiForm.valtc1->setText(value); - m_uiForm.valtc2->setText(value); - - // // Disable R3 field/label/asterisk. - m_uiForm.valR3->setText(value); - - if (checked) + if(shape == "FlatPlate") { - UserInputValidator uiv; - uiv.checkFieldIsValid("",m_uiForm.lecansigs, m_uiForm.valCansigs); - uiv.checkFieldIsValid("",m_uiForm.lecansiga, m_uiForm.valCansiga); - uiv.checkFieldIsValid("",m_uiForm.letc1, m_uiForm.valtc1); - uiv.checkFieldIsValid("",m_uiForm.letc2, m_uiForm.valtc2); - uiv.checkFieldIsValid("",m_uiForm.ler3, m_uiForm.valR3); + double sampleThickness = m_uiForm.spFlatSampleThickness->value(); + alg->setProperty("SampleThickness", sampleThickness); + + double sampleAngle = m_uiForm.spFlatSampleAngle->value(); + alg->setProperty("SampleAngle", sampleAngle); } + else if(shape == "Cylinder") + { + double sampleInnerRadius = m_uiForm.spCylSampleInnerRadius->value(); + alg->setProperty("SampleInnerRadius", sampleInnerRadius); - m_uiForm.dsCanInput->setEnabled(checked); + double sampleOuterRadius = m_uiForm.spCylSampleOuterRadius->value(); + alg->setProperty("SampleOuterRadius", sampleOuterRadius); - // Workaround for "disabling" title of the QGroupBox. - QPalette palette; - if(checked) - palette.setColor( - QPalette::Disabled, - QPalette::WindowText, - QApplication::palette().color(QPalette::Disabled, QPalette::WindowText)); - else - palette.setColor( - QPalette::Active, - QPalette::WindowText, - QApplication::palette().color(QPalette::Active, QPalette::WindowText)); + double beamWidth = m_uiForm.spCylBeamWidth->value(); + alg->setProperty("BeamWidth", beamWidth); - m_uiForm.gbCan->setPalette(palette); - } + double beamHeight = m_uiForm.spCylBeamHeight->value(); + alg->setProperty("BeamHeight", beamHeight); - void CalcCorr::tcSync() - { - if ( m_uiForm.letc2->text() == "" ) - { - QString val = m_uiForm.letc1->text(); - m_uiForm.letc2->setText(val); + double stepSize = m_uiForm.spCylStepSize->value(); + alg->setProperty("StepSize", stepSize); } } - void CalcCorr::getBeamWidthFromWorkspace(const QString& wsname) - { - using namespace Mantid::API; - auto ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(wsname.toStdString()); - if (!ws) + /** + * Sets algorithm properties specific to the container for a given shape. + * + * @param alg Algorithm to set properties of + * @param shape Sample shape + */ + void CalcCorr::addShapeSpecificCanOptions(IAlgorithm_sptr alg, QString shape) + { + if(shape == "FlatPlate") { - showMessageBox("Failed to find workspace " + wsname); - return; - } + double canFrontThickness = m_uiForm.spFlatCanFrontThickness->value(); + alg->setProperty("CanFrontThickness", canFrontThickness); - std::string paramName = "Workflow.beam-width"; - auto instrument = ws->getInstrument(); - if (instrument->hasParameter(paramName)) - { - std::string beamWidth = instrument->getStringParameter(paramName)[0]; - m_uiForm.lewidth->setText(QString::fromUtf8(beamWidth.c_str())); + double canBackThickness = m_uiForm.spFlatCanBackThickness->value(); + alg->setProperty("SampleThickness", canBackThickness); } - else + else if(shape == "Cylinder") { - m_uiForm.lewidth->setText(""); + double canOuterRadius = m_uiForm.spCylCanOuterRadius->value(); + alg->setProperty("CanOuterRadius", canOuterRadius); } - } + + } // namespace IDA } // namespace CustomInterfaces } // namespace MantidQt diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp index 87c3b3416da06f74275c0db18fc57d6105fd32eb..d1f64dc1bcc2e7b197c66ee3d8896b230585af8f 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp @@ -89,20 +89,20 @@ namespace IDA double energyMin = m_dblManager->value(m_properties["ELow"]); double energyMax = m_dblManager->value(m_properties["EHigh"]); - long numBins = static_cast<long>(m_dblManager->value(m_properties["SampleBinning"])); + double numBins = m_dblManager->value(m_properties["SampleBinning"]); bool plot = m_uiForm.ckPlot->isChecked(); bool save = m_uiForm.ckSave->isChecked(); - IAlgorithm_sptr furyAlg = AlgorithmManager::Instance().create("Fury", -1); + IAlgorithm_sptr furyAlg = AlgorithmManager::Instance().create("TransformToIqt", -1); furyAlg->initialize(); - furyAlg->setProperty("Sample", wsName.toStdString()); - furyAlg->setProperty("Resolution", resName.toStdString()); + furyAlg->setProperty("SampleWorkspace", wsName.toStdString()); + furyAlg->setProperty("ResolutionWorkspace", resName.toStdString()); furyAlg->setProperty("EnergyMin", energyMin); furyAlg->setProperty("EnergyMax", energyMax); - furyAlg->setProperty("NumBins", numBins); + furyAlg->setProperty("BinReductionFactor", numBins); furyAlg->setProperty("Plot", plot); furyAlg->setProperty("Save", save); @@ -188,20 +188,20 @@ namespace IDA double energyMin = m_dblManager->value(m_properties["ELow"]); double energyMax = m_dblManager->value(m_properties["EHigh"]); - long numBins = static_cast<long>(m_dblManager->value(m_properties["SampleBinning"])); // Default value + double numBins = m_dblManager->value(m_properties["SampleBinning"]); if(numBins == 0) return; - IAlgorithm_sptr furyAlg = AlgorithmManager::Instance().create("Fury"); + IAlgorithm_sptr furyAlg = AlgorithmManager::Instance().create("TransformToIqt"); furyAlg->initialize(); - furyAlg->setProperty("Sample", wsName.toStdString()); - furyAlg->setProperty("Resolution", resName.toStdString()); + furyAlg->setProperty("SampleWorkspace", wsName.toStdString()); + furyAlg->setProperty("ResolutionWorkspace", resName.toStdString()); furyAlg->setProperty("ParameterWorkspace", "__FuryProperties_temp"); furyAlg->setProperty("EnergyMin", energyMin); furyAlg->setProperty("EnergyMax", energyMax); - furyAlg->setProperty("NumBins", numBins); + furyAlg->setProperty("BinReductionFactor", numBins); furyAlg->setProperty("Plot", false); furyAlg->setProperty("Save", false); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp index 0cabe7f5e333cc35de84aec9fd83e2a75b5615f8..4b394e01c0370771d4e95e458b66e96062477afa 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IDATab.cpp @@ -32,6 +32,7 @@ namespace IDA m_blnEdFac = new QtCheckBoxFactory(this); } + /** * Loads the tab's settings. * @@ -44,6 +45,7 @@ namespace IDA loadSettings(settings); } + /** * Slot that can be called when a user edits an input. */ @@ -52,6 +54,7 @@ namespace IDA validate(); } + /** * Check that the binning between two workspaces matches. * @@ -74,6 +77,35 @@ namespace IDA } } + + /** + * Adds a unit converstion into wavelength step to the batch algorithm queue. + * + * @param ws Pointer to the workspace to convert + * @return Name of output workspace + */ + std::string IDATab::addConvertToWavelengthStep(MatrixWorkspace_sptr ws) + { + std::string outputName = ws->name() + "_inWavelength"; + + IAlgorithm_sptr convertAlg = AlgorithmManager::Instance().create("ConvertUnits"); + convertAlg->initialize(); + + convertAlg->setProperty("InputWorkspace", ws->name()); + convertAlg->setProperty("OutputWorkspace", outputName); + convertAlg->setProperty("Target", "Wavelength"); + + std::string eMode = getEMode(ws); + convertAlg->setProperty("EMode", eMode); + + if(eMode == "Indirect") + convertAlg->setProperty("EFixed", getEFixed(ws)); + + m_batchAlgoRunner->addAlgorithm(convertAlg); + + return outputName; + } + } // namespace IDA } // namespace CustomInterfaces } // namespace MantidQt diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp index c4e6b705319331cd2ab47f9fe87fb79ce65ec875..c74a02eaf835cf91acadf40476a8e1a77dab2120 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp @@ -11,6 +11,7 @@ #include "MantidQtCustomInterfaces/Indirect/ConvFit.h" #include "MantidQtCustomInterfaces/Indirect/CalcCorr.h" #include "MantidQtCustomInterfaces/Indirect/ApplyCorr.h" +#include "MantidQtCustomInterfaces/Indirect/AbsorptionCorrections.h" #include "MantidQtAPI/HelpWindow.h" #include "MantidQtAPI/ManageUserDirectories.h" @@ -51,6 +52,7 @@ namespace IDA m_tabs.insert(std::make_pair(CONV_FIT, new ConvFit(m_uiForm.twIDATabs->widget(CONV_FIT)))); m_tabs.insert(std::make_pair(CALC_CORR, new CalcCorr(m_uiForm.twIDATabs->widget(CALC_CORR)))); m_tabs.insert(std::make_pair(APPLY_CORR, new ApplyCorr(m_uiForm.twIDATabs->widget(APPLY_CORR)))); + m_tabs.insert(std::make_pair(ABSORPTION_CORRECTIONS, new AbsorptionCorrections(m_uiForm.twIDATabs->widget(ABSORPTION_CORRECTIONS)))); } /** diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReductionTab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReductionTab.cpp index 87c0f817542f3db909188d93a28661f049851618..423cd02cae0214aa3325bfb9fcb5bb9de12a19f2 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReductionTab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectDataReductionTab.cpp @@ -188,7 +188,7 @@ namespace CustomInterfaces loadParamAlg->execute(); energyWs = loadParamAlg->getProperty("Workspace"); - double efixed = energyWs->getInstrument()->getNumberParameter("efixed-val")[0]; + double efixed = getEFixed(energyWs); auto spectrum = energyWs->getSpectrum(0); spectrum->setSpectrumNo(3); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTab.cpp index 2e35ed5775cab275e89d46d050334fe3a8412936..856a69723d9939f2eafcbf0c09d1b1f52cd89981 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/IndirectTab.cpp @@ -6,6 +6,8 @@ #include "MantidQtAPI/InterfaceManager.h" #include "MantidQtMantidWidgets/RangeSelector.h" +#include <boost/algorithm/string/find.hpp> + using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid::Kernel; @@ -44,6 +46,7 @@ namespace CustomInterfaces connect(&m_pythonRunner, SIGNAL(runAsPythonScript(const QString&, bool)), this, SIGNAL(runAsPythonScript(const QString&, bool))); } + //---------------------------------------------------------------------------------------------- /** Destructor */ @@ -51,6 +54,7 @@ namespace CustomInterfaces { } + void IndirectTab::runTab() { if(validate()) @@ -64,16 +68,19 @@ namespace CustomInterfaces } } + void IndirectTab::setupTab() { setup(); } + bool IndirectTab::validateTab() { return validate(); } + /** * Handles generating a Python script for the algorithms run on the current tab. */ @@ -114,6 +121,7 @@ namespace CustomInterfaces dlg->activateWindow(); } + /** * Run the load algorithm with the supplied filename and spectrum range * @@ -140,10 +148,97 @@ namespace CustomInterfaces load->execute(); - //If reloading fails we're out of options + // If reloading fails we're out of options return load->isExecuted(); } + + /** + * Configures the SaveNexusProcessed algorithm to save a workspace in the default + * save directory and adds the algorithm to the batch queue. + * + * This uses the plotSpectrum function from the Python API. + * + * @param wsName Name of workspace to save + * @param filename Name of file to save as (including extension) + */ + void IndirectTab::addSaveWorkspaceToQueue(const QString & wsName, const QString & filename) + { + // Setup the input workspace property + API::BatchAlgorithmRunner::AlgorithmRuntimeProps saveProps; + saveProps["InputWorkspace"] = wsName.toStdString(); + + // Setup the algorithm + IAlgorithm_sptr saveAlgo = AlgorithmManager::Instance().create("SaveNexusProcessed"); + saveAlgo->initialize(); + + if(filename.isEmpty()) + saveAlgo->setProperty("Filename", wsName.toStdString() + ".nxs"); + else + saveAlgo->setProperty("Filename", filename.toStdString()); + + // Add the save algorithm to the batch + m_batchAlgoRunner->addAlgorithm(saveAlgo, saveProps); + } + + + /** + * Creates a spectrum plot of one or more workspaces at a given spectrum + * index. + * + * This uses the plotSpectrum function from the Python API. + * + * @param workspaceNames List of names of workspaces to plot + * @param specIndex Index of spectrum from each workspace to plot + */ + void IndirectTab::plotSpectrum(const QStringList & workspaceNames, int specIndex) + { + QString pyInput = "from mantidplot import plotSpectrum\n"; + + pyInput += "plotSpectrum('"; + pyInput += workspaceNames.join("','"); + pyInput += "', "; + pyInput += QString::number(specIndex); + pyInput += ")\n"; + + m_pythonRunner.runPythonCode(pyInput); + } + + + /** + * Creates a spectrum plot of a single workspace at a given spectrum + * index. + * + * @param workspaceName Names of workspace to plot + * @param specIndex Index of spectrum to plot + */ + void IndirectTab::plotSpectrum(const QString & workspaceName, int specIndex) + { + QStringList workspaceNames; + workspaceNames << workspaceName; + plotSpectrum(workspaceNames, specIndex); + } + + + /** + * Plots a contour (2D) plot of a given workspace. + * + * This uses the plot2D function from the Python API. + * + * @param workspaceName Name of workspace to plot + */ + void IndirectTab::plotContour(const QString & workspaceName) + { + QString pyInput = "from mantidplot import plot2D\n"; + + pyInput += "plot2D('"; + pyInput += workspaceName; + pyInput += "')\n"; + + m_pythonRunner.runPythonCode(pyInput); + } + + /** * Sets the edge bounds of plot to prevent the user inputting invalid values * Also sets limits for range selector movement @@ -163,6 +258,7 @@ namespace CustomInterfaces rs->setRange(bounds.first, bounds.second); } + /** * Set the position of the range selectors on the mini plot * @@ -180,6 +276,49 @@ namespace CustomInterfaces rs->setMaximum(bounds.second); } + + /** + * Gets the energy mode from a workspace based on the X unit. + * + * Units of dSpacing typically denote diffraction, hence Elastic. + * All other units default to spectroscopy, therefore Indirect. + * + * @param ws Pointer to the workspace + * @return Energy mode + */ + std::string IndirectTab::getEMode(Mantid::API::MatrixWorkspace_sptr ws) + { + Mantid::Kernel::Unit_sptr xUnit = ws->getAxis(0)->unit(); + std::string xUnitName = xUnit->caption(); + + g_log.debug() << "X unit name is: " << xUnitName << std::endl; + + if(boost::algorithm::find_first(xUnitName, "d-Spacing")) + return "Elastic"; + + return "Indirect"; + } + + + /** + * Gets the eFixed value from the workspace using the instrument parameters. + * + * @param ws Pointer to the workspace + * @return eFixed value + */ + double IndirectTab::getEFixed(Mantid::API::MatrixWorkspace_sptr ws) + { + Mantid::Geometry::Instrument_const_sptr inst = ws->getInstrument(); + if(!inst) + throw std::runtime_error("No instrument on workspace"); + + if(!inst->hasParameter("efixed-val")) + throw std::runtime_error("Instrument has no efixed parameter"); + + return inst->getNumberParameter("efixed-val")[0]; + } + + /** * Runs an algorithm async * @@ -198,6 +337,7 @@ namespace CustomInterfaces m_batchAlgoRunner->executeBatchAsync(); } + /** * Handles getting the results of an algorithm running async * @@ -213,6 +353,7 @@ namespace CustomInterfaces } } + /** * Run Python code and return anything printed to stdout. * diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp index c1be652ce1893086dde17f8be70bff29af6f2bf9..10c42a32c5867dcb7f7a617adea1f1523b80f563 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp @@ -920,10 +920,16 @@ bool SANSRunWindow::loadUserFile() // from the ticket #5942 both detectors have center coordinates dbl_param = runReduceScriptFunction( "print i.ReductionSingleton().get_beam_center('rear')[0]").toDouble(); - m_uiForm.rear_beam_x->setText(QString::number(dbl_param*1000.0)); + // get the scale factor1 for the beam centre to scale it correctly + double dbl_paramsf = runReduceScriptFunction( + "print i.ReductionSingleton().get_beam_center_scale_factor1()").toDouble(); + m_uiForm.rear_beam_x->setText(QString::number(dbl_param*dbl_paramsf)); + // get scale factor2 for the beam centre to scale it correctly + dbl_paramsf = runReduceScriptFunction( + "print i.ReductionSingleton().get_beam_center_scale_factor2()").toDouble(); dbl_param = runReduceScriptFunction( "print i.ReductionSingleton().get_beam_center('rear')[1]").toDouble(); - m_uiForm.rear_beam_y->setText(QString::number(dbl_param*1000.0)); + m_uiForm.rear_beam_y->setText(QString::number(dbl_param*dbl_paramsf)); // front dbl_param = runReduceScriptFunction( "print i.ReductionSingleton().get_beam_center('front')[0]").toDouble(); diff --git a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h index 1f2b9aba85fc93265981ab8a6cd13ccd17ae6d40..ebe50da848b75cf8bc808f672ff9ba6ebe403231 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h +++ b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h @@ -21,6 +21,7 @@ class QtStringPropertyManager; class QtEnumPropertyManager; class QtProperty; class QtBrowserItem; +class ParameterPropertyManager; class QPushButton; class QLabel; @@ -108,10 +109,14 @@ public: /// Update the function parameter value void setParameter(const QString& funcIndex, const QString& paramName, double value); + /// Update the function parameter error + void setParamError(const QString& funcIndex, const QString& paramName, double error); /// Get a value of a parameter double getParameter(const QString& funcIndex, const QString& paramName) const; /// Update the function parameter value void setParameter(const QString& paramName, double value); + /// Update the function parameter error + void setParamError(const QString& paramName, double error); /// Get a value of a parameter double getParameter(const QString& paramName) const; /// Update parameter values in the browser to match those of a function. @@ -147,7 +152,7 @@ protected: /// Add a function property AProperty addFunctionProperty(QtProperty* parent, QString funName); /// Add a parameter property - AProperty addParameterProperty(QtProperty* parent, QString paramName, double paramValue); + AProperty addParameterProperty(QtProperty* parent, QString paramName, QString paramDesc, double paramValue); /// Add a attribute property AProperty addAttributeProperty(QtProperty* parent, QString attName, const Mantid::API::IFunction::Attribute& att); /// Add attribute and parameter properties to a function property @@ -249,7 +254,7 @@ protected: /// Manager for function group properties QtGroupPropertyManager *m_functionManager; /// Manager for function parameter properties - QtDoublePropertyManager *m_parameterManager; + ParameterPropertyManager *m_parameterManager; /// Manager for function string attribute properties QtStringPropertyManager *m_attributeStringManager; /// Manager for function double attribute properties diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/FunctionBrowser.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/FunctionBrowser.cpp index 874e0423532f04af14b9dda86758be24108fb236..7804ff7052dc75226a4567738d3b0e49b88513e3 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/src/FunctionBrowser.cpp +++ b/Code/Mantid/MantidQt/MantidWidgets/src/FunctionBrowser.cpp @@ -115,7 +115,7 @@ void FunctionBrowser::createBrowser() /* Create property managers: they create, own properties, get and set values */ m_functionManager = new QtGroupPropertyManager(this); - m_parameterManager = new QtDoublePropertyManager(this); + m_parameterManager = new ParameterPropertyManager(this); m_attributeStringManager = new QtStringPropertyManager(this); m_attributeDoubleManager = new QtDoublePropertyManager(this); m_attributeIntManager = new QtIntPropertyManager(this); @@ -133,19 +133,20 @@ void FunctionBrowser::createBrowser() // create editor factories QtSpinBoxFactory *spinBoxFactory = new QtSpinBoxFactory(this); DoubleEditorFactory *doubleEditorFactory = new DoubleEditorFactory(this); + ParameterEditorFactory *paramEditorFactory = new ParameterEditorFactory(this); - QtAbstractEditorFactory<QtDoublePropertyManager> *parameterEditorFactory(NULL); + QtAbstractEditorFactory<ParameterPropertyManager> *parameterEditorFactory(NULL); if ( m_multiDataset ) { auto buttonFactory = new DoubleButtonEditorFactory(this); - auto compositeFactory = new CompositeEditorFactory<QtDoublePropertyManager>(this,buttonFactory); - compositeFactory->setSecondaryFactory(globalOptionName, doubleEditorFactory); + auto compositeFactory = new CompositeEditorFactory<ParameterPropertyManager>(this,buttonFactory); + compositeFactory->setSecondaryFactory(globalOptionName, paramEditorFactory); parameterEditorFactory = compositeFactory; connect(buttonFactory,SIGNAL(buttonClicked(QtProperty*)), this,SLOT(parameterButtonClicked(QtProperty*))); } else { - parameterEditorFactory = doubleEditorFactory; + parameterEditorFactory = paramEditorFactory; } QtLineEditFactory *lineEditFactory = new QtLineEditFactory(this); @@ -185,6 +186,7 @@ void FunctionBrowser::createBrowser() SLOT(parameterChanged(QtProperty*))); connect(m_browser, SIGNAL(currentItemChanged(QtBrowserItem*)), SLOT(updateCurrentFunctionIndex())); + } /** @@ -227,6 +229,8 @@ void FunctionBrowser::createActions() m_actionRemoveConstraint = new QAction("Remove",this); connect(m_actionRemoveConstraint,SIGNAL(triggered()),this,SLOT(removeConstraint())); + + m_parameterManager->setErrorsEnabled(true); } /** @@ -396,9 +400,10 @@ FunctionBrowser::AProperty FunctionBrowser::addFunctionProperty(QtProperty* pare * Add a parameter property * @param parent :: Parent function property * @param paramName :: Parameter name + * @param paramDesc :: Parameter description * @param paramValue :: Parameter value */ -FunctionBrowser::AProperty FunctionBrowser::addParameterProperty(QtProperty* parent, QString paramName, double paramValue) +FunctionBrowser::AProperty FunctionBrowser::addParameterProperty(QtProperty* parent, QString paramName, QString paramDesc, double paramValue) { // check that parent is a function property if (!parent || dynamic_cast<QtAbstractPropertyManager*>(m_functionManager) != parent->propertyManager()) @@ -408,6 +413,8 @@ FunctionBrowser::AProperty FunctionBrowser::addParameterProperty(QtProperty* par QtProperty* prop = m_parameterManager->addProperty(paramName); m_parameterManager->setDecimals(prop,6); m_parameterManager->setValue(prop,paramValue); + m_parameterManager->setDescription(prop,paramDesc.toStdString()); + if ( m_multiDataset ) { prop->setOption(globalOptionName,false); @@ -667,8 +674,9 @@ void FunctionBrowser::addAttributeAndParameterProperties(QtProperty* prop, Manti for(size_t i = 0; i < fun->nParams(); ++i) { QString name = QString::fromStdString(fun->parameterName(i)); + QString desc = QString::fromStdString(fun->parameterDescription(i)); double value = fun->getParameter(i); - AProperty ap = addParameterProperty(prop, name, value); + AProperty ap = addParameterProperty(prop, name, desc, value); // if parameter has a tie if (fun->isFixed(i)) { @@ -1511,6 +1519,29 @@ void FunctionBrowser::setParameter(const QString& funcIndex, const QString& para } } +/** + * Updates the function parameter error + * @param funcIndex :: Index of the function + * @param paramName :: Parameter name + * @param error :: New error + */ +void FunctionBrowser::setParamError(const QString& funcIndex, const QString& paramName, double error) +{ + if (auto prop = getFunctionProperty(funcIndex)) + { + auto children = prop->subProperties(); + foreach(QtProperty* child, children) + { + if (isParameter(child) && child->propertyName() == paramName) + { +// m_parameterManager->setDescription(child,""); + m_parameterManager->setError(child, error); + break; + } + } + } +} + /** * Get a value of a parameter * @param funcIndex :: Index of the function @@ -1565,6 +1596,17 @@ void FunctionBrowser::setParameter(const QString& paramName, double value) setParameter(name[0],name[1],value); } +/** + * Updates the function parameter error + * @param paramName :: Fully qualified parameter name (includes function index) + * @param error :: New error + */ +void FunctionBrowser::setParamError(const QString& paramName, double error) +{ + QStringList name = splitParameterName(paramName); + setParamError(name[0],name[1],error); +} + /** * Get a value of a parameter * @param paramName :: Fully qualified parameter name (includes function index) diff --git a/Code/Mantid/MantidQt/SliceViewer/inc/MantidQtSliceViewer/LineViewer.ui b/Code/Mantid/MantidQt/SliceViewer/inc/MantidQtSliceViewer/LineViewer.ui index 63ef5c455ce485641893f794a0f89c9706ce3206..936842470df498a47a2ddff99af393dd814bba5e 100644 --- a/Code/Mantid/MantidQt/SliceViewer/inc/MantidQtSliceViewer/LineViewer.ui +++ b/Code/Mantid/MantidQt/SliceViewer/inc/MantidQtSliceViewer/LineViewer.ui @@ -240,6 +240,19 @@ from the length of the line being drawn</string> </property> </widget> </item> + <item> + <widget class="QCheckBox" name="ckOverWrite"> + <property name="toolTip"> + <string>Overwrite any existing line cuts from the same MDWorkspace</string> + </property> + <property name="text"> + <string>Overwrite lines</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> <item> <spacer name="horizontalSpacer_4"> <property name="orientation"> @@ -268,7 +281,16 @@ from the length of the line being drawn</string> <property name="spacing"> <number>4</number> </property> - <property name="margin"> + <property name="leftMargin"> + <number>2</number> + </property> + <property name="topMargin"> + <number>2</number> + </property> + <property name="rightMargin"> + <number>2</number> + </property> + <property name="bottomMargin"> <number>2</number> </property> <item> diff --git a/Code/Mantid/MantidQt/SliceViewer/src/LineViewer.cpp b/Code/Mantid/MantidQt/SliceViewer/src/LineViewer.cpp index 0be3451b0d4bed1d8b9cd73172732d06139e89c6..6201328b653383db637246c2ac271eaec7b90a8d 100644 --- a/Code/Mantid/MantidQt/SliceViewer/src/LineViewer.cpp +++ b/Code/Mantid/MantidQt/SliceViewer/src/LineViewer.cpp @@ -24,58 +24,80 @@ using namespace Mantid::Kernel; using Mantid::Geometry::IMDDimension_const_sptr; using MantidQt::API::AlgorithmRunner; -namespace MantidQt -{ -namespace SliceViewer -{ - namespace - { - /// static logger - Mantid::Kernel::Logger g_log("LineViewer"); - - /** - * Set thicknesses allowing the integrated dimensions, where the default should be to integrate to the full range. - * @param ws : Workspace to integrate - * @param dimIndex : Dimension index to set the thickness for. - * @param width : Default thickness (for non integrated dimensions) - * @param thicknesses : Thickness vector to write to - */ - void setThicknessUsingDimensionInfo(IMDWorkspace_sptr ws, size_t dimIndex, double width, - Mantid::Kernel::VMD& thicknesses) - { - auto currentDim = ws->getDimension(dimIndex); - if (currentDim->getIsIntegrated()) - { - const double min = currentDim->getMaximum(); - const double max = currentDim->getMinimum(); - double range = std::abs(max - min)/2; - thicknesses[dimIndex] = VMD_t(range); - } - else - { - thicknesses[dimIndex] = VMD_t(width); - } - } +namespace { + +/** + * Makes names for line cuts + * @param wsName : Name of the workspace to create a cut from + * @param overwrite : True to overwrite anything of this name in the analysis + * data service + * @return name of the line cut. + */ +std::string proposeIntegratedWSName(const std::string &wsName, + const bool overwrite) { + const auto baseName = wsName + "_line"; + std::string resultName = baseName; + if (!overwrite) { + // Fabricate a new name based on the base name. + AnalysisDataServiceImpl &store = AnalysisDataService::Instance(); + + if (store.doesExist(baseName)) { + std::string candidateName; + unsigned int counter = 1; + do { + candidateName = baseName + QString::number(counter).toStdString(); + ++counter; + } while (store.doesExist(candidateName)); + resultName = candidateName; + } } + return resultName; +} +} +namespace MantidQt { +namespace SliceViewer { +namespace { +/// static logger +Mantid::Kernel::Logger g_log("LineViewer"); + +/** + * Set thicknesses allowing the integrated dimensions, where the default should + * be to integrate to the full range. + * @param ws : Workspace to integrate + * @param dimIndex : Dimension index to set the thickness for. + * @param width : Default thickness (for non integrated dimensions) + * @param thicknesses : Thickness vector to write to + */ +void setThicknessUsingDimensionInfo(IMDWorkspace_sptr ws, size_t dimIndex, + double width, + Mantid::Kernel::VMD &thicknesses) { + auto currentDim = ws->getDimension(dimIndex); + if (currentDim->getIsIntegrated()) { + const double min = currentDim->getMaximum(); + const double max = currentDim->getMinimum(); + double range = std::abs(max - min) / 2; + thicknesses[dimIndex] = VMD_t(range); + } else { + thicknesses[dimIndex] = VMD_t(width); + } +} +} LineViewer::LineViewer(QWidget *parent) - : QWidget(parent), - m_planeWidth(0), - m_numBins(100), - m_allDimsFree(false), m_freeDimX(0), m_freeDimY(1), - m_fixedBinWidthMode(false), m_fixedBinWidth(0.1), m_binWidth(0.1) -{ - ui.setupUi(this); - - // Other setup + : QWidget(parent), m_planeWidth(0), m_numBins(100), m_allDimsFree(false), + m_freeDimX(0), m_freeDimY(1), m_fixedBinWidthMode(false), + m_fixedBinWidth(0.1), m_binWidth(0.1) { + ui.setupUi(this); + + // Other setup ui.textBinWidth->setValidator(new QDoubleValidator(ui.textBinWidth)); - // --------- Create the plot ----------------- + // --------- Create the plot ----------------- m_plotLayout = new QVBoxLayout(ui.frmPlot); m_plot = new QwtPlot(); m_plot->autoRefresh(); - m_plot->setBackgroundColor(QColor(255,255,255)); // White background + m_plot->setBackgroundColor(QColor(255, 255, 255)); // White background m_plotLayout->addWidget(m_plot, 1); // Make the 2 curves @@ -93,7 +115,8 @@ LineViewer::LineViewer(QWidget *parent) // To run BinMD in the background m_algoRunner = new AlgorithmRunner(this); - QObject::connect(m_algoRunner, SIGNAL(algorithmComplete(bool)), this, SLOT(lineIntegrationComplete(bool))); + QObject::connect(m_algoRunner, SIGNAL(algorithmComplete(bool)), this, + SLOT(lineIntegrationComplete(bool))); // Make the splitter use the minimum size for the controls and not stretch out ui.splitter->setStretchFactor(0, 0); @@ -101,83 +124,86 @@ LineViewer::LineViewer(QWidget *parent) //----------- Connect signals ------------- QObject::connect(ui.btnApply, SIGNAL(clicked()), this, SLOT(apply())); - QObject::connect(ui.chkAdaptiveBins, SIGNAL( stateChanged(int)), this, SLOT(adaptiveBinsChanged())); - QObject::connect(ui.spinNumBins, SIGNAL(valueChanged(int)), this, SLOT(numBinsChanged())); - QObject::connect(ui.textPlaneWidth, SIGNAL(textEdited(QString)), this, SLOT(thicknessTextEdited())); - QObject::connect(ui.radNumBins, SIGNAL(toggled(bool)), this, SLOT(on_radNumBins_toggled())); - QObject::connect(ui.textBinWidth, SIGNAL(editingFinished()), this, SLOT(textBinWidth_changed())); - - QObject::connect(m_lineOptions, SIGNAL(changedPlotAxis()), this, SLOT(refreshPlot())); - QObject::connect(m_lineOptions, SIGNAL(changedNormalization()), this, SLOT(refreshPlot())); - QObject::connect(m_lineOptions, SIGNAL(changedYLogScaling()), this, SLOT(onToggleLogYAxis())); + QObject::connect(ui.chkAdaptiveBins, SIGNAL(stateChanged(int)), this, + SLOT(adaptiveBinsChanged())); + QObject::connect(ui.spinNumBins, SIGNAL(valueChanged(int)), this, + SLOT(numBinsChanged())); + QObject::connect(ui.textPlaneWidth, SIGNAL(textEdited(QString)), this, + SLOT(thicknessTextEdited())); + QObject::connect(ui.radNumBins, SIGNAL(toggled(bool)), this, + SLOT(on_radNumBins_toggled())); + QObject::connect(ui.textBinWidth, SIGNAL(editingFinished()), this, + SLOT(textBinWidth_changed())); + + QObject::connect(m_lineOptions, SIGNAL(changedPlotAxis()), this, + SLOT(refreshPlot())); + QObject::connect(m_lineOptions, SIGNAL(changedNormalization()), this, + SLOT(refreshPlot())); + QObject::connect(m_lineOptions, SIGNAL(changedYLogScaling()), this, + SLOT(onToggleLogYAxis())); } -LineViewer::~LineViewer() -{ - -} +LineViewer::~LineViewer() {} //----------------------------------------------------------------------------------------------- /** With the workspace set, create the dimension text boxes */ -void LineViewer::createDimensionWidgets() -{ +void LineViewer::createDimensionWidgets() { // Create all necessary widgets - if (m_startText.size() < int(m_ws->getNumDims())) - { - for (size_t d=m_startText.size(); d<m_ws->getNumDims(); d++) - { - QLabel * dimLabel = new QLabel(this); + if (m_startText.size() < int(m_ws->getNumDims())) { + for (size_t d = m_startText.size(); d < m_ws->getNumDims(); d++) { + QLabel *dimLabel = new QLabel(this); dimLabel->setAlignment(Qt::AlignHCenter); - ui.gridLayout->addWidget(dimLabel, 0, int(d)+1); + ui.gridLayout->addWidget(dimLabel, 0, int(d) + 1); m_dimensionLabel.push_back(dimLabel); - QLineEdit * startText = new QLineEdit(this); - QLineEdit * endText = new QLineEdit(this); - QLineEdit * thicknessText = new QLineEdit(this); + QLineEdit *startText = new QLineEdit(this); + QLineEdit *endText = new QLineEdit(this); + QLineEdit *thicknessText = new QLineEdit(this); startText->setMaximumWidth(100); endText->setMaximumWidth(100); thicknessText->setMaximumWidth(100); startText->setToolTip("Start point of the line in this dimension"); endText->setToolTip("End point of the line in this dimension"); - thicknessText->setToolTip("Integration thickness (above and below plane) in this dimension. Specify 1/2 the total thickness for integration."); + thicknessText->setToolTip("Integration thickness (above and below plane) " + "in this dimension. Specify 1/2 the total " + "thickness for integration."); startText->setValidator(new QDoubleValidator(startText)); endText->setValidator(new QDoubleValidator(endText)); thicknessText->setValidator(new QDoubleValidator(thicknessText)); - ui.gridLayout->addWidget(startText, 1, int(d)+1); - ui.gridLayout->addWidget(endText, 2, int(d)+1); - ui.gridLayout->addWidget(thicknessText, 3, int(d)+1); + ui.gridLayout->addWidget(startText, 1, int(d) + 1); + ui.gridLayout->addWidget(endText, 2, int(d) + 1); + ui.gridLayout->addWidget(thicknessText, 3, int(d) + 1); m_startText.push_back(startText); m_endText.push_back(endText); m_thicknessText.push_back(thicknessText); // Signals that don't change - QObject::connect(thicknessText, SIGNAL(textEdited(QString)), this, SLOT(thicknessTextEdited())); + QObject::connect(thicknessText, SIGNAL(textEdited(QString)), this, + SLOT(thicknessTextEdited())); } } // ------ Update the widgets ------------------------- - for (int d=0; d<int(m_ws->getNumDims()); d++) - { - m_dimensionLabel[d]->setText( QString::fromStdString(m_ws->getDimension( size_t(d))->getName() ) ); + for (int d = 0; d < int(m_ws->getNumDims()); d++) { + m_dimensionLabel[d]->setText( + QString::fromStdString(m_ws->getDimension(size_t(d))->getName())); } } - //----------------------------------------------------------------------------------------------- /** Disable any controls relating to dimensions that are not "free" * e.g. if you are in the X-Y plane, the Z position cannot be changed. * Also updates the radio buttons for the choice of X axis. */ -void LineViewer::updateFreeDimensions() -{ - for (int d=0; d<int(m_ws->getNumDims()); d++) - { +void LineViewer::updateFreeDimensions() { + for (int d = 0; d < int(m_ws->getNumDims()); d++) { // Can always change the start value m_startText[d]->setEnabled(true); // This dimension is free to move if b == true bool b = (m_allDimsFree || d == m_freeDimX || d == m_freeDimY); m_endText[d]->setEnabled(b); - // If all dims are free, width makes little sense. Only allow one (circular) width + // If all dims are free, width makes little sense. Only allow one (circular) + // width if (m_allDimsFree) m_thicknessText[d]->setVisible(d != 0); else @@ -187,33 +213,29 @@ void LineViewer::updateFreeDimensions() m_startText[d]->disconnect(); m_endText[d]->disconnect(); - if (d == m_freeDimX || d == m_freeDimY) - { + if (d == m_freeDimX || d == m_freeDimY) { // Free dimension - update the preview - QObject::connect(m_startText[d], SIGNAL(textEdited(QString)), this, SLOT(startEndTextEdited())); - QObject::connect(m_endText[d], SIGNAL(textEdited(QString)), this, SLOT(startEndTextEdited())); - } - else - { + QObject::connect(m_startText[d], SIGNAL(textEdited(QString)), this, + SLOT(startEndTextEdited())); + QObject::connect(m_endText[d], SIGNAL(textEdited(QString)), this, + SLOT(startEndTextEdited())); + } else { // Non-Free dimension - link start to end - QObject::connect(m_startText[d], SIGNAL(textEdited(QString)), this, SLOT(startLinkedToEndText())); + QObject::connect(m_startText[d], SIGNAL(textEdited(QString)), this, + SLOT(startLinkedToEndText())); } } - if (!m_allDimsFree) - { - std::string s = "(in " + m_ws->getDimension(m_freeDimX)->getName() + "-" + m_ws->getDimension(m_freeDimY)->getName() - + " plane)"; + if (!m_allDimsFree) { + std::string s = "(in " + m_ws->getDimension(m_freeDimX)->getName() + "-" + + m_ws->getDimension(m_freeDimY)->getName() + " plane)"; ui.lblPlaneWidth->setText(QString::fromStdString(s)); } - } //----------------------------------------------------------------------------------------------- /** Show the start/end/width points in the GUI */ -void LineViewer::updateStartEnd() -{ - for (int d=0; d<int(m_ws->getNumDims()); d++) - { +void LineViewer::updateStartEnd() { + for (int d = 0; d < int(m_ws->getNumDims()); d++) { m_startText[d]->setText(QString::number(m_start[d])); m_endText[d]->setText(QString::number(m_end[d])); m_thicknessText[d]->setText(QString::number(m_thickness[d])); @@ -227,17 +249,16 @@ void LineViewer::updateStartEnd() //----------------------------------------------------------------------------------------------- /** Calculate the number of bins (fixed-bin-width mode) * or show the bin width (fixed-#-bins mode) */ -void LineViewer::updateBinWidth() -{ +void LineViewer::updateBinWidth() { // If partially initialized, vectors might be wrong if (m_start.getNumDims() != m_end.getNumDims()) return; double length = (m_start - m_end).norm(); - if (m_fixedBinWidthMode) - { + if (m_fixedBinWidthMode) { // Fixed bin width. Find the number of bins. m_numBins = size_t(length / m_fixedBinWidth + 0.5); - if (m_numBins < 1) m_numBins = 1; + if (m_numBins < 1) + m_numBins = 1; // Show the # of bins ui.spinNumBins->blockSignals(true); ui.spinNumBins->setValue(int(m_numBins)); @@ -245,9 +266,7 @@ void LineViewer::updateBinWidth() // Show the fixed bin width m_binWidth = length / double(m_numBins); ui.textBinWidth->setText(QString::number(m_fixedBinWidth)); - } - else - { + } else { // Fixed number of bins mode m_binWidth = length / double(m_numBins); ui.textBinWidth->setText(QString::number(m_binWidth)); @@ -258,15 +277,13 @@ void LineViewer::updateBinWidth() /** Read all the text boxes and interpret their values. * Does not refresh. */ -void LineViewer::readTextboxes() -{ +void LineViewer::readTextboxes() { VMD start = m_start; VMD end = m_start; VMD width = m_thickness; bool allOk = true; bool ok; - for (int d=0; d<int(m_ws->getNumDims()); d++) - { + for (int d = 0; d < int(m_ws->getNumDims()); d++) { start[d] = VMD_t(m_startText[d]->text().toDouble(&ok)); allOk = allOk && ok; @@ -281,7 +298,8 @@ void LineViewer::readTextboxes() allOk = allOk && ok; // Only continue if all values typed were valid numbers. - if (!allOk) return; + if (!allOk) + return; m_start = start; m_end = end; m_thickness = width; @@ -294,23 +312,20 @@ void LineViewer::readTextboxes() * * @param ws :: MatrixWorkspace to integrate */ -IAlgorithm_sptr LineViewer::applyMatrixWorkspace(Mantid::API::MatrixWorkspace_sptr ws) -{ - try - { +IAlgorithm_sptr +LineViewer::applyMatrixWorkspace(Mantid::API::MatrixWorkspace_sptr ws) { + try { if (getPlanarWidth() <= 0) throw std::runtime_error("Planar Width must be > 0"); - IAlgorithm_sptr alg = AlgorithmManager::Instance().createUnmanaged("Rebin2D"); + IAlgorithm_sptr alg = + AlgorithmManager::Instance().createUnmanaged("Rebin2D"); alg->initialize(); alg->setProperty("InputWorkspace", ws); alg->setPropertyValue("OutputWorkspace", m_integratedWSName); - if(ws->id() == "RebinnedOutput") - { + if (ws->id() == "RebinnedOutput") { alg->setProperty("UseFractionalArea", true); - } - else - { + } else { alg->setProperty("UseFractionalArea", false); } // (half-width in the plane) @@ -320,49 +335,49 @@ IAlgorithm_sptr LineViewer::applyMatrixWorkspace(Mantid::API::MatrixWorkspace_sp double dy = m_end[m_freeDimY] - m_start[m_freeDimY]; size_t numBins = m_numBins; - if (fabs(dx) > fabs(dy)) - { + if (fabs(dx) > fabs(dy)) { // Horizontal line double start = m_start[m_freeDimX]; double end = m_end[m_freeDimX]; - if (end < start) - { + if (end < start) { start = end; end = m_start[m_freeDimX]; } double vertical = m_start[m_freeDimY]; - double binWidth = (end-start) / static_cast<double>(numBins); - if (binWidth <= 0) return IAlgorithm_sptr(); + double binWidth = (end - start) / static_cast<double>(numBins); + if (binWidth <= 0) + return IAlgorithm_sptr(); - alg->setPropertyValue("Axis1Binning", - Strings::toString(start) + "," + Strings::toString(binWidth) + "," + Strings::toString(end)); + alg->setPropertyValue("Axis1Binning", Strings::toString(start) + "," + + Strings::toString(binWidth) + + "," + Strings::toString(end)); alg->setPropertyValue("Axis2Binning", - Strings::toString(vertical-planeWidth) + "," + Strings::toString(planeWidth*2) + "," + Strings::toString(vertical+planeWidth)); + Strings::toString(vertical - planeWidth) + "," + + Strings::toString(planeWidth * 2) + "," + + Strings::toString(vertical + planeWidth)); alg->setProperty("Transpose", false); - } - else - { + } else { // Vertical line double start = m_start[m_freeDimY]; double end = m_end[m_freeDimY]; - if (end < start) - { + if (end < start) { start = end; end = m_start[m_freeDimY]; } - double binWidth = (end-start) / static_cast<double>(numBins); + double binWidth = (end - start) / static_cast<double>(numBins); double vertical = m_start[m_freeDimX]; alg->setPropertyValue("Axis1Binning", - Strings::toString(vertical-planeWidth) + "," + Strings::toString(planeWidth*2) + "," + Strings::toString(vertical+planeWidth)); - alg->setPropertyValue("Axis2Binning", - Strings::toString(start) + "," + Strings::toString(binWidth) + "," + Strings::toString(end)); + Strings::toString(vertical - planeWidth) + "," + + Strings::toString(planeWidth * 2) + "," + + Strings::toString(vertical + planeWidth)); + alg->setPropertyValue("Axis2Binning", Strings::toString(start) + "," + + Strings::toString(binWidth) + + "," + Strings::toString(end)); alg->setProperty("Transpose", true); } return alg; - } - catch (std::exception & e) - { + } catch (std::exception &e) { // Log the error g_log.error() << "Invalid property passed to Rebin2D:" << std::endl; g_log.error() << e.what() << std::endl; @@ -376,8 +391,8 @@ IAlgorithm_sptr LineViewer::applyMatrixWorkspace(Mantid::API::MatrixWorkspace_sp * @param ws :: MDHisto or MDEventWorkspace to integrate * @return the algorithm to run */ -IAlgorithm_sptr LineViewer::applyMDWorkspace(Mantid::API::IMDWorkspace_sptr ws) -{ +IAlgorithm_sptr +LineViewer::applyMDWorkspace(Mantid::API::IMDWorkspace_sptr ws) { bool adaptive = ui.chkAdaptiveBins->isChecked(); // (half-width in the plane) @@ -403,13 +418,11 @@ IAlgorithm_sptr LineViewer::applyMDWorkspace(Mantid::API::IMDWorkspace_sptr ws) IAlgorithm_sptr alg; size_t numBins = m_numBins; - if (adaptive) - { + if (adaptive) { alg = AlgorithmManager::Instance().create("SliceMD"); // "SplitInto" parameter numBins = 2; - } - else + } else alg = AlgorithmManager::Instance().create("BinMD"); alg->setProperty("InputWorkspace", ws); @@ -420,7 +433,7 @@ IAlgorithm_sptr LineViewer::applyMDWorkspace(Mantid::API::IMDWorkspace_sptr ws) std::vector<double> OutputExtents; // The X basis vector - alg->setPropertyValue("BasisVector0", "X,units," + basisX.toString(",") ); + alg->setPropertyValue("BasisVector0", "X,units," + basisX.toString(",")); OutputExtents.push_back(0); OutputExtents.push_back(length); OutputBins.push_back(int(numBins)); @@ -434,17 +447,17 @@ IAlgorithm_sptr LineViewer::applyMDWorkspace(Mantid::API::IMDWorkspace_sptr ws) // Now each remaining dimension std::string dimChars = "012345"; // SlicingAlgorithm::getDimensionChars(); size_t propNum = 2; - for (int d=0; d<int(ws->getNumDims()); d++) - { - if ((d != m_freeDimX) && (d != m_freeDimY)) - { + for (int d = 0; d < int(ws->getNumDims()); d++) { + if ((d != m_freeDimX) && (d != m_freeDimY)) { // Letter of the dimension - std::string dim(" "); dim[0] = dimChars[propNum]; + std::string dim(" "); + dim[0] = dimChars[propNum]; // Simple basis vector going only in this direction VMD basis = m_start * 0; basis[d] = 1.0; // Set the basis vector with the width *2 and 1 bin - alg->setPropertyValue("BasisVector" + dim, dim +",units," + basis.toString(",") ); + alg->setPropertyValue("BasisVector" + dim, + dim + ",units," + basis.toString(",")); OutputExtents.push_back(-m_thickness[d]); OutputExtents.push_back(+m_thickness[d]); OutputBins.push_back(1); @@ -452,15 +465,13 @@ IAlgorithm_sptr LineViewer::applyMDWorkspace(Mantid::API::IMDWorkspace_sptr ws) propNum++; if (propNum > dimChars.size()) throw std::runtime_error("LineViewer::apply(): too many dimensions!"); - } } - alg->setPropertyValue("Translation", origin.toString(",") ); - alg->setProperty("OutputBins", OutputBins ); - alg->setProperty("OutputExtents", OutputExtents ); - if (!adaptive) - { + alg->setPropertyValue("Translation", origin.toString(",")); + alg->setProperty("OutputBins", OutputBins); + alg->setProperty("OutputExtents", OutputExtents); + if (!adaptive) { alg->setProperty("IterateEvents", true); } return alg; @@ -474,15 +485,20 @@ IAlgorithm_sptr LineViewer::applyMDWorkspace(Mantid::API::IMDWorkspace_sptr ws) * * @throw std::runtime_error if an error occurs. * */ -void LineViewer::apply() -{ - if (m_allDimsFree) - throw std::runtime_error("Not currently supported with all dimensions free!"); +void LineViewer::apply() { + + if (m_allDimsFree) { + throw std::runtime_error( + "Not currently supported with all dimensions free!"); + } m_algoRunner->cancelRunningAlgorithm(); - m_integratedWSName = m_ws->getName() + "_line" ; + + // Make a name for the line-cut + m_integratedWSName = proposeIntegratedWSName(m_ws->getName(), ui.ckOverWrite->isChecked()); // Different call for - MatrixWorkspace_sptr matrixWs = boost::dynamic_pointer_cast<MatrixWorkspace>(m_ws); + MatrixWorkspace_sptr matrixWs = + boost::dynamic_pointer_cast<MatrixWorkspace>(m_ws); IAlgorithm_sptr alg; if (matrixWs) @@ -490,23 +506,19 @@ void LineViewer::apply() else alg = this->applyMDWorkspace(m_ws); - if (alg) - { + if (alg) { // Start the algorithm asynchronously m_algoRunner->startAlgorithm(alg); // In the mean time, change the title m_plot->setTitle("Integrating Line..."); - } - else + } else m_plot->setTitle("Invalid Properties for Rebin Algorithm"); - } - - // ============================================================================================== -// ================================== SLOTS ===================================================== +// ================================== SLOTS +// ===================================================== // ============================================================================================== /** Slot called when the line integration algorithm (typically BinMD) @@ -514,15 +526,12 @@ void LineViewer::apply() * * @param error :: true if something went wrong */ -void LineViewer::lineIntegrationComplete(bool error) -{ - if (!error) - { - m_sliceWS = AnalysisDataService::Instance().retrieveWS<IMDWorkspace>(m_integratedWSName); +void LineViewer::lineIntegrationComplete(bool error) { + if (!error) { + m_sliceWS = AnalysisDataService::Instance().retrieveWS<IMDWorkspace>( + m_integratedWSName); this->showFull(); - } - else - { + } else { // Unspecified error in algorithm this->showPreview(); m_plot->setTitle("Error integrating workspace - see log."); @@ -533,27 +542,22 @@ void LineViewer::lineIntegrationComplete(bool error) /** Slot called when the start text of a non-free dimensions is changed. * Changes the end text correspondingly */ -void LineViewer::startLinkedToEndText() -{ - for (int d=0; d<int(m_ws->getNumDims()); d++) - { - if (d != m_freeDimX && d != m_freeDimY) - { +void LineViewer::startLinkedToEndText() { + for (int d = 0; d < int(m_ws->getNumDims()); d++) { + if (d != m_freeDimX && d != m_freeDimY) { // Copy the start text to the end text - m_endText[d]->setText( m_startText[d]->text() ); + m_endText[d]->setText(m_startText[d]->text()); } } // Call the slot to update the preview startEndTextEdited(); } - //------------------------------------------------------------------------------------------------- /** Slot called when any of the start/end text boxes are edited * in GUI. Only changes the values if they are all valid. */ -void LineViewer::startEndTextEdited() -{ +void LineViewer::startEndTextEdited() { this->readTextboxes(); this->showPreview(); // Send the signal that the positions changed @@ -561,55 +565,45 @@ void LineViewer::startEndTextEdited() } /** Slot called when the width text box is edited */ -void LineViewer::thicknessTextEdited() -{ +void LineViewer::thicknessTextEdited() { this->readTextboxes(); - //TODO: Don't always auto-apply + // TODO: Don't always auto-apply this->apply(); // Send the signal that the width changed emit changedPlanarWidth(this->getPlanarWidth()); } /** Slot called when the number of bins changes */ -void LineViewer::numBinsChanged() -{ +void LineViewer::numBinsChanged() { m_numBins = ui.spinNumBins->value(); // Show the bin width this->updateBinWidth(); - //TODO: Don't always auto-apply + // TODO: Don't always auto-apply this->apply(); } /** Slot called when checking the adaptive box */ -void LineViewer::adaptiveBinsChanged() -{ - //TODO: Don't always auto-apply +void LineViewer::adaptiveBinsChanged() { + // TODO: Don't always auto-apply this->apply(); } /** Slot called when the num bins/bin width radio choice changes */ -void LineViewer::on_radNumBins_toggled() -{ +void LineViewer::on_radNumBins_toggled() { setFixedBinWidthMode(ui.radNumBins->isChecked(), m_fixedBinWidth); } - /** Slot called when the desired fixed bin width text box * is edited and the user pressed Return or lost focus. */ -void LineViewer::textBinWidth_changed() -{ - if (m_fixedBinWidthMode) - { +void LineViewer::textBinWidth_changed() { + if (m_fixedBinWidthMode) { bool ok; double width = ui.textBinWidth->text().toDouble(&ok); - if (ok && width > 0) - { + if (ok && width > 0) { // Change the desired bin size and update necessary GUI this->setFixedBinWidthMode(m_fixedBinWidthMode, width); - } - else - { + } else { // Bad number! Reset to the old value this->updateBinWidth(); } @@ -617,46 +611,37 @@ void LineViewer::textBinWidth_changed() } // ============================================================================================== -// ================================== External Getters ========================================== +// ================================== External Getters +// ========================================== // ============================================================================================== -/** @return the width in the plane, or the width in dimension 0 if not restricted to a plane */ -double LineViewer::getPlanarWidth() const -{ - return m_planeWidth; -} +/** @return the width in the plane, or the width in dimension 0 if not + * restricted to a plane */ +double LineViewer::getPlanarWidth() const { return m_planeWidth; } -/// @return the full width vector in each dimensions. The values in the X-Y dimensions should be ignored -Mantid::Kernel::VMD LineViewer::getWidth() const -{ - return m_thickness; -} +/// @return the full width vector in each dimensions. The values in the X-Y +/// dimensions should be ignored +Mantid::Kernel::VMD LineViewer::getWidth() const { return m_thickness; } /** For fixed-bin-width mode, get the desired fixed bin width. * @return the desired fixed bin width */ -double LineViewer::getFixedBinWidth() const -{ - return m_fixedBinWidth; -} +double LineViewer::getFixedBinWidth() const { return m_fixedBinWidth; } /** Is the LineViewer in fixed-bin-width mode? * @return True if in fixed bin width mode. */ -bool LineViewer::getFixedBinWidthMode() const -{ - return m_fixedBinWidthMode; -} +bool LineViewer::getFixedBinWidthMode() const { return m_fixedBinWidthMode; } // ============================================================================================== -// ================================== External Setters ========================================== +// ================================== External Setters +// ========================================== // ============================================================================================== //----------------------------------------------------------------------------------------------- /** Set the workspace being sliced * * @param ws :: IMDWorkspace */ -void LineViewer::setWorkspace(Mantid::API::IMDWorkspace_sptr ws) -{ - if(!ws) +void LineViewer::setWorkspace(Mantid::API::IMDWorkspace_sptr ws) { + if (!ws) throw std::runtime_error("LineViewer::setWorkspace(): Invalid workspace."); m_ws = ws; m_thickness = VMD(ws->getNumDims()); @@ -665,34 +650,33 @@ void LineViewer::setWorkspace(Mantid::API::IMDWorkspace_sptr ws) m_lineOptions->setOriginalWorkspace(m_ws); } - /** Set the start point of the line to integrate * @param start :: vector for the start point */ -void LineViewer::setStart(Mantid::Kernel::VMD start) -{ +void LineViewer::setStart(Mantid::Kernel::VMD start) { if (m_ws && start.getNumDims() != m_ws->getNumDims()) - throw std::runtime_error("LineViewer::setStart(): Invalid number of dimensions in the start vector."); + throw std::runtime_error("LineViewer::setStart(): Invalid number of " + "dimensions in the start vector."); m_start = start; updateStartEnd(); } /** Set the end point of the line to integrate * @param end :: vector for the end point */ -void LineViewer::setEnd(Mantid::Kernel::VMD end) -{ +void LineViewer::setEnd(Mantid::Kernel::VMD end) { if (m_ws && end.getNumDims() != m_ws->getNumDims()) - throw std::runtime_error("LineViewer::setEnd(): Invalid number of dimensions in the end vector."); + throw std::runtime_error("LineViewer::setEnd(): Invalid number of " + "dimensions in the end vector."); m_end = end; updateStartEnd(); } - /** Set the width of the line in each dimensions - * @param width :: vector for the width in each dimension. X dimension stands in for the XY plane width */ -void LineViewer::setThickness(Mantid::Kernel::VMD width) -{ + * @param width :: vector for the width in each dimension. X dimension stands in + * for the XY plane width */ +void LineViewer::setThickness(Mantid::Kernel::VMD width) { if (m_ws && width.getNumDims() != m_ws->getNumDims()) - throw std::runtime_error("LineViewer::setThickness(): Invalid number of dimensions in the width vector."); + throw std::runtime_error("LineViewer::setThickness(): Invalid number of " + "dimensions in the width vector."); m_thickness = width; updateStartEnd(); } @@ -700,23 +684,16 @@ void LineViewer::setThickness(Mantid::Kernel::VMD width) /** Set the width of the line in the planar dimension only. * Other dimensions' widths will follow unless they were manually changed * @param width :: width in the plane. */ -void LineViewer::setPlanarWidth(double width) -{ - if (m_allDimsFree) - { - for (size_t d=0; d<m_thickness.getNumDims(); d++) - { +void LineViewer::setPlanarWidth(double width) { + if (m_allDimsFree) { + for (size_t d = 0; d < m_thickness.getNumDims(); d++) { setThicknessUsingDimensionInfo(m_ws, d, width, m_thickness); } - } - else - { + } else { double oldPlanarWidth = this->getPlanarWidth(); - for (size_t d = 0; d < m_thickness.getNumDims(); d++) - { + for (size_t d = 0; d < m_thickness.getNumDims(); d++) { // Only modify the locked ones - if (m_thickness[d] == oldPlanarWidth) - { + if (m_thickness[d] == oldPlanarWidth) { setThicknessUsingDimensionInfo(m_ws, d, width, m_thickness); } } @@ -732,14 +709,13 @@ void LineViewer::setPlanarWidth(double width) * @param numBins :: # of bins * @throw std::invalid_argument if numBins < 1 * */ -void LineViewer::setNumBins(int numBins) -{ +void LineViewer::setNumBins(int numBins) { if (numBins < 1) throw std::invalid_argument("LineViewer::setNumBins(): must be > 0"); m_numBins = size_t(numBins); - //ui.spinNumBins->blockSignals(true); - ui.spinNumBins->setValue( int(numBins) ); - //ui.spinNumBins->blockSignals(false); + // ui.spinNumBins->blockSignals(true); + ui.spinNumBins->setValue(int(numBins)); + // ui.spinNumBins->blockSignals(false); } /** Set the free dimensions - dimensions that are allowed to change @@ -748,13 +724,14 @@ void LineViewer::setNumBins(int numBins) * @param dimX :: Index of the X dimension in the 2D slice * @param dimY :: Index of the Y dimension in the 2D slice */ -void LineViewer::setFreeDimensions(bool all, int dimX, int dimY) -{ +void LineViewer::setFreeDimensions(bool all, int dimX, int dimY) { int nd = int(m_ws->getNumDims()); if (dimX < 0 || dimX >= nd) - throw std::runtime_error("LineViewer::setFreeDimensions(): Free X dimension index is out of range."); + throw std::runtime_error("LineViewer::setFreeDimensions(): Free X " + "dimension index is out of range."); if (dimY < 0 || dimY >= nd) - throw std::runtime_error("LineViewer::setFreeDimensions(): Free Y dimension index is out of range."); + throw std::runtime_error("LineViewer::setFreeDimensions(): Free Y " + "dimension index is out of range."); m_allDimsFree = all; m_freeDimX = dimX; m_freeDimY = dimY; @@ -766,8 +743,7 @@ void LineViewer::setFreeDimensions(bool all, int dimX, int dimY) * @param dimX :: index of the X-dimension of the plane * @param dimY :: index of the Y-dimension of the plane */ -void LineViewer::setFreeDimensions(size_t dimX, size_t dimY) -{ +void LineViewer::setFreeDimensions(size_t dimX, size_t dimY) { m_allDimsFree = false; m_freeDimX = int(dimX); m_freeDimY = int(dimY); @@ -787,22 +763,21 @@ void LineViewer::setFreeDimensions(size_t dimX, size_t dimY) * bin width. Must be > 0. Ignored for non-fixed-bin-width mode. * @throw std::invalid_argument if binWidth <= 0 */ -void LineViewer::setFixedBinWidthMode(bool fixedWidth, double binWidth) -{ +void LineViewer::setFixedBinWidthMode(bool fixedWidth, double binWidth) { if (binWidth <= 0) - throw std::invalid_argument("LineViewer::setFixedBinWidthMode(): binWidth must be > 0"); + throw std::invalid_argument( + "LineViewer::setFixedBinWidthMode(): binWidth must be > 0"); m_fixedBinWidthMode = fixedWidth; - if (m_fixedBinWidthMode) - { + if (m_fixedBinWidthMode) { m_fixedBinWidth = binWidth; ui.textBinWidth->setReadOnly(false); - ui.textBinWidth->setToolTip("Desired bin width (will adjust the number of bins)."); + ui.textBinWidth->setToolTip( + "Desired bin width (will adjust the number of bins)."); ui.spinNumBins->setReadOnly(true); - ui.spinNumBins->setToolTip("Current number of bins (calculated from the fixed bin width)"); - } - else - { + ui.spinNumBins->setToolTip( + "Current number of bins (calculated from the fixed bin width)"); + } else { ui.textBinWidth->setReadOnly(true); ui.textBinWidth->setToolTip("Current bin width, given the number of bins."); ui.spinNumBins->setReadOnly(false); @@ -820,12 +795,13 @@ void LineViewer::setFixedBinWidthMode(bool fixedWidth, double binWidth) // Show the start/end, and update # of bins this->updateStartEnd(); - //TODO: Don't always auto-apply + // TODO: Don't always auto-apply this->apply(); } // ============================================================================================== -// ================================== Methods for Python ========================================== +// ================================== Methods for Python +// ========================================== // ============================================================================================== /** Set the start point of the line to integrate * @@ -834,10 +810,10 @@ void LineViewer::setFixedBinWidthMode(bool fixedWidth, double binWidth) * @param y :: position of the start in the "Y" dimension * (as shown in the SliceViewer). */ -void LineViewer::setStartXY(double x, double y) -{ +void LineViewer::setStartXY(double x, double y) { if (m_allDimsFree) - throw std::runtime_error("LineViewer::setStartXY(): cannot use with all dimensions free."); + throw std::runtime_error( + "LineViewer::setStartXY(): cannot use with all dimensions free."); m_start[m_freeDimX] = VMD_t(x); m_start[m_freeDimY] = VMD_t(y); updateStartEnd(); @@ -852,10 +828,10 @@ void LineViewer::setStartXY(double x, double y) * @param y :: position of the start in the "Y" dimension * (as shown in the SliceViewer). */ -void LineViewer::setEndXY(double x, double y) -{ +void LineViewer::setEndXY(double x, double y) { if (m_allDimsFree) - throw std::runtime_error("LineViewer::setEndXY(): cannot use with all dimensions free."); + throw std::runtime_error( + "LineViewer::setEndXY(): cannot use with all dimensions free."); m_end[m_freeDimX] = VMD_t(x); m_end[m_freeDimY] = VMD_t(y); updateStartEnd(); @@ -868,10 +844,10 @@ void LineViewer::setEndXY(double x, double y) * in the X/Y coordinates as shown in the SliceViewer * @return [X,Y] coordinates */ -QPointF LineViewer::getStartXY() const -{ +QPointF LineViewer::getStartXY() const { if (m_allDimsFree) - throw std::runtime_error("LineViewer::getStartXY(): cannot use with all dimensions free."); + throw std::runtime_error( + "LineViewer::getStartXY(): cannot use with all dimensions free."); return QPointF(m_start[m_freeDimX], m_start[m_freeDimY]); } @@ -879,10 +855,10 @@ QPointF LineViewer::getStartXY() const * in the X/Y coordinates as shown in the SliceViewer * @return [X,Y] coordinates */ -QPointF LineViewer::getEndXY() const -{ +QPointF LineViewer::getEndXY() const { if (m_allDimsFree) - throw std::runtime_error("LineViewer::getEndXY(): cannot use with all dimensions free."); + throw std::runtime_error( + "LineViewer::getEndXY(): cannot use with all dimensions free."); return QPointF(m_end[m_freeDimX], m_end[m_freeDimY]); } @@ -894,10 +870,10 @@ QPointF LineViewer::getEndXY() const * * @param width :: width of integration, in the units of all dimensions */ -void LineViewer::setThickness(double width) -{ - if (!m_ws) return; - for (int i=0; i<int(m_ws->getNumDims()); i++) +void LineViewer::setThickness(double width) { + if (!m_ws) + return; + for (int i = 0; i < int(m_ws->getNumDims()); i++) m_thickness[i] = VMD_t(width); this->setPlanarWidth(width); } @@ -913,11 +889,12 @@ void LineViewer::setThickness(double width) * @param width :: width of integration, in the units of the dimension. * @throw std::invalid_argument if the index is invalid */ -void LineViewer::setThickness(int dim, double width) -{ - if (!m_ws) return; +void LineViewer::setThickness(int dim, double width) { + if (!m_ws) + return; if (dim >= int(m_ws->getNumDims()) || dim < 0) - throw std::invalid_argument("There is no dimension # " + Strings::toString(dim) + " in the workspace."); + throw std::invalid_argument("There is no dimension # " + + Strings::toString(dim) + " in the workspace."); m_thickness[dim] = VMD_t(width); updateStartEnd(); } @@ -933,9 +910,9 @@ void LineViewer::setThickness(int dim, double width) * @param width :: thickness of integration, in the units of the dimension. * @throw std::runtime_error if the name is not found in the workspace */ -void LineViewer::setThickness(const QString & dim, double width) -{ - if (!m_ws) return; +void LineViewer::setThickness(const QString &dim, double width) { + if (!m_ws) + return; int index = int(m_ws->getDimensionIndexByName(dim.toStdString())); return this->setThickness(index, width); } @@ -944,58 +921,44 @@ void LineViewer::setThickness(const QString & dim, double width) * * @return the number of bins in the line to integrate (int) */ -int LineViewer::getNumBins() const -{ - return int(m_numBins); -} +int LineViewer::getNumBins() const { return int(m_numBins); } /** Get the width of each bin * * @return the width of each bin (double) */ -double LineViewer::getBinWidth() const -{ - return m_binWidth; -} +double LineViewer::getBinWidth() const { return m_binWidth; } /** Choose which coordinates to use as the X axis to plot in the line view. * * @param choice :: PlotAxisChoice, either Auto, X, Y or Distance. */ -void LineViewer::setPlotAxis(int choice) -{ - m_lineOptions->setPlotAxis(choice); -} +void LineViewer::setPlotAxis(int choice) { m_lineOptions->setPlotAxis(choice); } /** Return which coordinates to use as the X axis to plot in the line view. * * @return PlotAxisChoice, either Auto, X, Y or Distance. */ -int LineViewer::getPlotAxis() const -{ - return m_lineOptions->getPlotAxis(); -} +int LineViewer::getPlotAxis() const { return m_lineOptions->getPlotAxis(); } // ============================================================================================== -// ================================== Rendering ================================================= +// ================================== Rendering +// ================================================= // ============================================================================================== - /** * Helper method to get the positive min value. * @param curveData : CurveData to look through the data of. * @param from : Start value * @return : Positive min value. */ -double getPositiveMin(const MantidQwtWorkspaceData& curveData, const double from) -{ +double getPositiveMin(const MantidQwtWorkspaceData &curveData, + const double from) { double yPositiveMin = from; size_t n = curveData.size(); - for (size_t i = 0; i < n; ++i) - { + for (size_t i = 0; i < n; ++i) { double y = curveData.y(i); - if (y > 0 && y < yPositiveMin) - { + if (y > 0 && y < yPositiveMin) { yPositiveMin = y; } } @@ -1007,19 +970,15 @@ double getPositiveMin(const MantidQwtWorkspaceData& curveData, const double from * Uses the isLogScaled method to work out which scale engine to make. * @param curveData : Curve Data to read. */ -void LineViewer::setupScaleEngine(MantidQwtWorkspaceData& curveData) -{ - QwtScaleEngine* engine = NULL; +void LineViewer::setupScaleEngine(MantidQwtWorkspaceData &curveData) { + QwtScaleEngine *engine = NULL; auto from = curveData.getYMin(); auto to = curveData.getYMax(); - if (m_lineOptions->isLogScaledY()) - { + if (m_lineOptions->isLogScaledY()) { engine = new QwtLog10ScaleEngine(); curveData.saveLowestPositiveValue(from); - } - else - { + } else { engine = new QwtLinearScaleEngine(); } m_plot->setAxisScaleEngine(QwtPlot::yLeft, engine); @@ -1029,16 +988,14 @@ void LineViewer::setupScaleEngine(MantidQwtWorkspaceData& curveData) //----------------------------------------------------------------------------- /** Calculate and show the preview (non-integrated) line, * using the current parameters. */ -void LineViewer::showPreview() -{ - MantidQwtIMDWorkspaceData curveData(m_ws, isLogScaledY(), - m_start, m_end, m_lineOptions->getNormalization()); +void LineViewer::showPreview() { + MantidQwtIMDWorkspaceData curveData(m_ws, isLogScaledY(), m_start, m_end, + m_lineOptions->getNormalization()); curveData.setPreviewMode(true); curveData.setPlotAxisChoice(m_lineOptions->getPlotAxis()); m_previewCurve->setData(curveData); - if (m_fullCurve->isVisible()) - { + if (m_fullCurve->isVisible()) { m_fullCurve->setVisible(false); m_fullCurve->detach(); m_previewCurve->attach(m_plot); @@ -1050,18 +1007,17 @@ void LineViewer::showPreview() m_plot->replot(); m_plot->setTitle("Preview Plot"); - m_plot->setAxisTitle( QwtPlot::xBottom, curveData.getXAxisLabel() ); - m_plot->setAxisTitle( QwtPlot::yLeft, curveData.getYAxisLabel() ); + m_plot->setAxisTitle(QwtPlot::xBottom, curveData.getXAxisLabel()); + m_plot->setAxisTitle(QwtPlot::yLeft, curveData.getYAxisLabel()); } /** Gets the dimension index corresponding to the lineviewers preview plot x axis. @return the index. */ -int LineViewer::getXAxisDimensionIndex() const -{ - MantidQwtIMDWorkspaceData curveData(m_ws, isLogScaledY(), - m_start, m_end, m_lineOptions->getNormalization()); +int LineViewer::getXAxisDimensionIndex() const { + MantidQwtIMDWorkspaceData curveData(m_ws, isLogScaledY(), m_start, m_end, + m_lineOptions->getNormalization()); curveData.setPreviewMode(true); curveData.setPlotAxisChoice(m_lineOptions->getPlotAxis()); return curveData.currentPlotXAxis(); @@ -1071,42 +1027,37 @@ int LineViewer::getXAxisDimensionIndex() const * Getter for the log scaled status. * @return True if and only if the y-axis is log scaled. */ -bool LineViewer::isLogScaledY() const -{ - return m_lineOptions->isLogScaledY(); -} +bool LineViewer::isLogScaledY() const { return m_lineOptions->isLogScaledY(); } //----------------------------------------------------------------------------- /** Calculate and show the full (integrated) line, using the latest * integrated workspace. The apply() method must have been called * before calling this. */ -void LineViewer::showFull() -{ - if (!m_sliceWS) return; - MatrixWorkspace_sptr sliceMatrix = boost::dynamic_pointer_cast<MatrixWorkspace>(m_sliceWS); - if (sliceMatrix) - { +void LineViewer::showFull() { + if (!m_sliceWS) + return; + MatrixWorkspace_sptr sliceMatrix = + boost::dynamic_pointer_cast<MatrixWorkspace>(m_sliceWS); + if (sliceMatrix) { const bool distribution(false); - QwtWorkspaceSpectrumData curveData(*sliceMatrix, 0, isLogScaledY(), distribution); + QwtWorkspaceSpectrumData curveData(*sliceMatrix, 0, isLogScaledY(), + distribution); m_fullCurve->setData(curveData); setupScaleEngine(curveData); - m_plot->setAxisTitle( QwtPlot::xBottom, curveData.getXAxisLabel() ); - m_plot->setAxisTitle( QwtPlot::yLeft, curveData.getYAxisLabel() ); - } - else - { - MantidQwtIMDWorkspaceData curveData(m_sliceWS, isLogScaledY(), - VMD(), VMD(), m_lineOptions->getNormalization()); + m_plot->setAxisTitle(QwtPlot::xBottom, curveData.getXAxisLabel()); + m_plot->setAxisTitle(QwtPlot::yLeft, curveData.getYAxisLabel()); + } else { + MantidQwtIMDWorkspaceData curveData(m_sliceWS, isLogScaledY(), VMD(), VMD(), + m_lineOptions->getNormalization()); curveData.setPreviewMode(false); curveData.setPlotAxisChoice(m_lineOptions->getPlotAxis()); m_fullCurve->setData(curveData); setupScaleEngine(curveData); - m_plot->setAxisTitle( QwtPlot::xBottom, curveData.getXAxisLabel() ); - m_plot->setAxisTitle( QwtPlot::yLeft, curveData.getYAxisLabel() ); + m_plot->setAxisTitle(QwtPlot::xBottom, curveData.getXAxisLabel()); + m_plot->setAxisTitle(QwtPlot::yLeft, curveData.getYAxisLabel()); } - if (m_previewCurve->isVisible()) - { + if (m_previewCurve->isVisible()) { m_previewCurve->setVisible(false); m_previewCurve->detach(); m_fullCurve->attach(m_plot); @@ -1122,22 +1073,17 @@ void LineViewer::showFull() * or plot axis. * Refreshes the preview or full plot, whichever is visible. */ -void LineViewer::refreshPlot() -{ +void LineViewer::refreshPlot() { if (m_previewCurve->isVisible()) showPreview(); else showFull(); } - /** * Handler for the log10 toggle axis event. */ -void LineViewer::onToggleLogYAxis() -{ - refreshPlot(); -} +void LineViewer::onToggleLogYAxis() { refreshPlot(); } } // namespace } diff --git a/Code/Mantid/QtPropertyBrowser/src/ButtonEditorFactory.h b/Code/Mantid/QtPropertyBrowser/src/ButtonEditorFactory.h index 5377cf692879688e245cffffb3c0e317619f4930..2f70a74e6244967b0523ccf2c0f565902f5fb422 100644 --- a/Code/Mantid/QtPropertyBrowser/src/ButtonEditorFactory.h +++ b/Code/Mantid/QtPropertyBrowser/src/ButtonEditorFactory.h @@ -1,6 +1,7 @@ #ifndef BUTTONEDITORFACTORY_H #define BUTTONEDITORFACTORY_H +#include "ParameterPropertyManager.h" #include "qtpropertymanager.h" #include <QPushButton> @@ -57,12 +58,12 @@ protected: } }; -class QT_QTPROPERTYBROWSER_EXPORT DoubleButtonEditorFactory: public ButtonEditorFactory<QtDoublePropertyManager> +class QT_QTPROPERTYBROWSER_EXPORT DoubleButtonEditorFactory: public ButtonEditorFactory<ParameterPropertyManager> { Q_OBJECT public: - DoubleButtonEditorFactory(QObject *parent):ButtonEditorFactory<QtDoublePropertyManager>(parent){} + DoubleButtonEditorFactory(QObject *parent):ButtonEditorFactory<ParameterPropertyManager>(parent){} Q_SIGNALS: void buttonClicked(QtProperty *); diff --git a/Code/Mantid/Testing/Data/DocTest/MANDI_801.peaks.md5 b/Code/Mantid/Testing/Data/DocTest/MANDI_801.peaks.md5 new file mode 100644 index 0000000000000000000000000000000000000000..260e383f2448270db932afdc04d6a3934b997a39 --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/MANDI_801.peaks.md5 @@ -0,0 +1 @@ +eca8af9c1ce4bd2b534f00ee50ab8ae7 diff --git a/Code/Mantid/Testing/Data/UnitTest/irs26173_graphite002_res.nxs.md5 b/Code/Mantid/Testing/Data/UnitTest/irs26173_graphite002_res.nxs.md5 new file mode 100644 index 0000000000000000000000000000000000000000..f8094ffb61e4994fb5350f25c238d1d2730c85b6 --- /dev/null +++ b/Code/Mantid/Testing/Data/UnitTest/irs26173_graphite002_res.nxs.md5 @@ -0,0 +1 @@ +4a322a634e527c87fbef27f1cc9559d2 \ No newline at end of file diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/CodeConventions.py b/Code/Mantid/Testing/SystemTests/tests/analysis/CodeConventions.py index b87cc677be768a642d06adbc26f83ca5e8405fba..bb8d03df8b96e4d2f595df70647f2615d85ee9b3 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/CodeConventions.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/CodeConventions.py @@ -35,7 +35,8 @@ ALG_BAD_PARAMS = { "MaxPositionChange_meters"), "SetUB(v1)":("a", "b", "c", "alpha", "beta", "gamma", "u", "v"), "ViewBOA(v1)":("CD-Distance"), - "PoldiCreatePeaksFromCell(v1)":("a", "b", "c", "alpha", "beta", "gamma") + "PoldiCreatePeaksFromCell(v1)":("a", "b", "c", "alpha", "beta", "gamma"), + "CreateMD(v1)" : ("u", "v") } # TODO this list should be empty diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISIndirectInelastic.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISIndirectInelastic.py index 573b3654654da2b0eec2c3a4d0506ada2e03acb9..60c6e04a961de78ed7c22d955ade098454380b06 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISIndirectInelastic.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISIndirectInelastic.py @@ -682,7 +682,7 @@ class OSIRISDiagnostics(ISISIndirectInelasticDiagnostics): #============================================================================== class ISISIndirectInelasticMoments(ISISIndirectInelasticBase): - '''A base class for the ISIS indirect inelastic Fury/FuryFit tests + '''A base class for the ISIS indirect inelastic TransformToIqt/TransformToIqtFit tests The output of Elwin is usually used with MSDFit and so we plug one into the other in this test. @@ -849,7 +849,7 @@ class ISISIndirectInelasticFuryAndFuryFit(ISISIndirectInelasticBase): ''' A base class for the ISIS indirect inelastic Fury/FuryFit tests - The output of Fury is usually used with FuryFit and so we plug one into + The output of TransformToIqt is usually used with FuryFit and so we plug one into the other in this test. ''' @@ -865,14 +865,14 @@ class ISISIndirectInelasticFuryAndFuryFit(ISISIndirectInelasticBase): LoadNexus(sample, OutputWorkspace=sample) LoadNexus(self.resolution, OutputWorkspace=self.resolution) - fury_props, fury_ws = Fury(Sample=self.samples[0], - Resolution=self.resolution, - EnergyMin=self.e_min, - EnergyMax=self.e_max, - NumBins=self.num_bins, - DryRun=False, - Save=False, - Plot=False) + fury_props, fury_ws = TransformToIqt(SampleWorkspace=self.samples[0], + ResolutionWorkspace=self.resolution, + EnergyMin=self.e_min, + EnergyMax=self.e_max, + BinReductionFactor=self.num_bins, + DryRun=False, + Save=False, + Plot=False) # Test FuryFit Sequential furyfitSeq_ws = furyfitSeq(fury_ws.getName(), @@ -922,7 +922,7 @@ class OSIRISFuryAndFuryFit(ISISIndirectInelasticFuryAndFuryFit): def __init__(self): ISISIndirectInelasticFuryAndFuryFit.__init__(self) - # Fury + # TransformToIqt self.samples = ['osi97935_graphite002_red.nxs'] self.resolution = 'osi97935_graphite002_res.nxs' self.e_min = -0.4 @@ -947,7 +947,7 @@ class IRISFuryAndFuryFit(ISISIndirectInelasticFuryAndFuryFit): def __init__(self): ISISIndirectInelasticFuryAndFuryFit.__init__(self) - # Fury + # TransformToIqt self.samples = ['irs53664_graphite002_red.nxs'] self.resolution = 'irs53664_graphite002_res.nxs' self.e_min = -0.4 @@ -986,14 +986,14 @@ class ISISIndirectInelasticFuryAndFuryFitMulti(ISISIndirectInelasticBase): LoadNexus(sample, OutputWorkspace=sample) LoadNexus(self.resolution, OutputWorkspace=self.resolution) - fury_props, fury_ws = Fury(Sample=self.samples[0], - Resolution=self.resolution, - EnergyMin=self.e_min, - EnergyMax=self.e_max, - NumBins=self.num_bins, - DryRun=False, - Save=False, - Plot=False) + fury_props, fury_ws = TransformToIqt(SampleWorkspace=self.samples[0], + ResolutionWorkspace=self.resolution, + EnergyMin=self.e_min, + EnergyMax=self.e_max, + BinReductionFactor=self.num_bins, + DryRun=False, + Save=False, + Plot=False) # Test FuryFit Sequential furyfitSeq_ws = furyfitMult(fury_ws.getName(), @@ -1045,7 +1045,7 @@ class OSIRISFuryAndFuryFitMulti(ISISIndirectInelasticFuryAndFuryFitMulti): def __init__(self): ISISIndirectInelasticFuryAndFuryFitMulti.__init__(self) - # Fury + # TransformToIqt self.samples = ['osi97935_graphite002_red.nxs'] self.resolution = 'osi97935_graphite002_res.nxs' self.e_min = -0.4 @@ -1070,7 +1070,7 @@ class IRISFuryAndFuryFitMulti(ISISIndirectInelasticFuryAndFuryFitMulti): def __init__(self): ISISIndirectInelasticFuryAndFuryFitMulti.__init__(self) - # Fury + # TransformToIqt self.samples = ['irs53664_graphite002_red.nxs'] self.resolution = 'irs53664_graphite002_res.nxs' self.e_min = -0.4 diff --git a/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/LoadVTK.h b/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/LoadVTK.h index dca708bdd2b000cb71a44bd2f116b013e95e0467..98c5ac15d4ad60937be925c1cfecddd7d06496cd 100644 --- a/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/LoadVTK.h +++ b/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/LoadVTK.h @@ -3,7 +3,7 @@ #include "MantidKernel/System.h" #include "MantidGeometry/MDGeometry/MDHistoDimension.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidAPI/IFileLoader.h" class vtkUnsignedShortArray; diff --git a/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHexFactory.h b/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHexFactory.h index ab7ca35cd6bb6fd30353e20db4b66abc98b14989..fbd0925ad026c673c43c5999b488717980e6b5b4 100644 --- a/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHexFactory.h +++ b/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHexFactory.h @@ -2,14 +2,14 @@ #define MANTID_VATES_VTK_MD_HEX_FACTORY_H_ #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidVatesAPI/ThresholdRange.h" #include "MantidVatesAPI/vtkDataSetFactory.h" #include "MantidVatesAPI/TimeToTimeStep.h" #include <boost/shared_ptr.hpp> -using Mantid::MDEvents::MDEventWorkspace; +using Mantid::DataObjects::MDEventWorkspace; namespace Mantid { diff --git a/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHistoHexFactory.h b/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHistoHexFactory.h index 4d8c9634247b1eb53884a129f733a492f3a99a90..584aad4d4afe351fd9baf8b772b03335bfb26a2a 100644 --- a/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHistoHexFactory.h +++ b/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHistoHexFactory.h @@ -35,7 +35,7 @@ #include <vtkFloatArray.h> #include <vtkCellData.h> #include <vtkHexahedron.h> -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" namespace Mantid { @@ -80,7 +80,7 @@ protected: void validateDimensionsPresent() const; /// Image from which to draw. - Mantid::MDEvents::MDHistoWorkspace_sptr m_workspace; + Mantid::DataObjects::MDHistoWorkspace_sptr m_workspace; /// Name of the scalar to provide on mesh. std::string m_scalarName; diff --git a/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHistoLineFactory.h b/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHistoLineFactory.h index 299956276c2fcf228f91406af6a241fd2f94f9b6..98b9eae6a3953499508a28bffdb2733bc9c3fe3f 100644 --- a/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHistoLineFactory.h +++ b/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHistoLineFactory.h @@ -6,7 +6,7 @@ #include "MantidAPI/IMDWorkspace.h" #include "vtkUnstructuredGrid.h" #include "MantidVatesAPI/ThresholdRange.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" namespace Mantid { @@ -72,7 +72,7 @@ namespace Mantid private: - Mantid::MDEvents::MDHistoWorkspace_sptr m_workspace; + Mantid::DataObjects::MDHistoWorkspace_sptr m_workspace; std::string m_scalarName; diff --git a/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHistoQuadFactory.h b/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHistoQuadFactory.h index 1b168b6f1eb508ecf4020a763da09f400965dc7b..b4643b92cba65ea94381bc684c46fd3ba2492153 100644 --- a/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHistoQuadFactory.h +++ b/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkMDHistoQuadFactory.h @@ -6,7 +6,7 @@ #include "MantidVatesAPI/ThresholdRange.h" #include "MantidAPI/IMDWorkspace.h" #include "vtkUnstructuredGrid.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" namespace Mantid { @@ -74,7 +74,7 @@ however, some visualisation frameworks won't be able to treat these factories in virtual void validate() const; private: - Mantid::MDEvents::MDHistoWorkspace_sptr m_workspace; + Mantid::DataObjects::MDHistoWorkspace_sptr m_workspace; std::string m_scalarName; diff --git a/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkSplatterPlotFactory.h b/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkSplatterPlotFactory.h index b793eae000e3e1216cfe1b8a6546d801d8a46e9b..779bd0d62d2dae26838a5e26d31039ea0c13c4bd 100644 --- a/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkSplatterPlotFactory.h +++ b/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkSplatterPlotFactory.h @@ -5,8 +5,8 @@ #include "MantidVatesAPI/MetaDataExtractorUtils.h" #include "MantidAPI/IMDNode.h" #include "MantidAPI/IMDHistoWorkspace.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidVatesAPI/ThresholdRange.h" #include "MantidVatesAPI/vtkDataSetFactory.h" #include "MantidVatesAPI/MetaDataExtractorUtils.h" @@ -17,7 +17,7 @@ #include <boost/scoped_ptr.hpp> -using Mantid::MDEvents::MDEventWorkspace; +using Mantid::DataObjects::MDEventWorkspace; namespace Mantid { diff --git a/Code/Mantid/Vates/VatesAPI/src/LoadVTK.cpp b/Code/Mantid/Vates/VatesAPI/src/LoadVTK.cpp index 4bc43553b977c210ed5412e656e8d8ad8305dac5..a003d1569f72fb1ba7ef008ada705180e846474e 100644 --- a/Code/Mantid/Vates/VatesAPI/src/LoadVTK.cpp +++ b/Code/Mantid/Vates/VatesAPI/src/LoadVTK.cpp @@ -40,8 +40,8 @@ support rebinning in-situ as part of the visualisation process. #include "MantidAPI/FileProperty.h" #include "MantidAPI/Progress.h" #include "MantidAPI/RegisterFileLoader.h" -#include "MantidMDEvents/MDHistoWorkspace.h" -#include "MantidMDEvents/MDEventWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" +#include "MantidDataObjects/MDEventWorkspace.h" #include "MantidKernel/MandatoryValidator.h" #include "MantidKernel/MultiThreaded.h" #include "MantidKernel/BoundedValidator.h" @@ -59,7 +59,7 @@ support rebinning in-situ as part of the visualisation process. using namespace Mantid::Kernel; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; namespace Mantid diff --git a/Code/Mantid/Vates/VatesAPI/src/vtkMDHexFactory.cpp b/Code/Mantid/Vates/VatesAPI/src/vtkMDHexFactory.cpp index dff61fc73ff69b679b04f6f6407b427f0b0228f2..bdd9b18d11005c5b482c427383c24e1e105b750d 100644 --- a/Code/Mantid/Vates/VatesAPI/src/vtkMDHexFactory.cpp +++ b/Code/Mantid/Vates/VatesAPI/src/vtkMDHexFactory.cpp @@ -1,6 +1,6 @@ #include "MantidAPI/IMDEventWorkspace.h" #include "MantidKernel/CPUTimer.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidVatesAPI/vtkMDHexFactory.h" #include "MantidVatesAPI/Common.h" #include "MantidVatesAPI/ProgressAction.h" @@ -13,7 +13,7 @@ #include "MantidKernel/ReadLock.h" using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; using Mantid::Kernel::CPUTimer; using Mantid::Kernel::ReadLock; diff --git a/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoHex4DFactory.cpp b/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoHex4DFactory.cpp index 48286287285bb9227c4de6235a84916cfbac5c20..ddccca5282d0fb3ab3cc5a7e5398ffaedfae24cd 100644 --- a/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoHex4DFactory.cpp +++ b/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoHex4DFactory.cpp @@ -1,6 +1,6 @@ #include "MantidAPI/IMDWorkspace.h" #include "MantidKernel/CPUTimer.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidVatesAPI/TimeStepToTimeStep.h" #include "MantidVatesAPI/TimeToTimeStep.h" #include "MantidVatesAPI/vtkMDHistoHex4DFactory.h" @@ -9,7 +9,7 @@ using Mantid::API::IMDWorkspace; using Mantid::Kernel::CPUTimer; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; namespace Mantid { diff --git a/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoHexFactory.cpp b/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoHexFactory.cpp index 9f2c33f2357459785f064cd0fcee09f83839c9c9..a9e5bf239d39e1164ec917ac8e5825400863b6fc 100644 --- a/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoHexFactory.cpp +++ b/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoHexFactory.cpp @@ -1,6 +1,6 @@ #include "MantidAPI/IMDWorkspace.h" #include "MantidKernel/CPUTimer.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidVatesAPI/vtkMDHistoHexFactory.h" #include "MantidVatesAPI/Common.h" #include "MantidVatesAPI/ProgressAction.h" @@ -11,7 +11,7 @@ using Mantid::API::IMDWorkspace; using Mantid::API::IMDHistoWorkspace; using Mantid::Kernel::CPUTimer; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using Mantid::Kernel::ReadLock; namespace Mantid diff --git a/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoLineFactory.cpp b/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoLineFactory.cpp index 58679343101fa11da23cabd4807e0f306d59dd6d..87c7f890b2cb77042da5907fde1def4d9fe16187 100644 --- a/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoLineFactory.cpp +++ b/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoLineFactory.cpp @@ -10,11 +10,11 @@ #include <vector> #include "MantidAPI/IMDWorkspace.h" #include "MantidAPI/NullCoordTransform.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidKernel/ReadLock.h" using Mantid::API::IMDWorkspace; -using Mantid::MDEvents::MDHistoWorkspace; +using Mantid::DataObjects::MDHistoWorkspace; using Mantid::API::NullCoordTransform; namespace Mantid diff --git a/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp b/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp index 5199a36414ae103a7fb49d6639b387f01ea8bcc7..7f31e7343cf5a079a9d6011187485a828b264d12 100644 --- a/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp +++ b/Code/Mantid/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp @@ -1,6 +1,6 @@ #include "MantidAPI/IMDWorkspace.h" #include "MantidKernel/CPUTimer.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidAPI/NullCoordTransform.h" #include "MantidVatesAPI/vtkMDHistoQuadFactory.h" #include "MantidVatesAPI/Common.h" @@ -16,7 +16,7 @@ using Mantid::API::IMDWorkspace; using Mantid::Kernel::CPUTimer; -using Mantid::MDEvents::MDHistoWorkspace; +using Mantid::DataObjects::MDHistoWorkspace; namespace Mantid { diff --git a/Code/Mantid/Vates/VatesAPI/src/vtkSplatterPlotFactory.cpp b/Code/Mantid/Vates/VatesAPI/src/vtkSplatterPlotFactory.cpp index 02c12390c53328d517d0c26b3c816e678de65180..0182401e60d7e2de6f3b0f3a89ea9b844b6eb83e 100644 --- a/Code/Mantid/Vates/VatesAPI/src/vtkSplatterPlotFactory.cpp +++ b/Code/Mantid/Vates/VatesAPI/src/vtkSplatterPlotFactory.cpp @@ -5,7 +5,7 @@ #include "MantidAPI/IMDHistoWorkspace.h" #include "MantidKernel/CPUTimer.h" #include "MantidKernel/ReadLock.h" -#include "MantidMDEvents/MDEventFactory.h" +#include "MantidDataObjects/MDEventFactory.h" #include "MantidGeometry/MDGeometry/MDHistoDimension.h" #include "MantidVatesAPI/ProgressAction.h" #include "MantidVatesAPI/Common.h" @@ -30,7 +30,7 @@ #include <qwt_double_interval.h> using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::Geometry; using Mantid::Kernel::CPUTimer; using Mantid::Kernel::ReadLock; diff --git a/Code/Mantid/Vates/VatesAPI/test/MDHWInMemoryLoadingPresenterTest.h b/Code/Mantid/Vates/VatesAPI/test/MDHWInMemoryLoadingPresenterTest.h index 0939db35836781e5c846bea09b5f02340e7947bb..e4ac2b2a474737534e1a87eef7a8c283dce08579 100644 --- a/Code/Mantid/Vates/VatesAPI/test/MDHWInMemoryLoadingPresenterTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/MDHWInMemoryLoadingPresenterTest.h @@ -13,7 +13,7 @@ using namespace Mantid::VATES; using namespace Mantid::API; using namespace testing; -using Mantid::MDEvents::MDEventsTestHelper::makeFakeMDHistoWorkspace; +using Mantid::DataObjects::MDEventsTestHelper::makeFakeMDHistoWorkspace; class MDHWInMemoryLoadingPresenterTest: public CxxTest::TestSuite { @@ -32,7 +32,7 @@ private: // Helper method. Generates and returns a valid IMDHistoWorkspace static Mantid::API::Workspace_sptr getGoodWorkspace() { - Mantid::MDEvents::MDHistoWorkspace_sptr ws = makeFakeMDHistoWorkspace(1.0, 4, 5, 1.0, 0.1,"MD_HISTO_WS"); + Mantid::DataObjects::MDHistoWorkspace_sptr ws = makeFakeMDHistoWorkspace(1.0, 4, 5, 1.0, 0.1,"MD_HISTO_WS"); return ws; } diff --git a/Code/Mantid/Vates/VatesAPI/test/MedianAndBelowThresholdRangeTest.h b/Code/Mantid/Vates/VatesAPI/test/MedianAndBelowThresholdRangeTest.h index d21fc3037a2196209c6f172575bba062e3aaebc7..ff276d7ca7ba2cb4d205b80286c972d71727e4e5 100644 --- a/Code/Mantid/Vates/VatesAPI/test/MedianAndBelowThresholdRangeTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/MedianAndBelowThresholdRangeTest.h @@ -7,10 +7,10 @@ #include "MantidVatesAPI/MedianAndBelowThresholdRange.h" #include "MantidAPI/IMDIterator.h" #include "MantidTestHelpers/MDEventsTestHelper.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace testing; //===================================================================================== diff --git a/Code/Mantid/Vates/VatesAPI/test/MetaDataExtractorUtilsTest.h b/Code/Mantid/Vates/VatesAPI/test/MetaDataExtractorUtilsTest.h index 29c3278be94a88d7d63f089172d9345721efebf3..be99ebc9564a37afb6c627d74c4b86f23da4ff36 100644 --- a/Code/Mantid/Vates/VatesAPI/test/MetaDataExtractorUtilsTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/MetaDataExtractorUtilsTest.h @@ -16,7 +16,7 @@ using namespace Mantid::VATES; using namespace Mantid::API; using namespace testing; -using Mantid::MDEvents::MDEventsTestHelper::makeFakeMDHistoWorkspace; +using Mantid::DataObjects::MDEventsTestHelper::makeFakeMDHistoWorkspace; class MetaDataExtractorUtilsTest : public CxxTest::TestSuite { @@ -40,7 +40,7 @@ class MetaDataExtractorUtilsTest : public CxxTest::TestSuite void testShouldExtractMinAndMaxFromWorkspaceForMDHisto() { // Arrange - Mantid::MDEvents::MDHistoWorkspace_sptr histoWorkspace = makeFakeMDHistoWorkspace(1.0, 4); + Mantid::DataObjects::MDHistoWorkspace_sptr histoWorkspace = makeFakeMDHistoWorkspace(1.0, 4); // Act MetaDataExtractorUtils extractor; diff --git a/Code/Mantid/Vates/VatesAPI/test/MockObjects.h b/Code/Mantid/Vates/VatesAPI/test/MockObjects.h index aa8be83dfa11b026c036aab907e142973078cd7d..39404d1b97db3dac076d4de9e9d3890adb220ccd 100644 --- a/Code/Mantid/Vates/VatesAPI/test/MockObjects.h +++ b/Code/Mantid/Vates/VatesAPI/test/MockObjects.h @@ -11,7 +11,7 @@ #include "MantidGeometry/MDGeometry/MDTypes.h" #include "MantidGeometry/MDGeometry/MDImplicitFunction.h" #include "MantidKernel/UnitLabel.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidVatesAPI/MDLoadingView.h" #include "MantidVatesAPI/Common.h" #include "MantidVatesAPI/vtkDataSetFactory.h" @@ -429,7 +429,7 @@ Create a field data entry containing (as contents) the argument text. Mantid::API::Workspace_sptr get3DWorkspace(bool integratedTDimension, bool sliceMD) { using namespace Mantid::API; - using namespace Mantid::MDEvents; + using namespace Mantid::DataObjects; Mantid::API::Workspace_sptr inputWs = createSimple3DWorkspace(); diff --git a/Code/Mantid/Vates/VatesAPI/test/vtkDataSetFactoryTest.h b/Code/Mantid/Vates/VatesAPI/test/vtkDataSetFactoryTest.h index 3bbac5cd85a5fccb1264c41d77a45600cb99d364..434b20176d60ff30035d7517b55b63a53324ac15 100644 --- a/Code/Mantid/Vates/VatesAPI/test/vtkDataSetFactoryTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/vtkDataSetFactoryTest.h @@ -15,7 +15,7 @@ #include "MantidVatesAPI/vtkStructuredGrid_Silent.h" using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace testing; class vtkDataSetFactoryTest : public CxxTest::TestSuite diff --git a/Code/Mantid/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h b/Code/Mantid/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h index 742dfdc8acac6aa47c871a20810f305ad4c541db..6ca224d78ba7cf4948ff8d3405a19cbdb2849a03 100644 --- a/Code/Mantid/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h @@ -8,7 +8,7 @@ #include "MantidAPI/IMDEventWorkspace.h" #include "MantidKernel/Matrix.h" #include "MantidKernel/PropertyWithValue.h" -#include "MantidMDEvents/CoordTransformAffine.h" +#include "MantidDataObjects/CoordTransformAffine.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include <vtkDataArray.h> @@ -20,8 +20,8 @@ using namespace Mantid::API; using namespace Mantid::Kernel; -using namespace Mantid::MDEvents; -using namespace Mantid::MDEvents::MDEventsTestHelper; +using namespace Mantid::DataObjects; +using namespace Mantid::DataObjects::MDEventsTestHelper; using namespace Mantid::VATES; class vtkDataSetToNonOrthogonalDataSetTest : public CxxTest::TestSuite diff --git a/Code/Mantid/Vates/VatesAPI/test/vtkDataSetToPeaksFilteredDataSetTest.h b/Code/Mantid/Vates/VatesAPI/test/vtkDataSetToPeaksFilteredDataSetTest.h index 1e5e1080b6b3d3330592e1eae0da3a9907ca356b..a238bfa66872bd46a7b0400340aca94c6bd7c5a8 100644 --- a/Code/Mantid/Vates/VatesAPI/test/vtkDataSetToPeaksFilteredDataSetTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/vtkDataSetToPeaksFilteredDataSetTest.h @@ -33,7 +33,7 @@ #include <boost/shared_ptr.hpp> -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::VATES; using namespace ::testing; @@ -65,7 +65,7 @@ private: vtkUnstructuredGrid* makeSplatterSourceGrid() { FakeProgressAction progressUpdate; - Mantid::MDEvents::MDEventWorkspace3Lean::sptr ws = MDEventsTestHelper::makeMDEW<3>(10, -10.0, 10.0, 1); + MDEventWorkspace3Lean::sptr ws = MDEventsTestHelper::makeMDEW<3>(10, -10.0, 10.0, 1); vtkSplatterPlotFactory factory(ThresholdRange_scptr(new UserDefinedThresholdRange(0, 1)), "signal"); factory.initialize(ws); vtkDataSet* product = NULL; @@ -358,4 +358,4 @@ public: out->Delete(); } }; -#endif \ No newline at end of file +#endif diff --git a/Code/Mantid/Vates/VatesAPI/test/vtkDataSetToScaledDataSetTest.h b/Code/Mantid/Vates/VatesAPI/test/vtkDataSetToScaledDataSetTest.h index 041a036bf847e7e73e6500bf4e122ed85e79fd0c..76c891a84077644a7dbdd787a80b60ccbb79626e 100644 --- a/Code/Mantid/Vates/VatesAPI/test/vtkDataSetToScaledDataSetTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/vtkDataSetToScaledDataSetTest.h @@ -19,7 +19,7 @@ #include <vtkUnsignedCharArray.h> #include <vtkUnstructuredGrid.h> -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::VATES; class vtkDataSetToScaledDataSetTest : public CxxTest::TestSuite diff --git a/Code/Mantid/Vates/VatesAPI/test/vtkMDHexFactoryTest.h b/Code/Mantid/Vates/VatesAPI/test/vtkMDHexFactoryTest.h index f6684874c544a05ad8f358b8778c0bcb9e9a707b..4fa380c9d591c9ecfda89248097523c71fb03f58 100644 --- a/Code/Mantid/Vates/VatesAPI/test/vtkMDHexFactoryTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/vtkMDHexFactoryTest.h @@ -2,9 +2,9 @@ #define VTK_MD_HEX_FACTORY_TEST #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidVatesAPI/UserDefinedThresholdRange.h" @@ -21,7 +21,7 @@ using namespace Mantid; using namespace Mantid::VATES; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace testing; //===================================================================================== @@ -33,7 +33,7 @@ private: void doDimensionalityTesting(bool doCheckDimensionality) { - Mantid::MDEvents::MDEventWorkspace3Lean::sptr input_ws = MDEventsTestHelper::makeMDEW<3>(10, 0.0, 10.0, 1); + Mantid::DataObjects::MDEventWorkspace3Lean::sptr input_ws = MDEventsTestHelper::makeMDEW<3>(10, 0.0, 10.0, 1); using namespace Mantid::API; IAlgorithm_sptr slice = AlgorithmManager::Instance().createUnmanaged("SliceMD"); @@ -155,7 +155,7 @@ public: { FakeProgressAction progressUpdate; - Mantid::MDEvents::MDEventWorkspace3Lean::sptr ws = MDEventsTestHelper::makeMDEW<3>(10, 0.0, 10.0, 1); + Mantid::DataObjects::MDEventWorkspace3Lean::sptr ws = MDEventsTestHelper::makeMDEW<3>(10, 0.0, 10.0, 1); vtkMDHexFactory factory(ThresholdRange_scptr(new UserDefinedThresholdRange(0, 1)), "signal"); factory.initialize(ws); vtkDataSet* product = NULL; @@ -189,7 +189,7 @@ public: MockProgressAction mockProgressAction; EXPECT_CALL(mockProgressAction, eventRaised(_)).Times(AtLeast(1)); - Mantid::MDEvents::MDEventWorkspace4Lean::sptr ws = MDEventsTestHelper::makeMDEW<4>(5, -10.0, 10.0, 1); + Mantid::DataObjects::MDEventWorkspace4Lean::sptr ws = MDEventsTestHelper::makeMDEW<4>(5, -10.0, 10.0, 1); vtkMDHexFactory factory(ThresholdRange_scptr(new UserDefinedThresholdRange(0, 1)), "signal"); factory.initialize(ws); vtkDataSet* product = NULL; @@ -231,8 +231,8 @@ class vtkMDHexFactoryTestPerformance : public CxxTest::TestSuite private: - Mantid::MDEvents::MDEventWorkspace3Lean::sptr m_ws3; - Mantid::MDEvents::MDEventWorkspace4Lean::sptr m_ws4; + Mantid::DataObjects::MDEventWorkspace3Lean::sptr m_ws3; + Mantid::DataObjects::MDEventWorkspace4Lean::sptr m_ws4; public : diff --git a/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoHex4DFactoryTest.h b/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoHex4DFactoryTest.h index 75307ce3110e38fb61af5e915ca58ab00dfb1b9f..053fe1588f654ce38574676fa09ca9a0ba645922 100644 --- a/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoHex4DFactoryTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoHex4DFactoryTest.h @@ -2,7 +2,7 @@ #define VTK_MD_HEX_4D_FACTORY_TEST_H_ #include "MantidAPI/IMDWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidVatesAPI/TimeStepToTimeStep.h" #include "MantidVatesAPI/UserDefinedThresholdRange.h" @@ -13,7 +13,7 @@ #include "MantidVatesAPI/vtkStructuredGrid_Silent.h" using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::VATES; using namespace Mantid::API; using namespace Mantid::Geometry; diff --git a/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoHexFactoryTest.h b/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoHexFactoryTest.h index 73e800f03badfe5515367c17bd9872fe2d7ea184..cc152f7608b150ab119ff23cc2170729c409f6d6 100644 --- a/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoHexFactoryTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoHexFactoryTest.h @@ -1,7 +1,7 @@ #ifndef VTK_MD_HISTO_HEX_FACTORY_TEST_H_ #define VTK_MD_HISTO_HEX_FACTORY_TEST_H_ -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidVatesAPI/UserDefinedThresholdRange.h" #include "MantidVatesAPI/NoThresholdRange.h" @@ -14,7 +14,7 @@ using namespace Mantid; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::VATES; using namespace Mantid::Geometry; using namespace testing; diff --git a/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoLineFactoryTest.h b/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoLineFactoryTest.h index 3be1859ae839589f4bf9ada170d2fbb53ead2b36..0555e16fc83ba2cc1d12898b2ad2cf99480a6905 100644 --- a/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoLineFactoryTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoLineFactoryTest.h @@ -13,7 +13,7 @@ #include "MantidVatesAPI/vtkStructuredGrid_Silent.h" using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid::VATES; diff --git a/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoQuadFactoryTest.h b/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoQuadFactoryTest.h index 612edc4c54c638e86fcf540e84bf572e34dd4551..5b30bb1eff8714fca37113c187e5c98469507b41 100644 --- a/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoQuadFactoryTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/vtkMDHistoQuadFactoryTest.h @@ -13,12 +13,12 @@ #include <gtest/gtest.h> using namespace Mantid; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid::VATES; using namespace testing; -using Mantid::MDEvents::MDEventsTestHelper::makeFakeMDHistoWorkspace; +using Mantid::DataObjects::MDEventsTestHelper::makeFakeMDHistoWorkspace; //===================================================================================== diff --git a/Code/Mantid/Vates/VatesAPI/test/vtkMDLineFactoryTest.h b/Code/Mantid/Vates/VatesAPI/test/vtkMDLineFactoryTest.h index 168ced945c5dbdd444252275ca75e7036faaa938..17c3a61aca525ab73df26644bb8459c636b07670 100644 --- a/Code/Mantid/Vates/VatesAPI/test/vtkMDLineFactoryTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/vtkMDLineFactoryTest.h @@ -13,7 +13,7 @@ using namespace Mantid::VATES; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace testing; //===================================================================================== @@ -87,7 +87,7 @@ public: //Expectation checks that progress should be >= 0 and <= 100 and called at least once! EXPECT_CALL(mockProgressAction, eventRaised(AllOf(Le(100),Ge(0)))).Times(AtLeast(1)); - boost::shared_ptr<Mantid::MDEvents::MDEventWorkspace<Mantid::MDEvents::MDEvent<1>,1> > + boost::shared_ptr<Mantid::DataObjects::MDEventWorkspace<Mantid::DataObjects::MDEvent<1>,1> > ws = MDEventsTestHelper::makeMDEWFull<1>(10, 10, 10, 10); //Rebin it to make it possible to compare cells to bins. @@ -128,7 +128,7 @@ public: void setUp() { - boost::shared_ptr<Mantid::MDEvents::MDEventWorkspace<Mantid::MDEvents::MDEvent<1>,1> > input + boost::shared_ptr<Mantid::DataObjects::MDEventWorkspace<Mantid::DataObjects::MDEvent<1>,1> > input = MDEventsTestHelper::makeMDEWFull<1>(2, 10, 10, 4000); //Rebin it to make it possible to compare cells to bins. using namespace Mantid::API; diff --git a/Code/Mantid/Vates/VatesAPI/test/vtkMDQuadFactoryTest.h b/Code/Mantid/Vates/VatesAPI/test/vtkMDQuadFactoryTest.h index 5358248c4cf3c2edc0f57f6c6dfd4c0e7a409e06..6207f3f3c8112cd9f950d03bfa3904659916b73f 100644 --- a/Code/Mantid/Vates/VatesAPI/test/vtkMDQuadFactoryTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/vtkMDQuadFactoryTest.h @@ -13,7 +13,7 @@ using namespace Mantid::VATES; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace testing; //===================================================================================== @@ -88,7 +88,7 @@ public: //Expectation checks that progress should be >= 0 and <= 100 and called at least once! EXPECT_CALL(mockProgressAction, eventRaised(AllOf(Le(100),Ge(0)))).Times(AtLeast(1)); - boost::shared_ptr<Mantid::MDEvents::MDEventWorkspace<Mantid::MDEvents::MDEvent<2>,2> > + boost::shared_ptr<Mantid::DataObjects::MDEventWorkspace<Mantid::DataObjects::MDEvent<2>,2> > ws = MDEventsTestHelper::makeMDEWFull<2>(10, 10, 10, 10); //Rebin it to make it possible to compare cells to bins. @@ -130,7 +130,7 @@ public: void setUp() { - boost::shared_ptr<Mantid::MDEvents::MDEventWorkspace<Mantid::MDEvents::MDEvent<2>,2> > input + boost::shared_ptr<Mantid::DataObjects::MDEventWorkspace<Mantid::DataObjects::MDEvent<2>,2> > input = MDEventsTestHelper::makeMDEWFull<2>(10, 10, 10, 1000); //Rebin it to make it possible to compare cells to bins. using namespace Mantid::API; diff --git a/Code/Mantid/Vates/VatesAPI/test/vtkSplatterPlotFactoryTest.h b/Code/Mantid/Vates/VatesAPI/test/vtkSplatterPlotFactoryTest.h index ac5e17b344fdee8bd8d0a8ddfdfdd996386b85a2..550f65988cad1aff6ab4a27ae22faea67dbbf407 100644 --- a/Code/Mantid/Vates/VatesAPI/test/vtkSplatterPlotFactoryTest.h +++ b/Code/Mantid/Vates/VatesAPI/test/vtkSplatterPlotFactoryTest.h @@ -2,9 +2,9 @@ #define VTK_SPLATTERPLOT_FACTORY_TEST #include "MantidAPI/IMDEventWorkspace.h" -#include "MantidMDEvents/MDEventFactory.h" -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDHistoWorkspace.h" +#include "MantidDataObjects/MDEventFactory.h" +#include "MantidDataObjects/MDEventWorkspace.h" +#include "MantidDataObjects/MDHistoWorkspace.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidVatesAPI/UserDefinedThresholdRange.h" #include "MantidVatesAPI/vtkSplatterPlotFactory.h" @@ -22,7 +22,7 @@ using namespace Mantid; using namespace Mantid::VATES; using namespace Mantid::API; -using namespace Mantid::MDEvents; +using namespace Mantid::DataObjects; using namespace testing; //===================================================================================== @@ -114,7 +114,7 @@ public: { FakeProgressAction progressUpdate; - Mantid::MDEvents::MDEventWorkspace3Lean::sptr ws = MDEventsTestHelper::makeMDEW<3>(10, 0.0, 10.0, 1); + MDEventWorkspace3Lean::sptr ws = MDEventsTestHelper::makeMDEW<3>(10, 0.0, 10.0, 1); vtkSplatterPlotFactory factory(ThresholdRange_scptr(new UserDefinedThresholdRange(0, 1)), "signal"); factory.initialize(ws); vtkDataSet* product = NULL; @@ -145,7 +145,7 @@ public: { FakeProgressAction progressUpdate; - Mantid::MDEvents::MDEventWorkspace4Lean::sptr ws = MDEventsTestHelper::makeMDEW<4>(5, -10.0, 10.0, 1); + MDEventWorkspace4Lean::sptr ws = MDEventsTestHelper::makeMDEW<4>(5, -10.0, 10.0, 1); vtkSplatterPlotFactory factory(ThresholdRange_scptr(new UserDefinedThresholdRange(0, 1)), "signal"); factory.initialize(ws); vtkDataSet* product = NULL; @@ -175,7 +175,7 @@ public: FakeProgressAction progressUpdate; - Mantid::MDEvents::MDEventWorkspace3Lean::sptr ws = MDEventsTestHelper::makeMDEW<3>(10, 0.0, 10.0, 1); + MDEventWorkspace3Lean::sptr ws = MDEventsTestHelper::makeMDEW<3>(10, 0.0, 10.0, 1); vtkSplatterPlotFactory factory(ThresholdRange_scptr(new UserDefinedThresholdRange(0, 1)), "signal"); factory.initialize(ws); vtkDataSet* product = NULL; diff --git a/Code/Mantid/docs/source/algorithms/CreateMD-v1.rst b/Code/Mantid/docs/source/algorithms/CreateMD-v1.rst new file mode 100644 index 0000000000000000000000000000000000000000..a54a350697b331d310c2bef58b9ee8b9b7716b6e --- /dev/null +++ b/Code/Mantid/docs/source/algorithms/CreateMD-v1.rst @@ -0,0 +1,105 @@ +.. algorithm:: + +.. summary:: + +.. alias:: + +.. properties:: + +Description +----------- + +This workflow algorithm creates MDWorkspaces in the Q3D, HKL frame using :ref:`algm-ConvertToMD`. + +Setting the UB matrix +###################################### + +*u* and *v* are required. *u* and *v* are both 3-element vectors. These specify how the crystal's axes were oriented relative to the spectrometer in the setup for which you define psi to be zero. *u* specifies the lattice vector that is parallel to the incident neutron beam, whilst *v* is a vector perpendicular to this in the horizontal plane. In UB matrix notation, *u* and *v* provide the U matrix. See :ref:`algm-SetUB`. *Alatt* and *Angdeg* are the lattice parameters in Angstroms and lattice angles in degrees respectively. Both are 3-element vectors. These form the B-matrix. + +Goniometer Settings +##################### + +If goniometer settings have been provided then these will be applied to the input workspace(s). For multiple input workspaces, you will need to provide goniometer settings (*Psi*, *Gl*, *Gs*) as vectors where each element of the vector corresponds to the workspace in the order listed in *InputWorkspaces*. You do not need to provide the goniometer settings at all. If you run :ref:`algm-SetGoniometer` individually on the input workspace prior to running CreateMD, then those settings will not be overwritten by CreateMD. + +Merging Individually Converted Runs +##################################### + +If a sequence of input workspaces are provided then these are individually processed as above, and are merged together via :ref:`algm-MergeMD`. Intermediate workspaces are not kept. + +Additional Information +####################### +CreateMD steps use :ref:`algm-ConvertToMDMinMaxGlobal` to determine the min and max possible extents prior to running :ref:`algm-ConvertToMD` on each run. + + +.. figure:: /images/HoraceOrientation.png + :alt: HoraceOrientation.png + + `Horace <http://horace.isis.rl.ac.uk/Generating_SQW_files>`__ style orientation used by CreateMD. DSPI and Omega in the image have no meaning in Mantid and are not required by this algorithm. + + +**Single Conversion Example** +########################################## + +.. testcode:: SingleConversion + + # Create some input data. + current_ws = CreateSimulationWorkspace(Instrument='MAR', BinParams=[-3,1,3], UnitX='DeltaE') + AddSampleLog(Workspace=current_ws,LogName='Ei',LogText='3.0',LogType='Number') + + # Execute CreateMD + new_mdew = CreateMD(current_ws, Emode='Direct', Alatt=[1.4165, 1.4165,1.4165], Angdeg=[ 90, 90, 90], u=[1, 0, 0,], v=[0,1,0], Psi=6, Gs=0, Gl=[0]) + + # Show dimensionality and dimension names + ndims = new_mdew.getNumDims() + for i in range(ndims): + dim = new_mdew.getDimension(i) + print dim.getName() + +Output +^^^^^^ + +.. testoutput:: SingleConversion + + [H,0,0] + [0,K,0] + [0,0,L] + DeltaE + +**Multi Conversion Example** +########################################## + +.. testcode:: MultiConversion + + # Create multiple runs + input_runs = list() + psi = list() + gs = list() + gl = list() + for i in range(1, 5): + current_ws = CreateSimulationWorkspace(Instrument='MAR', BinParams=[-3,1,3], UnitX='DeltaE', OutputWorkspace='input_ws_' + str(i)) + input_runs.append(current_ws.name()) + AddSampleLog(Workspace=current_ws,LogName='Ei',LogText='3.0',LogType='Number') + psi.append(float(5 * i)) + gl.append(0.0) + gs.append(0.0) + + # Convert and merge + new_merged = CreateMD(input_runs, Emode='Direct', Alatt=[1.4165, 1.4165,1.4165], Angdeg=[ 90, 90, 90], u=[1, 0, 0,], v=[0,1,0], Psi=psi, Gl=gl, Gs=gs) + + # Show dimensionality and dimension names + ndims = new_merged.getNumDims() + for i in range(ndims): + dim = new_merged.getDimension(i) + print dim.getName() + +Output +^^^^^^ + +.. testoutput:: MultiConversion + + [H,0,0] + [0,K,0] + [0,0,L] + DeltaE + +.. categories:: diff --git a/Code/Mantid/docs/source/algorithms/CutMD-v1.rst b/Code/Mantid/docs/source/algorithms/CutMD-v1.rst index da2f0f251e15456314cd10bdb50cc2a8e139241e..77d8cb021a86e0d4b9582790e511caf070daf30c 100644 --- a/Code/Mantid/docs/source/algorithms/CutMD-v1.rst +++ b/Code/Mantid/docs/source/algorithms/CutMD-v1.rst @@ -23,6 +23,67 @@ all then be processed sequentially with the same options. The only requirement is that the same number of output workspaces are also given so that CutMD knows what to call each output workspace created. +Creating Projections +~~~~~~~~~~~~~~~~~~~~ + +Projections are used by CutMD to transform the multidimensional data prior to +cutting it. Projections are provided to CutMD in the form of a :ref:`TableWorkspace <Table Workspaces>`. +The format of these workspaces is as follows: + ++------------+--------+-------------------------------------------------------+ +| Column | Type | Purpose | ++============+========+=======================================================+ +| name | string | Specifies the dimension the row controls. Can be 'u', | +| | | 'v', or 'w'. | ++------------+--------+-------------------------------------------------------+ +| value | string | A 3 dimensional vector specifying the axis for the | +| | | dimension. Example: '1,-1,0' | ++------------+--------+-------------------------------------------------------+ +| offset | double | The offset value to use for this dimension. | ++------------+--------+-------------------------------------------------------+ +| type | string | The type/unit of this dimension. 'r' is RLU, 'a' is | +| | | inverse angstroms. | ++------------+--------+-------------------------------------------------------+ + +A projection table should have three rows: one for u, one for v, and one for w. + +There is a helper class called Projection that can be used to construct these +projection tables for you automatically. For example: + +.. code-block:: python + + from mantid.api import Projection + # Create an identity projection + proj_id = Projection([1,0,0], [0,1,0], [0,0,1]) + + # Automatically infer third dimension as being orthogonal to the first two + proj_rot = Projection([1,1,0], [1,-1,0]) + + # Set other properties + proj_prop = Projection() + proj_prop.setOffset(0, 100) # Set u offset to 100 + proj_prop.setOffset(1, -5.0) # Set v offset to -5 + proj_prop.setType(1, 'a') # Set v type to be RLU + proj_prop.setType(2, 'a') # Set w type to be inverse angstroms + + #Create table workspaces from these projections + ws_id = proj_id.createWorkspace() # Named ws_id + proj_rot.createWorkspace(OutputWorkspace="ws_rot") # Name ws_rot + + +When calling createWorkspace inside of algorithms like CutMD, the +OutputWorkspace name must be provided, or createWorkspace will not know what to +call the created workspace: + +.. code-block:: python + + #Good: + CutMD(..., Projection=proj.createWorkspace(OutputWorkspace='proj_ws'), ...) + + #Bad: + CutMD(..., Projection=proj.createWorkspace(), ...) + + Usage ----- diff --git a/Code/Mantid/docs/source/algorithms/Fury-v1.rst b/Code/Mantid/docs/source/algorithms/Fury-v1.rst deleted file mode 100644 index a82a566e5ec784ab5326137903881925e7dee98c..0000000000000000000000000000000000000000 --- a/Code/Mantid/docs/source/algorithms/Fury-v1.rst +++ /dev/null @@ -1,24 +0,0 @@ -.. algorithm:: - -.. summary:: - -.. alias:: - -.. properties:: - -Description ------------ - -The model that is being fitted is that of a delta-function (elastic component) of amplitude :math:`A(0)` and Lorentzians of amplitude :math:`A(j)` and HWHM :math:`W(j)` where :math:`j=1,2,3`. The whole function is then convolved with the resolution function. The -function and Lorentzians are intrinsically -normalised to unity so that the amplitudes represent their integrated areas. - -For a Lorentzian, the Fourier transform does the conversion: :math:`1/(x^{2}+\delta^{2}) \Leftrightarrow exp[-2\pi(\delta k)]`. -If :math:`x` is identified with energy :math:`E` and :math:`2\pi k` with :math:`t/\hbar` where t is time then: :math:`1/[E^{2}+(\hbar / \tau )^{2}] \Leftrightarrow exp[-t /\tau]` and :math:`\sigma` is identified with :math:`\hbar / \tau`. -The program estimates the quasielastic components of each of the groups of spectra and requires the resolution file and optionally the normalisation file created by ResNorm. - -For a Stretched Exponential, the choice of several Lorentzians is replaced with a single function with the shape : :math:`\psi\beta(x) \Leftrightarrow exp[-2\pi(\sigma k)\beta]`. This, in the energy to time FT transformation, is :math:`\psi\beta(E) \Leftrightarrow exp[-(t/\tau)\beta]`. So \sigma is identified with :math:`(2\pi)\beta\hbar/\tau`. -The model that is fitted is that of an elastic component and the stretched exponential and the program gives the best estimate for the :math:`\beta` parameter and the width for each group of spectra. - -This routine was originally part of the MODES package. - -.. categories:: diff --git a/Code/Mantid/docs/source/algorithms/LoadDNSLegacy-v1.rst b/Code/Mantid/docs/source/algorithms/LoadDNSLegacy-v1.rst index 369b381acf627d81d508958d0cf9efaeec993993..ed825958bf18294086397f2a608b9206f8c3c25d 100644 --- a/Code/Mantid/docs/source/algorithms/LoadDNSLegacy-v1.rst +++ b/Code/Mantid/docs/source/algorithms/LoadDNSLegacy-v1.rst @@ -10,7 +10,7 @@ Description ----------- Loads a DNS legacy .d_dat data file into a :ref:`Workspace2D <Workspace2D>` with -the given name. +the given name. The loader rotates the detector bank in the position given in the data file. @@ -27,7 +27,7 @@ Usage datafile = 'dn134011vana.d_dat' # Load dataset - ws = LoadDNSLegacy(datafile) + ws = LoadDNSLegacy(datafile, Polarisation='x') print "This workspace has", ws.getNumDims(), "dimensions and has", \ ws.getNumberHistograms(), "histograms." diff --git a/Code/Mantid/docs/source/algorithms/LoadFITS-v1.rst b/Code/Mantid/docs/source/algorithms/LoadFITS-v1.rst index 1184957082ea3bb9cc5fcd8427abafca0877988f..dfeae5b13f7f708ab961b2d2f3ac96cdc33508b7 100644 --- a/Code/Mantid/docs/source/algorithms/LoadFITS-v1.rst +++ b/Code/Mantid/docs/source/algorithms/LoadFITS-v1.rst @@ -62,15 +62,15 @@ Usage ws = wsg.getItem(0) # A couple of standard FITS header entries - bpp_log = '_BITPIX' + bpp_log = 'BITPIX' try: log = ws.getRun().getLogData(bpp_log).value print "Bits per pixel: %s" % int(log) except RuntimeError: print "Could not find the keyword '%s' in this FITS file" % bpp_log - axis1_log = '_NAXIS1' - axis2_log = '_NAXIS2' + axis1_log = 'NAXIS1' + axis2_log = 'NAXIS2' try: log1 = ws.getRun().getLogData(axis1_log).value log2 = ws.getRun().getLogData(axis2_log).value diff --git a/Code/Mantid/docs/source/algorithms/SCDCalibratePanels-v1.rst b/Code/Mantid/docs/source/algorithms/SCDCalibratePanels-v1.rst index 1f98aa15a476e3838012d2570b2cee52b2ba01b5..6e4da1575dcae1e432a8e12aa1a82911a08cdfc4 100644 --- a/Code/Mantid/docs/source/algorithms/SCDCalibratePanels-v1.rst +++ b/Code/Mantid/docs/source/algorithms/SCDCalibratePanels-v1.rst @@ -96,16 +96,38 @@ the InputWorkspace and the workspace you want to copy the calibration to, the OutputWorkspace. Usage ------- - -**Example - SCDCalibratePanels:** - - LoadIsawPeaks(Filename='MANDI_801.peaks', OutputWorkspace='peaks') - SCDCalibratePanels(PeakWorkspace='peaks',DetCalFilename='mandi_801.DetCal',XmlFilename='mandi_801.xml',a=74,b=74.5,c=99.9,alpha=90,beta=90,gamma=60) - Load(Filename='MANDI_801_event.nxs', OutputWorkspace='MANDI_801_event') - CloneWorkspace(InputWorkspace='MANDI_801_event', OutputWorkspace='MANDI_801_event_xml') - LoadParameterFile(Workspace='MANDI_801_event_xml', Filename='mandi_801.xml') - RenameWorkspace(InputWorkspace='MANDI_801_event_xml', OutputWorkspace='MANDI_801_event_DetCal') - LoadIsawDetCal(InputWorkspace='MANDI_801_event_DetCal', Filename='mandi_801.DetCal') - +----- + +.. testcode:: SCDCalibratePanels + + #Calibrate peaks file and load to workspace + LoadIsawPeaks(Filename='MANDI_801.peaks', OutputWorkspace='peaks') + #TimeOffset is not stored in xml file, so use DetCal output if you need TimeOffset + SCDCalibratePanels(PeakWorkspace='peaks',DetCalFilename='mandi_801.DetCal',XmlFilename='mandi_801.xml',a=74,b=74.5,c=99.9,alpha=90,beta=90,gamma=60,usetimeOffset=False) + LoadEmptyInstrument(Filename='MANDI_Definition_2013_08_01.xml', OutputWorkspace='MANDI_801_event_DetCal') + CloneWorkspace(InputWorkspace='MANDI_801_event_DetCal', OutputWorkspace='MANDI_801_event_xml') + LoadParameterFile(Workspace='MANDI_801_event_xml', Filename='mandi_801.xml') + LoadIsawDetCal(InputWorkspace='MANDI_801_event_DetCal', Filename='mandi_801.DetCal') + det1 = mtd['MANDI_801_event_DetCal'].getInstrument().getDetector(327680) + det2 = mtd['MANDI_801_event_xml'].getInstrument().getDetector(327680) + if det1.getPos() == det2.getPos(): + print "matches" + +.. testcleanup:: SCDCalibratePanels + + DeleteWorkspace('peaks') + DeleteWorkspace('MANDI_801_event_xml') + DeleteWorkspace('MANDI_801_event_DetCal') + import os,mantid + filename=mantid.config.getString("defaultsave.directory")+"mandi_801.xml" + os.remove(filename) + filename=mantid.config.getString("defaultsave.directory")+"mandi_801.DetCal" + os.remove(filename) + +Output: + +.. testoutput:: SCDCalibratePanels + + matches + .. categories:: diff --git a/Code/Mantid/docs/source/algorithms/TransformToIqt-v1.rst b/Code/Mantid/docs/source/algorithms/TransformToIqt-v1.rst new file mode 100644 index 0000000000000000000000000000000000000000..83480d11785c64b0edfd40982bb5bcdf0ad8006d --- /dev/null +++ b/Code/Mantid/docs/source/algorithms/TransformToIqt-v1.rst @@ -0,0 +1,112 @@ +.. algorithm:: + +.. summary:: + +.. alias:: + +.. properties:: + +Description +----------- + +This algorithm transforms either a reduced (*_red*) or S(Q, w) (*_sqw*) +workspace to a I(Q, t) workspace. + +Theory +------ + +The measured spectrum :math:`I(Q, \omega)` is proportional to the four +dimensional convolution of the scattering law :math:`S(Q, \omega)` with the +resolution function :math:`R(Q, \omega)` of the spectrometer via :math:`I(Q, +\omega) = S(Q, \omega) ⊗ R(Q, \omega)`, so :math:`S(Q, \omega)` can be obtained, +in principle, by a deconvolution in :math:`Q` and :math:`\omega`. The method +employed here is based on the Fourier Transform (FT) technique [6,7]. On Fourier +transforming the equation becomes :math:`I(Q, t) = S(Q, t) x R(Q, t)` where the +convolution in :math:`\omega`-space is replaced by a simple multiplication in +:math:`t`-space. The intermediate scattering law :math:`I(Q, t)` is then +obtained by simple division and the scattering law :math:`S(Q, \omega)` itself +can be obtained by back transformation. The latter however is full of pitfalls +for the unwary. The advantage of this technique over that of a fitting procedure +such as SWIFT is that a functional form for :math:`I(Q, t)` does not have to be +assumed. On IRIS the resolution function is close to a Lorentzian and the +scattering law is often in the form of one or more Lorentzians. The FT of a +Lorentzian is a decaying exponential, :math:`exp(-\alpha t)` , so that plots of +:math:`ln(I(Q, t))` against t would be straight lines thus making interpretation +easier. + +In general, the origin in energy for the sample run and the resolution run need +not necessarily be the same or indeed be exactly zero in the conversion of the +RAW data from time-of-flight to energy transfer. This will depend, for example, +on the sample and vanadium shapes and positions and whether the analyser +temperature has changed between the runs. The procedure takes this into account +automatically, without using an arbitrary fitting procedure, in the following +way. From the general properties of the FT, the transform of an offset +Lorentzian has the form :math:`(cos(\omega_{0}t) + isin(\omega_{0}t))exp(-\Gamma +t)` , thus taking the modulus produces the exponential :math:`exp(-\Gamma t)` +which is the required function. If this is carried out for both sample and +resolution, the difference in the energy origin is automatically removed. The +results of this procedure should however be treated with some caution when +applied to more complicated spectra in which it is possible for :math:`I(Q, t)` +to become negative, for example, when inelastic side peaks are comparable in +height to the elastic peak. + +The interpretation of the data must also take into account the propagation of +statistical errors (counting statistics) in the measured data as discussed by +Wild et al [1]. If the count in channel :math:`k` is :math:`X_{k}` , then +:math:`X_{k}=<X_{k}>+\Delta X_{k}` where :math:`<X_{k}>` is the mean value and +:math:`\Delta X_{k}` the error. The standard deviation for channel :math:`k` is +:math:`\sigma k` :math:`2=<\Delta X_{k}>2` which is assumed to be given by +:math:`\sigma k=<X_{k}>`. The FT of :math:`X_{k}` is defined by +:math:`X_{j}=<X_{j}>+\Delta X_{j}` and the real and imaginary parts denoted by +:math:`X_{j} I` and :math:`X_{j} I` respectively. The standard deviations on +:math:`X_{j}` are then given by :math:`\sigma 2(X_{j} R)=1/2 X0 R + 1/2 X2j R` +and :math:`\sigma 2(X_{j} I)=1/2 X0 I - 1/2 X2j I`. + +Note that :math:`\sigma 2(X_{0} R) = X_{0} R` and from the properties of FT +:math:`X_{0} R = X_{k}`. Thus the standard deviation of the first coefficient +of the FT is the square root of the integrated intensity of the spectrum. In +practice, apart from the first few coefficients, the error is nearly constant +and close to :math:`X_{0} R`. A further point to note is that the errors make +the imaginary part of :math:`I(Q, t)` non-zero and that, although these will be +distributed about zero, on taking the modulus of :math:`I(Q, t)`, they become +positive at all times and are distributed about a non-zero positive value. When +:math:`I(Q, t)` is plotted on a log-scale the size of the error bars increases +with time (coefficient) and for the resolution will reach a point where the +error on a coefficient is comparable to its value. This region must therefore be +treated with caution. For a true deconvolution by back transforming, the data +would be truncated to remove this poor region before back transforming. If the +truncation is severe the back transform may contain added ripples, so an +automatic back transform is not provided. + +References +---------- + +1. U P Wild, R Holzwarth & H P Good, Rev Sci Instr 48 1621 (1977) + +Usage +----- + +**Example - TransformToIqt with IRIS data.** + +.. testcode:: exTransformToIqtIRIS + + sample = Load('irs26176_graphite002_red.nxs') + can = Load('irs26173_graphite002_red.nxs') + + params, iqt = TransformToIqt(SampleWorkspace=sample, + ResolutionWorkspace=can, + EnergyMin=-0.5, + EnergyMax=0.5, + BinReductionFactor=10) + + print 'Number of output bins: %d' % (params.cell('SampleOutputBins', 0)) + print 'Resolution bins: %d' % (params.cell('ResolutionBins', 0)) + +Output: + +.. testoutput:: exTransformToIqtIRIS + + Number of output bins: 172 + Resolution bins: 6 + +.. categories:: diff --git a/Code/Mantid/docs/source/concepts/InstrumentDefinitionFile.rst b/Code/Mantid/docs/source/concepts/InstrumentDefinitionFile.rst index 01aa6d96f88e985d419881cb02529a658889275c..acdf04823d6ba5cd380fd0ce085bdb484879dbbe 100644 --- a/Code/Mantid/docs/source/concepts/InstrumentDefinitionFile.rst +++ b/Code/Mantid/docs/source/concepts/InstrumentDefinitionFile.rst @@ -162,18 +162,23 @@ For information on how to define geometric shapes see Top level <instrument> ~~~~~~~~~~~~~~~~~~~~~~ -<instrument> is the top level XML element of an IDF. It takes attributes, two of +<instrument> is the top level XML element of an IDF. It takes attributes, three of which must be included. An example is .. code-block:: xml - <instrument name="ARCS" + <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="ARCS" valid-from="1900-01-31 23:59:59" valid-to="2100-01-31 23:59:59" last-modified="2010-10-12 08:54:07.279621"> Of the four attributes in the example above +- xmlns, xmlns:xsi, xsi:schemaLocation are required attributes that can + be copied verbatim as above - name is (at present) optional, although it is recommended to specify something sensible - valid-from is compulsory and is the date from which the IDF is valid diff --git a/Code/Mantid/docs/source/images/HoraceOrientation.png b/Code/Mantid/docs/source/images/HoraceOrientation.png new file mode 100644 index 0000000000000000000000000000000000000000..d9beeb9cbb966d4a0dc76ac78877e810a511f92a Binary files /dev/null and b/Code/Mantid/docs/source/images/HoraceOrientation.png differ diff --git a/Code/Mantid/docs/source/interfaces/Indirect_DataAnalysis.rst b/Code/Mantid/docs/source/interfaces/Indirect_DataAnalysis.rst index 30201258338fd85aa81809fbd695c9791c640b9f..13573c27051d1f0988be8cbab4837cc4f0f3f0ec 100644 --- a/Code/Mantid/docs/source/interfaces/Indirect_DataAnalysis.rst +++ b/Code/Mantid/docs/source/interfaces/Indirect_DataAnalysis.rst @@ -127,9 +127,6 @@ Plot Spectrum Spectra Range The spectra range over which to perform sequential fitting. -Verbose - Enables outputting additional information to the Results Log. - Plot Result If enabled will plot the result as a spectra plot. @@ -144,7 +141,7 @@ Fury :widget: tabFury Given sample and resolution inputs, carries out a fit as per the theory detailed -below. +in the :ref:`TransformToIqt <algm-TransformToIqt>` algorithm. Options ~~~~~~~ @@ -164,9 +161,6 @@ SampleBinning The ratio at which to decrease the number of bins by through merging of intensities from neighbouring bins. -Verbose - Enables outputting additional information to the Results Log. - Plot Result If enabled will plot the result as a spectra plot. @@ -194,76 +188,6 @@ ResolutionBins Number of bins in the resolution after rebinning, typically this should be at least 5 and a warning will be shown if it is less. -Theory -~~~~~~ - -The measured spectrum :math:`I(Q, \omega)` is proportional to the four -dimensional convolution of the scattering law :math:`S(Q, \omega)` with the -resolution function :math:`R(Q, \omega)` of the spectrometer via :math:`I(Q, -\omega) = S(Q, \omega) ⊗ R(Q, \omega)`, so :math:`S(Q, \omega)` can be obtained, -in principle, by a deconvolution in :math:`Q` and :math:`\omega`. The method -employed here is based on the Fourier Transform (FT) technique [6,7]. On Fourier -transforming the equation becomes :math:`I(Q, t) = S(Q, t) x R(Q, t)` where the -convolution in :math:`\omega`-space is replaced by a simple multiplication in -:math:`t`-space. The intermediate scattering law :math:`I(Q, t)` is then -obtained by simple division and the scattering law :math:`S(Q, \omega)` itself -can be obtained by back transformation. The latter however is full of pitfalls -for the unwary. The advantage of this technique over that of a fitting procedure -such as SWIFT is that a functional form for :math:`I(Q, t)` does not have to be -assumed. On IRIS the resolution function is close to a Lorentzian and the -scattering law is often in the form of one or more Lorentzians. The FT of a -Lorentzian is a decaying exponential, :math:`exp(-\alpha t)` , so that plots of -:math:`ln(I(Q, t))` against t would be straight lines thus making interpretation -easier. - -In general, the origin in energy for the sample run and the resolution run need -not necessarily be the same or indeed be exactly zero in the conversion of the -RAW data from time-of-flight to energy transfer. This will depend, for example, -on the sample and vanadium shapes and positions and whether the analyser -temperature has changed between the runs. The procedure takes this into account -automatically, without using an arbitrary fitting procedure, in the following -way. From the general properties of the FT, the transform of an offset -Lorentzian has the form :math:`(cos(\omega_{0}t) + isin(\omega_{0}t))exp(-\Gamma -t)` , thus taking the modulus produces the exponential :math:`exp(-\Gamma t)` -which is the required function. If this is carried out for both sample and -resolution, the difference in the energy origin is automatically removed. The -results of this procedure should however be treated with some caution when -applied to more complicated spectra in which it is possible for :math:`I(Q, t)` -to become negative, for example, when inelastic side peaks are comparable in -height to the elastic peak. - -The interpretation of the data must also take into account the propagation of -statistical errors (counting statistics) in the measured data as discussed by -Wild et al [1]. If the count in channel :math:`k` is :math:`X_{k}` , then -:math:`X_{k}=<X_{k}>+\Delta X_{k}` where :math:`<X_{k}>` is the mean value and -:math:`\Delta X_{k}` the error. The standard deviation for channel :math:`k` is -:math:`\sigma k` :math:`2=<\Delta X_{k}>2` which is assumed to be given by -:math:`\sigma k=<X_{k}>`. The FT of :math:`X_{k}` is defined by -:math:`X_{j}=<X_{j}>+\Delta X_{j}` and the real and imaginary parts denoted by -:math:`X_{j} I` and :math:`X_{j} I` respectively. The standard deviations on -:math:`X_{j}` are then given by :math:`\sigma 2(X_{j} R)=1/2 X0 R + 1/2 X2j R` -and :math:`\sigma 2(X_{j} I)=1/2 X0 I - 1/2 X2j I`. - -Note that :math:`\sigma 2(X_{0} R) = X_{0} R` and from the properties of FT -:math:`X_{0} R = X_{k}`. Thus the standard deviation of the first coefficient -of the FT is the square root of the integrated intensity of the spectrum. In -practice, apart from the first few coefficients, the error is nearly constant -and close to :math:`X_{0} R`. A further point to note is that the errors make -the imaginary part of :math:`I(Q, t)` non-zero and that, although these will be -distributed about zero, on taking the modulus of :math:`I(Q, t)`, they become -positive at all times and are distributed about a non-zero positive value. When -:math:`I(Q, t)` is plotted on a log-scale the size of the error bars increases -with time (coefficient) and for the resolution will reach a point where the -error on a coefficient is comparable to its value. This region must therefore be -treated with caution. For a true deconvolution by back transforming, the data -would be truncated to remove this poor region before back transforming. If the -truncation is severe the back transform may contain added ripples, so an -automatic back transform is not provided. - -References: - -1. U P Wild, R Holzwarth & H P Good, Rev Sci Instr 48 1621 (1977) - Fury Fit -------- @@ -326,9 +250,6 @@ Plot Spectrum Spectra Range The spectra range over which to perform sequential fitting. -Verbose - Enables outputting additional information to the Results Log. - Plot Output Allows plotting spectra plots of fitting parameters, the options available will depend on the type of fit chosen. @@ -401,9 +322,6 @@ Plot Spectrum Spectra Range The spectra range over which to perform sequential fitting. -Verbose - Enables outputting additional information to the Results Log. - Plot Output Allows plotting spectra plots of fitting parameters, the options available will depend on the type of fit chosen. @@ -506,13 +424,12 @@ References: Calculate Corrections --------------------- -.. warning:: This interface is only available on Windows - .. interface:: Data Analysis :widget: tabCalcCorr -Calculates absorption corrections that could be applied to the data when given -information about the sample (and optionally can) geometry. +Calculates absorption corrections in the Paalman & Pings absorption factors that +could be applied to the data when given information about the sample (and +optionally can) geometry. Options ~~~~~~~ @@ -527,16 +444,18 @@ Use Can \omega)` file (*_sqw.nxs*) or workspace (*_sqw*). Sample Shape - Sets the shape of the sample, this affects the options for the sample details, - see below. + Sets the shape of the sample, this affects the options for the shape details + (see below). -Beam Width - Width of the incident beam. +Sample/Can Number Density + Density of the sample or container. -Verbose - Enables outputting additional information to the Results Log. +Sample/Can Chemical Formula + Chemical formula of the sample or can material. This must be provided in the + format expected by the :ref:`SetSampleMaterial <algm-SetSampleMaterial>` + algorithm. -Plot Result +Plot Output Plots the :math:`A_{s,s}`, :math:`A_{s,sc}`, :math:`A_{c,sc}` and :math:`A_{c,c}` workspaces as spectra plots. @@ -544,60 +463,74 @@ Save Result If enabled the result will be saved as a NeXus file in the default save directory. -Sample Details -~~~~~~~~~~~~~~ +Shape Details +~~~~~~~~~~~~~ Depending on the shape of the sample different parameters for the sample dimension are required and are detailed below. -Flat -#### +Flat Plate +########## .. interface:: Data Analysis - :widget: pageFlat + :widget: pgFlatPlate + +The calculation for a flat plate geometry is performed by the +:ref:`FlatPlatePaalmanPingsCorrection <algm-FlatPlatePaalmanPingsCorrection>` +algorithm. -Thickness - Thickness of sample (cm). +Sample Thickness + Thickness of sample in :math:`cm`. + +Sample Angle + Sample angle in degrees. Can Front Thickness - Thickness of front container (cm). + Thickness of front container in :math:`cm`. Can Back Thickness - Thickness of back container (cm). - -Sample Angle - Sample angle (degrees). + Thickness of back container in :math:`cm`. Cylinder ######## +.. warning:: This mode is only available on Windows + .. interface:: Data Analysis - :widget: pageCylinder + :widget: pgCylinder + +The calculation for a cylindrical geometry is performed by the +:ref:`CylinderPaalmanPingsCorrection <algm-CylinderPaalmanPingsCorrection>` +algorithm, this algorithm is currently only available on Windows as it uses +FORTRAN code dependant of F2Py. + +Sample Inner Radius + Radius of the inner wall of the sample in :math:`cm`. -Radius 1 - Sample radius 1 (cm). +Sample Outer Radius + Radius of the outer wall of the sample in :math:`cm`. -Radius 2 - Sample radius 2 (cm). +Container Outer Radius + Radius of outer wall of the container in :math:`cm`. -Can Radius - Radius of inside of the container (cm). +Beam Height + Height of incident beam :math:`cm`. + +Beam Width + Width of incident beam in :math:`cm`. Step Size Step size used in calculation. -Theory -~~~~~~ +Background +~~~~~~~~~~ The main correction to be applied to neutron scattering data is that for absorption both in the sample and its container, when present. For flat plate geometry, the corrections can be analytical and have been discussed for example by Carlile [1]. The situation for cylindrical geometry is more complex and requires numerical integration. These techniques are well known and used in -liquid and amorphous diffraction, and are described in the ATLAS manual [2]. The -routines used here have been developed from the corrections programs in the -ATLAS suite and take into account the wavelength variation of both the -absorption and the scattering cross-sections for the inelastic flight paths. +liquid and amorphous diffraction, and are described in the ATLAS manual [2]. The absorption corrections use the formulism of Paalman and Pings [3] and involve the attenuation factors :math:`A_{i,j}` where :math:`i` refers to @@ -608,9 +541,7 @@ plus container. If the scattering cross sections for sample and container are scattering from the empty container is :math:`I_{c} = \Sigma_{c}A_{c,c}` and that from the sample plus container is :math:`I_{sc} = \Sigma_{s}A_{s,sc} + \Sigma_{c}A_{c,sc}`, thus :math:`\Sigma_{s} = (I_{sc} - I_{c}A_{c,sc}/A_{c,c}) / -A_{s,sc}`. In the package, the program Acorn calculates the attenuation -coefficients :math:`A_{i,j}` and the routine Analyse uses them to calculate Σs -which we identify with :math:`S(Q, \omega)`. +A_{s,sc}`. References: @@ -618,7 +549,6 @@ References: 2. A K Soper, W S Howells & A C Hannon, RAL Report RAL-89-046 (1989) 3. H H Paalman & C J Pings, J Appl Phys 33 2635 (1962) - Apply Corrections ----------------- @@ -628,12 +558,29 @@ Apply Corrections The Apply Corrections tab applies the corrections calculated in the Calculate Corrections tab of the Indirect Data Analysis interface. -This tab will expect to find the ass file generated in the previous tab. If Use -Can is selected, it will also expect the assc, acsc and acc files. It will take -the run number from the sample file, and geometry from the option you select. +This uses the :ref:`ApplyPaalmanPingsCorrection +<algm-ApplyPaalmanPingsCorrection>` algorithm to apply absorption corrections in +the form of the Paalman & Pings correction factors. When *Use Can* is disabled +only the :math:`A_{s,s}` factor must be provided, when using a container the +additional factors must be provided: :math:`A_{c,sc}`, :math:`A_{s,sc}` and +:math:`A_{c,c}`. Once run the corrected output and can correction is shown in the preview plot, -the Spectrum spin box can be used to scroll through each spectrum. +the Spectrum spin box can be used to scroll through each spectrum. Note that +when this plot shows the result of a calculation the X axis is always in +wavelength, however when data is initially selected the X axis unit matches that +of the sample workspace. + +The input and container workspaces will be converted to wavelength (using +:ref:`ConvertUnits <algm-ConvertUnits>`) if they do not already have wavelength +as their X unit. + +The binning of the sample, container and corrections factor workspace must all +match, if the sample and container do not match you will be given the option to +rebin (using :ref:`RebinToWorkspace <algm-RebinToWorkspace>`) the sample to +match the container, if the correction factors do not match you will be given +the option to interpolate (:ref:`SplineInterpolation +<algm-SplineInterpolation>`) the correction factor to match the sample. Options ~~~~~~~ @@ -651,12 +598,14 @@ Use Can either a reduced file (*_red.nxs*) or workspace (*_red*) or an :math:`S(Q, \omega)` file (*_sqw.nxs*) or workspace (*_sqw*). -Corrections File - The output file (_Abs.nxs) or workspace group (_Abs) generated by Calculate - Corrections. +Scale Can by factor + Allows the container intensity to be scaled by a given scale factor before + being used in the corrections calculation. -Verbose - Enables outputting additional information to the Results Log. +Use Corrections + The Paalman & Pings correction factors to use in the calculation, note that + the file or workspace name must end in either *_flt_abs* or *_cyl_abs* for the + flat plate and cylinder geometries respectively. Plot Output Gives the option to create either a spectra or contour plot (or both) of the @@ -666,4 +615,123 @@ Save Result If enabled the result will be saved as a NeXus file in the default save directory. +Absorption Corrections +---------------------- + +.. interface:: Data Analysis + :widget: tabAbsorptionCorrections + +The Absorption Corrections tab provides a cross platform alternative to the +previous Calculate and Apply Corrections tabs. + +Common Options +~~~~~~~~~~~~~~ + +Sample Input + Used to select the sample from either a file or a workspace already loaded + into Mantid. + +Use Container + Used to enable or disable use of a container and selects one from either a + file or loaded workspace. + +Shape + Select the shape of the sample (see specific geometry options below). + +Number Density + Number density for either the sample or container. + +Chemical Formula + Chemical formula for either the sample or container in the format expected by + :ref:`SetSampleMaterial <algm-SetSampleMaterial>`. + +Use Container Corrections + Enables full container corrections, if disabled only a can subtraction will be + performed. + +Scale + Scale factor to scale container input by. + +Keep Correction Factors + If checked a :ref:`WorkspaceGroup` containing the correction factors will also + be created, this will have the suffix *_Factors*. + +Plot Result + If checked the corrected workspace and correction factors will be plotted. + +Save Result + If checked the corrected workspace and (if *Keep Correction Factors* is + checked) the correction factor workspace will be saved as a NeXus file in the + default save directory. + +Flat Plate +~~~~~~~~~~ + +.. interface:: Data Analysis + :widget: pgAbsCorFlatPlate + +Flat plate calculations are provided by the +:ref:`IndirectFlatPlateAbsorption <algm-IndirectFlatPlateAbsorption>` algorithm. + +Sample Width + Width of the sample in :math:`cm`. + +Sample Height + Height of the sample in :math:`cm`. + +Sample Thickness + Thickness of the sample in :math:`cm`. + +Container Front Thickness + Thickness of the front of the container in :math:`cm`. + +Container Back Thickness + Thickness of the back of the container in :math:`cm`. + +Element Size + Size of the square "chunks" to divide the frontal area of the sample into to + calculate corrections in :math:`cm`. + +Annulus +~~~~~~~ + +.. interface:: Data Analysis + :widget: pgAbsCorAnnulus + +Annulus calculations are provided by the :ref:`IndirectAnnulusAbsorption +<algm-IndirectAnnulusAbsorption>` algorithm. + +Sample Inner Radius + Radius of the inner wall of the sample in :math:`cm`. + +Sample Outer Radius + Radius of the outer wall of the sample in :math:`cm`. + +Container Inner Radius + Radius of the inner wall of the container in :math:`cm`. + +Container Outer Radius + Radius of the outer wall of the container in :math:`cm`. + +Neutron Events + Number of events to use in the Monte Carlo simulation. + +Cylinder +~~~~~~~~ + +.. interface:: Data Analysis + :widget: pgAbsCorCylinder + +Cylinder calculations are provided by the +:ref:`IndirectCylinderAbsorption <algm-IndirectCylinderAbsorption>` algorithm. + +Sample Radius + Radius of the outer wall of the sample in :math:`cm`. + +Container Radius + Radius of the outer wall of the container in :math:`cm`. + +Neutron Events + Number of events to use in the Monte Carlo simulation. + .. categories:: Interfaces Indirect diff --git a/Code/Mantid/instrument/DNS_Definition_PAonly.xml b/Code/Mantid/instrument/DNS_Definition_PAonly.xml index b9949f4781afadaf90bf51091f12d43616b2b0cd..c34560606067404f7d69f1ccacc41a1f492441ea 100644 --- a/Code/Mantid/instrument/DNS_Definition_PAonly.xml +++ b/Code/Mantid/instrument/DNS_Definition_PAonly.xml @@ -1,6 +1,9 @@ <?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 name="DNS" valid-from="1900-01-31 23:59:59" valid-to="2100-01-31 23:59:59" last-modified="2015-03-25 10:17:17"> +<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="DNS" valid-from="1900-01-31 23:59:59" valid-to="2100-01-31 23:59:59" last-modified="2015-03-25 10:17:17"> <!-- Author: m.ganeva@fz-juelich.de --> <defaults> <length unit="meter" /> diff --git a/Code/Mantid/instrument/Facilities.xml b/Code/Mantid/instrument/Facilities.xml index 1213adaf37862f103db1ccae6db21105283eec1a..5c4f469095b5cc6957e616090be8e134d3b7838f 100644 --- a/Code/Mantid/instrument/Facilities.xml +++ b/Code/Mantid/instrument/Facilities.xml @@ -6,7 +6,7 @@ <archiveSearch plugin="ISISDataSearch" /> </archive> - <computeResource name="SCARF@STFC" JobManagerType="SCARFLSFJobManager"> + <computeResource name="SCARF@STFC" jobmanagertype="SCARFLSFJobManager"> <baseURL>https://portal.scarf.rl.ac.uk</baseURL> </computeResource> diff --git a/Code/Mantid/instrument/LARMOR_Parameters.xml b/Code/Mantid/instrument/LARMOR_Parameters.xml index 7d8452b19e2cddf0ce2ec8da034e230ae67f2147..269f48964a125ff254df06f2e4735dfcac7475c5 100644 --- a/Code/Mantid/instrument/LARMOR_Parameters.xml +++ b/Code/Mantid/instrument/LARMOR_Parameters.xml @@ -46,10 +46,32 @@ <parameter name="centre-finder-step-size"> -<!-- this is the initial step for the beam centre finder in metres --> +<!-- this is the initial step for the beam centre finder degrees (X value)--> +<!-- 5mm at 4m = 0.07deg --> + <value val="0.07"/> +</parameter> + +<parameter name="beam-centre-scale-factor1"> +<!-- This is a scale factor to allow the beam centre coordinates to be set in meaningful units (X value)--> +<!-- e.g. mm in the mask file means this should be 1000.0 --> +<!-- If no value is supplied then a default of 1000.0 is assumed for backward compatibility --> +<!-- For Larmor X is in degrees so does not need a multiplier --> + <value val="1000.0"/> +</parameter> + +<parameter name="centre-finder-step-size2"> +<!-- this is the second initial step for the beam centre finder if using angle and displacement (Y value)--> <value val="0.005"/> </parameter> +<parameter name="beam-centre-scale-factor2"> +<!-- This is a scale factor to allow the beam centre coordinates to be set in meaningful units (Y value)--> +<!-- e.g. mm in the mask file means this should be 1000.0 --> +<!-- If no value is supplied then a default of 1000.0 is assumed for backward compatibility --> +<!-- For Larmor Y is in mm --> + <value val="1000.0"/> +</parameter> + </component-link> </parameter-file> diff --git a/Code/Mantid/instrument/Schema/Facilities/1.0/FacilitiesSchema.xsd b/Code/Mantid/instrument/Schema/Facilities/1.0/FacilitiesSchema.xsd index bb7024143dc289e38f427f9e862a36d7db29fdc6..2063f26253244f8f76a772d5aa4957639fd807d8 100644 --- a/Code/Mantid/instrument/Schema/Facilities/1.0/FacilitiesSchema.xsd +++ b/Code/Mantid/instrument/Schema/Facilities/1.0/FacilitiesSchema.xsd @@ -27,7 +27,7 @@ <xs:element name="pythonExecutable" type="xs:string" /> </xs:choice> <xs:attribute name="name"/> - <xs:attribute name="type"/> + <xs:attribute name="jobmanagertype"/> </xs:complexType> </xs:element> <xs:element name="catalog"> diff --git a/Code/Mantid/scripts/Inelastic/IndirectDataAnalysis.py b/Code/Mantid/scripts/Inelastic/IndirectDataAnalysis.py index c258965efba5ec46a5ac556cd70b6135b829669d..a1d11b69033a13cadda975757e3775e6e857fbc1 100644 --- a/Code/Mantid/scripts/Inelastic/IndirectDataAnalysis.py +++ b/Code/Mantid/scripts/Inelastic/IndirectDataAnalysis.py @@ -288,7 +288,7 @@ def furyfitMult(inputWS, function, ftype, startx, endx, spec_min=0, spec_max=Non if Plot != 'None': furyfitPlotSeq(result_workspace, Plot) - EndTime('FuryFit Multi') + EndTime('TransformToIqtFit Multi') return result_workspace diff --git a/Code/Mantid/scripts/SANS/ISISCommandInterface.py b/Code/Mantid/scripts/SANS/ISISCommandInterface.py index b453bb6065b28543b8198a481c2e35285e5a2163..127cc5410f9793efc32eb66af44bf6a30f0c2379 100644 --- a/Code/Mantid/scripts/SANS/ISISCommandInterface.py +++ b/Code/Mantid/scripts/SANS/ISISCommandInterface.py @@ -316,9 +316,12 @@ def SetCentre(xcoord, ycoord, bank = 'rear'): Introduced #5942 """ _printMessage('SetCentre(' + str(xcoord) + ', ' + str(ycoord) + ')') + # use the scale factors from the parameter file to scale correctly + XSF = ReductionSingleton().inst.beam_centre_scale_factor1 + YSF = ReductionSingleton().inst.beam_centre_scale_factor2 ReductionSingleton().set_beam_finder(isis_reduction_steps.BaseBeamFinder(\ - float(xcoord)/1000.0, float(ycoord)/1000.0), bank) + float(xcoord)/XSF, float(ycoord)/YSF), bank) def GetMismatchedDetList(): """ @@ -561,56 +564,56 @@ def _fitRescaleAndShift(rAnds, frontData, rearData): Fit rear data to FRONTnew(Q) = ( FRONT(Q) + SHIFT )xRESCALE, FRONT(Q) is the frontData argument. Returns scale and shift - Note SHIFT is shift of a constant back, not the Shift parameter in - TabulatedFunction. - @param rAnds: A DetectorBank -> _RescaleAndShift structure @param frontData: Reduced front data @param rearData: Reduced rear data """ if rAnds.fitScale==False and rAnds.fitShift==False: return rAnds.scale, rAnds.shift - + #TODO: we should allow the user to add constraints? if rAnds.fitScale==False: if rAnds.qRangeUserSelected: Fit(InputWorkspace=rearData, Function='name=TabulatedFunction, Workspace="'+str(frontData)+'"' - +";name=FlatBackground", - Ties='f0.Scaling='+str(rAnds.scale)+',f0.Shift=0.0', + +";name=FlatBackground", Ties='f0.Scaling='+str(rAnds.scale), Output="__fitRescaleAndShift", StartX=rAnds.qMin, EndX=rAnds.qMax) else: Fit(InputWorkspace=rearData, Function='name=TabulatedFunction, Workspace="'+str(frontData)+'"' - +";name=FlatBackground", - Ties='f0.Scaling='+str(rAnds.scale)+',f0.Shift=0.0', + +";name=FlatBackground", Ties='f0.Scaling='+str(rAnds.scale), Output="__fitRescaleAndShift") elif rAnds.fitShift==False: if rAnds.qRangeUserSelected: + function_input = 'name=TabulatedFunction, Workspace="'+str(frontData)+'"' +";name=FlatBackground" + ties = 'f1.A0='+str(rAnds.shift*rAnds.scale) + logger.warning('function input ' + str(function_input)) + Fit(InputWorkspace=rearData, Function='name=TabulatedFunction, Workspace="'+str(frontData)+'"' - +";name=FlatBackground", - Ties='f1.A0='+str(rAnds.shift*rAnds.scale)+',f0.Shift=0.0', + +";name=FlatBackground", Ties='f1.A0='+str(rAnds.shift*rAnds.scale), Output="__fitRescaleAndShift", StartX=rAnds.qMin, EndX=rAnds.qMax) else: Fit(InputWorkspace=rearData, Function='name=TabulatedFunction, Workspace="'+str(frontData)+'"' - +";name=FlatBackground", - Ties='f1.A0='+str(rAnds.shift*rAnds.scale)+',f0.Shift=0.0', + +";name=FlatBackground", Ties='f1.A0='+str(rAnds.shift*rAnds.scale), Output="__fitRescaleAndShift") else: if rAnds.qRangeUserSelected: Fit(InputWorkspace=rearData, Function='name=TabulatedFunction, Workspace="'+str(frontData)+'"' - +";name=FlatBackground", Ties=',f0.Shift=0.0', + +";name=FlatBackground", Output="__fitRescaleAndShift", StartX=rAnds.qMin, EndX=rAnds.qMax) else: Fit(InputWorkspace=rearData, Function='name=TabulatedFunction, Workspace="'+str(frontData)+'"' - +";name=FlatBackground", Ties=',f0.Shift=0.0', Output="__fitRescaleAndShift") + +";name=FlatBackground",Output="__fitRescaleAndShift") param = mtd['__fitRescaleAndShift_Parameters'] - scale = param.row(0).items()[1][1] - chiSquared = param.row(3).items()[1][1] + row1 = param.row(0).items() + row2 = param.row(1).items() + row3 = param.row(2).items() + scale = row1[1][1] + chiSquared = row3[1][1] fitSuccess = True if not chiSquared > 0: @@ -623,7 +626,7 @@ def _fitRescaleAndShift(rAnds, frontData, rearData): if fitSuccess == False: return rAnds.scale, rAnds.shift - shift = param.row(2).items()[1][1] / scale + shift = row2[1][1] / scale delete_workspaces('__fitRescaleAndShift_Parameters') delete_workspaces('__fitRescaleAndShift_NormalisedCovarianceMatrix') @@ -823,7 +826,8 @@ def SetPhiLimit(phimin, phimax, use_mirror=True): #a beam centre of [0,0,0] makes sense if the detector has been moved such that beam centre is at [0,0,0] ReductionSingleton().mask.set_phi_limit(phimin, phimax, use_mirror) -def SetDetectorOffsets(bank, x, y, z, rot, radius, side): +def SetDetectorOffsets(bank, x, y, z, rot, radius, side, xtilt=0.0, ytilt=0.0 ): + # 10/03/15 RKH added 2 more parameters - xtilt & ytilt """ Adjust detector position away from position defined in IDF. On SANS2D the detector banks can be moved around. This method allows fine adjustments of detector bank position @@ -841,10 +845,12 @@ def SetDetectorOffsets(bank, x, y, z, rot, radius, side): @param rot: shift in degrees @param radius: shift in mm @param side: shift in mm + @param side: xtilt in degrees + @param side: ytilt in degrees """ _printMessage("SetDetectorOffsets(" + str(bank) + ', ' + str(x) + ','+str(y) + ',' + str(z) + ',' + str(rot) - + ',' + str(radius) + ',' + str(side) + ')') + + ',' + str(radius) + ',' + str(side) + ',' + str(xtilt)+ ',' + str(ytilt) +')') detector = ReductionSingleton().instrument.getDetector(bank) detector.x_corr = x @@ -853,7 +859,24 @@ def SetDetectorOffsets(bank, x, y, z, rot, radius, side): detector.rot_corr = rot detector.radius_corr = radius detector.side_corr = side + # 10/03/15 RKH add 2 more + detector.x_tilt = xtilt + detector.y_tilt = ytilt +def SetCorrectionFile(bank, filename): + # 10/03/15 RKH, create a new routine that allows change of "direct beam file" = correction file, for a given + # detector, this simplify the iterative process used to adjust it. Will still have to keep changing the name of the file + # for each iteratiom to avoid Mantid using a cached version, but can then use only a single user (=mask) file for each set of iterations. + # Modelled this on SetDetectorOffsets above ... + """ + @param bank: Must be either 'front' or 'rear' (not case sensitive) + @param filename: self explanatory + """ + _printMessage("SetCorrectionFile(" + str(bank) + ', ' + filename +')') + + detector = ReductionSingleton().instrument.getDetector(bank) + detector.correction_file = filename + def LimitsR(rmin, rmax, quiet=False, reducer=None): if reducer == None: reducer = ReductionSingleton().reference() @@ -1038,7 +1061,10 @@ def FindBeamCentre(rlow, rupp, MaxIter = 10, xstart = None, ystart = None, toler @return: the best guess for the beam centre point """ XSTEP = ReductionSingleton().inst.cen_find_step - YSTEP = ReductionSingleton().inst.cen_find_step + YSTEP = ReductionSingleton().inst.cen_find_step2 + + XSF = ReductionSingleton().inst.beam_centre_scale_factor1 + YSF = ReductionSingleton().inst.beam_centre_scale_factor2 original = ReductionSingleton().get_instrument().cur_detector_position(ReductionSingleton().get_sample().get_wksp_name()) @@ -1077,6 +1103,7 @@ def FindBeamCentre(rlow, rupp, MaxIter = 10, xstart = None, ystart = None, toler XNEW = xstart + XSTEP YNEW = ystart + YSTEP graph_handle = None + it = 0 for i in range(1, MaxIter+1): it = i @@ -1123,7 +1150,7 @@ def FindBeamCentre(rlow, rupp, MaxIter = 10, xstart = None, ystart = None, toler ReductionSingleton().set_beam_finder( isis_reduction_steps.BaseBeamFinder(XNEW, YNEW), det_bank) - centre.logger.notice("Centre coordinates updated: [" + str(XNEW)+ ", "+ str(YNEW) + ']') + centre.logger.notice("Centre coordinates updated: [" + str(XNEW*XSF) + ", " + str(YNEW*YSF) + ']') return XNEW, YNEW diff --git a/Code/Mantid/scripts/SANS/centre_finder.py b/Code/Mantid/scripts/SANS/centre_finder.py index a3f2e4ca4658fcde0f1f2e1ce244e11dcd9e063e..b179ee8328d451445d135384b4818756b3e47ab3 100644 --- a/Code/Mantid/scripts/SANS/centre_finder.py +++ b/Code/Mantid/scripts/SANS/centre_finder.py @@ -21,6 +21,8 @@ class CentreFinder(object): self.logger = Logger("CentreFinder") self._last_pos = guess_centre self.detector = None + self.XSF = 1.0 + self.YSF = 1.0 def SeekCentre(self, setup, trial): """ @@ -33,6 +35,10 @@ class CentreFinder(object): self.detector = setup.instrument.cur_detector().name() + # populate the x and y scale factor values at this point for the text box + self.XSF = setup.instrument.beam_centre_scale_factor1 + self.YSF = setup.instrument.beam_centre_scale_factor2 + self.move(setup, trial[0]-self._last_pos[0], trial[1]-self._last_pos[1]) #phi masking will remove areas of the detector that we need @@ -83,8 +89,9 @@ class CentreFinder(object): @param y_res: asymmetry in y @return: a human readable string """ - x_str = str(self._last_pos[0]*1000.).ljust(10)[0:9] - y_str = str(self._last_pos[1]*1000.).ljust(10)[0:9] + + x_str = str(self._last_pos[0] * self.XSF).ljust(10)[0:9] + y_str = str(self._last_pos[1] * self.YSF).ljust(10)[0:9] x_res = ' SX='+str(x_res).ljust(7)[0:6] y_res = ' SY='+str(y_res).ljust(7)[0:6] return 'Itr '+str(iter)+': ('+x_str+', '+y_str+')'+x_res+y_res diff --git a/Code/Mantid/scripts/SANS/isis_instrument.py b/Code/Mantid/scripts/SANS/isis_instrument.py index 743145fa0b79f6349c077742193b01cdf73872b2..088d87dd5f3481a27bb9cc82a476b8dc892dd9c0 100644 --- a/Code/Mantid/scripts/SANS/isis_instrument.py +++ b/Code/Mantid/scripts/SANS/isis_instrument.py @@ -10,6 +10,7 @@ import xml.dom.minidom from mantid.simpleapi import * from mantid.api import WorkspaceGroup, Workspace, ExperimentInfo from mantid.kernel import Logger +from mantid.kernel import V3D import SANSUtility as su sanslog = Logger("SANS") @@ -219,6 +220,9 @@ class DetectorBank(object): #23/3/12 RKH add 2 more variables self._radius_corr = 0.0 self._side_corr =0.0 + # 10/03/15 RKH add 2 more, valid for all detectors. WHY do some of the above have an extra leading underscore?? Seems they are the optional ones sorted below + self.x_tilt = 0.0 + self.y_tilt = 0.0 # hold rescale and shift object _RescaleAndShift self.rescaleAndShift = self._RescaleAndShift() @@ -427,8 +431,28 @@ class ISISInstrument(BaseInstrument): #the spectrum with this number is used to normalize the workspace data self._incid_monitor = int(self.definition.getNumberParameter( 'default-incident-monitor-spectrum')[0]) - self.cen_find_step = float(self.definition.getNumberParameter( - 'centre-finder-step-size')[0]) + self.cen_find_step = float(self.definition.getNumberParameter('centre-finder-step-size')[0]) + # see if a second step size is defined. If not set the second value to the first for compatibility + #logger.warning("Trying to find centre-finder-step-size2") + try: + self.cen_find_step2 = float(self.definition.getNumberParameter('centre-finder-step-size2')[0]) + except: + #logger.warning("Failed to find centre-finder-step-size2") + self.cen_find_step2 = self.cen_find_step + + logger.warning("Trying to find beam-centre-scale-factor1") + try: + self.beam_centre_scale_factor1 = float(self.definition.getNumberParameter('beam-centre-scale-factor1')[0]) + except: + logger.warning("Failed to find beam-centre-scale-factor1") + self.beam_centre_scale_factor1 = 1000.0 + + logger.warning("Trying to find beam-centre-scale-factor2") + try: + self.beam_centre_scale_factor2 = float(self.definition.getNumberParameter('beam-centre-scale-factor2')[0]) + except: + logger.warning("Failed to find beam-centre-scale-factor2") + self.beam_centre_scale_factor2 = 1000.0 firstDetect = DetectorBank(self.definition, 'low-angle') #firstDetect.disable_y_and_rot_corrs() @@ -463,6 +487,10 @@ class ISISInstrument(BaseInstrument): self.REAR_DET_Z = 0.0 self.REAR_DET_X = 0 + # LOG files for Larmor will have these encoder readings + # why are these not defined in Larmor + self.BENCH_ROT = 0.0 + #spectrum number of the monitor used to as the incidient in the transmission calculations self.default_trans_spec = int(self.definition.getNumberParameter( 'default-transmission-monitor-spectrum')[0]) @@ -896,7 +924,15 @@ class SANS2D(ISISInstrument): FRONT_DET_Z, FRONT_DET_X, FRONT_DET_ROT, REAR_DET_Z, REAR_DET_X = self.getDetValues(ws) # Deal with front detector - # 9/1/2 this all dates to Richard Heenan & Russell Taylor's original python development for SANS2d + # 10/03/15 RKH need to add tilt of detector, in degrees, with respect to the horizontal or vertical of the detector plane + # this time we can rotate about the detector's own axis so can use RotateInstrumentComponent, ytilt rotates about x axis, xtilt rotates about z axis + # + if frontDet.y_tilt != 0.0: + RotateInstrumentComponent(Workspace=ws,ComponentName= self.getDetector('front').name(), X = "1.", Y = "0.", Z = "0.", Angle = frontDet.y_tilt) + if frontDet.x_tilt != 0.0: + RotateInstrumentComponent(Workspace=ws,ComponentName= self.getDetector('front').name(), X = "0.", Y = "0.", Z = "1.", Angle = frontDet.x_tilt) + # + # 9/1/12 this all dates to Richard Heenan & Russell Taylor's original python development for SANS2d # the rotation axis on the SANS2d front detector is actually set front_det_radius = 306mm behind the detector. # Since RotateInstrumentComponent will only rotate about the centre of the detector, we have to to the rest here. # rotate front detector according to value in log file and correction value provided in user file @@ -925,6 +961,14 @@ class SANS2D(ISISInstrument): # deal with rear detector + # 10/03/15 RKH need to add tilt of detector, in degrees, with respect to the horizontal or vertical of the detector plane + # Best to do the tilts first, while the detector is still centred on the z axis, ytilt rotates about x axis, xtilt rotates about z axis + # NOTE the beam centre coordinates may change + if rearDet.y_tilt != 0.0: + RotateInstrumentComponent(Workspace=ws,ComponentName= rearDet.name(), X = "1.", Y = "0.", Z = "0.", Angle = rearDet.y_tilt) + if rearDet.x_tilt != 0.0: + RotateInstrumentComponent(Workspace=ws,ComponentName= rearDet.name(), X = "0.", Y = "0.", Z = "1.", Angle = rearDet.x_tilt) + xshift = -xbeam yshift = -ybeam zshift = (REAR_DET_Z + rearDet.z_corr)/1000. @@ -1140,10 +1184,16 @@ class SANS2D(ISISInstrument): class LARMOR(ISISInstrument): _NAME = 'LARMOR' - WAV_RANGE_MIN = 2.2 - WAV_RANGE_MAX = 10.0 + WAV_RANGE_MIN = 0.5 + WAV_RANGE_MAX = 13.5 def __init__(self): super(LARMOR,self).__init__('LARMOR_Definition.xml') + self._marked_dets = [] + # set to true once the detector positions have been moved to the locations given in the sample logs + self.corrections_applied = False + # a warning is issued if the can logs are not the same as the sample + self._can_logs = {} + self.monitor_names = dict() for i in range(1,6): @@ -1161,82 +1211,259 @@ class LARMOR(ISISInstrument): second.set_orien('Horizontal') second.place_after(first) - def move_components(self, ws, xbeam, ybeam): - self.move_all_components(ws) + def getDetValues(self, ws_name): + """ + Retrive the values of Bench_Rot from the workspace. If it does not find the value at the run info, + it takes as default value the self.BENCH_ROT, which are extracted from the sample workspace + at apply_detector_log. + This is done to allow the function move_components to use the correct values and not to use + all the values for TRANS ans SAMPLE the same, as sometimes, this assumption is not valid. + The reason for this method is explained at the ticket http://trac.mantidproject.org/mantid/ticket/7314. + """ + # set the default value for these variables + values = [self.BENCH_ROT] + # get these variables from the workspace run + run_info = mtd[str(ws_name)].run() + ind = 0 + name = 'Bench_Rot' + try: + var = run_info.get(name).value + if hasattr(var, '__iter__'): + var = var[-1] + values[ind] = float(var) + except: + pass # ignore, because we do have a default value + ind += 1 + #return these variables + return tuple(values) - detBanch = self.getDetector('rear') + def get_detector_log(self, wksp): + """ + Reads information about the state of the instrument on the information + stored in the sample + @param logs: a workspace pointer + @return the values that were read as a dictionary + """ + #logger.warning("Entering get_detector_log") + self._marked_dets = [] + wksp = su.getWorkspaceReference(wksp) + #assume complete log information is stored in the first entry, it isn't stored in the group workspace itself + if isinstance(wksp, WorkspaceGroup): + wksp = wksp[0] - xshift = -xbeam - yshift = -ybeam - #zshift = ( detBanch.z_corr)/1000. - #zshift -= self.REAR_DET_DEFAULT_SD_M - zshift = 0 - sanslog.notice("Setup move " + str(xshift*1000) + " " + str(yshift*1000) + " " + str(zshift*1000)) - MoveInstrumentComponent(ws, ComponentName=detBanch.name(), X=xshift, - Y=yshift, Z=zshift) - # beam centre, translation - return [0.0, 0.0], [-xbeam, -ybeam] + samp = wksp.getRun() - def cur_detector_position(self, ws_name): - """Return the position of the center of the detector bank""" - ws = mtd[ws_name] - pos = ws.getInstrument().getComponentByName(self.cur_detector().name()).getPos() + logvalues = {} + logvalues['Bench_Rot'] = self._get_const_num(samp, 'Bench_Rot') + #logger.warning(str(logvalues)) - return [-pos.getX(), -pos.getY()] + return logvalues + def _get_const_num(self, log_data, log_name): + """ + Get a the named entry from the log object. If the entry is a + time series it's assumed to contain unchanging data and the first + value is used. The answer must be convertible to float otherwise + this throws. + @param log_data: the sample object from a workspace + @param log_name: a string with the name of the individual entry to load + @return: the floating point number + @raise TypeError: if that log entry can't be converted to a float + """ + try: + # return the log value if it stored as a single number + return float(log_data.getLogData(log_name).value) + except TypeError: + # Python 2.4 doesn't have datetime.strptime... + def format_date(date_string, format, date_str_len): + if len(date_string)>date_str_len: + date_string = date_string[:date_str_len] + from datetime import datetime + if sys.version_info[0] == 2 and sys.version_info[1] < 5: + import time + return datetime(*(time.strptime(date_string, format)[0:6])) + else: + return datetime.strptime(date_string, format) -class LARMOR(ISISInstrument): - _NAME = 'LARMOR' - WAV_RANGE_MIN = 2.2 - WAV_RANGE_MAX = 10.0 - def __init__(self): - super(LARMOR,self).__init__('LARMOR_Definition.xml') - self.monitor_names = dict() + # if the value was stored as a time series we have an array here + property = log_data.getLogData(log_name) - for i in range(1,6): - self.monitor_names[i] = 'monitor'+str(i) + size = len(property.value) + if size == 1: + return float(log_data.getLogData(log_name).value[0]) - def set_up_for_run(self, base_runno): + start = log_data.getLogData('run_start') + dt_0 = format_date(start.value,"%Y-%m-%dT%H:%M:%S",19) + for i in range(0, size): + dt = format_date(str(property.times[i]),"%Y-%m-%dT%H:%M:%S",19) + if dt > dt_0: + if i == 0: + return float(log_data.getLogData(log_name).value[0]) + else: + return float(log_data.getLogData(log_name).value[i-1]) + + # this gets executed if all entries is before the start-time + return float(log_data.getLogData(log_name).value[size-1]) + + def apply_detector_logs(self, logvalues): + #apply the corrections that came from the logs + self.BENCH_ROT = float(logvalues['Bench_Rot']) + self.corrections_applied = True + if len(self._can_logs) > 0: + self.check_can_logs(self._can_logs) + + def check_can_logs(self, new_logs): """ - Needs to run whenever a sample is loaded + Tests if applying the corrections from the passed logvalues + would give the same result as the corrections that were + already made + @param new_logs: the new values to check are equivalent + @return: True if the are the same False if not """ - first = self.DETECTORS['low-angle'] - second = self.DETECTORS['high-angle'] + #logger.warning("Entering check_can_logs") - first.set_orien('Horizontal') - first.set_first_spec_num(10) - second.set_orien('Horizontal') - second.place_after(first) + if not self.corrections_applied: + #the check needs to wait until there's something to compare against + self._can_logs = new_logs + + if len(new_logs) == 0: + return False + + existing_values = [] + existing_values.append(self.BENCH_ROT) + + new_values = [] + new_values.append(float(new_logs['Bench_Rot'])) + + errors = 0 + corr_names = ['Bench_Rot'] + for i in range(0, len(existing_values)): + if math.fabs(existing_values[i] - new_values[i]) > 5e-04: + sanslog.warning('values differ between sample and can runs: Sample ' + corr_names[i] + ' = ' + str(existing_values[i]) + \ + ', can value is ' + str(new_values[i])) + errors += 1 + + self.append_marked(corr_names[i]) + + #the check has been done clear up + self._can_logs = {} + + return errors == 0 def move_components(self, ws, xbeam, ybeam): + #logger.warning("Entering move_components") self.move_all_components(ws) + #logger.warning("Back from move_all_components") - detBanch = self.getDetector('rear') + detBench = self.getDetector('rear') - xshift = -xbeam + # get the bench rotation value from the instrument log + BENCH_ROT = self.getDetValues(ws)[0] + + # use the scale factors from the parameter file to scale appropriately + XSF = self.beam_centre_scale_factor1 + YSF = self.beam_centre_scale_factor2 + + # in this case the x shift is actually a value of 2theta rotated about the sample stack centre + # so... we need to do two moves first a shift in y and then a rotation yshift = -ybeam #zshift = ( detBanch.z_corr)/1000. #zshift -= self.REAR_DET_DEFAULT_SD_M + xshift = 0 zshift = 0 - sanslog.notice("Setup move " + str(xshift*1000) + " " + str(yshift*1000) + " " + str(zshift*1000)) - MoveInstrumentComponent(ws, ComponentName=detBanch.name(), X=xshift, - Y=yshift, Z=zshift) + sanslog.notice("Setup move " + str(xshift*XSF) + " " + str(yshift*YSF) + " " + str(zshift*1000)) + MoveInstrumentComponent(ws, ComponentName=detBench.name(), X=xshift, Y=yshift, Z=zshift) + # in order to avoid rewriting old mask files from initial commisioning during 2014. + ws_ref=mtd[ws] + try: + run_num = ws_ref.getRun().getLogData('run_number').value + except: + run_num = int(re.findall(r'\d+',str(ws_name))[-1]) + + # The angle value + # Note that the x position gets converted from mm to m when read from the user file so we need to reverse this if X is now an angle + if(int(run_num) < 2217): + # Initial commisioning before run 2217 did not pay much attention to making sure the bench_rot value was meaningful + xshift = -xbeam + sanslog.notice("Setup move " + str(xshift*XSF) + " " + str(0.0) + " " + str(0.0)) + MoveInstrumentComponent(ws, ComponentName=detBench.name(), X=xshift, Y=0.0, Z=0.0) + else: + xshift = BENCH_ROT-xbeam*XSF + sanslog.notice("Setup move " + str(xshift*XSF) + " " + str(0.0) + " " + str(0.0)) + RotateInstrumentComponent(ws, ComponentName=detBench.name(), X=0, Y=1, Z=0, Angle=xshift) + #logger.warning("Back from RotateInstrumentComponent") + # beam centre, translation return [0.0, 0.0], [-xbeam, -ybeam] + def append_marked(self, detNames): + self._marked_dets.append(detNames) + + def get_marked_dets(self): + return self._marked_dets + def load_transmission_inst(self, ws_trans, ws_direct, beamcentre): """ - Not required for SANS2D + Larmor requires centralisation of the detectors of the transmission + as well as the sample and can. """ - pass + self.move_components(ws_trans, beamcentre[0], beamcentre[1]) + if ws_trans != ws_direct: + self.move_components(ws_direct, beamcentre[0], beamcentre[1]) def cur_detector_position(self, ws_name): """Return the position of the center of the detector bank""" + """Unforunately getting the angle of the bench does not work so we have to get bench and detector""" + + #logger.warning("Entering cur_detector_position") ws = mtd[ws_name] - pos = ws.getInstrument().getComponentByName(self.cur_detector().name()).getPos() + # define the vector along the beam axis + a1 = V3D(0,0,1) + # position of the detector itself + pos = ws.getInstrument().getComponentByName('LARMORSANSDetector').getPos() + # position of the bench + pos2 = ws.getInstrument().getComponentByName(self.cur_detector().name()).getPos() + # take the difference + posdiff = pos-pos2 + deg2rad = 4.0*math.atan(1.0)/180.0 + # now finally find the angle between the vector for the difference and the beam axis + angle = posdiff.angle(a1)/deg2rad + + # return the angle and the y displacement + #logger.warning("Blah: angle=" + str(angle) + " Y displacement=" +str(-pos2.getY()) ) + return [-angle, -pos2.getY()] - return [-pos.getX(), -pos.getY()] + def on_load_sample(self, ws_name, beamcentre, isSample): + """For Larmor in addition to the operations defined in on_load_sample of ISISInstrument + it has to deal with the log, which defines some offsets for the movement of the + detector bank. + """ + #logger.warning("Entering on_load_sample") + ws_ref = mtd[str(ws_name)] + # in order to avoid problems with files from initial commisioning during 2014. + # these didn't have the required log entries for the detector position + try: + run_num = ws_ref.getRun().getLogData('run_number').value + except: + run_num = int(re.findall(r'\d+',str(ws_name))[-1]) + if(int(run_num) >= 2217): + try: + #logger.warning("Trying get_detector_log") + log = self.get_detector_log(ws_ref) + if log == "": + raise "Invalid log" + except: + if isSample: + raise RuntimeError('Sample logs cannot be loaded, cannot continue') + else: + logger.warning("Can logs could not be loaded, using sample values.") + + if isSample: + self.apply_detector_logs(log) + else: + self.check_can_logs(log) + ISISInstrument.on_load_sample(self, ws_name, beamcentre, isSample) if __name__ == '__main__': pass diff --git a/Code/Mantid/scripts/SANS/isis_reducer.py b/Code/Mantid/scripts/SANS/isis_reducer.py index d22422c814008ebce2db02e81f23b520e081d81b..8b9195ee640a7dce0f32a1119cbd9efa08d64533 100644 --- a/Code/Mantid/scripts/SANS/isis_reducer.py +++ b/Code/Mantid/scripts/SANS/isis_reducer.py @@ -622,6 +622,18 @@ class ISISReducer(Reducer): else: return self._beam_finder.get_beam_center() + def get_beam_center_scale_factor1(self): + """ + Return the beam center scale factor 1 defined in the parameter file. + """ + return self.instrument.beam_centre_scale_factor1 + + def get_beam_center_scale_factor2(self): + """ + Return the beam center scale factor 2 defined in the parameter file. + """ + return self.instrument.beam_centre_scale_factor2 + def getCurrSliceLimit(self): if not self._slices_def: self._slices_def = su.sliceParser("") diff --git a/Code/Mantid/scripts/SANS/isis_reduction_steps.py b/Code/Mantid/scripts/SANS/isis_reduction_steps.py index 308d8e5e8ec0becac8cbb06ce0879eef0bb94e9a..65bf57953fed2fbf5700accf26ae28a7c81927c0 100644 --- a/Code/Mantid/scripts/SANS/isis_reduction_steps.py +++ b/Code/Mantid/scripts/SANS/isis_reduction_steps.py @@ -1533,9 +1533,9 @@ class CalculateNormISIS(object): """ detector = detector.upper() - if detector in ("FRONT","HAB","FRONT-DETECTOR-BANK"): + if detector in ("FRONT", "HAB", "FRONT-DETECTOR-BANK"): self._high_angle_pixel_file = filename - if detector in ("REAR","MAIN","","MAIN-DETECTOR-BANK"): + if detector in ("REAR", "MAIN", "", "MAIN-DETECTOR-BANK", "DETECTORBENCH"): self._low_angle_pixel_file = filename def getPixelCorrFile(self, detector ): @@ -1546,9 +1546,9 @@ class CalculateNormISIS(object): """ detector = detector.upper() - if detector in ("FRONT","HAB","FRONT-DETECTOR-BANK", "FRONT-DETECTOR"): + if detector in ("FRONT", "HAB", "FRONT-DETECTOR-BANK", "FRONT-DETECTOR"): return self._high_angle_pixel_file - elif detector in ("REAR","MAIN","MAIN-DETECTOR-BANK","", "REAR-DETECTOR"): + elif detector in ("REAR","MAIN", "MAIN-DETECTOR-BANK", "", "REAR-DETECTOR", "DETECTORBENCH"): return self._low_angle_pixel_file else : logger.warning("Request of pixel correction file with unknown detector ("+ str(detector)+")") @@ -1998,19 +1998,23 @@ class UserFile(ReductionStep): hab_str_pos = upper_line.find('HAB') x_pos = 0.0 y_pos = 0.0 + # use the scale factors supplied in the parameter file + XSF = reducer.inst.beam_centre_scale_factor1 + YSF = reducer.inst.beam_centre_scale_factor2 + if main_str_pos > 0: values = upper_line[main_str_pos+5:].split() #remov the SET CENTRE/MAIN - x_pos = float(values[0])/1000.0 - y_pos = float(values[1])/1000.0 + x_pos = float(values[0])/XSF + y_pos = float(values[1])/YSF elif hab_str_pos > 0: values = upper_line[hab_str_pos+4:].split() # remove the SET CENTRE/HAB print ' convert values ',values - x_pos = float(values[0])/1000.0 - y_pos = float(values[1])/1000.0 + x_pos = float(values[0])/XSF + y_pos = float(values[1])/YSF else: values = upper_line.split() - x_pos = float(values[2])/1000.0 - y_pos = float(values[3])/1000.0 + x_pos = float(values[2])/XSF + y_pos = float(values[3])/YSF if hab_str_pos > 0: print 'Front values = ',x_pos,y_pos reducer.set_beam_finder(BaseBeamFinder(x_pos, y_pos),'front') @@ -2085,7 +2089,7 @@ class UserFile(ReductionStep): else: _issueWarning('FIT/MONITOR line specific to LOQ instrument. Line ignored') - elif upper_line == 'SANS2D' or upper_line == 'LOQ': + elif upper_line == 'SANS2D' or upper_line == 'LOQ' or upper_line == 'LARMOR': self._check_instrument(upper_line, reducer) elif upper_line.startswith('PRINT '): @@ -2338,6 +2342,11 @@ class UserFile(ReductionStep): detector.radius_corr = shift elif det_axis == 'SIDE': detector.side_corr = shift + # 10/03/15 RKH add 2 more variables + elif det_axis == 'XTILT': + detector.x_tilt = shift + elif det_axis == 'YTILT': + detector.y_tilt = shift else: raise NotImplemented('Detector correction on "'+det_axis+'" is not supported')