Isis 3 Developer Reference
StatCumProbDistDynCalc.h
Go to the documentation of this file.
1 #ifndef StatCumProbDistDynCalc_h
2 #define StatCumProbDistDynCalc_h
3 
24 #include <QList>
25 #include <QObject>
26 #include <QVector>
27 
28 #include "XmlStackedHandler.h"
29 
30 class QDataStream;
31 class QUuid;
32 class QXmlStreamWriter;
33 
34 namespace Isis {
35  class Project;// ??? does xml stuff need project???
36  class XmlStackedHandlerReader;
37 
80  Q_OBJECT
81  // class uses the P^2 Algorithim to calculate equiprobability cell histograms from a stream of
82  // data without storing the data
83  // see "The p^2 Algorithim for Dynamic Calculations of Quantiles and Histograms Without Storing
84  // Observations"
85  public:
86  StatCumProbDistDynCalc(unsigned int nodes=20, QObject *parent = 0); //individual qunatile value to be calculated
88  QObject *parent = 0); // TODO: does xml stuff need project???
92 
93  void initialize(); // clears the member lists and initializes the rest of the member data to 0
94  void setQuantiles(unsigned int nodes); // initializes/resets the class to start new calculation
95 
96  void validate();
97  void addObs(double obs);
98 
99  double cumProb(double value); //given a value return the cumulative probility
100  double value(double cumProb); //given a cumulative probibility return a value
101  double max(); //return the largest value so far
102  double min(); //return the smallest values so far
103 
104  void save(QXmlStreamWriter &stream, const Project *project) const; // TODO: does xml stuff need project???
105 
106  QDataStream &write(QDataStream &stream) const;
107  QDataStream &read(QDataStream &stream);
108 
109  private:
116  class XmlHandler : public XmlStackedHandler {
117  public:
118  XmlHandler(StatCumProbDistDynCalc *probabilityCalc, Project *project); // TODO: does xml stuff need project???
119  ~XmlHandler();
120 
121  virtual bool startElement(const QString &namespaceURI, const QString &localName,
122  const QString &qName, const QXmlAttributes &atts);
123  virtual bool characters(const QString &ch);
124  virtual bool endElement(const QString &namespaceURI, const QString &localName,
125  const QString &qName);
126 
127  private:
128  Q_DISABLE_COPY(XmlHandler);
129 
130  StatCumProbDistDynCalc *m_xmlHandlerCumProbCalc;
131  Project *m_xmlHandlerProject; // TODO: does xml stuff need project???
132  QString m_xmlHandlerCharacters;
133  };
134 
135  unsigned int m_numberCells;
138  unsigned int m_numberQuantiles;
142  unsigned int m_numberObservations;
145  QList<double> m_quantiles;
147  QList<double> m_observationValues;
150  QList<double> m_idealNumObsBelowQuantile;
155  QList<int> m_numObsBelowQuantile;
159  };
160 
161  // operators to read/write StatCumProbDistDynCalc to/from binary data
162  QDataStream &operator<<(QDataStream &stream, const StatCumProbDistDynCalc &scpddc);
163  QDataStream &operator>>(QDataStream &stream, StatCumProbDistDynCalc &scpddc);
164 
165 } //end namespace Isis
166 
167 #endif
double max()
Returns the maximum observation so far included in the dynamic calculation.
Definition: StatCumProbDistDynCalc.cpp:156
The main project for ipce.
Definition: Project.h:289
void setQuantiles(unsigned int nodes)
Definition: StatCumProbDistDynCalc.cpp:120
StatCumProbDistDynCalc(unsigned int nodes=20, QObject *parent=0)
Construtor sets up the class to start recieving data.
Definition: StatCumProbDistDynCalc.cpp:50
void validate()
Definition: StatCumProbDistDynCalc.cpp:646
double value(double cumProb)
Provides the value of the variable that has the given cumulative probility (according the current est...
Definition: StatCumProbDistDynCalc.cpp:195
~StatCumProbDistDynCalc()
Destroys StatCumProbDistDynCalc object.
Definition: StatCumProbDistDynCalc.cpp:82
void save(QXmlStreamWriter &stream, const Project *project) const
Definition: StatCumProbDistDynCalc.cpp:504
This class is used to approximate cumulative probibility distributions of a stream of observations wi...
Definition: StatCumProbDistDynCalc.h:79
std::istream & operator>>(std::istream &is, CSVReader &csv)
Input read operator for input stream sources.
Definition: CSVReader.cpp:463
XML Handler that parses XMLs in a stack-oriented way.
Definition: XmlStackedHandler.h:112
QDataStream & read(QDataStream &stream)
Definition: StatCumProbDistDynCalc.cpp:617
void initialize()
Inializer, resets the class to start its dynamic calculation anew.
Definition: StatCumProbDistDynCalc.cpp:110
void addObs(double obs)
Values for the estimated quantile positions are update as observations are added. ...
Definition: StatCumProbDistDynCalc.cpp:407
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
double min()
Returns the maximum observation so far included in the dynamic calculation.
Definition: StatCumProbDistDynCalc.cpp:173
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
Definition: Hillshade.cpp:308
double cumProb(double value)
Provides the cumulative probility, that is, the proportion of the distribution that is less than or e...
Definition: StatCumProbDistDynCalc.cpp:312
Manage a stack of content handlers for reading XML files.
Definition: XmlStackedHandlerReader.h:25
StatCumProbDistDynCalc & operator=(const StatCumProbDistDynCalc &other)
Definition: StatCumProbDistDynCalc.cpp:87
QDataStream & write(QDataStream &stream) const
Definition: StatCumProbDistDynCalc.cpp:604