32 if (!descriptor.isAscii())
35 auto &file = descriptor.data();
38 size_t axiscols(0), datacols(0);
41 const std::string sep =
" ";
44 while (std::getline(file, str)) {
47 if (str.empty() || str ==
"\r")
53 if (str.at(0) ==
'#') {
54 if (str.at(1) ==
'L') {
55 axiscols = tok.
count();
64 datacols = tok.
count();
67 }
catch (std::out_of_range &) {
70 if (snsspec && datacols == 3)
77using namespace Kernel;
88 const std::vector<std::string> exts{
".dat",
".txt"};
90 "The name of the text file to read, including its full or "
91 "relative path. The file extension must be .txt or .dat.");
93 "The name of the workspace that will be created, filled with the read-in "
94 "data and stored in the [[Analysis Data Service]].");
97 declareProperty(
"Unit",
"Energy", std::make_shared<Kernel::StringListValidator>(units),
98 "The unit to assign to the X axis (anything known to the "
99 "[[Unit Factory]] or \"Dimensionless\") (default: Energy)");
105 alg->setPropertyValue(
"OutputWorkspace",
getPropertyValue(
"OutputWorkspace"));
#define DECLARE_FILELOADER_ALGORITHM(classname)
DECLARE_FILELOADER_ALGORITHM should be used in place of the standard DECLARE_ALGORITHM macro when wri...
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
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.
Class for marking algorithms as deprecated.
void deprecatedDate(const std::string &)
The date the algorithm was deprecated on.
void useAlgorithm(const std::string &, const int version=-1)
The algorithm to use instead of this one.
@ Load
allowed here which will be passed to the algorithm
A property class for workspaces.
Loads a workspace from an SNS spec file.
LoadSNSspec()
Empty constructor.
void exec() override
Virtual method - must be overridden by concrete algorithm.
void init() override
Initialisation method.
Defines a wrapper around an open file.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
@ TOK_IGNORE_EMPTY
ignore empty tokens
std::size_t count() const
Get the total number of tokens.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
@ Output
An output workspace.