Commit da7f4e8d authored by Jesse Mapel's avatar Jesse Mapel
Browse files

Added documentation to BundleResults and improved test coverage. Fixes #3975

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@6892 41f8697f-d340-4b68-9986-7bafba869bb8
parent 64873346
Loading
Loading
Loading
Loading
+661 −163

File changed.

Preview size limit exceeded, changes collapsed.

+45 −28
Original line number Diff line number Diff line
@@ -25,8 +25,8 @@
 */

#include <QList>
#include <QPair>
#include <QObject>
#include <QPair>
#include <QString>
#include <QVector>

@@ -74,12 +74,15 @@ namespace Isis {
   *                           member variables to make names more descriptive.
   *   @history 2015-10-14 Jeffrey Covington - Declared BundleResults as a Qt
   *                           metatype for use with QVariant.
   *   @history 2016-07-01 Jesse Mapel - Updated documentation and testing in preparation for
   *                           merging from IPCE into ISIS. Fixes #3975.
   */
  class BundleResults : public QObject {
    Q_OBJECT
    public:
      BundleResults(QObject *parent = 0);
      BundleResults(Project *project, XmlStackedHandlerReader *xmlReader, QObject *parent = 0);   // TODO: does xml stuff need project???
      // TODO: does xml stuff need project???
      BundleResults(Project *project, XmlStackedHandlerReader *xmlReader, QObject *parent = 0);
      BundleResults(const BundleResults &src);
      ~BundleResults();
      BundleResults &operator=(const BundleResults &src);
@@ -125,7 +128,8 @@ namespace Isis {
#endif
      void setRejectionLimit(double rejectionLimit);
#if 0
      double computeResiduals(ControlNet *pCnet,
      double computeResiduals(
               ControlNet *pCnet,
               std::vector< boost::numeric::ublas::bounded_vector< double, 3 > > pointWeights,
               std::vector< boost::numeric::ublas::bounded_vector< double, 3 > > pointCorrections,
               boost::numeric::ublas::vector< double > image_Corrections,
@@ -218,7 +222,8 @@ namespace Isis {
      void setCorrMatCovFileName(FileName name);
      void setCorrMatImgsAndParams(QMap<QString, QStringList> imgsAndParams);

      void save(QXmlStreamWriter &stream, const Project *project) const;   // TODO: does xml stuff need project???
      // TODO: does xml stuff need project???
      void save(QXmlStreamWriter &stream, const Project *project) const;
      
      QDataStream &write(QDataStream &stream) const;
      QDataStream &read(QDataStream &stream);
@@ -232,6 +237,9 @@ namespace Isis {

    private:
      /**
       * This class is an XmlHandler used to read and write BundleResults objects
       * from and to XML files.  Documentation will be updated when it is decided
       * if XML support will remain.
       * 
       * @author 2014-07-28 Jeannie Backer
       *
@@ -239,7 +247,8 @@ namespace Isis {
       */
      class XmlHandler : public XmlStackedHandler {
        public:
          XmlHandler(BundleResults *statistics, Project *project);   // TODO: does xml stuff need project???
          // TODO: does xml stuff need project???
          XmlHandler(BundleResults *statistics, Project *project);
          ~XmlHandler();
   
          virtual bool startElement(const QString &namespaceURI, const QString &localName,
@@ -277,7 +286,7 @@ namespace Isis {
       */
      QUuid *m_id;
//???      QString m_instrumentId;               //!< The spacecraft instrument id for this observation.
      CorrelationMatrix *m_correlationMatrix;
      CorrelationMatrix *m_correlationMatrix; //!< The correlation matrix from the BundleAdjust.

// ???       Statistics m_statsx;                       //!<  x errors
// ???       Statistics m_statsy;                       //!<  y errors
@@ -320,26 +329,32 @@ namespace Isis {
      QList<Statistics> m_rmsImageResiduals;      /**< RMS image sample and line residual statistics 
                                                       for each image in the bundle  */

      //!< The root mean square image x sigmas.
      QVector<Statistics> m_rmsImageXSigmas;     // unset and unused ???
      //!< The root mean square image y sigmas.
      QVector<Statistics> m_rmsImageYSigmas;     // unset and unused ???
      //!< The root mean square image z sigmas.
      QVector<Statistics> m_rmsImageZSigmas;     // unset and unused ???
      //!< The root mean square image right ascension sigmas.
      QVector<Statistics> m_rmsImageRASigmas;    // unset and unused ???
      //!< The root mean square image declination sigmas.
      QVector<Statistics> m_rmsImageDECSigmas;   // unset and unused ???
      //!< The root mean square image twist sigmas.
      QVector<Statistics> m_rmsImageTWISTSigmas; // unset and unused ???

      Distance m_minSigmaLatitudeDistance;
      Distance m_maxSigmaLatitudeDistance;
      Distance m_minSigmaLongitudeDistance;
      Distance m_maxSigmaLongitudeDistance;
      Distance m_minSigmaRadiusDistance;
      Distance m_maxSigmaRadiusDistance;
      Distance m_minSigmaLatitudeDistance; //!< The minimum sigma latitude distance.
      Distance m_maxSigmaLatitudeDistance; //!< The maximum sigma latitude distance.
      Distance m_minSigmaLongitudeDistance; //!< The minimum sigma longitude distance.
      Distance m_maxSigmaLongitudeDistance; //!< The maximum sigma longitude distance.
      Distance m_minSigmaRadiusDistance; //!< The minimum sigma radius distance.
      Distance m_maxSigmaRadiusDistance; //!< The maximum sigma radius distance.

      QString m_minSigmaLatitudePointId;
      QString m_maxSigmaLatitudePointId;
      QString m_minSigmaLongitudePointId;
      QString m_maxSigmaLongitudePointId;
      QString m_minSigmaRadiusPointId;
      QString m_maxSigmaRadiusPointId;
      QString m_minSigmaLatitudePointId; //!< The minimum sigma latitude point id.
      QString m_maxSigmaLatitudePointId; //!< The maximum sigma latitude point id.
      QString m_minSigmaLongitudePointId; //!< The minimum sigma longitude point id.
      QString m_maxSigmaLongitudePointId; //!< The maximum sigma longitude point id.
      QString m_minSigmaRadiusPointId; //!< The minimum sigma radius point id.
      QString m_maxSigmaRadiusPointId; //!< The maximum sigma radius point id.

      double m_rmsSigmaLatitudeStats;               //!< rms of adjusted Latitude sigmas
      double m_rmsSigmaLongitudeStats;               //!< rms of adjusted Longitude sigmas
@@ -348,6 +363,8 @@ namespace Isis {
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      // variables for maximum likelihood estimation
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      //!< The maximum likelihood models and their quantiles.
      QList< QPair< MaximumLikelihoodWFunctions, double > > m_maximumLikelihoodFunctions;

      /**< The number of maximum likelihood estimation 
@@ -361,7 +378,7 @@ namespace Isis {
      /**< Quantiles of the |residual| distribution to be
           used for tweaking constants of the maximum 
           probability models.*/
      int m_maximumLikelihoodIndex;            /**< This count keeps track of which stadge of the
      int m_maximumLikelihoodIndex;            /**< This count keeps track of which stage of the
                                                    maximum likelihood adjustment the bundle is
                                                    currently on.*/
      StatCumProbDistDynCalc *m_cumPro;        /**< This class will be used to calculate the
+6 −6
Original line number Diff line number Diff line
@@ -215,8 +215,8 @@ Object = MutatedResultsObject
  NumberObservations                 = 9
  NumberImageParameters              = 10
  NumberConstrainedPointParameters   = 11
  NumberConstrainedImageParameters   = 12
  NumberConstrainedTargetParameters  = 0
  NumberConstrainedImageParameters   = 10
  NumberConstrainedTargetParameters  = 2
  NumberUnknownParameters            = 13
  DegreesOfFreedom                   = 14
  Sigma0                             = 15.0
@@ -277,8 +277,8 @@ Object = BundleResults
  NumberObservations                 = 9
  NumberImageParameters              = 10
  NumberConstrainedPointParameters   = 11
  NumberConstrainedImageParameters   = 12
  NumberConstrainedTargetParameters  = 0
  NumberConstrainedImageParameters   = 10
  NumberConstrainedTargetParameters  = 2
  NumberUnknownParameters            = 32
  DegreesOfFreedom                   = 0
  Sigma0                             = 0.0
@@ -329,8 +329,8 @@ Object = BundleResultsFromXml
  NumberObservations                 = 9
  NumberImageParameters              = 10
  NumberConstrainedPointParameters   = 11
  NumberConstrainedImageParameters   = 12
  NumberConstrainedTargetParameters  = 0
  NumberConstrainedImageParameters   = 10
  NumberConstrainedTargetParameters  = 2
  NumberUnknownParameters            = 32
  DegreesOfFreedom                   = 0
  Sigma0                             = 0.0
+32 −10
Original line number Diff line number Diff line
@@ -21,8 +21,22 @@ using namespace std;
using namespace Isis;

namespace Isis {
  /**
   * This class is used to test BundleResults' XmlHandler class.
   * 
   * @author 2014-07-28 Jeannie Backer
   * 
   * @internal
   */
  class BundleResultsXmlHandlerTester : public BundleResults {
    public:
      /**
       * Constructs the tester object from an xml file.
       *
       * @param project The project object the tester belongs to.
       * @param reader The XmlStackedHandlerReader that reads the xml file.
       * @param xmlFile The xml file to construct the tester from.
       */
      BundleResultsXmlHandlerTester(Project *project, XmlStackedHandlerReader *reader, 
                                     FileName xmlFile) : BundleResults(project, reader) {

@@ -45,6 +59,9 @@ namespace Isis {

      }

      /**
       * Destroys the tester object
       */
      ~BundleResultsXmlHandlerTester() {
      }

@@ -142,7 +159,9 @@ int main(int argc, char *argv[]) {
    results.resetNumberConstrainedPointParameters();
    results.incrementNumberConstrainedPointParameters(11);
    results.resetNumberConstrainedImageParameters();
    results.incrementNumberConstrainedImageParameters(12);
    results.incrementNumberConstrainedImageParameters(10);
    results.resetNumberConstrainedTargetParameters();
    results.incrementNumberConstrainedTargetParameters(2);
    results.setNumberUnknownParameters(13);
    results.setDegreesOfFreedom(14.0);
    results.setSigma0(15.0);
@@ -175,7 +194,8 @@ int main(int argc, char *argv[]) {

    qDebug() << "Testing accessor methods...";
    qDebug() << "maximum likelihood index = " << toString(results.maximumLikelihoodModelIndex());
    qDebug() << "maximum likelihood median r2 residuals = " << toString(results.maximumLikelihoodMedianR2Residuals());
    qDebug() << "maximum likelihood median r2 residuals = "
             << toString(results.maximumLikelihoodMedianR2Residuals());

    for (int i = 0; i < results.numberMaximumLikelihoodModels(); i++) {
      qDebug() << "maximum likelihood index,model,quantile = [" << toString(i)
@@ -234,6 +254,7 @@ int main(int argc, char *argv[]) {
      results.setNumberObservations(0);
      results.resetNumberConstrainedPointParameters();
      results.resetNumberConstrainedImageParameters();
      results.resetNumberConstrainedTargetParameters();
      results.setNumberUnknownParameters(1);
      results.computeSigma0(1.0, BundleSettings::Sigma0);
    } 
@@ -244,6 +265,7 @@ int main(int argc, char *argv[]) {
      results.setNumberObservations(1);
      results.resetNumberConstrainedPointParameters();
      results.resetNumberConstrainedImageParameters();
      results.resetNumberConstrainedTargetParameters();
      results.setNumberUnknownParameters(1);
      results.computeSigma0(1.0, BundleSettings::Sigma0);
    }