Isis 3.0 Programmer Reference
Back | Home
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???
91  StatCumProbDistDynCalc &operator=(const StatCumProbDistDynCalc &other);
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  QUuid *m_id;
138  unsigned int m_numberCells;
141  unsigned int m_numberQuantiles;
145  unsigned int m_numberObservations;
162  };
163 
164  // operators to read/write StatCumProbDistDynCalc to/from binary data
165  QDataStream &operator<<(QDataStream &stream, const StatCumProbDistDynCalc &scpddc);
166  QDataStream &operator>>(QDataStream &stream, StatCumProbDistDynCalc &scpddc);
167 
168 } //end namespace Isis
169 
170 #endif
double max()
Returns the maximum observation so far included in the dynamic calculation.
The main project for cnetsuite.
Definition: Project.h:105
StatCumProbDistDynCalc(unsigned int nodes=20, QObject *parent=0)
Construtor sets up the class to start recieving data.
double value(double cumProb)
Provides the value of the variable that has the given cumulative probility (according the current est...
~StatCumProbDistDynCalc()
Destroys StatCumProbDistDynCalc object.
QList< double > m_observationValues
The calculated values of the quantiles, note this is dynamically changing as observations are added...
unsigned int m_numberQuantiles
The number of quantiles being used to model the probility density function.
This class is used to approximate cumulative probibility distributions of a stream of observations wi...
unsigned int m_numberCells
The number of cells or histogram bins that are being used to model the probility density function...
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.
QUuid * m_id
A unique ID for this object (useful for others to reference this object when saving to disk)...
QList< double > m_quantiles
The target quantiles being modeled, between 0 and 1.
void initialize()
Inializer, resets the class to start its dynamic calculation anew.
QList< int > m_numObsBelowQuantile
The actual number of observations that are less than or equal to the value of the corresponding quant...
unsigned int m_numberObservations
The number of observations, note this is dynamically changing as observations are added...
void addObs(double obs)
Values for the estimated quantile positions are update as observations are added. ...
double min()
Returns the maximum observation so far included in the dynamic calculation.
QList< double > m_idealNumObsBelowQuantile
The ideal number of observations that should be less than or equal to the value of the correspond...
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...
his enables stack-based XML parsing of XML files.

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:29:52