14#include <boost/algorithm/string/classification.hpp>
15#include <boost/algorithm/string/split.hpp>
16#include <boost/lexical_cast.hpp>
41 return "Removes instrument geometry records from a given workspace.";
49 "An input workspace.");
51 "An output workspace.");
53 "For MD workspaces, the ExperimentInfo indices to have the instrument removed."
54 "If empty, the instrument will be removed from all ExperimentInfo objects."
55 "The parameter is ignored for any other workspace type.");
65 if (outputWS != inputWS) {
66 outputWS = inputWS->clone();
73 if (outputMtrxWS !=
nullptr) {
74 outputMtrxWS->setInstrument(emptyInstrument);
77 if (outputMDWS !=
nullptr) {
79 std::vector<int> indicesToRemoveInstrument = this->
getProperty(
"MDExperimentInfoNumbers");
81 if (indicesToRemoveInstrument.empty()) {
82 indicesToRemoveInstrument.resize(outputMDWS->getNumExperimentInfo());
83 std::iota(indicesToRemoveInstrument.begin(), indicesToRemoveInstrument.end(), 0);
86 for (uint16_t i = 0; i < indicesToRemoveInstrument.size(); i++) {
87 auto ei = outputMDWS->getExperimentInfo(
static_cast<uint16_t
>(indicesToRemoveInstrument[i]));
88 ei->setInstrument(emptyInstrument);
91 throw std::invalid_argument(
"Wrong type of input workspace");
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
A property class for workspaces.
RemoveInstrumentGeometry :
void exec() override
Execute the algorithm.
int version() const override
Algorithm's version for identification.
const std::string summary() const override
Algorithm's summary for use in the GUI and help.
void init() override
Initialize the algorithm's properties.
const std::string category() const override
Algorithm's category for identification.
Support for a property that holds an array of values.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
std::shared_ptr< const Workspace > Workspace_const_sptr
shared pointer to Mantid::API::Workspace (const version)
std::shared_ptr< MultipleExperimentInfos > MultipleExperimentInfos_sptr
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< Instrument > Instrument_sptr
Shared pointer to an instrument object.
Helper class which provides the Collimation Length for SANS instruments.
Describes the direction (within an algorithm) of a Property.
@ Input
An input workspace.
@ Output
An output workspace.