Mantid
Loading...
Searching...
No Matches
ChangeTimeZero.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
10#include "MantidAlgorithms/DllConfig.h"
14#include <memory>
15
16namespace Mantid {
17namespace Algorithms {
18
19class MANTID_ALGORITHMS_DLL ChangeTimeZero final : public API::Algorithm {
20public:
22 const std::string name() const override { return "ChangeTimeZero"; };
24 const std::string summary() const override { return "The algorithm adjusts the zero time of a workspace."; }
26 std::map<std::string, std::string> validateInputs() override;
27
29 int version() const override { return 1; };
31 const std::string category() const override { return "Utility\\Workspaces"; }
32
33private:
35 void init() override;
37 void exec() override;
39 Mantid::API::MatrixWorkspace_sptr createOutputWS(const Mantid::API::MatrixWorkspace_sptr &input, double startProgress,
40 double stopProgress);
42 double getTimeShift(const API::MatrixWorkspace_sptr &ws) const;
44 void shiftTimeOfLogs(const Mantid::API::MatrixWorkspace_sptr &ws, double timeShift, double startProgress,
45 double stopProgress);
47 Mantid::Types::Core::DateAndTime getStartTimeFromWorkspace(const Mantid::API::MatrixWorkspace_sptr &ws) const;
49 bool checkForDouble(const std::string &val) const;
51 bool checkForDateTime(const std::string &val) const;
52
54 void shiftTimeInLogForTimeSeries(const Mantid::API::MatrixWorkspace_sptr &ws, Mantid::Kernel::Property *prop,
55 double timeShift) const;
57 void shiftTimeOfLogForStringProperty(Mantid::Kernel::PropertyWithValue<std::string> *logEntry,
58 double timeShift) const;
59 // Shift the time of the neutrons
60 void shiftTimeOfNeutrons(const Mantid::API::MatrixWorkspace_sptr &ws, double timeShift, double startProgress,
61 double stopProgress);
62
63 bool isRelativeTimeShift(double offset) const;
64 bool isAbsoluteTimeShift(const std::string &offset) const;
65
66 const double m_defaultTimeShift = 0.0;
67 const std::string m_defaultAbsoluteTimeShift;
68};
69
70} // namespace Algorithms
71} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
const std::string summary() const override
Summary of algorithms purpose.
int version() const override
Algorithm's version for identification.
const std::string name() const override
Algorithm's name for identification.
const std::string m_defaultAbsoluteTimeShift
const std::string category() const override
Algorithm's category for identification.
The concrete, templated class for properties.
Base class for properties.
Definition: Property.h:94
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.