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"
11
12#include <cstddef>
13
14namespace Mantid {
15using namespace Types::Core;
16namespace Kernel {
17
18class SplittingInterval;
19
24template <typename HeldType> class MANTID_KERNEL_DLL FilteredTimeSeriesProperty : public TimeSeriesProperty<HeldType> {
25
26public:
27 explicit FilteredTimeSeriesProperty(const std::string &name);
30 FilteredTimeSeriesProperty(const std::string &name, const std::vector<Types::Core::DateAndTime> &times,
31 const std::vector<HeldType> &values);
32
34
37 FilteredTimeSeriesProperty(std::unique_ptr<const TimeSeriesProperty<HeldType>> seriesProp,
38 const TimeSeriesProperty<bool> &filterProp);
40 FilteredTimeSeriesProperty<HeldType> *clone() const override;
41
43
46
49
51 std::vector<HeldType> filteredValuesAsVector(const Kernel::TimeROI *roi) const override;
52 // overload method rather than default value so python bindings work
53 std::vector<HeldType> filteredValuesAsVector() const override;
55 std::vector<Types::Core::DateAndTime> filteredTimesAsVector(const Kernel::TimeROI *roi) const override;
56 // overload method rather than default value so python bindings work
57 std::vector<Types::Core::DateAndTime> filteredTimesAsVector() const override;
58
60 TimeInterval nthInterval(int n) const override;
62 HeldType nthValue(int n) const override;
63 Types::Core::DateAndTime nthTime(int n) const override;
64
67 void filterWith(const TimeSeriesProperty<bool> *filter);
70 void filterWith(const TimeROI &filter);
72 void clearFilter() const;
73 // Returns whether the time series has been filtered
74 bool isFiltered() const override { return m_filterApplied; }
75
76 int size() const override;
77
79 const TimeSeriesProperty<HeldType> *unfiltered() const;
80
82 std::vector<Mantid::Kernel::TimeInterval> getTimeIntervals() const override;
83
84 const Kernel::TimeROI &getTimeROI() const;
85 double timeAverageValue(const TimeROI *timeRoi = nullptr) const override;
86
87 bool operator==(const TimeSeriesProperty<HeldType> &right) const override;
88 bool operator==(const Property &right) const override;
89
90private:
92 void applyFilter() const;
94 void countSize() const;
96 void clearFilterCache() const;
97
99 std::string setValueFromProperty(const Property &right) override;
100
101 TimeROI *intersectFilterWithOther(const TimeROI *other) const;
102
104 mutable std::unique_ptr<TimeROI> m_filter;
106 mutable std::vector<size_t> m_filterMap;
108 mutable std::vector<TimeInterval> m_filterIntervals;
110 mutable bool m_filterApplied;
111};
112
113} // namespace Kernel
114} // namespace Mantid
std::string name
Definition Run.cpp:60
double right
boost::python::list getTimeIntervals(const TimeROI &self)
Definition TimeROI.cpp:19
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:95
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.
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)