Mantid
Loading...
Searching...
No Matches
FilteredTimeSeriesProperty.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2012 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
9#include "MantidKernel/DllConfig.h"
10#include "MantidKernel/System.h"
12
13namespace Mantid {
14using namespace Types::Core;
15namespace Kernel {
16
17class SplittingInterval;
18
23template <typename HeldType> class DLLExport FilteredTimeSeriesProperty : public TimeSeriesProperty<HeldType> {
24
25public:
26 explicit FilteredTimeSeriesProperty(const std::string &name);
29 FilteredTimeSeriesProperty(const std::string &name, const std::vector<Types::Core::DateAndTime> &times,
30 const std::vector<HeldType> &values);
31
33
36 FilteredTimeSeriesProperty(std::unique_ptr<const TimeSeriesProperty<HeldType>> seriesProp,
37 const TimeSeriesProperty<bool> &filterProp);
39 FilteredTimeSeriesProperty<HeldType> *clone() const override;
40
42
45
48
50 std::vector<HeldType> filteredValuesAsVector(const Kernel::TimeROI *roi) const override;
51 // overload method rather than default value so python bindings work
52 std::vector<HeldType> filteredValuesAsVector() const override;
54 std::vector<Types::Core::DateAndTime> filteredTimesAsVector(const Kernel::TimeROI *roi) const override;
55 // overload method rather than default value so python bindings work
56 std::vector<Types::Core::DateAndTime> filteredTimesAsVector() const override;
57
59 TimeInterval nthInterval(int n) const override;
61 HeldType nthValue(int n) const override;
62 Types::Core::DateAndTime nthTime(int n) const override;
63
66 void filterWith(const TimeSeriesProperty<bool> *filter);
69 void filterWith(const TimeROI &filter);
71 void clearFilter() const;
72 // Returns whether the time series has been filtered
73 bool isFiltered() const override { return m_filterApplied; }
74
75 int size() const override;
76
78 const TimeSeriesProperty<HeldType> *unfiltered() const;
79
81 std::vector<Mantid::Kernel::TimeInterval> getTimeIntervals() const override;
82
83 const Kernel::TimeROI &getTimeROI() const;
84 double timeAverageValue(const TimeROI *timeRoi = nullptr) const override;
85
86 bool operator==(const TimeSeriesProperty<HeldType> &right) const override;
87 bool operator==(const Property &right) const override;
88
89private:
91 void applyFilter() const;
93 void countSize() const;
95 void clearFilterCache() const;
96
98 std::string setValueFromProperty(const Property &right) override;
99
100 TimeROI *intersectFilterWithOther(const TimeROI *other) const;
101
103 mutable std::unique_ptr<TimeROI> m_filter;
105 mutable std::vector<size_t> m_filterMap;
107 mutable std::vector<TimeInterval> m_filterIntervals;
109 mutable bool m_filterApplied;
110};
111
112} // namespace Kernel
113} // namespace Mantid
std::string name
Definition Run.cpp:60
double right
MANTID_NEXUS_DLL bool operator==(std::string const &s, Mantid::Nexus::NexusAddress const &p)
boost::python::list getTimeIntervals(const TimeROI &self)
Definition TimeROI.cpp:19
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
Definition System.h:37
Templated class that defines a filtered time series but still gives access to the original data.
std::unique_ptr< TimeROI > m_filter
The filter.
std::vector< size_t > m_filterMap
Maps the index supplied to nthValue and nthInterval to values in m_value.
FilteredTimeSeriesProperty()=delete
Disable default constructor.
std::vector< TimeInterval > m_filterIntervals
Cached values for the time intervals inside the filter.
bool m_filterApplied
True if a filter has been applied.
~FilteredTimeSeriesProperty() override
Destructor.
Base class for properties.
Definition Property.h:94
Represents a time interval.
Definition DateAndTime.h:25
TimeROI : Object that holds information about when the time measurement was active.
Definition TimeROI.h:18
A specialised Property class for holding a series of time-value pairs.
Helper class which provides the Collimation Length for SANS instruments.