16const DateAndTime UNSET_TIME(DateAndTime::GPS_EPOCH);
74 if (std::find(values.cbegin(), values.cend(),
true) == values.cend()) {
78 filterOpenEnded =
false;
95 auto filter2 = std::unique_ptr<TimeSeriesProperty<bool>>(
filter.
clone());
97 TimeInterval time1 = filter1->nthInterval(filter1->size() - 1);
98 TimeInterval time2 = filter2->nthInterval(filter2->size() - 1);
100 if (time1.start() < time2.
start()) {
101 filter1->addValue(time2.
start(),
104 }
else if (time2.
start() < time1.start()) {
105 filter2->addValue(time1.start(),
true);
123 if (filterOpenEnded) {
126 timeroi.
addROI(
m_filter->lastTime(), DateAndTime(
"2100-Jan-01 00:00:01"));
133 m_prop->filterWith(timeroi);
135 const auto mysize =
m_prop->size();
136 const auto penultimate_interval =
m_prop->nthInterval(mysize - 2);
137 const auto ultimate_interval =
m_prop->nthInterval(mysize - 1);
138 const auto oldEnd = ultimate_interval.stop();
139 const auto newEnd = ultimate_interval.start() + penultimate_interval.length();
142 timeroi.
addMask(newEnd, ultimate_interval.stop());
143 else if (newEnd > oldEnd)
144 timeroi.
addROI(oldEnd, newEnd);
151 m_prop->filterWith(timeroi);
167template <
typename SrcType>
struct ConvertToTimeSeriesDouble {
173 auto pmap = srcTypeSeries->valueAsMap();
174 for (
auto it =
pmap.begin(); it !=
pmap.end(); ++it) {
175 converted->addValue(it->first,
double(it->second));
190 if (
auto doubleSeries = ConvertToTimeSeriesDouble<double>::apply(prop)) {
192 }
else if (
auto doubleSeries = ConvertToTimeSeriesDouble<int>::apply(prop)) {
194 }
else if (
auto doubleSeries = ConvertToTimeSeriesDouble<bool>::apply(prop)) {
197 throw std::invalid_argument(
"LogFilter::convertToTimeSeriesOfDouble - Cannot convert property, \"" + prop->
name() +
198 "\", to double series.");
204 std::vector<bool> values;
205 std::vector<DateAndTime> times;
207 values.emplace_back(
true);
208 values.emplace_back(
false);
209 times.emplace_back(splitter.start());
210 times.emplace_back(splitter.stop());
213 if (filterOpenEnded) {
220 m_filter = std::make_unique<TimeSeriesProperty<bool>>(
"filter");
222 m_filter->replaceValues(times, values);
Templated class that defines a filtered time series but still gives access to the original data.
std::unique_ptr< FilteredTimeSeriesProperty< double > > m_prop
Owned pointer to the filtered property.
void clear()
Clears filters.
const TimeSeriesProperty< bool > * filter() const
Returns a reference to the filter.
void addFilter(const TimeSeriesProperty< bool > &filter)
Adds a filter using boolean AND.
FilteredTimeSeriesProperty< double > * convertToTimeSeriesOfDouble(const Property *prop)
Converts the given property to a TimeSeriesProperty<double>, throws if invalid.
std::unique_ptr< TimeSeriesProperty< bool > > m_filter
Owned pointer to the filter mask.
LogFilter()=delete
Disable default constructor.
void setFilter(const TimeROI &roi, const bool filterOpenEnded)
Base class for properties.
const std::string & name() const
Get the property's name.
Represents a time interval.
const Types::Core::DateAndTime & start() const
Beginning of the interval.
TimeROI : Object that holds information about when the time measurement was active.
void addMask(const std::string &startTime, const std::string &stopTime)
const std::vector< Kernel::TimeInterval > toTimeIntervals() const
This method is to lend itself to helping with transition.
void addROI(const std::string &startTime, const std::string &stopTime)
void update_intersection(const TimeROI &other)
Updates the TimeROI values with the intersection with another TimeROI.
A specialised Property class for holding a series of time-value pairs.
TimeSeriesProperty< TYPE > * clone() const override
"Virtual" copy constructor
int size() const override
Returns the number of values at UNIQUE time intervals in the time series.
std::vector< TYPE > valuesAsVector() const
Return the time series's values (unfiltered) as a vector<TYPE>
Types::Core::DateAndTime firstTime() const
Returns the first time regardless of filter.
TYPE lastValue() const
Returns the last value.
Generate a tableworkspace to store the calibration results.