diff --git a/Code/Mantid/Framework/MDAlgorithms/src/BinMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/BinMD.cpp index ee3fe19deeca6bcdf0c39b82adfd8ef57295f01f..418ef2789c7d9a2313f2aff7063094c83fb46981 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/BinMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/BinMD.cpp @@ -410,11 +410,15 @@ void BinMD::exec() { CALL_MDEVENT_FUNCTION(this->binByIterating, m_inWS); - // Copy the experiment infos to the output + // Copy the + + // Copy the coordinate system & experiment infos to the output IMDEventWorkspace_sptr inEWS = boost::dynamic_pointer_cast<IMDEventWorkspace>(m_inWS); - if (inEWS) + if (inEWS) { + outWS->setCoordinateSystem(inEWS->getSpecialCoordinateSystem()); outWS->copyExperimentInfos(*inEWS); + } outWS->updateSum(); // Save the output diff --git a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/SimulateResolutionConvolvedModel.cpp b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/SimulateResolutionConvolvedModel.cpp index f9ec66937c51c87e60150eee2c2bd54ce01fed42..e7582e636b6d0023894a13a6cafa9d3ea8cd32ec 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/Quantification/SimulateResolutionConvolvedModel.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/Quantification/SimulateResolutionConvolvedModel.cpp @@ -176,6 +176,8 @@ void SimulateResolutionConvolvedModel::createOutputWorkspace() { } // Run information m_outputWS->copyExperimentInfos(*m_inputWS); + // Coordinates + m_outputWS->setCoordinateSystem(m_inputWS->getSpecialCoordinateSystem()); m_outputWS->initialize(); m_outputWS->splitBox(); // Make grid box diff --git a/Code/Mantid/Framework/MDAlgorithms/src/SliceMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/SliceMD.cpp index ac2348eadb8fc05f39e4afaa2007c5921ff393e2..f59e3e3feb2b3652bee30a9a800cc786d3ce348a 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/SliceMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/SliceMD.cpp @@ -122,8 +122,10 @@ void SliceMD::slice(typename MDEventWorkspace<MDE, nd>::sptr ws) { // Create the ouput workspace typename MDEventWorkspace<OMDE, ond>::sptr outWS( new MDEventWorkspace<OMDE, ond>()); - for (size_t od = 0; od < m_binDimensions.size(); od++) + for (size_t od = 0; od < m_binDimensions.size(); od++) { outWS->addDimension(m_binDimensions[od]); + } + outWS->setCoordinateSystem(ws->getSpecialCoordinateSystem()); outWS->initialize(); // Copy settings from the original box controller BoxController_sptr bc = ws->getBoxController(); diff --git a/Code/Mantid/Framework/MDAlgorithms/test/BinMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/BinMDTest.h index 5200dc777f76e0ea2b4291231ac4e92d968df588..c23b7c04e4c7bb3577691bf7a7d243d2537a08ba 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/BinMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/BinMDTest.h @@ -137,8 +137,10 @@ public: TS_ASSERT( alg.isInitialized() ) IMDEventWorkspace_sptr in_ws = MDEventsTestHelper::makeMDEW<3>(10, 0.0, 10.0, numEventsPerBox); - in_ws->addExperimentInfo(ExperimentInfo_sptr(new ExperimentInfo)); + Mantid::Kernel::SpecialCoordinateSystem appliedCoord = Mantid::Kernel::QSample; + in_ws->setCoordinateSystem(appliedCoord); AnalysisDataService::Instance().addOrReplace("BinMDTest_ws", in_ws); + // 1000 boxes with 1 event each TS_ASSERT_EQUALS( in_ws->getNPoints(), 1000*numEventsPerBox); @@ -161,6 +163,7 @@ public: TS_ASSERT(out); if(!out) return; + TS_ASSERT_EQUALS(appliedCoord, out->getSpecialCoordinateSystem()); // Took 6x6x6 bins in the middle of the box TS_ASSERT_EQUALS(out->getNPoints(), expected_numBins); // Every box has a single event summed into it, so 1.0 weight diff --git a/Code/Mantid/Framework/MDAlgorithms/test/MergeMDFilesTest.h b/Code/Mantid/Framework/MDAlgorithms/test/MergeMDFilesTest.h index 3ecbe17b97b7d4048fb06facfd79cd232f6691f8..e4e4d932672d69ada816168c75b9cfe0d5a8c5d8 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/MergeMDFilesTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/MergeMDFilesTest.h @@ -48,6 +48,7 @@ public: // Create a bunch of input files std::vector<std::vector<std::string> > filenames; + Mantid::Kernel::SpecialCoordinateSystem appliedCoord = Mantid::Kernel::QSample; std::vector<MDEventWorkspace3Lean::sptr> inWorkspaces; // how many events put into each file. long nFileEvents(1000); @@ -55,7 +56,9 @@ public: { std::ostringstream mess; mess << "MergeMDFilesTestInput" << i; - MDEventWorkspace3Lean::sptr ws = MDEventsTestHelper::makeFileBackedMDEW(mess.str(), true,-nFileEvents); + MDEventWorkspace3Lean::sptr ws = + MDEventsTestHelper::makeFileBackedMDEW(mess.str(), true,-nFileEvents, appliedCoord); + inWorkspaces.push_back(ws); filenames.push_back(std::vector<std::string>(1,ws->getBoxController()->getFilename())); } @@ -87,6 +90,7 @@ public: TS_ASSERT(ws); if (!ws) return; + TS_ASSERT_EQUALS(appliedCoord, ws->getSpecialCoordinateSystem()); TS_ASSERT_EQUALS( ws->getNPoints(), 3*nFileEvents); MDBoxBase3Lean * box = ws->getBox(); TS_ASSERT_EQUALS( box->getNumChildren(), 1000); diff --git a/Code/Mantid/Framework/MDAlgorithms/test/SliceMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/SliceMDTest.h index f031322ce1dce76176cfc9d890ae886f4f63d96c..a02607812cd8f5fb7ff57d99bd67a527f2747267 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/SliceMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/SliceMDTest.h @@ -137,6 +137,8 @@ public: TS_ASSERT( alg.isInitialized() ) IMDEventWorkspace_sptr in_ws = MDEventsTestHelper::makeAnyMDEW<MDE,nd>(10, 0.0, 10.0, 1); + Mantid::Kernel::SpecialCoordinateSystem appliedCoord = Mantid::Kernel::QSample; + in_ws->setCoordinateSystem(appliedCoord); AnalysisDataService::Instance().addOrReplace("SliceMDTest_ws", in_ws); TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("InputWorkspace", "SliceMDTest_ws") ); @@ -166,6 +168,8 @@ public: TSM_ASSERT_EQUALS("Should default to TakeMaxRecursionDepthFromInput == true", in_ws->getBoxController()->getMaxDepth(), out->getBoxController()->getMaxDepth()); + TS_ASSERT_EQUALS(appliedCoord, out->getSpecialCoordinateSystem()); + // Took this many events out with the slice TS_ASSERT_EQUALS(out->getNPoints(), expectedNumPoints); // Output has this number of dimensions diff --git a/Code/Mantid/Framework/MDEvents/src/FitMD.cpp b/Code/Mantid/Framework/MDEvents/src/FitMD.cpp index e398bee85440879542788b6ddba14790a211b12c..dbb17e2e1f4f7fafb929f36525899a2a4fc49959 100644 --- a/Code/Mantid/Framework/MDEvents/src/FitMD.cpp +++ b/Code/Mantid/Framework/MDEvents/src/FitMD.cpp @@ -211,6 +211,8 @@ boost::shared_ptr<API::Workspace> FitMD::createEventOutputWorkspace( // Run information outputWS->copyExperimentInfos(inputWorkspace); + // Coordinates + outputWS->setCoordinateSystem(inputWorkspace.getSpecialCoordinateSystem()); // Set sensible defaults for splitting behaviour BoxController_sptr bc = outputWS->getBoxController(); bc->setSplitInto(3); diff --git a/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/MDEventsTestHelper.h b/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/MDEventsTestHelper.h index 602776597d710b18448930039d26f8a3cd4e0dd7..f8a69de9bc935c4dbc9c5d2d8eb30a4c3b164dea 100644 --- a/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/MDEventsTestHelper.h +++ b/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/MDEventsTestHelper.h @@ -47,7 +47,8 @@ createDiffractionEventWorkspace(int numEvents, int numPixels = 400, * @return MDEW sptr */ Mantid::MDEvents::MDEventWorkspace3Lean::sptr -makeFileBackedMDEW(std::string wsName, bool fileBacked, long numEvents = 10000); +makeFileBackedMDEW(std::string wsName, bool fileBacked, long numEvents = 10000, + Kernel::SpecialCoordinateSystem coord = Kernel::None); /// Make a fake n-dimensional MDHistoWorkspace Mantid::MDEvents::MDHistoWorkspace_sptr diff --git a/Code/Mantid/Framework/TestHelpers/src/MDEventsTestHelper.cpp b/Code/Mantid/Framework/TestHelpers/src/MDEventsTestHelper.cpp index 22950faaa81aac46ed6da35937b2e1fca03e3b9b..6fa5be11b7fcf19742f7bfd2dfcb6770dc9845be 100644 --- a/Code/Mantid/Framework/TestHelpers/src/MDEventsTestHelper.cpp +++ b/Code/Mantid/Framework/TestHelpers/src/MDEventsTestHelper.cpp @@ -128,11 +128,13 @@ createDiffractionEventWorkspace(int numEvents, int numPixels, int numBins) { * @return MDEW sptr */ MDEventWorkspace3Lean::sptr -makeFileBackedMDEW(std::string wsName, bool fileBacked, long numEvents) { +makeFileBackedMDEW(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->setCoordinateSystem(coord); ws1->getBoxController()->setSplitThreshold(100); Mantid::API::AnalysisDataService::Instance().addOrReplace( wsName, boost::dynamic_pointer_cast<Mantid::API::IMDEventWorkspace>(ws1));