This class implements a statistical filter that uses 'windowed' averages. There are several statistical filters implemented as classes. These classes are templates; the template parameter should be a float (probably double); it is used to construct gnsstk::Stats<T>, gnsstk::TwoSampleStats<T> and gnsstk::SeqStats<T>, which are fundamental to these algorithms. All the filters look for outliers and discontinuities (slips) in a timeseries. The first difference filter analyses the simple first difference of the data. The window filter uses a 2-pane sliding window centered on the data point in question; statistics on the data in each to the 2 panes are computed and used in the analysis. The window filter uses 1- and 2-sample statistics in Stats.hpp, along with a wrapper class (StatsFilterBase, this module) that provides a single interface for the two statistics, allowing WindowFilter::filter() to use either type of filter interchangably. Two-sample stats are used when an xdata array ("time") is given along with the data array; this is appropriate for data that has systematic "time" dependence. One-sample stats are used when the data is ~constant; in this case the xdata can be given as well but will be used only in dump(). All the filters have a getStats(FilterHit) function that computes statistics on the filter quantities (NOT the data) over the interval covered by the event, and stores them in the FilterHit. These stats are slightly different for the two filters; WindowFilter::getStats computes min, max, median and mad of sigma = rms(sig of future and past), but not including points within one width of the endpoints (avoids the bump in sigma due to slip(s) at the segment boundaries).
The structure of these filters allows the caller to call filters repeatedly, and to call different filters, on the same dataset, because none of the filters modify the data array(s) in any way. The arrays are passed as constant references to the constructor. The xdata reference must be provided, but it may be empty (except for the window filter if two sample statistics are to be used). If xdata is not empty, values of xdata are included in the dump() output. Similarly, an integer vector of flags is also passed to the constructor (also as a const reference), and it may be empty. If it is not empty, flag[i] != 0 causes the data at index i to be ignored by the filters. The arrays data, xdata and flags must always be parallel, and xdata and flags cannot be shorter than data unless they are empty (when they are ignored). The filter() function has optional input of the starting index and the number of points to process, so that segments of the data (and xdata and flags) array(s) can be processed in the filters. These features allow the user to, for example, call a filter, mark data in the flags array (e.g. outliers) and then filter again. If a slip is found, the caller can then filter the data again but starting at the slip, or filter only the segment of data before the slip [using filter(index, npts)]. NB the caller must construct a new filter at each call - if you declare a Filter object, run filter(), then use the results to modify flags[] and try to call filter() again, it does not see the changes to flags[]. Instead you need to call the constructor again.
Definition in file WindowFilter.hpp.