18void toLower(std::string &name) {
19 std::transform(name.begin(), name.end(), name.begin(), [](
unsigned char c) { return std::tolower(c); });
28using namespace Kernel;
29using API::FileProperty;
30using API::MatrixWorkspace;
33using API::WorkspaceProperty;
44 "The name of the workspace to which the log data will be added.");
46 "The filename (including its full or relative path) of the "
70 localWorkspace->mutableSample().setName(nxload.
getSampleName());
72 std::set<std::string> logNames;
73 auto logs = localWorkspace->mutableRun().getLogData();
75 for (
auto log : logs) {
76 std::string
name = log->name();
78 logNames.insert(
name);
97 toLower(logNameLower);
99 if (logNames.find(logNameLower) != logNames.end()) {
101 " is already in the nexus file. The sample log names are "
102 "case insensitive.");
105 logNames.insert(newLogName);
106 auto l_PropertyDouble = std::make_unique<TimeSeriesProperty<double>>(newLogName);
107 auto l_PropertyString = std::make_unique<TimeSeriesProperty<std::string>>(newLogName);
111 std::string logValue;
115 l_PropertyString->addValue(logTime, logValue);
123 l_PropertyDouble->addValue(logTime, logValue);
130 localWorkspace->mutableRun().addLogData(std::move(l_PropertyDouble));
132 localWorkspace->mutableRun().addLogData(std::move(l_PropertyString));
141 std::transform(strToConvert.begin(), strToConvert.end(), strToConvert.begin(), ::tolower);
151 if (str.size() >= 19)
152 if (str.compare(4, 1,
"-") == 0 && str.compare(7, 1,
"-") == 0 && str.compare(13, 1,
":") == 0 &&
153 str.compare(16, 1,
":") == 0 && str.compare(10, 1,
"T") == 0)
#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.
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.
@ Load
allowed here which will be passed to the algorithm
Helper class for reporting progress from algorithms.
A property class for workspaces.
std::string m_filename
The name and path of an input file.
void init() override
Overwrites Algorithm method.
LoadMuonLog()
Default constructor.
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
bool isDateTimeString(const std::string &str)
check if first 19 characters of a string is data-time string according to yyyy-mm-ddThh:mm:ss
void exec() override
Overwrites Algorithm method.
void addLogValueFromIndex(MuonNexusReader &nxload, const int &index, API::MatrixWorkspace_sptr &localWorkspace, std::set< std::string > &logNames)
Adds a log to the workspace.
std::string stringToLower(std::string strToConvert)
convert string to lower case
void warning(const std::string &msg)
Logs at warning level.
void report()
Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
MuunNexusReader opens a Nexus file and reads certain fields expected for a ISIS Muon data file (old f...
int numberOfLogs() const
Number of NXlog sections read from file.
std::string logUnits(const int i) const
void readLogData(const std::string &filename)
read log data
std::string getSampleName() const
int getLogLength(const int i) const
Lenght of i'th log.
bool logTypeNumeric(const int i) const
true if i'th log is of numeric type
void getLogValues(const int &logNumber, const int &logSequence, std::time_t &logTime, double &value)
get logSequence pair of logNumber log
std::string getLogName(const int i) const
Name of i'th log.
void getLogStringValues(const int &logNumber, const int &logSequence, std::time_t &logTime, std::string &value)
get logSequence pair of logNumber string log
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< Workspace2D > Workspace2D_sptr
shared pointer to Mantid::DataObjects::Workspace2D
MANTID_KERNEL_DLL std::string toLower(const std::string &input)
Converts string to all lowercase.
@ InOut
Both an input & output workspace.