Commit 28fb5798 authored by Kristin Berry's avatar Kristin Berry Committed by Jesse Mapel
Browse files

Updates Bundle Observation Vector to support Csm observations. (#4457)



* Remove duplicated member variables and accesor functions from BundleObservation and add Csm camera type to Camera enum

* Remove commented-out code

* Imagecoeff migrated into BundleObservation class working

* Get base level working for all coeffs in ISIS

* Fix accidental move into if statement to get tests passing again

* Updated RHS for CsmBundleObservation to work

* Adds point3D support to CSM Camera observations and also adds ground Partials member function to CSMCamera

* Draft of sensor partials code

* Add docs, some fixes based on review requests

* move computation of weights and observation values to bundle observations

* Add observationvalue function to CsmBundleObservation and move the weighting that it is possible to to the observation classes

* Make CSMSolveSet an optional parameter to get jigsaw tests passing again

* cleanup

* Move observation weights into MLE if block

* Added isis vs. csm support to Bundle Observation Vector class to allow jigsaw to proceed past the setup stage for csm networks

* Comment cleanup

* Fix failing unit tests

* Add docs

* Updated based on feedback with potentially temporary fix to get unit tests passing

* Update tests a bit

* Aligned signature definitions and cleaned up

* remove unneeded functions

* More comment cleanup

Co-authored-by: default avatarKristin Berry <kberry@gyro.wr.usgs.gov>
parent 8709485b
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -436,16 +436,6 @@ namespace Isis {
        }
      }

      // initialize exterior orientation (spice) for all BundleImages in all BundleObservations
      // 
      // TODO!!! - should these initializations just be done when we add the new observation above?
      m_bundleObservations.initializeExteriorOrientation();

      // TODO
      if (m_bundleSettings->solveTargetBody()) {
        m_bundleObservations.initializeBodyRotation();
      }

      // set up vector of BundleControlPoints
      int numControlPoints = m_controlNet->GetNumPoints();
      for (int i = 0; i < numControlPoints; i++) {
+5 −3
Original line number Diff line number Diff line
@@ -45,8 +45,10 @@ namespace Isis {
      virtual AbstractBundleObservation &operator=(const AbstractBundleObservation &src);

      // copy method
      // not implementedn in BundleObservation either???
//      virtual void copy(const AbstractBundleObservation &src);

      void copy(const AbstractBundleObservation &src);

      virtual bool setSolveSettings(BundleObservationSolveSettings solveSettings) = 0;

      virtual void append(const BundleImageQsp &value);

+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ namespace Isis {
      // copy method
      void copy(const BundleObservation &src);

      bool setSolveSettings(BundleObservationSolveSettings solveSettings);
      virtual bool setSolveSettings(BundleObservationSolveSettings solveSettings);

      int numberPositionParameters();
      int numberPointingParameters();
+38 −47
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@ find files of those names at the top level of this repository. **/

#include "AbstractBundleObservation.h"
#include "BundleObservation.h"
#include "Camera.h"
#include "CsmBundleObservation.h"
#include "IException.h"

namespace Isis {
@@ -101,7 +103,6 @@ namespace Isis {
    AbstractBundleObservationQsp bundleObservation;
    bool addToExisting = false;

    // TODO it looks like this can just become 1 if statement
    if (bundleSettings->solveObservationMode() &&
        m_observationNumberToObservationMap.contains(observationNumber)) {
      bundleObservation = m_observationNumberToObservationMap.value(observationNumber);
@@ -124,13 +125,30 @@ namespace Isis {
    }
    else {
      // create new BundleObservation and append to this vector
      BundleObservation *isisObservation = new BundleObservation(bundleImage,

      bool isIsisObservation = true;

      // This NULL check is needed solely for the unit test
      if (bundleImage->camera() != NULL) {
        isIsisObservation = bundleImage->camera()->GetCameraType() != Camera::Csm;
      }

      AbstractBundleObservation *observation = NULL;

      if (isIsisObservation) {
        observation = new BundleObservation(bundleImage,
                                            observationNumber,
                                            instrumentId,
                                            bundleSettings->bundleTargetBody());
      }
      else {
        observation = new CsmBundleObservation(bundleImage,
                                               observationNumber,
                                               instrumentId,
                                               bundleSettings->bundleTargetBody());
      }


      if (!isisObservation) {
      if (!observation) {
        QString message = "Unable to allocate new BundleObservation ";
        message += "for " + bundleImage->fileName();
        throw IException(IException::Programmer, message, _FILEINFO_);
@@ -148,9 +166,8 @@ namespace Isis {
        solveSettings = bundleSettings->observationSolveSettings(observationNumber);
      }

      isisObservation->setSolveSettings(solveSettings);

      bundleObservation.reset(isisObservation);
      observation->setSolveSettings(solveSettings);
      bundleObservation.reset(observation);

      bundleObservation->setIndex(size());

@@ -158,6 +175,17 @@ namespace Isis {

      append(bundleObservation);

      if (isIsisObservation) {
        QSharedPointer<BundleObservation> isisObs = qSharedPointerDynamicCast<BundleObservation>(bundleObservation);
        // This check is needed for the current unit test
        if (bundleImage->camera() != NULL) {
          isisObs->initializeExteriorOrientation();
          if (bundleSettings->solveTargetBody()) {
            isisObs->initializeBodyRotation();
          }
        }
      }

      // update observation number to observation ptr map
      m_observationNumberToObservationMap.insertMulti(observationNumber, bundleObservation);

@@ -233,41 +261,4 @@ namespace Isis {
    std::reverse(std::begin(list), std::end(list));
    return list;
  }


  /**
   * Initializes the exterior orientations for the contained ISIS
   * BundleObservations.
   *
   * @return @b bool Returns true upon successful initialization
   */
  bool BundleObservationVector::initializeExteriorOrientation() {
    // get isis observations
    // get csm observations
    int nObservations = size();
    // just do it for ISIS observations
    for (int i = 0; i < nObservations; i++) {
      // TODO: how to only do this if ISIS observations
      QSharedPointer<BundleObservation> observation = qSharedPointerDynamicCast<BundleObservation>( at(i) );
      observation->initializeExteriorOrientation();
    }
    return true;
  }


  /**
   * Initializes the body rotations for the contained BundleObservations.
   *
   * @return @b bool Returns true upon successful initialization
   */
  bool BundleObservationVector::initializeBodyRotation() {
    int nObservations = size();
    //TODO: just do it for ISIS observations
    for (int i = 0; i < nObservations; i++) {
    QSharedPointer<BundleObservation> observation = qSharedPointerDynamicCast<BundleObservation>( at(i) );
      observation->initializeBodyRotation();
    }

    return true;
  }
}
+1 −8
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ find files of those names at the top level of this repository. **/
#include "BundleImage.h"
#include "AbstractBundleObservation.h"
#include "BundleObservation.h"
#include "CsmBundleObservation.h"
#include "BundleSettings.h"

namespace Isis {
@@ -71,14 +72,6 @@ namespace Isis {
      QList<QString> instrumentIds() const;
      QList<AbstractBundleObservationQsp> observationsByInstId(QString instrumentId) const;

      bool initializeExteriorOrientation();
      bool initializeBodyRotation();

      // To add:
      // getCsmObservations()
      // getIsisObservations()
      // addNewIsis()?

  private:
      //! Map between observation number and pointer to observation.
      QMap<QString, AbstractBundleObservationQsp> m_observationNumberToObservationMap;
Loading