Classes | Public Member Functions | Public Attributes | Private Attributes | List of all members
gnsstk::WindowFilter< T > Class Template Reference

Detailed Description

template<class T>
class gnsstk::WindowFilter< T >

This class computes statistics in a sliding window with two equal halves, 'past' and 'future', at each point in the input data array(s). The objective is to detect discontinuities or "slips" and compute statistics on the data between slips. This class will read the data, apply the window filter, generating statistics that are stored, then analyze the statistics, returning a vector of simple results, and optionally dump all the data, analysis information and results.

Definition at line 302 of file WindowFilter.hpp.

#include <WindowFilter.hpp>

Classes

class  Analysis
 class used to store analysis arrays filled by the window filters. More...
 

Public Member Functions

int analyze ()
 
void dump (std::ostream &s, std::string tag=std::string())
 
int filter (const size_t index=0, int npts=-1)
 
int getBufferSize ()
 
bool getDebug ()
 
int getHalfWidth ()
 
getMinMargin ()
 
getMinRatio ()
 
getMinStep ()
 
getPFFrac ()
 
std::vector< FilterHit< T > > getResults ()
 get results vector of FilterHit More...
 
void getStats (FilterHit< T > &fe, bool noedge=true)
 
int getWidth ()
 
bool isBalanced ()
 
bool isFullWindows ()
 
bool isOneSample ()
 
bool isTwoSample ()
 
void reset ()
 
void setBalanced (bool b)
 
void setBufferSize (int b)
 
void setDebug (bool b)
 debug prints in analysis() More...
 
void setDumpAnalMsg (bool b)
 
void setDumpNoAnal (bool b)
 in dump(), don't dump data when there was no analysis More...
 
void setFullWindows (bool b)
 
void setHalfWidth (int hw)
 
void setMinMargin (T val)
 
void setMinRatio (T val)
 
void setMinStep (T val)
 
void setPFFrac (T val)
 
void setprecision (int p)
 
void setTwoSample (bool b)
 
void setw (int w)
 
void setWidth (int w)
 
bool willDumpAnalMsg ()
 
bool willDumpNoAnal ()
 
 WindowFilter (const std::vector< T > &x, const std::vector< T > &d, const std::vector< int > &f)
 

Public Attributes

std::vector< FilterHit< T > > results
 

Private Attributes

std::vector< Analysisanalvec
 
bool balanced
 if true, 2 panes of sliding window have = size More...
 
int buffsize
 number of good points ignored btwn past, future More...
 
const std::vector< T > & data
 reference to data to be filtered More...
 
bool debug
 if true, print debug messages in analyze() (F) More...
 
bool dumpAmsg
 if true, add analysis message in dump() (F) More...
 
bool dumpNA
 if false, don't dump() data with no analysis (T) More...
 
const std::vector< int > & flags
 reference to flags, parallel to data, 0 == good More...
 
bool fullwindows
 if true, only process with full windows More...
 
unsigned int halfwidth
 number of points on either side of slip analyzed More...
 
minmargin
 limit on step/minstep+ratio/minratio-2 More...
 
minratio
 ratio=|step/sig| < this is not a slip More...
 
minstep
 |step|(=fut ave - past ave) < this is not slip More...
 
bool noflags
 true when flags array is not given More...
 
bool noxdata
 true when xdata array is not given More...
 
int osp
 width and precision for dump(), (default 8,3) More...
 
int osw
 
pffrac
 delta(f,p) sigma < this frac * sigma not a slip More...
 
bool twoSample
 if true, use two-sample statistics More...
 
unsigned int width
 width or number of points in (1 pane of) window More...
 
const std::vector< T > & xdata
 reference to x-data to be filtered (TwoSample) More...
 

Constructor & Destructor Documentation

◆ WindowFilter()

template<class T >
gnsstk::WindowFilter< T >::WindowFilter ( const std::vector< T > &  x,
const std::vector< T > &  d,
const std::vector< int > &  f 
)
inline

constructor

Parameters
xconst vector<T> of 'times' values, NB (x,d,f) all parallel
dconst vector<T> of data values
fconst vector<int> of flags, 0 means good. this array may be empty.

Definition at line 343 of file WindowFilter.hpp.

Member Function Documentation

◆ analyze()

template<class T >
int gnsstk::WindowFilter< T >::analyze

analyze the output of the filter(), filling the analysis array 'analvec' also fills the 'results' vector of one or more FilterHit.

Returns
the number of slips, outliers, etc (size of results vector<FilterHit>)

Definition at line 945 of file WindowFilter.hpp.

◆ dump()

template<class T >
void gnsstk::WindowFilter< T >::dump ( std::ostream &  s,
std::string  tag = std::string() 
)

dump the data and analysis, including first and last 2 pts which have no stats. optionally include a tag at the start of each line, and configure width and precision.

Definition at line 1341 of file WindowFilter.hpp.

◆ filter()

template<class T >
int gnsstk::WindowFilter< T >::filter ( const size_t  index = 0,
int  npts = -1 
)

window filter routine that does the work. NB this routine configures the analysis data and therefore is critical to anlayse() and dump().

Parameters
indexin data arrays at which to start, defaults to 0
nptsnumber of data to process, defaults to -1, meaning to end of data.
Returns
> 0 number of points in analysis vector, which will be ngood -1 the data arrays are too short for the given window width -2 if the xdata-array is required (twoSample) yet missing -3 if the xdata|flags array is given but shorter than data array This routine clears the analysis vector, runs filter and generates analysis.

Definition at line 506 of file WindowFilter.hpp.

◆ getBufferSize()

template<class T >
int gnsstk::WindowFilter< T >::getBufferSize ( )
inline

Definition at line 373 of file WindowFilter.hpp.

◆ getDebug()

template<class T >
bool gnsstk::WindowFilter< T >::getDebug ( )
inline

Definition at line 401 of file WindowFilter.hpp.

◆ getHalfWidth()

template<class T >
int gnsstk::WindowFilter< T >::getHalfWidth ( )
inline

Definition at line 388 of file WindowFilter.hpp.

◆ getMinMargin()

template<class T >
T gnsstk::WindowFilter< T >::getMinMargin ( )
inline

Definition at line 386 of file WindowFilter.hpp.

◆ getMinRatio()

template<class T >
T gnsstk::WindowFilter< T >::getMinRatio ( )
inline

Definition at line 384 of file WindowFilter.hpp.

◆ getMinStep()

template<class T >
T gnsstk::WindowFilter< T >::getMinStep ( )
inline

Definition at line 385 of file WindowFilter.hpp.

◆ getPFFrac()

template<class T >
T gnsstk::WindowFilter< T >::getPFFrac ( )
inline

Definition at line 387 of file WindowFilter.hpp.

◆ getResults()

template<class T >
std::vector<FilterHit<T> > gnsstk::WindowFilter< T >::getResults ( )
inline

get results vector of FilterHit

Definition at line 407 of file WindowFilter.hpp.

◆ getStats()

template<class T >
void gnsstk::WindowFilter< T >::getStats ( FilterHit< T > &  fe,
bool  noedge = true 
)

compute stats on the filter quanitites within the given FilterHit, defined as the min, max, median and mad of sigma, the rss(future and past stddev). if the flag is true (default), exclude data within the filter width of the end points, to avoid the bump(s) due to slip(s) at the FilterHit boundaries.

Definition at line 1445 of file WindowFilter.hpp.

◆ getWidth()

template<class T >
int gnsstk::WindowFilter< T >::getWidth ( )
inline

Definition at line 372 of file WindowFilter.hpp.

◆ isBalanced()

template<class T >
bool gnsstk::WindowFilter< T >::isBalanced ( )
inline

Definition at line 376 of file WindowFilter.hpp.

◆ isFullWindows()

template<class T >
bool gnsstk::WindowFilter< T >::isFullWindows ( )
inline

Definition at line 377 of file WindowFilter.hpp.

◆ isOneSample()

template<class T >
bool gnsstk::WindowFilter< T >::isOneSample ( )
inline

Definition at line 375 of file WindowFilter.hpp.

◆ isTwoSample()

template<class T >
bool gnsstk::WindowFilter< T >::isTwoSample ( )
inline

Definition at line 374 of file WindowFilter.hpp.

◆ reset()

template<class T >
void gnsstk::WindowFilter< T >::reset ( )
inline

reset the analysis information stored internally. This does not change the data arrays; to do so, instantiate a new filter object.

Definition at line 413 of file WindowFilter.hpp.

◆ setBalanced()

template<class T >
void gnsstk::WindowFilter< T >::setBalanced ( bool  b)
inline

Definition at line 370 of file WindowFilter.hpp.

◆ setBufferSize()

template<class T >
void gnsstk::WindowFilter< T >::setBufferSize ( int  b)
inline

Definition at line 368 of file WindowFilter.hpp.

◆ setDebug()

template<class T >
void gnsstk::WindowFilter< T >::setDebug ( bool  b)
inline

debug prints in analysis()

Definition at line 400 of file WindowFilter.hpp.

◆ setDumpAnalMsg()

template<class T >
void gnsstk::WindowFilter< T >::setDumpAnalMsg ( bool  b)
inline

get and set for dump() parameters in dump(), include the little message at the end of line from analyze()

Definition at line 394 of file WindowFilter.hpp.

◆ setDumpNoAnal()

template<class T >
void gnsstk::WindowFilter< T >::setDumpNoAnal ( bool  b)
inline

in dump(), don't dump data when there was no analysis

Definition at line 397 of file WindowFilter.hpp.

◆ setFullWindows()

template<class T >
void gnsstk::WindowFilter< T >::setFullWindows ( bool  b)
inline

Definition at line 371 of file WindowFilter.hpp.

◆ setHalfWidth()

template<class T >
void gnsstk::WindowFilter< T >::setHalfWidth ( int  hw)
inline

Definition at line 383 of file WindowFilter.hpp.

◆ setMinMargin()

template<class T >
void gnsstk::WindowFilter< T >::setMinMargin ( val)
inline

Definition at line 381 of file WindowFilter.hpp.

◆ setMinRatio()

template<class T >
void gnsstk::WindowFilter< T >::setMinRatio ( val)
inline

Definition at line 379 of file WindowFilter.hpp.

◆ setMinStep()

template<class T >
void gnsstk::WindowFilter< T >::setMinStep ( val)
inline

Definition at line 380 of file WindowFilter.hpp.

◆ setPFFrac()

template<class T >
void gnsstk::WindowFilter< T >::setPFFrac ( val)
inline

Definition at line 382 of file WindowFilter.hpp.

◆ setprecision()

template<class T >
void gnsstk::WindowFilter< T >::setprecision ( int  p)
inline

Definition at line 404 of file WindowFilter.hpp.

◆ setTwoSample()

template<class T >
void gnsstk::WindowFilter< T >::setTwoSample ( bool  b)
inline

Definition at line 369 of file WindowFilter.hpp.

◆ setw()

template<class T >
void gnsstk::WindowFilter< T >::setw ( int  w)
inline

Definition at line 403 of file WindowFilter.hpp.

◆ setWidth()

template<class T >
void gnsstk::WindowFilter< T >::setWidth ( int  w)
inline

Definition at line 367 of file WindowFilter.hpp.

◆ willDumpAnalMsg()

template<class T >
bool gnsstk::WindowFilter< T >::willDumpAnalMsg ( )
inline

Definition at line 395 of file WindowFilter.hpp.

◆ willDumpNoAnal()

template<class T >
bool gnsstk::WindowFilter< T >::willDumpNoAnal ( )
inline

Definition at line 398 of file WindowFilter.hpp.

Member Data Documentation

◆ analvec

template<class T >
std::vector<Analysis> gnsstk::WindowFilter< T >::analvec
private

vector of Analysis objects, holding analysis information, generated by filter() and used by analyze() and included in dump() output.

Definition at line 489 of file WindowFilter.hpp.

◆ balanced

template<class T >
bool gnsstk::WindowFilter< T >::balanced
private

if true, 2 panes of sliding window have = size

Definition at line 459 of file WindowFilter.hpp.

◆ buffsize

template<class T >
int gnsstk::WindowFilter< T >::buffsize
private

number of good points ignored btwn past, future

Definition at line 463 of file WindowFilter.hpp.

◆ data

template<class T >
const std::vector<T>& gnsstk::WindowFilter< T >::data
private

reference to data to be filtered

Definition at line 476 of file WindowFilter.hpp.

◆ debug

template<class T >
bool gnsstk::WindowFilter< T >::debug
private

if true, print debug messages in analyze() (F)

Definition at line 483 of file WindowFilter.hpp.

◆ dumpAmsg

template<class T >
bool gnsstk::WindowFilter< T >::dumpAmsg
private

if true, add analysis message in dump() (F)

Definition at line 482 of file WindowFilter.hpp.

◆ dumpNA

template<class T >
bool gnsstk::WindowFilter< T >::dumpNA
private

if false, don't dump() data with no analysis (T)

Definition at line 481 of file WindowFilter.hpp.

◆ flags

template<class T >
const std::vector<int>& gnsstk::WindowFilter< T >::flags
private

reference to flags, parallel to data, 0 == good

Definition at line 478 of file WindowFilter.hpp.

◆ fullwindows

template<class T >
bool gnsstk::WindowFilter< T >::fullwindows
private

if true, only process with full windows

Definition at line 460 of file WindowFilter.hpp.

◆ halfwidth

template<class T >
unsigned int gnsstk::WindowFilter< T >::halfwidth
private

number of points on either side of slip analyzed

Definition at line 468 of file WindowFilter.hpp.

◆ minmargin

template<class T >
T gnsstk::WindowFilter< T >::minmargin
private

limit on step/minstep+ratio/minratio-2

Definition at line 471 of file WindowFilter.hpp.

◆ minratio

template<class T >
T gnsstk::WindowFilter< T >::minratio
private

ratio=|step/sig| < this is not a slip

Definition at line 469 of file WindowFilter.hpp.

◆ minstep

template<class T >
T gnsstk::WindowFilter< T >::minstep
private

|step|(=fut ave - past ave) < this is not slip

Definition at line 470 of file WindowFilter.hpp.

◆ noflags

template<class T >
bool gnsstk::WindowFilter< T >::noflags
private

true when flags array is not given

Definition at line 465 of file WindowFilter.hpp.

◆ noxdata

template<class T >
bool gnsstk::WindowFilter< T >::noxdata
private

true when xdata array is not given

Definition at line 464 of file WindowFilter.hpp.

◆ osp

template<class T >
int gnsstk::WindowFilter< T >::osp
private

width and precision for dump(), (default 8,3)

Definition at line 480 of file WindowFilter.hpp.

◆ osw

template<class T >
int gnsstk::WindowFilter< T >::osw
private

Definition at line 480 of file WindowFilter.hpp.

◆ pffrac

template<class T >
T gnsstk::WindowFilter< T >::pffrac
private

delta(f,p) sigma < this frac * sigma not a slip

Definition at line 472 of file WindowFilter.hpp.

◆ results

template<class T >
std::vector<FilterHit<T> > gnsstk::WindowFilter< T >::results

vector of FilterHit, generated and returned by analyze(); keep this copy for use in dump()

Definition at line 496 of file WindowFilter.hpp.

◆ twoSample

template<class T >
bool gnsstk::WindowFilter< T >::twoSample
private

if true, use two-sample statistics

Definition at line 461 of file WindowFilter.hpp.

◆ width

template<class T >
unsigned int gnsstk::WindowFilter< T >::width
private

width or number of points in (1 pane of) window

Definition at line 462 of file WindowFilter.hpp.

◆ xdata

template<class T >
const std::vector<T>& gnsstk::WindowFilter< T >::xdata
private

reference to x-data to be filtered (TwoSample)

Definition at line 475 of file WindowFilter.hpp.


The documentation for this class was generated from the following file:


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:46