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

Add hooks for csm bundle settings to jigsaw (#4438)



* In progress

* Added tests and Pvl support

* Add missing 'y' to docs

Co-authored-by: default avatarKristin Berry <kberry@usgs.gov>
parent 72f2fbfb
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -443,6 +443,29 @@ namespace Isis {
                                                              positionVelocityAprioriSigma,
                                                              positionAccelerationAprioriSigma);

      if ((ui.WasEntered("CSMSOLVESET")  && ui.WasEntered("CSMSOLVETYPE")) ||
          (ui.WasEntered("CSMSOLVESET")  && ui.WasEntered("CSMSOLVELIST")) ||
          (ui.WasEntered("CSMSOLVETYPE") && ui.WasEntered("CSMSOLVELIST")) ) {
        QString msg = "Only one of CSMSOLVESET, CSMSOLVETYPE, and CSMSOLVELIST "
                      "can be specified at a time.";
        throw IException(IException::User, msg, _FILEINFO_);
      }

      if (ui.WasEntered("CSMSOLVESET")) {
        observationSolveSettings.setCSMSolveSet(
            BundleObservationSolveSettings::stringToCSMSolveSet(ui.GetString("CSMSOLVESET")));
      }
      else if (ui.WasEntered("CSMSOLVETYPE")) {
        observationSolveSettings.setCSMSolveType(
            BundleObservationSolveSettings::stringToCSMSolveType(ui.GetString("CSMSOLVETYPE")));
      }
      else if (ui.WasEntered("CSMSOLVELIST")) {
        std::vector<QString> csmParamVector;
        ui.GetString("CSMSOLVELIST", csmParamVector);
        QStringList csmParamList = QStringList::fromVector(QVector<QString>::fromStdVector(csmParamVector));
        observationSolveSettings.setCSMSolveParameterList(csmParamList);
      }

      // add all image observation numbers to this BOSS.
      for (int sn = 0; sn < cubeSNs.size(); sn++) {
        observationSolveSettings.addObservationNumber(cubeSNs.observationNumber(sn));
@@ -450,6 +473,7 @@ namespace Isis {

      // append the GUI acquired solve parameters to BOSS list.
      observationSolveSettingsList.append(observationSolveSettings);

    }


+78 −1
Original line number Diff line number Diff line
@@ -1020,6 +1020,83 @@
      </parameter>
    </group>

    <group name="Community Sensor Model Options">
      <parameter name="CSMSOLVESET">
        <type>string</type>
        <brief>Specify a set of a CSM parameters to solve for.</brief>
        <description>
          Specify one of the parameter sets from the CSM GeometricModel API to solve for.
          All parameters belonging to the specified set will be solved for.
        </description>
        <exclusions>
          <item>CSMSOLVETYPE</item>
          <item>CSMSOLVELIST</item>
        </exclusions>
        <list>
          <option value="VALID">
            <brief> Solves for CSM parameters that are not NONE.</brief>
          </option>
          <option value="ADJUSTABLE">
            <brief>Solves for real or fictitous CSM parameters.</brief>
          </option>
          <option value="NONADJUSTABLE">
            <brief>Solves for fixed CSM parameters.</brief>
            <description>
              Solve for fixed CSM parameters. These parameters are generally not adjusted
              but do have uncertainty which can help constrain the solutions and improve
              a posteriori uncertainties for other parameters.
            </description>
          </option>
        </list>
      </parameter>

      <parameter name="CSMSOLVETYPE">
        <type>string</type>
        <brief>Specify a type of a CSM parameters to solve for.</brief>
        <description>
          Specify a parameter type from the CSM GeometricModel API to solve for.
          All parameters of the specified type will be solved for.
        </description>
        <exclusions>
          <item>CSMSOLVESET</item>
          <item>CSMSOLVELIST</item>
        </exclusions>
        <list>
          <option value="NONE">
            <brief>Solve for unitialized CSM parameters</brief>
          </option>
          <option value="FICTITIOUS">
            <brief>Solve for CSM parameters calculted by resection</brief>
          </option>
          <option value="REAL">
            <brief>Solve for measured CSM parameters</brief>
          </option>
          <option value="FIXED">
            <brief>Solve for fixed CSM parameters</brief>
          </option>
          <description>
            Solve for fixed CSM parameters. These parameters are generally not adjusted
            but do have uncertainty which can help constrain the solutions and improve
            a posteriori uncertainties for other parameters.
          </description>
        </list>
      </parameter>

      <parameter name="CSMSOLVELIST">
        <type>string</type>
        <brief>Specify an explicit list of CSM parameters to solve for.</brief>
        <description>
          All CSM parameters in this list will be solved for. Trailing and leading whitespace
          will be stripped off. Use standard ISIS parameter array notation to specify multiple
          parameters.
        </description>
        <exclusions>
          <item>CSMSOLVESET</item>
          <item>CSMSOLVETYPE</item>
        </exclusions>
      </parameter>
    </group>

    <group name="Target Body">
      <parameter name="SOLVETARGETBODY">
        <type>boolean</type>
+0 −3
Original line number Diff line number Diff line
@@ -541,9 +541,6 @@ namespace Isis {
      }
    }
    return defaultSolveSettings;
    //QString msg = "Unable to find BundleObservationSolveSettings for observation number ["
    //              + observationNumber + "].";
   // throw IException(IException::Unknown, msg, _FILEINFO_);
  }


+97 −3
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ namespace Isis {
      m_ckDegree = (int)(scParameterGroup.findKeyword("CKDEGREE"));
    }

    // If CKSOLVEDEGREE is not specified, then a default of 2 is used -------jwb----- why ??? why not match camsolve option ???
    // If CKSOLVEDEGREE is not specified, then a default of 2 is used
    if (scParameterGroup.hasKeyword("CKSOLVEDEGREE")) {
      m_ckSolveDegree = (int) (scParameterGroup.findKeyword("CKSOLVEDEGREE"));
    }
@@ -237,6 +237,22 @@ namespace Isis {
        }
      }
    }

    // CSM settings
    if (scParameterGroup.hasKeyword("CSMSOLVESET")) {
      setCSMSolveSet(stringToCSMSolveSet(scParameterGroup.findKeyword("CSMSOLVESET")));
    }
    else if (scParameterGroup.hasKeyword("CSMSOLVETYPE")) {
      setCSMSolveType(stringToCSMSolveType(scParameterGroup.findKeyword("CSMSOLVETYPE")));
    }
    else if (scParameterGroup.hasKeyword("CSMSOLVELIST")) {
      PvlKeyword csmSolveListKey = scParameterGroup.findKeyword("CSMSOLVELIST");
      QStringList csmSolveList;
      for (int i = 0; i < csmSolveListKey.size(); i++) {
        csmSolveList.append(csmSolveListKey[i]);
      }
      setCSMSolveParameterList(csmSolveList);
    }
  }


@@ -486,6 +502,84 @@ namespace Isis {
  }



  csm::param::Set BundleObservationSolveSettings::stringToCSMSolveSet(QString set) {
    if (set.compare("VALID", Qt::CaseInsensitive) == 0) {
      return csm::param::VALID;
    }
    else if (set.compare("ADJUSTABLE", Qt::CaseInsensitive) == 0) {
      return csm::param::ADJUSTABLE;
    }
    else if (set.compare("NON_ADJUSTABLE", Qt::CaseInsensitive) == 0) {
      return csm::param::NON_ADJUSTABLE;
    }
    else {
      throw IException(IException::Unknown,
                       "Unknown bundle CSM parameter set " + set + ".",
                       _FILEINFO_);
    }
  }

  QString BundleObservationSolveSettings::csmSolveSetToString(csm::param::Set set) {
    if (set == csm::param::VALID) {
      return "VALID";
    }
    else if (set == csm::param::ADJUSTABLE)  {
      return "ADJUSTABLE";
    }
    else if (set == csm::param::NON_ADJUSTABLE) {
      return "NON_ADJUSTABLE";
    }
    else {
      throw IException(IException::Programmer,
                       "Unknown CSM parameter set enum [" + toString(set) + "].",
                       _FILEINFO_);
    }
  }


  csm::param::Type BundleObservationSolveSettings::stringToCSMSolveType(QString type) {
    if (type.compare("NONE", Qt::CaseInsensitive) == 0) {
      return csm::param::NONE;
    }
    else if (type.compare("FICTITIOUS", Qt::CaseInsensitive) == 0) {
      return csm::param::FICTITIOUS;
    }
    else if (type.compare("REAL", Qt::CaseInsensitive) == 0) {
      return csm::param::REAL;
    }
    else if (type.compare("FIXED", Qt::CaseInsensitive) == 0) {
      return csm::param::FIXED;
    }
    else {
      throw IException(IException::Unknown,
                       "Unknown bundle CSM parameter type " + type + ".",
                       _FILEINFO_);
    }
  }


  QString BundleObservationSolveSettings::csmSolveTypeToString(csm::param::Type type) {
    if (type == csm::param::NONE) {
      return "NONE";
    }
    else if (type == csm::param::FICTITIOUS)  {
      return "FICTITIOUS";
    }
    else if (type == csm::param::REAL) {
      return "REAL";
    }
    else if (type == csm::param::FIXED) {
      return "FIXED";
    }
    else {
      throw IException(IException::Programmer,
                       "Unknown CSM parameter type enum [" + toString(type) + "].",
                       _FILEINFO_);
    }
  }


  void BundleObservationSolveSettings::setCSMSolveSet(csm::param::Set set) {
    m_csmSolveOption = BundleObservationSolveSettings::Set;
    m_csmSolveSet = set;
+4 −0
Original line number Diff line number Diff line
@@ -110,6 +110,10 @@ class BundleObservationSolveSettings {

      static CSMSolveOption stringToCSMSolveOption(QString option);
      static QString csmSolveOptionToString(CSMSolveOption option);
      static csm::param::Set stringToCSMSolveSet(QString set);
      static QString csmSolveSetToString(csm::param::Set set);
      static csm::param::Type stringToCSMSolveType(QString type);
      static QString csmSolveTypeToString(csm::param::Type type);
      void setCSMSolveSet(csm::param::Set set);
      void setCSMSolveType(csm::param::Type type);
      void setCSMSolveParameterList(QStringList list);
Loading