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

Detailed Description

template<class T>
class gnsstk::FirstDiffFilter< T >

This class computes the first difference of the input data array. It will read the data, compute the first difference and store it, then analyze the result, returning a vector of simple results giving outliers and statistics on the data between outliers.

Definition at line 111 of file FirstDiffFilter.hpp.

#include <FirstDiffFilter.hpp>

Classes

class  Analysis
 class used to store analysis arrays filled by the first difference filter More...
 

Public Member Functions

int analyze ()
 
int analyze2 (double ratlim, double siglim)
 
int analyze2 (double ratlim, double siglim, std::string &dumpmsg)
 
void dump (std::ostream &s, const std::string &tag=std::string())
 
int filter (const size_t index=0, int npts=-1)
 
 FirstDiffFilter (const std::vector< T > &x, const std::vector< T > &d, const std::vector< int > &f)
 
void fixUpResults ()
 
getLimit ()
 
std::vector< FilterHit< T > > getResults ()
 return a copy of the filter hit results More...
 
void getStats (FilterHit< T > &fe)
 
void setDumpNoAnal (bool b)
 
void setLimit (T val)
 get and set More...
 
void setprecision (int p)
 
void setw (int w)
 get and set for dump More...
 
bool willDumpNoAnal ()
 

Public Attributes

std::vector< Analysisanalvec
 
const std::vector< T > & data
 reference to data to be filtered More...
 
bool dumpNA
 if false, don't dump() data with no analysis (T) More...
 
fdlimit
 |first diff| must be > this to be an outlier More...
 
const std::vector< int > & flags
 reference to flags, parallel to data, 0 == good More...
 
int ilimit
 largest allowed index in data[] is ilimit-1 More...
 
bool noflags
 true when flags array is not given More...
 
bool noxdata
 true when xdata is not given More...
 
unsigned int Npts
 size of sliding window More...
 
int osp
 width and precision for dump(), (default 8,3) More...
 
int osw
 
std::vector< FilterHit< T > > results
 vector of FilterHit, generated by analyze(), also for use in dump() More...
 
const std::vector< T > & xdata
 reference to xdata - used only in dump More...
 

Private Member Functions

int analyze2 (double ratlim, double siglim, bool dump, std::string &dumpmsg)
 

Constructor & Destructor Documentation

◆ FirstDiffFilter()

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

constructor with two arrays - x is used only in dump(); x and f must exist but may be empty

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 135 of file FirstDiffFilter.hpp.

Member Function Documentation

◆ analyze()

template<class T >
int gnsstk::FirstDiffFilter< 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 334 of file FirstDiffFilter.hpp.

◆ analyze2() [1/3]

template<class T >
int gnsstk::FirstDiffFilter< T >::analyze2 ( double  ratlim,
double  siglim 
)
inline

analyze the output of the filter(), filling the analysis array 'analvec' also fills the 'results' vector of one or more FilterHit. Uses a different algorithm - sliding window ave/sigma of fdiff on either side of, vs fdiff at, point of interest.

Parameters
ratlimlimit on |ratio fdiff to <sigmas>| (also fdiff > fdlimit for hit)
Returns
the number of slips (size of results vector<FilterHit> - 1)

Definition at line 187 of file FirstDiffFilter.hpp.

◆ analyze2() [2/3]

template<class T >
int gnsstk::FirstDiffFilter< T >::analyze2 ( double  ratlim,
double  siglim,
bool  dump,
std::string &  dumpmsg 
)
private

private version of analyze2 with all arguments, cf. overloaded versions' doc.

Parameters
ratlimlimit on |ratio fdiff to <sigmas>| (also fdiff > fdlimit for hit)
dumpbool if true dump analysis output to dumpmsg
dumpmsgstring for analysis dump when bool dump is true

Definition at line 495 of file FirstDiffFilter.hpp.

◆ analyze2() [3/3]

template<class T >
int gnsstk::FirstDiffFilter< T >::analyze2 ( double  ratlim,
double  siglim,
std::string &  dumpmsg 
)
inline

Overloaded version with analysis dump to string reference; cf. other versions

Parameters
ratlimlimit on |ratio fdiff to <sigmas>| (also fdiff > fdlimit for hit)
dumpmsgstring for analysis dump when bool dump is true

Definition at line 199 of file FirstDiffFilter.hpp.

◆ dump()

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

dump the data and analysis; optionally include a tag at the start of each line, and configure width and precision.

Definition at line 682 of file FirstDiffFilter.hpp.

◆ filter()

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

filter routine that computes the first difference

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 the analysis vector == number good data -1 the data array is too short (< 2) -3 if the flags array is given but shorter than data array This routine clears the analysis vector.

Definition at line 266 of file FirstDiffFilter.hpp.

◆ fixUpResults()

template<class T >
void gnsstk::FirstDiffFilter< T >::fixUpResults

fix some potential problems in the results vector, namely: if the first point(s) are outliers, analyze() makes the first FilterHit BOD with only 1 point, then either outliers or a slip; fix this by making first FilterHit outliers. Called at end of analyze()

Definition at line 463 of file FirstDiffFilter.hpp.

◆ getLimit()

template<class T >
T gnsstk::FirstDiffFilter< T >::getLimit ( )
inline

Definition at line 149 of file FirstDiffFilter.hpp.

◆ getResults()

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

return a copy of the filter hit results

Definition at line 156 of file FirstDiffFilter.hpp.

◆ getStats()

template<class T >
void gnsstk::FirstDiffFilter< T >::getStats ( FilterHit< T > &  fe)

compute stats on the first differences within the given FilterHit, store in Seg NB this must be called on filter.results[i] in order to show stats in dump()

Definition at line 730 of file FirstDiffFilter.hpp.

◆ setDumpNoAnal()

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

Definition at line 153 of file FirstDiffFilter.hpp.

◆ setLimit()

template<class T >
void gnsstk::FirstDiffFilter< T >::setLimit ( val)
inline

get and set

Definition at line 148 of file FirstDiffFilter.hpp.

◆ setprecision()

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

Definition at line 152 of file FirstDiffFilter.hpp.

◆ setw()

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

get and set for dump

Definition at line 151 of file FirstDiffFilter.hpp.

◆ willDumpNoAnal()

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

Definition at line 154 of file FirstDiffFilter.hpp.

Member Data Documentation

◆ analvec

template<class T >
std::vector<Analysis> gnsstk::FirstDiffFilter< T >::analvec

vector of Analysis objects, holding first differences and indexes, generated by filter(), used by analyze() and included in dump() output.

Definition at line 247 of file FirstDiffFilter.hpp.

◆ data

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

reference to data to be filtered

Definition at line 237 of file FirstDiffFilter.hpp.

◆ dumpNA

template<class T >
bool gnsstk::FirstDiffFilter< T >::dumpNA

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

Definition at line 232 of file FirstDiffFilter.hpp.

◆ fdlimit

template<class T >
T gnsstk::FirstDiffFilter< T >::fdlimit

|first diff| must be > this to be an outlier

Definition at line 234 of file FirstDiffFilter.hpp.

◆ flags

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

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

Definition at line 239 of file FirstDiffFilter.hpp.

◆ ilimit

template<class T >
int gnsstk::FirstDiffFilter< T >::ilimit

largest allowed index in data[] is ilimit-1

Definition at line 240 of file FirstDiffFilter.hpp.

◆ noflags

template<class T >
bool gnsstk::FirstDiffFilter< T >::noflags

true when flags array is not given

Definition at line 231 of file FirstDiffFilter.hpp.

◆ noxdata

template<class T >
bool gnsstk::FirstDiffFilter< T >::noxdata

true when xdata is not given

Definition at line 230 of file FirstDiffFilter.hpp.

◆ Npts

template<class T >
unsigned int gnsstk::FirstDiffFilter< T >::Npts

size of sliding window

Definition at line 235 of file FirstDiffFilter.hpp.

◆ osp

template<class T >
int gnsstk::FirstDiffFilter< T >::osp

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

Definition at line 229 of file FirstDiffFilter.hpp.

◆ osw

template<class T >
int gnsstk::FirstDiffFilter< T >::osw

Definition at line 229 of file FirstDiffFilter.hpp.

◆ results

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

vector of FilterHit, generated by analyze(), also for use in dump()

Definition at line 250 of file FirstDiffFilter.hpp.

◆ xdata

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

reference to xdata - used only in dump

Definition at line 236 of file FirstDiffFilter.hpp.


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


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