StatsFilterHit.hpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
47 #ifndef STATISTICAL_FILTER_HIT_INCLUDE
48 #define STATISTICAL_FILTER_HIT_INCLUDE
49 
50 namespace gnsstk
51 {
52  //---------------------------------------------------------------------------------
53  // TD NB pffrac is never used.
54  // NB WindowFilter does not find outliers
55  //---------------------------------------------------------------------------------
56 
68  template <class T> class FilterHit
69  {
70  public:
72  typedef enum EventType
73  {
74  BOD = 0,
76  slip,
78  } event;
79 
82  : index(-1), type(BOD), npts(0), ngood(0), score(0), step(T(0)),
83  sigma(T(0)), dx(T(0)), haveStats(false)
84  {
85  }
86 
87  // member data
88  event type;
89 
90  unsigned int
92  unsigned int
93  npts;
94  unsigned int ngood;
95  unsigned int
97 
98  T step;
99  T sigma;
100  T dx;
101 
102  bool haveStats;
103  // see getStats() - meanings depend on filter
104  T min, max, med, mad;
105 
106  std::string msg;
107 
109  bool isBOD() { return (type == BOD); }
110 
112  bool isOutlier() { return (type == outlier); }
113 
115  bool isSlip() { return (type == slip); }
116 
118  std::string analMsg() const { return msg; }
119 
121  std::string asString(const int osp = 3) const
122  {
123  std::stringstream oss;
124  switch (type)
125  {
126  case BOD:
127  oss << "BOD";
128  break;
129  case outlier:
130  oss << "OUT";
131  break;
132  case slip:
133  oss << "SLIP";
134  break;
135  default:
136  case other:
137  oss << "other";
138  break;
139  }
140  oss << std::fixed << std::setprecision(osp);
141 
142  // ind npts step dx sig score - be sure this order matches
143  // asStringRead()
144  oss << " " << index << " " << npts << " " << dx;
145  if (type == slip)
146  {
147  oss << " " << step << " " << sigma << " " << score;
148  }
149  else
150  {
151  oss << " ?"
152  << " ?"
153  << " ?";
154  }
155 
156  return oss.str();
157  }
158 
163  std::string asStringRead(const int osp = 3) const
164  {
165  std::stringstream oss;
166  switch (type)
167  {
168  case BOD:
169  oss << "BOD";
170  break;
171  case outlier:
172  oss << "OUT";
173  break;
174  case slip:
175  oss << "SLIP";
176  break;
177  default:
178  case other:
179  oss << "other";
180  break;
181  }
182  oss << " ind=" << index << " npts=" << npts << " ngood=" << ngood
183  << std::fixed << std::setprecision(osp) << " x_gap=" << dx;
184  if (type == slip)
185  {
186  oss << " step=" << step << " sig=" << sigma << " score=" << score
187  << (score < 100 ? " SMALL" : "");
188  }
189 
190  return oss.str();
191  }
192 
197  std::string asStatsString(const int osp = 3) const
198  {
199  std::stringstream oss;
200  oss << asString(osp) << std::fixed << std::setprecision(osp);
201  if (!haveStats)
202  {
203  oss << "; NoSt";
204  }
205  else
206  {
207  oss << " min=" << min << " max=" << max << " med=" << med
208  << " mad=" << mad;
209  }
210  return oss.str();
211  }
212 
213  }; // end class FilterHit
214 
215  //---------------------------------------------------------------------------------
216  //---------------------------------------------------------------------------------
217 } // namespace gnsstk
218 #endif // #define STATISTICAL_FILTER_HIT_INCLUDE
gnsstk::FilterHit::index
unsigned int index
index in the data array(s) at which this event occurs
Definition: StatsFilterHit.hpp:91
gnsstk::FilterHit::isBOD
bool isBOD()
return true if this is BOD
Definition: StatsFilterHit.hpp:109
gnsstk::FilterHit::asStringRead
std::string asStringRead(const int osp=3) const
Definition: StatsFilterHit.hpp:163
gnsstk::FilterHit::analMsg
std::string analMsg() const
return the analysis message
Definition: StatsFilterHit.hpp:118
gnsstk::FilterHit::isOutlier
bool isOutlier()
return true if this is outlier
Definition: StatsFilterHit.hpp:112
gnsstk::FilterHit::isSlip
bool isSlip()
return true if this is slip
Definition: StatsFilterHit.hpp:115
gnsstk::FilterHit::med
T med
Definition: StatsFilterHit.hpp:104
gnsstk::FilterHit::slip
@ slip
slip (discontinuity)
Definition: StatsFilterHit.hpp:76
gnsstk::FilterHit::max
T max
Definition: StatsFilterHit.hpp:104
gnsstk::FilterHit::EventType
EventType
enum used to indicate the kind of event in this result
Definition: StatsFilterHit.hpp:72
gnsstk::FilterHit::asString
std::string asString(const int osp=3) const
return as a single string with just type, index and npts
Definition: StatsFilterHit.hpp:121
gnsstk::FilterHit::outlier
@ outlier
outlier(s) - npts is the number of outliers
Definition: StatsFilterHit.hpp:75
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::FilterHit::asStatsString
std::string asStatsString(const int osp=3) const
Definition: StatsFilterHit.hpp:197
gnsstk::FilterHit::BOD
@ BOD
beginning of data
Definition: StatsFilterHit.hpp:74
gnsstk::FilterHit::other
@ other
never used?
Definition: StatsFilterHit.hpp:77
gnsstk::FilterHit::score
unsigned int score
weight of slip (=100)
Definition: StatsFilterHit.hpp:96
gnsstk::FilterHit::haveStats
bool haveStats
set true when getStats() is called
Definition: StatsFilterHit.hpp:102
gnsstk::FilterHit::npts
unsigned int npts
number data points in segment (= a delta index)
Definition: StatsFilterHit.hpp:93
gnsstk::FilterHit::FilterHit
FilterHit()
empty and only constructor
Definition: StatsFilterHit.hpp:81
gnsstk::FilterHit::msg
std::string msg
message from analysis
Definition: StatsFilterHit.hpp:106
gnsstk::FilterHit::ngood
unsigned int ngood
number of good (flag==0) points in this segment
Definition: StatsFilterHit.hpp:94
gnsstk::FilterHit::event
enum gnsstk::FilterHit::EventType event
enum used to indicate the kind of event in this result
gnsstk::FilterHit::min
T min
Definition: StatsFilterHit.hpp:104
gnsstk::FilterHit::step
T step
for a slip, an estimate of the step in the data
Definition: StatsFilterHit.hpp:98
gnsstk::FilterHit::type
event type
type of event: BOD, outlier(s), slip, other
Definition: StatsFilterHit.hpp:88
gnsstk::FilterHit::dx
T dx
step in xdata: before SLIP or after OUT
Definition: StatsFilterHit.hpp:100
gnsstk::FilterHit
Definition: StatsFilterHit.hpp:68
gnsstk::FilterHit::sigma
T sigma
for a slip, RSS future and past sigma on the data
Definition: StatsFilterHit.hpp:99
gnsstk::FilterHit::mad
T mad
robust stats on the filter quantities (not data)
Definition: StatsFilterHit.hpp:104


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