diff --git a/Framework/Algorithms/test/WorkspaceCreationHelperTest.h b/Framework/Algorithms/test/WorkspaceCreationHelperTest.h index 1d49687056595c5d7f41fcedf705e619b5300671..8b5ed46efbb65c7a11cbe665505ed348f8513ef8 100644 --- a/Framework/Algorithms/test/WorkspaceCreationHelperTest.h +++ b/Framework/Algorithms/test/WorkspaceCreationHelperTest.h @@ -50,6 +50,20 @@ public: 1, 2, false, std::set<int64_t>(), false); TS_ASSERT(!ws2->hasDx(0)); } + + void test_create2DWorkspace123WithMaskedBin() { + int numHist = 3; + int numBins = 4; + // mask bin at workspace index 0, bin 1 + Workspace2D_sptr ws = + WorkspaceCreationHelper::create2DWorkspace123WithMaskedBin( + numHist, numBins, 0, 1); + TS_ASSERT(ws); + TS_ASSERT_EQUALS(ws->getNumberHistograms(), numHist); + TS_ASSERT_EQUALS(ws->blocksize(), numBins); + TS_ASSERT_EQUALS(ws->hasMaskedBins(0), true); + TS_ASSERT_EQUALS(ws->hasMaskedBins(1), false); + } }; #endif /* MANTID_ALGORITHMS_WORKSPACECREATIONHELPERTEST_H_ */ diff --git a/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp b/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp index a5dfe28bbbb36409deb997fc7484c1240b716888..bd57c037ee9ed1937809b62ae31c9ae0fd036299 100644 --- a/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp +++ b/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp @@ -41,6 +41,7 @@ BOOST_PYTHON_FUNCTION_OVERLOADS(makeFakeMDHistoWorkspace_overloads, BOOST_PYTHON_FUNCTION_OVERLOADS( create2DWorkspaceWithRectangularInstrument_overloads, create2DWorkspaceWithRectangularInstrument, 3, 3) + GNU_DIAG_ON("conversion") GNU_DIAG_ON("unused-local-typedef") @@ -56,6 +57,7 @@ BOOST_PYTHON_MODULE(WorkspaceCreationHelper) { // Function pointers to disambiguate the calls using Signature1_2D = Workspace2D_sptr (*)(int, int, bool, bool); using Signature2_2D = Workspace2D_sptr (*)(int, int, int); + using Signature3_2D = Workspace2D_sptr (*)(int, int, int, int); def("create2DWorkspaceWithFullInstrument", reinterpret_cast<Signature1_2D>(&create2DWorkspaceWithFullInstrument), @@ -65,6 +67,9 @@ BOOST_PYTHON_MODULE(WorkspaceCreationHelper) { (Signature2_2D)&create2DWorkspaceWithRectangularInstrument, create2DWorkspaceWithRectangularInstrument_overloads()); + def("create2DWorkspace123WithMaskedBin", + reinterpret_cast<Signature3_2D>(&create2DWorkspace123WithMaskedBin)); + //=================================== Event Workspaces //=================================== diff --git a/Framework/TestHelpers/inc/MantidTestHelpers/WorkspaceCreationHelper.h b/Framework/TestHelpers/inc/MantidTestHelpers/WorkspaceCreationHelper.h index 49ffdb60feff03b295515fdc738660e3dad5c1ef..aa751d315634de0848603d8395167edfd3ec8773 100644 --- a/Framework/TestHelpers/inc/MantidTestHelpers/WorkspaceCreationHelper.h +++ b/Framework/TestHelpers/inc/MantidTestHelpers/WorkspaceCreationHelper.h @@ -271,6 +271,9 @@ Mantid::DataObjects::Workspace2D_sptr create2DWorkspaceThetaVsTOF(int nHist, Mantid::DataObjects::Workspace2D_sptr create2DWorkspaceWithRectangularInstrument(int numBanks, int numPixels, int numBins); +Mantid::DataObjects::Workspace2D_sptr +create2DWorkspace123WithMaskedBin(int numHist, int numBins, + int maskedWorkspaceIndex, int maskedBinIndex); /** Create an Eventworkspace with an instrument that contains * RectangularDetector's */ diff --git a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp index b0e962e69aed9ed295f4cd10c4a0049e13d8bb4d..0010da478d8d423e91e76c409eb12fbf52b89875 100644 --- a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp +++ b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp @@ -1542,4 +1542,10 @@ createEPPTableWorkspace(const std::vector<EPPTableRow> &rows) { } return ws; } +Mantid::DataObjects::Workspace2D_sptr +create2DWorkspace123WithMaskedBin(int numHist, int numBins, int maskedWorkspaceIndex, int maskedBinIndex) { + auto &ws = create2DWorkspace123(numHist, numBins); + ws->flagMasked(maskedWorkspaceIndex, maskedBinIndex); + return ws; +} } // namespace WorkspaceCreationHelper