Unverified Commit e80a03bc authored by Christopher Ryan Combs Jr's avatar Christopher Ryan Combs Jr Committed by GitHub
Browse files

Merge pull request #332 from USGS-Astrogeology/ipceBundleWindow

Merge 'ipceBundleWindow' into 'ipce'
parents c7037644 db5060fd
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -42,3 +42,4 @@ print.prt
*/tsts/*/input/*
*/tsts/*/input/*
*/tsts/*/truth/*
*/tsts/*/truth/*
*/tsts/*/output/*
*/tsts/*/output/*
data/
+24 −8
Original line number Original line Diff line number Diff line
@@ -359,7 +359,7 @@ namespace Isis {
   *   @todo answer comments with questions, TODO, ???, and !!!
   *   @todo answer comments with questions, TODO, ???, and !!!
   */
   */
  void BundleAdjust::init(Progress *progress) {
  void BundleAdjust::init(Progress *progress) {

    emit(statusUpdate("Initialization"));
    m_previousNumberImagePartials = 0;
    m_previousNumberImagePartials = 0;


    // initialize
    // initialize
@@ -710,6 +710,7 @@ namespace Isis {
   *                           mode. Fixes #4483.
   *                           mode. Fixes #4483.
   */
   */
  bool BundleAdjust::solveCholesky() {
  bool BundleAdjust::solveCholesky() {
    emit(statusBarUpdate("Solving"));
    try {
    try {


      // throw error if a frame camera is included AND
      // throw error if a frame camera is included AND
@@ -766,7 +767,7 @@ namespace Isis {


      for (;;) {
      for (;;) {


        emit iterationUpdate(m_iteration, m_bundleResults.sigma0());
        emit iterationUpdate(m_iteration);


        // testing
        // testing
        if (m_abort) {
        if (m_abort) {
@@ -870,7 +871,7 @@ namespace Isis {
                                  .arg(m_bundleResults.numberUnknownParameters()));
                                  .arg(m_bundleResults.numberUnknownParameters()));
        emit statusUpdate(QString("Degrees of Freedom: %1 \n")
        emit statusUpdate(QString("Degrees of Freedom: %1 \n")
                                  .arg(m_bundleResults.degreesOfFreedom()));
                                  .arg(m_bundleResults.degreesOfFreedom()));
        emit iterationUpdate(m_iteration, m_bundleResults.sigma0());
        emit iterationUpdate(m_iteration);


        // check for convergence
        // check for convergence
        if (m_bundleSettings->convergenceCriteria() == BundleSettings::Sigma0) {
        if (m_bundleSettings->convergenceCriteria() == BundleSettings::Sigma0) {
@@ -896,6 +897,7 @@ namespace Isis {
            else { // otherwise iterations are complete
            else { // otherwise iterations are complete
              m_bundleResults.setConverged(true);
              m_bundleResults.setConverged(true);
              emit statusUpdate("Bundle has converged\n");
              emit statusUpdate("Bundle has converged\n");
              emit statusBarUpdate("Converged");
              break;
              break;
            }
            }
          }
          }
@@ -915,6 +917,7 @@ namespace Isis {
          if ( numConvergedParams == numImgParams ) {
          if ( numConvergedParams == numImgParams ) {
            m_bundleResults.setConverged(true);
            m_bundleResults.setConverged(true);
            emit statusUpdate("Bundle has converged\n");
            emit statusUpdate("Bundle has converged\n");
            emit statusBarUpdate("Converged");
            break;
            break;
          }
          }
        }
        }
@@ -931,6 +934,7 @@ namespace Isis {


        // check for maximum iterations
        // check for maximum iterations
        if (m_iteration >= m_bundleSettings->convergenceCriteriaMaximumIterations()) {
        if (m_iteration >= m_bundleSettings->convergenceCriteriaMaximumIterations()) {
          emit(statusBarUpdate("Max Iterations Reached"));
          break;
          break;
        }
        }


@@ -987,6 +991,7 @@ namespace Isis {
    catch (IException &e) {
    catch (IException &e) {
      m_bundleResults.setConverged(false);
      m_bundleResults.setConverged(false);
      emit statusUpdate("\n aborting...");
      emit statusUpdate("\n aborting...");
      emit statusBarUpdate("Failed to Converge");
      emit finished();
      emit finished();
      QString msg = "Could not solve bundle adjust.";
      QString msg = "Could not solve bundle adjust.";
      throw IException(e, e.errorType(), msg, _FILEINFO_);
      throw IException(e, e.errorType(), msg, _FILEINFO_);
@@ -1027,6 +1032,7 @@ namespace Isis {
   * @see BundleAdjust::formWeightedNormals
   * @see BundleAdjust::formWeightedNormals
   */
   */
  bool BundleAdjust::formNormalEquations() {
  bool BundleAdjust::formNormalEquations() {
    emit(statusBarUpdate("Forming Normal Equations"));
    bool status = false;
    bool status = false;


    m_bundleResults.setNumberObservations(0);// ???
    m_bundleResults.setNumberObservations(0);// ???
@@ -1072,7 +1078,7 @@ namespace Isis {
    outputBundleStatus("\n\n");
    outputBundleStatus("\n\n");
    
    
    for (int i = 0; i < num3DPoints; i++) {
    for (int i = 0; i < num3DPoints; i++) {

      emit(pointUpdate(i+1));
      BundleControlPointQsp point = m_bundleControlPoints.at(i);
      BundleControlPointQsp point = m_bundleControlPoints.at(i);


      if (point->isRejected()) {
      if (point->isRejected()) {
@@ -2137,7 +2143,7 @@ namespace Isis {
   * apply parameter corrections for solution.
   * apply parameter corrections for solution.
   */
   */
  void BundleAdjust::applyParameterCorrections() {
  void BundleAdjust::applyParameterCorrections() {

    emit(statusBarUpdate("Updating Parameters"));
    int t = 0;
    int t = 0;


    // TODO - update target body parameters if in solution
    // TODO - update target body parameters if in solution
@@ -2272,6 +2278,7 @@ namespace Isis {
   *                           image sample and line residuals.
   *                           image sample and line residuals.
   */
   */
  double BundleAdjust::computeResiduals() {
  double BundleAdjust::computeResiduals() {
    emit(statusBarUpdate("Computing Residuals"));
    double vtpv = 0.0;
    double vtpv = 0.0;
    double vtpvControl = 0.0;
    double vtpvControl = 0.0;
    double vtpvImage = 0.0;
    double vtpvImage = 0.0;
@@ -2680,7 +2687,7 @@ namespace Isis {
   *                           Blocking and Filling point covariance messages. References #4463.
   *                           Blocking and Filling point covariance messages. References #4463.
   */
   */
  bool BundleAdjust::errorPropagation() {
  bool BundleAdjust::errorPropagation() {

    emit(statusBarUpdate("Error Propagation"));
    // free unneeded memory
    // free unneeded memory
    cholmod_free_triplet(&m_cholmodTriplet, &m_cholmodCommon);
    cholmod_free_triplet(&m_cholmodTriplet, &m_cholmodCommon);
    cholmod_free_sparse(&m_cholmodNormal, &m_cholmodCommon);
    cholmod_free_sparse(&m_cholmodNormal, &m_cholmodCommon);
@@ -2830,7 +2837,7 @@ namespace Isis {
      // now loop over all object points to sum contributions into 3x3 point covariance matrix
      // now loop over all object points to sum contributions into 3x3 point covariance matrix
      int pointIndex = 0;
      int pointIndex = 0;
      for (j = 0; j < numObjectPoints; j++) {
      for (j = 0; j < numObjectPoints; j++) {

        emit(pointUpdate(j+1));
        BundleControlPointQsp point = m_bundleControlPoints.at(pointIndex);
        BundleControlPointQsp point = m_bundleControlPoints.at(pointIndex);
        if ( point->isRejected() ) {
        if ( point->isRejected() ) {
          continue;
          continue;
@@ -2847,7 +2854,6 @@ namespace Isis {
          status.append(" of ");
          status.append(" of ");
          status.append(QString::number(numObjectPoints));
          status.append(QString::number(numObjectPoints));
          outputBundleStatus(status);
          outputBundleStatus(status);
          emit iterationUpdate(i+1, j+1);
        }
        }


        // get corresponding Q matrix
        // get corresponding Q matrix
@@ -3144,6 +3150,16 @@ namespace Isis {
  }
  }




    /**
   * Returns if the BundleAdjust has been aborted.
   *
   * @return @b bool If the BundleAdjust was aborted.
   */
  bool BundleAdjust::isAborted() {
    return m_abort;
  }


  /**
  /**
   * Returns the iteration summary string.
   * Returns the iteration summary string.
   *
   *
+6 −1
Original line number Original line Diff line number Diff line
@@ -292,6 +292,8 @@ namespace Isis {
   *                           constructor in the BundleSolutionInfo class because it is derived
   *                           constructor in the BundleSolutionInfo class because it is derived
   *                           from QObject. Note that we ultimately want to return a QSharedPointer
   *                           from QObject. Note that we ultimately want to return a QSharedPointer
   *                           instead of a raw pointer.
   *                           instead of a raw pointer.
   *   @history 2018-06-14 Christopher Combs - Added getter method to tell if a bundle adjust was
   *                           aborted. Added emits for status updates to the run widget.
   *   @history 2018-06-18 Makayla Shepherd - Stopped command line output for ipce BundleAdjust. 
   *   @history 2018-06-18 Makayla Shepherd - Stopped command line output for ipce BundleAdjust. 
   *                           Fixes #4171.
   *                           Fixes #4171.
   */
   */
@@ -326,6 +328,7 @@ namespace Isis {
      BundleSolutionInfo*    solveCholeskyBR();
      BundleSolutionInfo*    solveCholeskyBR();


      QList<ImageList *> imageLists();
      QList<ImageList *> imageLists();
      bool isAborted();


    public slots:
    public slots:
      bool solveCholesky();
      bool solveCholesky();
@@ -347,7 +350,9 @@ namespace Isis {
    signals:
    signals:
      void statusUpdate(QString);
      void statusUpdate(QString);
      void error(QString);
      void error(QString);
      void iterationUpdate(int, double);
      void iterationUpdate(int);
      void pointUpdate(int);
      void statusBarUpdate(QString);
      void resultsReady(BundleSolutionInfo *bundleSolveInformation);
      void resultsReady(BundleSolutionInfo *bundleSolveInformation);
      void finished();
      void finished();


+20 −6
Original line number Original line Diff line number Diff line
@@ -51,7 +51,7 @@ namespace Isis {
    m_createInverseMatrix  = false;
    m_createInverseMatrix  = false;


    m_outlierRejection     = false;
    m_outlierRejection     = false;
    m_outlierRejectionMultiplier = 1.0;
    m_outlierRejectionMultiplier = 3.0;


    // Parameter Uncertainties (Weighting)
    // Parameter Uncertainties (Weighting)
    m_globalLatitudeAprioriSigma  = Isis::Null;
    m_globalLatitudeAprioriSigma  = Isis::Null;
@@ -271,7 +271,7 @@ namespace Isis {
      m_outlierRejectionMultiplier = multiplier;
      m_outlierRejectionMultiplier = multiplier;
    }
    }
    else {
    else {
      m_outlierRejectionMultiplier = 1.0;
      m_outlierRejectionMultiplier = 3.0;
    }
    }
  }
  }


@@ -450,14 +450,17 @@ namespace Isis {
  BundleObservationSolveSettings
  BundleObservationSolveSettings
      BundleSettings::observationSolveSettings(QString observationNumber) const {
      BundleSettings::observationSolveSettings(QString observationNumber) const {


    BundleObservationSolveSettings defaultSolveSettings;

    for (int i = 0; i < numberSolveSettings(); i++) {
    for (int i = 0; i < numberSolveSettings(); i++) {
      if (m_observationSolveSettings[i].observationNumbers().contains(observationNumber)) {
      if (m_observationSolveSettings[i].observationNumbers().contains(observationNumber)) {
        return m_observationSolveSettings[i];
        return m_observationSolveSettings[i];
      }
      }
    }
    }
    QString msg = "Unable to find BundleObservationSolveSettings for observation number ["
    return defaultSolveSettings;
                  + observationNumber + "].";
    //QString msg = "Unable to find BundleObservationSolveSettings for observation number ["
    throw IException(IException::Unknown, msg, _FILEINFO_);
    //              + observationNumber + "].";
   // throw IException(IException::Unknown, msg, _FILEINFO_);
  }
  }




@@ -484,6 +487,17 @@ namespace Isis {
  }
  }




  /**
   * Retrieves solve settings for the observation corresponding to the given index.
   *
   * @return QList<BundleObservationSolveSettings> The QList of BundleObservationSolveSettings
   *                              objects
   */
  QList<BundleObservationSolveSettings> BundleSettings::observationSolveSettings() const {
    return m_observationSolveSettings;
  } 


  // =============================================================================================//
  // =============================================================================================//
  // ======================== Convergence Criteria ===============================================//
  // ======================== Convergence Criteria ===============================================//
  // =============================================================================================//
  // =============================================================================================//
@@ -1154,7 +1168,7 @@ namespace Isis {
                = toDouble(outlierRejectionMultiplierStr);
                = toDouble(outlierRejectionMultiplierStr);
          }
          }
          else {
          else {
            m_xmlHandlerBundleSettings->m_outlierRejectionMultiplier = 1.0;
            m_xmlHandlerBundleSettings->m_outlierRejectionMultiplier = 3.0;
          }
          }
        }
        }
      }
      }
+3 −0
Original line number Original line Diff line number Diff line
@@ -106,6 +106,8 @@ namespace Isis {
   *                              is for creating and displaying the correlation matrix, which is
   *                              is for creating and displaying the correlation matrix, which is
   *                              currently not working.
   *                              currently not working.
   *                           2) commented out hdf5 header includes in cpp
   *                           2) commented out hdf5 header includes in cpp
   *   @history 2018-06-28 Christopher Combs - Added observationSolveSettings() method to retrieve
   *                            m_observationSolveSettings. Fixes #497.
   *
   *
   *   @todo Determine which XmlStackedHandlerReader constructor is preferred
   *   @todo Determine which XmlStackedHandlerReader constructor is preferred
   *   @todo Determine which XmlStackedHandler needs a Project pointer (see constructors)
   *   @todo Determine which XmlStackedHandler needs a Project pointer (see constructors)
@@ -175,6 +177,7 @@ namespace Isis {
      int numberSolveSettings() const;
      int numberSolveSettings() const;
      BundleObservationSolveSettings observationSolveSettings(QString instrumentId) const;
      BundleObservationSolveSettings observationSolveSettings(QString instrumentId) const;
      BundleObservationSolveSettings observationSolveSettings(int n) const;
      BundleObservationSolveSettings observationSolveSettings(int n) const;
      QList<BundleObservationSolveSettings> observationSolveSettings() const; 




      //=====================================================================//
      //=====================================================================//
Loading