Unverified Commit c1adabcf authored by Jesse Mapel's avatar Jesse Mapel Committed by GitHub
Browse files

csm bundle building properly (#4409)

* Updates for linking and compiling

* Starting virtual functions
parent 3ccdcf33
Loading
Loading
Loading
Loading
+5 −67
Original line number Diff line number Diff line
@@ -34,12 +34,9 @@ namespace Isis {
    m_parameterNamesList.clear();
    m_observationNumber = "";
    m_instrumentId = "";
    m_instrumentRotation = NULL;
    m_instrumentPosition = NULL;
    m_index = 0;
    m_weights.clear();
    m_corrections.clear();
//    m_solution.clear();
    m_aprioriSigmas.clear();
    m_adjustedSigmas.clear();
  }
@@ -61,45 +58,20 @@ namespace Isis {
    m_parameterNamesList.clear();
    m_observationNumber = "";
    m_instrumentId = "";
    m_instrumentRotation = NULL;
    m_instrumentPosition = NULL;
    m_index = 0;
    m_weights.clear();
    m_corrections.clear();
//    m_solution.clear();
    m_aprioriSigmas.clear();
    m_adjustedSigmas.clear();

    m_observationNumber = observationNumber;
    m_instrumentId = instrumentId;

    m_bundleTargetBody = bundleTargetBody;

    if (image) {
      append(image);
      m_serialNumbers.append(image->serialNumber());
      m_imageNames.append(image->fileName());
      m_cubeSerialNumberToBundleImageMap.insert(image->serialNumber(), image);

      // set the observations spice position and rotation objects from the primary image in the
      // observation (this is, by design at the moment, the first image added to the observation)
      // if the image, camera, or instrument position/orientation is null, then set to null
      m_instrumentPosition = (image->camera() ?
                               (image->camera()->instrumentPosition() ?
                                 image->camera()->instrumentPosition() : NULL)
                               : NULL);
      m_instrumentRotation = (image->camera() ?
                               (image->camera()->instrumentRotation() ?
                                  image->camera()->instrumentRotation() : NULL)
                               : NULL);

      // set the observations target body spice rotation object from the primary image in the
      // observation (this is, by design at the moment, the first image added to the observation)
      // if the image, camera, or instrument position/orientation is null, then set to null
//      m_bodyRotation = (image->camera() ?
//                           (image->camera()->bodyRotation() ?
//                             image->camera()->bodyRotation() : NULL)
//                           : NULL);
    }
  }

@@ -116,9 +88,6 @@ namespace Isis {
    m_observationNumber = src.m_observationNumber;
    m_instrumentId = src.m_instrumentId;

    m_instrumentPosition = src.m_instrumentPosition;
    m_instrumentRotation = src.m_instrumentRotation;

    m_solveSettings = src.m_solveSettings;

    m_index = src.m_index;
@@ -152,9 +121,6 @@ namespace Isis {
      m_observationNumber = src.m_observationNumber;
      m_instrumentId = src.m_instrumentId;

      m_instrumentPosition = src.m_instrumentPosition;
      m_instrumentRotation = src.m_instrumentRotation;

      m_solveSettings = src.m_solveSettings;
    }
    return *this;
@@ -267,33 +233,14 @@ namespace Isis {
  /**
   * Accesses the solve settings
   *
   * @return @b const AbstractBundleObservationSolveSettingsQsp Returns a pointer to the solve
   * @return @b const BundleObservationSolveSettingsQsp Returns a pointer to the solve
   *                                                    settings for this AbstractBundleObservation
   */
  const AbstractBundleObservationSolveSettingsQsp AbstractBundleObservation::solveSettings() {
  const BundleObservationSolveSettingsQsp AbstractBundleObservation::solveSettings() {
    return m_solveSettings;
  }


  /**
   * Initializes the paramater weights for solving
   *
   * @return @b bool Returns true upon successful intialization
   *
   * @internal
   *   @todo Don't like this, don't like this, don't like this, don't like this, don't like this.
   *         By the way, this seems klunky to me, would like to come up with a better way.
   *         Also, apriori sigmas are in two places, the AbstractBundleObservationSolveSettings AND in the
   *         the AbstractBundleObservation class too - this is unnecessary should only be in the
   *         AbstractBundleObservationSolveSettings. But, they are split into position and pointing.
   *
   *   @todo always returns true?
   */
  bool AbstractBundleObservation::initParameterWeights() {
    // will be different for ISIS and CSM
  }


  /**
   * Applies the parameter corrections
   *
@@ -373,15 +320,6 @@ QString AbstractBundleObservation::formatBundleOutputString(bool errorPropagatio
}


// FIXME: if this is going to stay, needs to not take position and pointing
  void AbstractBundleObservation::bundleOutputFetchData(QVector<double> &finalParameterValues,
                          int &nPositionCoefficients, int &nPointingCoefficients,
                          bool &useDefaultPosition,
                          bool &useDefaultPointing, bool &useDefaultTwist) {
    // different for both, solve settings is a problem.
  }


  /**
   * @brief Takes in an open std::ofstream and writes out information which goes into the
   * bundleout.txt file.
+4 −11
Original line number Diff line number Diff line
@@ -37,13 +37,13 @@ namespace Isis {
      AbstractBundleObservation(const AbstractBundleObservation &src);

      // destructor
      ~AbstractBundleObservation();
      virtual ~AbstractBundleObservation();

      // equals operator
      AbstractBundleObservation &operator=(const AbstractBundleObservation &src);
      virtual AbstractBundleObservation &operator=(const AbstractBundleObservation &src);

      // copy method
      void copy(const AbstractBundleObservation &src);
      virtual void copy(const AbstractBundleObservation &src);

      void append(const BundleImageQsp &value);

@@ -66,13 +66,6 @@ namespace Isis {
      bool applyParameterCorrections(LinearAlgebra::Vector corrections);


      // FIXME: if this stays, needs to not use position/pointing
      void bundleOutputFetchData(QVector<double> &finalParameterValues,
                            int &nPositionCoefficients, int &nPointingCoefficients,
                            bool &useDefaultPosition, bool &useDefaultPointing,
                            bool &useDefaultTwist);


      void bundleOutputString(std::ostream &fpOut,bool errorPropagation);
      QString bundleOutputCSV(bool errorPropagation);

+13 −8
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ find files of those names at the top level of this repository. **/
#include <QDebug>

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

namespace Isis {
@@ -96,6 +97,7 @@ 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);
@@ -118,19 +120,18 @@ namespace Isis {
    }
    else {
      // create new BundleObservation and append to this vector
      bundleObservation = AbstractBundleObservationQsp(new AbstractBundleObservation(bundleImage,
      BundleObservation *isisObservation = new BundleObservation(bundleImage,
                                                                 observationNumber,
                                                                 instrumentId,
                                               bundleSettings->bundleTargetBody()));
                                                                 bundleSettings->bundleTargetBody());

      if (!bundleObservation) {

      if (!isisObservation) {
        QString message = "Unable to allocate new BundleObservation ";
        message += "for " + bundleImage->fileName();
        throw IException(IException::Programmer, message, _FILEINFO_);
      }

      bundleImage->setParentObservation(bundleObservation);

      // Find the bundle observation solve settings for this new observation
      BundleObservationSolveSettings solveSettings;
      // When there is only one bundle observation solve setting, use it for all observations
@@ -143,10 +144,14 @@ namespace Isis {
        solveSettings = bundleSettings->observationSolveSettings(observationNumber);
      }

      bundleObservation->setSolveSettings(solveSettings);
      isisObservation->setSolveSettings(solveSettings);

      bundleObservation.reset(isisObservation);

      bundleObservation->setIndex(size());

      bundleImage->setParentObservation(bundleObservation);

      append(bundleObservation);

      // update observation number to observation ptr map