19using std::stringstream;
24using Types::Core::DateAndTime;
40 "The name to use for the output workspace");
41 this->
declareProperty(
"LogName",
"",
"Name of the log to add the offset to");
43 "Number of seconds (a float) to add to the time of each log value. "
51 if (logname.empty()) {
52 throw std::runtime_error(
"Failed to supply a LogName");
62 msg <<
"InputWorkspace \'" << this->
getPropertyValue(
"InputWorkspace") <<
"\' does not have LogName \'" << logname
64 throw std::runtime_error(msg.str());
69 newlog->setUnits(oldlog->units());
70 int size = oldlog->realSize();
71 vector<double> values = oldlog->valuesAsVector();
72 vector<DateAndTime> times = oldlog->timesAsVector();
73 for (
int i = 0; i < size; i++) {
74 newlog->addValue(times[i] + offset, values[i]);
79 if (outputWS != inputWS) {
81 duplicate->initialize();
82 duplicate->setProperty<
Workspace_sptr>(
"InputWorkspace", std::dynamic_pointer_cast<Workspace>(inputWS));
85 outputWS = std::dynamic_pointer_cast<MatrixWorkspace>(temp);
90 outputWS->mutableRun().addProperty(newlog,
true);
#define DECLARE_ALGORITHM(classname)
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.
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.
void exec() override
Run the algorithm.
int version() const override
Algorithm's version for identification.
const std::string name() const override
Algorithm's name for identification.
void init() override
Initialise the properties.
const std::string category() const override
Algorithm's category for identification.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
The concrete, templated class for properties.
A specialised Property class for holding a series of time-value pairs.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
@ Input
An input workspace.
@ Output
An output workspace.