23 "Workspace to have logs merged");
25 "The name of the first log to be merged.");
27 "The name of the second log to be merged.");
29 "The name of the new log as the result "
30 "of log 1 being merged with log 2.");
31 declareProperty(
"ResetLogValue",
false,
"Reset both logs' values to unity for each one.");
32 declareProperty(
"LogValue1", 0.0,
"Unity value of log 1.");
33 declareProperty(
"LogValue2", 1.0,
"Unity value of log 2.");
41 std::string
const logName = this->
getProperty(propertyName);
45 ws->run().getTimeSeriesProperty<
double>(logName);
46 }
catch (std::invalid_argument &) {
47 return "Must be a TimeSeriesProperty";
50 return "TimeSeriesLog must exist.";
58 std::map<std::string, std::string> issues;
59 std::string
const mlogname = this->
getProperty(
"MergedLogName");
60 std::string
const logName1 = this->
getProperty(
"LogName1");
61 std::string
const logName2 = this->
getProperty(
"LogName2");
63 if ((mlogname == logName1) || (mlogname == logName2) || ws->run().hasProperty(mlogname))
64 issues[
"MergedLogName"] =
"TimeSeriesLog name must be unique.";
66 std::string
const &issueLog1 = this->
validateTSP(
"LogName1");
67 if (!issueLog1.empty())
68 issues[
"LogName1"] = issueLog1;
69 std::string
const &issueLog2 = this->
validateTSP(
"LogName2");
70 if (!issueLog2.empty())
71 issues[
"LogName2"] = issueLog2;
78 const std::string log1name = this->
getProperty(
"LogName1");
79 const std::string log2name = this->
getProperty(
"LogName2");
80 const std::string mlogname = this->
getProperty(
"MergedLogName");
81 const bool resetlogvalue = this->
getProperty(
"ResetLogValue");
84 std::unique_ptr<TimeSeriesProperty<double>> mlog1(log1->
clone());
85 std::unique_ptr<TimeSeriesProperty<double>> mlog2(log2->
clone());
86 mlog1->setName(mlogname);
87 mlog2->setName(mlogname);
89 const double logvalue1 = this->
getProperty(
"LogValue1");
90 const double logvalue2 = this->
getProperty(
"LogValue2");
91 const std::vector<double> logvector1(mlog1->size(), logvalue1);
92 const std::vector<double> logvector2(mlog2->size(), logvalue2);
96 mlog1->merge(mlog2.get());
97 ws->mutableRun().addProperty(std::move(mlog1));
#define DECLARE_ALGORITHM(classname)
Kernel::Property * getPointerToProperty(const std::string &name) const override
Get a property by name.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
bool isDefault(const std::string &name) const
A property class for workspaces.
std::map< std::string, std::string > validateInputs() override
Cross-check properties with each other.
std::string validateTSP(std::string const &propertyName)
Helper to validate the TimeSeriesProperty.
void exec() override
Virtual method - must be overridden by concrete algorithm.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
Validator to check that a property is not left empty.
A specialised Property class for holding a series of time-value pairs.
TimeSeriesProperty< TYPE > * clone() const override
"Virtual" copy constructor
std::vector< Types::Core::DateAndTime > timesAsVector() const override
Return the time series's times as a vector<DateAndTime>
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
@ InOut
Both an input & output workspace.