35using namespace Kernel;
37using namespace DataObjects;
47 const std::vector<std::string> exts{
".nxs",
".nx5",
".xml",
".n*"};
49 "The name of the Nexus file to read, as a full or relative path.");
52 "The name of the workspace to be created as the output of "
53 "the algorithm. A workspace of this name will be created "
54 "and stored in the Analysis Data Service. For multiperiod "
55 "files, one workspace will be generated for each period.");
58 auto mustBePositive = std::make_shared<BoundedValidator<int>>();
59 mustBePositive->setLower(0);
60 declareProperty(
"SpectrumMin", 1, mustBePositive,
"Number of first spectrum to read, only for single period data.");
62 "Number of last spectrum to read, only for single period data.");
64 "List of spectrum numbers to read, only for single period data.");
67 "0 indicates that every entry is loaded, into a separate "
68 "workspace within a group. "
69 "A positive number identifies one entry to be loaded, into "
86 std::vector<std::string> entryName, definition;
91 }
else if (
count == 0) {
97 }
else if (entryName[0] ==
"mantid_workspace_1") {
99 }
else if (entryName[0] ==
"raw_data_1") {
117 loadMuonNexus->setPropertyValue(
"Filename",
m_filename);
119 std::string outputWorkspace =
"OutputWorkspace";
120 loadMuonNexus->setPropertyValue(outputWorkspace,
m_workspace);
121 loadMuonNexus->setPropertyValue(
"DeadTimeTable",
m_workspace +
"_DeadTimeTable");
122 loadMuonNexus->setPropertyValue(
"DetectorGroupingTable",
m_workspace +
"DetectorGroupingTable");
123 loadMuonNexus->setPropertyValue(
"TimeZeroTable",
m_workspace +
"TimeZeroTable");
127 std::vector<int> specList =
getProperty(
"SpectrumList");
128 if (!specList.empty())
129 loadMuonNexus->setPropertyValue(
"SpectrumList",
getPropertyValue(
"SpectrumList"));
133 loadMuonNexus->setPropertyValue(
"SpectrumMax",
getPropertyValue(
"SpectrumMax"));
134 loadMuonNexus->setPropertyValue(
"SpectrumMin",
getPropertyValue(
"SpectrumMin"));
136 loadMuonNexus->setPropertyValue(
"EntryNumber",
getPropertyValue(
"EntryNumber"));
141 loadMuonNexus->execute();
147 if (!loadMuonNexus->isExecuted())
148 g_log.
error(
"Unable to successfully run LoadMuonNexus2 Child Algorithm");
156 loadNexusPro->setPropertyValue(
"Filename",
m_filename);
158 loadNexusPro->setPropertyValue(
"OutputWorkspace",
m_workspace);
160 loadNexusPro->setPropertyValue(
"SpectrumMin",
getPropertyValue(
"SpectrumMin"));
161 loadNexusPro->setPropertyValue(
"SpectrumMax",
getPropertyValue(
"SpectrumMax"));
162 loadNexusPro->setPropertyValue(
"SpectrumList",
getPropertyValue(
"SpectrumList"));
167 loadNexusPro->setPropertyValue(
"EntryNumber",
getPropertyValue(
"EntryNumber"));
169 loadNexusPro->execute();
170 if (!loadNexusPro->isExecuted())
171 g_log.
error(
"Unable to successfully run LoadNexusProcessed Child Algorithm");
179 loadNexusPro->setPropertyValue(
"Filename",
m_filename);
181 std::string outputWorkspace =
"OutputWorkspace";
182 loadNexusPro->setPropertyValue(outputWorkspace,
m_workspace);
185 std::vector<int> specList =
getProperty(
"SpectrumList");
186 if (!specList.empty())
187 loadNexusPro->setPropertyValue(
"SpectrumList",
getPropertyValue(
"SpectrumList"));
191 loadNexusPro->setPropertyValue(
"SpectrumMax",
getPropertyValue(
"SpectrumMax"));
192 loadNexusPro->setPropertyValue(
"SpectrumMin",
getPropertyValue(
"SpectrumMin"));
194 loadNexusPro->setPropertyValue(
"EntryNumber",
getPropertyValue(
"EntryNumber"));
196 loadNexusPro->execute();
198 if (!loadNexusPro->isExecuted())
199 g_log.
error(
"Unable to successfully run LoadISISNexus Child Algorithm");
207 loadNexusPro->setPropertyValue(
"Filename",
m_filename);
209 std::string outputWorkspace =
"OutputWorkspace";
210 loadNexusPro->setPropertyValue(outputWorkspace,
m_workspace);
213 std::vector<int> specList =
getProperty(
"SpectrumList");
214 if (!specList.empty())
215 loadNexusPro->setPropertyValue(
"SpectrumList",
getPropertyValue(
"SpectrumList"));
219 loadNexusPro->setPropertyValue(
"SpectrumMax",
getPropertyValue(
"SpectrumMax"));
220 loadNexusPro->setPropertyValue(
"SpectrumMin",
getPropertyValue(
"SpectrumMin"));
225 loadNexusPro->execute();
226 }
catch (std::runtime_error &) {
227 g_log.
error(
"Unable to successfully run LoadTOFRawNexus Child Algorithm");
229 if (!loadNexusPro->isExecuted())
230 g_log.
error(
"Unable to successfully run LoadTOFRawNexus Child Algorithm");
243 const std::vector<Property *> &loaderProps = loader->getProperties();
244 const size_t count = loader->propertyCount();
245 for (
size_t i = 0; i <
count; ++i) {
248 const std::string &
name = prop->
name();
#define DECLARE_ALGORITHM(classname)
Base class from which all concrete algorithm classes should be derived.
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
bool existsProperty(const std::string &name) const override
Checks whether the named property is already in the list of managed property.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
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.
@ Load
allowed here which will be passed to the algorithm
An interface that is implemented by WorkspaceProperty.
A property class for workspaces.
std::string m_filename
The name and path of the input file.
void exec() override
Overwrites Algorithm method.
void runLoadIsisNexus()
run LoadIsisNexus
void runLoadNexusProcessed()
run LoadNexusProcessed
void runLoadTOFRawNexus()
run LoadTOFRawNexus
std::string m_workspace
The name of the output workspace.
LoadNexus()
Default constructor.
static const std::string muonTD
void setOutputWorkspace(const API::IAlgorithm_sptr &loader)
set the output workspaces from the child algorithms
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
void runLoadMuonNexus()
run LoadMuonNexus
void init() override
Overwrites Algorithm method.
static const std::string pulsedTD
Support for a property that holds an array of values.
Records the filename and the description of failure.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void error(const std::string &msg)
Logs at error level.
Base class for properties.
unsigned int direction() const
returns the direction of the property
const std::string & name() const
Get the property's name.
std::vector< NXClassInfo > & groups() const
Returns a list of all classes (or groups) in this NXClass.
NXChar openNXChar(const std::string &name) const
Creates and opens a char dataset.
Templated class implementation of NXDataSet.
Implements NXentry Nexus class.
Implements NXroot Nexus class.
NXEntry openEntry(const std::string &name)
Opens an entry – a topmost Nexus class.
std::shared_ptr< IAlgorithm > IAlgorithm_sptr
shared pointer to Mantid::API::IAlgorithm
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
MANTID_NEXUS_DLL int getNexusEntryTypes(const std::string &fileName, std::vector< std::string > &entryName, std::vector< std::string > &definition)
Get all the Nexus entry types for a file.
constexpr int EMPTY_INT() noexcept
Returns what we consider an "empty" integer within a property.
@ Output
An output workspace.