44 event_A = MDEventsTestHelper::makeMDEW<2>(3, 0.0, 10.0, 1);
45 event_B = MDEventsTestHelper::makeMDEW<2>(3, 0.0, 10.0, 1);
47 AnalysisDataService::Instance().addOrReplace(
"histo_A", histo_A);
48 AnalysisDataService::Instance().addOrReplace(
"histo_B", histo_B);
49 AnalysisDataService::Instance().addOrReplace(
"histo_masked", histo_masked);
50 AnalysisDataService::Instance().addOrReplace(
"histo_zero", histo_zero);
51 AnalysisDataService::Instance().addOrReplace(
"event_A", event_A);
52 AnalysisDataService::Instance().addOrReplace(
"event_B", event_B);
53 AnalysisDataService::Instance().addOrReplace(
"scalar", scalar);
55 FrameworkManager::Instance().exec(
"MaskMD", 6,
"Workspace",
"histo_masked",
"Dimensions",
"x,y",
"Extents",
61 const std::string &outName,
bool succeeds,
const std::string &otherProp,
62 const std::string &otherPropValue) {
65 auto alg = AlgorithmManager::Instance().create(algoName);
67 alg->setPropertyValue(
"LHSWorkspace", lhs);
68 alg->setPropertyValue(
"RHSWorkspace",
rhs);
69 alg->setPropertyValue(
"OutputWorkspace", outName);
70 if (!otherProp.empty())
71 alg->setPropertyValue(otherProp, otherPropValue);
74 if (!alg->isExecuted())
75 throw std::runtime_error(
"Algorithm " + algoName +
" did not succeed.");
76 IMDWorkspace_sptr out = std::dynamic_pointer_cast<IMDWorkspace>(AnalysisDataService::Instance().retrieve(outName));
78 throw std::runtime_error(
"Algorithm " + algoName +
" did not create the output workspace.");
79 return std::dynamic_pointer_cast<MDHistoWorkspace>(out);
81 if (alg->isExecuted())
82 throw std::runtime_error(
"Algorithm " + algoName +
" did not fail as expected.");
92 bool succeeds,
const std::string &otherProp,
const std::string &otherPropValue) {
96 AnalysisDataService::Instance().addOrReplace(
"histo", histo);
97 AnalysisDataService::Instance().addOrReplace(
"event", event);
98 AnalysisDataService::Instance().addOrReplace(
"scalar", scalar);
100 auto alg = AlgorithmManager::Instance().create(algoName);
102 alg->setPropertyValue(
"InputWorkspace", inName);
103 alg->setPropertyValue(
"OutputWorkspace", outName);
104 if (!otherProp.empty())
105 alg->setPropertyValue(otherProp, otherPropValue);
108 if (!alg->isExecuted())
109 throw std::runtime_error(
"Algorithm " + algoName +
" did not succeed.");
110 IMDWorkspace_sptr out = std::dynamic_pointer_cast<IMDWorkspace>(AnalysisDataService::Instance().retrieve(outName));
112 throw std::runtime_error(
"Algorithm " + algoName +
" did not create the output workspace.");
113 return std::dynamic_pointer_cast<MDHistoWorkspace>(out);
115 if (alg->isExecuted())
116 throw std::runtime_error(
"Algorithm " + algoName +
" did not fail as expected.");
const std::vector< double > & rhs
DLLExport Mantid::DataObjects::MDHistoWorkspace_sptr doTest(const std::string &algoName, const std::string &lhs, const std::string &rhs, const std::string &outName, bool succeeds=true, const std::string &otherProp="", const std::string &otherPropValue="")
Run a binary algorithm.
void setUpBinaryOperationMDTestHelper()
std::shared_ptr< IMDEventWorkspace > IMDEventWorkspace_sptr
Shared pointer to Mantid::API::IMDEventWorkspace.
std::shared_ptr< IMDWorkspace > IMDWorkspace_sptr
Shared pointer to the IMDWorkspace base class.
static MatrixWorkspace_sptr createWorkspaceSingleValue(const double &rhsValue)
Creates a temporary single value workspace the error is set to zero.
MDHistoWorkspace_sptr makeFakeMDHistoWorkspace(double signal, size_t numDims, size_t numBins=10, coord_t max=10.0, double errorSquared=1.0, const std::string &name="", double numEvents=1.0)
Make a fake n-dimensional MDHistoWorkspace.
std::shared_ptr< WorkspaceSingleValue > WorkspaceSingleValue_sptr
shared pointer to the WorkspaceSingleValue class
std::shared_ptr< MDHistoWorkspace > MDHistoWorkspace_sptr
A shared pointer to a MDHistoWorkspace.
Helper class which provides the Collimation Length for SANS instruments.
DLLExport Mantid::DataObjects::MDHistoWorkspace_sptr doTest(const std::string &algoName, const std::string &inName, const std::string &outName, bool succeeds=true, const std::string &otherProp="", const std::string &otherPropValue="")
Run a unary algorithm.