32 return "Extracts unmasked spectra from a workspace and places them in a new "
43 "An optional mask workspace.");
45 "An output workspace.");
59 if (maskedWorkspace) {
60 if (std::dynamic_pointer_cast<API::IMaskWorkspace>(maskedWorkspace)) {
61 mask = maskedWorkspace;
64 extractMask->setProperty(
"InputWorkspace", maskedWorkspace);
65 extractMask->executeAsChildAlg();
66 mask = extractMask->getProperty(
"OutputWorkspace");
70 extractMask->setProperty(
"InputWorkspace", inputWorkspace);
71 extractMask->executeAsChildAlg();
72 mask = extractMask->getProperty(
"OutputWorkspace");
75 std::vector<size_t> indicesToExtract;
76 auto nSpectra = inputWorkspace->getNumberHistograms();
81 if (mask->readY(
index)[0] < 1.0) {
82 indicesToExtract.emplace_back(
index);
88 extractSpectra->setProperty(
"InputWorkspace", inputWorkspace);
89 extractSpectra->setProperty(
"WorkspaceIndexList", indicesToExtract);
90 extractSpectra->executeAsChildAlg();
#define DECLARE_ALGORITHM(classname)
std::map< DeltaEMode::Type, std::string > index
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.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
A property class for workspaces.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Describes the direction (within an algorithm) of a Property.
@ Input
An input workspace.
@ Output
An output workspace.