Commit 64b5e60c authored by Tyler Wilson's avatar Tyler Wilson
Browse files

Modified formatBundleOutputString(bool,bool) to support outputting CSV image...

Modified formatBundleOutputString(bool,bool) to support outputting CSV image information.  Fixes #4314

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@7159 41f8697f-d340-4b68-9986-7bafba869bb8
parent 128acbe1
Loading
Loading
Loading
Loading
+107 −5
Original line number Diff line number Diff line
@@ -782,15 +782,19 @@ namespace Isis {


  /**
   * Creates and returns a formatted QString representing the bundle coefficients and 
   * @brief Creates and returns a formatted QString representing the bundle coefficients and
   * parameters
   *
   * @param errorPropagation Boolean indicating whether or not to attach more information
   *     (corrections, sigmas, adjusted sigmas...) to the output QString
   * @param imageCSV Boolean which is set to true if the function is being
   * called from BundleSolutionInfo::outputImagesCSV().  It is set to false by default
   * for backwards compatibility.
   *
   * @return @b QString Returns a formatted QString representing the BundleObservation
   */
  QString BundleObservation::formatBundleOutputString(bool errorPropagation) {
  QString BundleObservation::formatBundleOutputString(bool errorPropagation, bool imageCSV) {

    std::vector<double> coefX;
    std::vector<double> coefY;
    std::vector<double> coefZ;
@@ -823,7 +827,11 @@ namespace Isis {
    // for convenience, create vectors of parameters names and values in the correct sequence
    std::vector<double> finalParameterValues;
    QStringList parameterNamesList;

    if(!imageCSV) {

    QString str("%1(t%2)");

    if (nPositionCoefficients > 0) {
      for (int i = 0; i < nPositionCoefficients; i++) {
        finalParameterValues.push_back(coefX[i]);
@@ -871,11 +879,48 @@ namespace Isis {
      }
    }

    }// end if(!imageCSV)

    else {

      if (nPositionCoefficients > 0) {

        for (int i = 0; i < nPositionCoefficients; i++) {
          finalParameterValues.push_back(coefX[i]);

        }
        for (int i = 0; i < nPositionCoefficients; i++) {
          finalParameterValues.push_back(coefY[i]);

        }
        for (int i = 0; i < nPositionCoefficients; i++) {
          finalParameterValues.push_back(coefZ[i]);

        }
      }
      if (nPointingCoefficients > 0) {
        for (int i = 0; i < nPointingCoefficients; i++) {
          finalParameterValues.push_back(coefRA[i] * RAD2DEG);

        }
        for (int i = 0; i < nPointingCoefficients; i++) {
          finalParameterValues.push_back(coefDEC[i] * RAD2DEG);

        }
        for (int i = 0; i < nPointingCoefficients; i++) {
          finalParameterValues.push_back(coefTWI[i] * RAD2DEG);

        }
      }


    }//end else

    m_parameterNamesList = parameterNamesList;
    QString finalqStr = "";
    QString qStr = "";
    QString sigma = "";

    if (!imageCSV) {
    // position parameters
    for (int i = 0; i < nPositionParameters; i++) {

@@ -930,6 +975,63 @@ namespace Isis {
      finalqStr += qStr;
     }

    }

    else {

      // position parameters
      for (int i = 0; i < nPositionParameters; i++) {

        sigma = ( IsSpecial(m_aprioriSigmas[i]) ? "N/A" : toString(m_aprioriSigmas[i], 8) );

        if (errorPropagation) {
          qStr = QString("%1,%2,%3,%4,%5,").
              //arg( parameterNamesList.at(i) ).
              arg(finalParameterValues[i] - m_corrections(i), 17, 'f', 8).
              arg(m_corrections(i), 21, 'f', 8).
              arg(finalParameterValues[i], 20, 'f', 8).
              arg(sigma, 18).
              arg(m_adjustedSigmas[i], 18, 'f', 8);
        }
        else {
          qStr = QString("%1,%2,%3,%4,%5,").
              //arg( parameterNamesList.at(i) ).
              arg(finalParameterValues[i] - m_corrections(i), 17, 'f', 8).
              arg(m_corrections(i), 21, 'f', 8).
              arg(finalParameterValues[i], 20, 'f', 8).
              arg(sigma, 18).
              arg("N/A", 18);
        }

        finalqStr += qStr;
      }

      // pointing parameters
      for (int i = nPositionParameters; i < nParameters; i++) {

        sigma = ( IsSpecial(m_aprioriSigmas[i]) ? "N/A" : toString(m_aprioriSigmas[i], 8) );

        if (errorPropagation) {
          qStr = QString("%1,%2,%3,%4,%5,").
              arg((finalParameterValues[i] - m_corrections(i) * RAD2DEG), 17, 'f', 8).
              arg(m_corrections(i) * RAD2DEG, 21, 'f', 8).
              arg(finalParameterValues[i], 20, 'f', 8).
              arg(sigma, 18).
              arg(m_adjustedSigmas[i] * RAD2DEG, 18, 'f', 8);
        }
        else {
          qStr = QString("%1,%2,%3,%4,%5,").
              arg((finalParameterValues[i] - m_corrections(i) * RAD2DEG), 17, 'f', 8).
              arg(m_corrections(i) * RAD2DEG, 21, 'f', 8).
              arg(finalParameterValues[i], 20, 'f', 8).
              arg(sigma, 18).
              arg("N/A", 18);
        }

        finalqStr += qStr;
      }

    }
    return finalqStr;
  }

+4 −1
Original line number Diff line number Diff line
@@ -63,6 +63,9 @@ namespace Isis {
   *                           bundle image.  References #4159.
   *   @history 2016-08-23 Ian Humphrey - The applyParameterCorrections() method now throws the
   *                           last exception. Fixes #4153.
   *   @history 2016-10-06 Tyler Wilson - Modified the function formatBundleOutputString so
   *                           that it can be used by BundleSolutionInfo::outputCSVImages()
   *                           function.  Fixes #4314.
   */
  class BundleObservation : public QVector<BundleImageQsp> {

@@ -119,7 +122,7 @@ namespace Isis {
      void initializeBodyRotation();
      void updateBodyRotation();

      QString formatBundleOutputString(bool errorPropagation);
      QString formatBundleOutputString(bool errorPropagation, bool imageCSV=false);
      QStringList parameterList();
      QStringList imageNames();

+5 −41
Original line number Diff line number Diff line
@@ -399,6 +399,7 @@ End_Object
    output bundle observation...



    Set solve settings using with TWIST=FALSE...
Object = NoTwist
  InstrumentPointingSolveOption       = AllPolynomialCoefficients
@@ -419,43 +420,8 @@ Object = NoTwist
End_Object

    output bundle observation...
  X  (t0)       0.00000000           0.00000000          0.00000000               8.0        0.00000000
     (t1)       0.00000000           0.00000000          0.00000000               9.0        0.00000000
     (t2)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t3)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t4)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t5)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t6)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t7)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
  Y  (t0)       0.00000000           0.00000000          0.00000000               8.0        0.00000000
     (t1)       0.00000000           0.00000000          0.00000000               9.0        0.00000000
     (t2)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t3)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t4)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t5)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t6)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t7)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
  Z  (t0)       0.00000000           0.00000000          0.00000000               8.0        0.00000000
     (t1)       0.00000000           0.00000000          0.00000000               9.0        0.00000000
     (t2)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t3)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t4)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t5)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t6)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t7)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
 RA  (t0)       0.00000000           0.00000000          0.00000000               1.0        0.00000000
     (t1)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t2)       0.00000000           0.00000000          0.00000000               3.0        0.00000000
     (t3)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t4)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t5)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
DEC  (t0)       0.00000000           0.00000000          0.00000000               1.0        0.00000000
     (t1)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t2)       0.00000000           0.00000000          0.00000000               3.0        0.00000000
     (t3)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t4)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
     (t5)       0.00000000           0.00000000          0.00000000               N/A        0.00000000

       0.00000000,           0.00000000,          0.00000000,               8.0,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               9.0,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               8.0,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               9.0,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               8.0,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               9.0,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               1.0,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               3.0,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               1.0,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               3.0,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,
       0.00000000,           0.00000000,          0.00000000,               8.0,               N/A,       0.00000000,           0.00000000,          0.00000000,               9.0,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               8.0,               N/A,       0.00000000,           0.00000000,          0.00000000,               9.0,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               8.0,               N/A,       0.00000000,           0.00000000,          0.00000000,               9.0,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               1.0,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               3.0,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               1.0,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               3.0,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,
  X  (t0)       0.00000000           0.00000000          0.00000000               8.0               N/A
     (t1)       0.00000000           0.00000000          0.00000000               9.0               N/A
     (t2)       0.00000000           0.00000000          0.00000000               N/A               N/A
@@ -524,14 +490,12 @@ parameter corrections : 0.0 0.0 0.0
apriori sigmas :        -1.79769313486231e+308     -1.79769313486231e+308     -1.79769313486231e+308     
adjusted sigmas :       0.0     0.0     0.0     
    output bundle observation...
       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,       0.00000000,           0.00000000,          0.00000000,               N/A,               N/A,
 RA  (t0)       0.00000000           0.00000000          0.00000000               N/A               N/A
DEC  (t0)       0.00000000           0.00000000          0.00000000               N/A               N/A
TWI  (t0)       0.00000000           0.00000000          0.00000000               N/A               N/A

 RA  (t0)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
DEC  (t0)       0.00000000           0.00000000          0.00000000               N/A        0.00000000
TWI  (t0)       0.00000000           0.00000000          0.00000000               N/A        0.00000000

       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,       0.00000000,           0.00000000,          0.00000000,               N/A,        0.00000000,
init exterior orientiation successful?   "Yes"
**ERROR** Unable to apply parameter corrections to BundleObservation.
**ERROR** Instrument rotation is NULL, but pointing solve option is AnglesOnly.
+8 −3
Original line number Diff line number Diff line
@@ -466,7 +466,8 @@ int main(int argc, char *argv[]) {
    pvl = bossFromBo.pvlObject("NoCamAngles");
    cout << pvl << endl << endl;
    qDebug() << "    output bundle observation...";
    qDebug().noquote() << bo2.formatBundleOutputString(true);
    qDebug().noquote() << bo2.formatBundleOutputString(true,true);
    qDebug().noquote() << bo2.formatBundleOutputString(false,true);
    qDebug().noquote() << bo2.formatBundleOutputString(false);
    qDebug() << "    Set solve settings using with TWIST=FALSE...";
    bo2.setSolveSettings(bossToFill);
@@ -474,8 +475,11 @@ int main(int argc, char *argv[]) {
    pvl = bossFromBo.pvlObject("NoTwist");
    cout << pvl << endl << endl;
    qDebug() << "    output bundle observation...";
    qDebug().noquote() << bo2.formatBundleOutputString(true);
    qDebug().noquote() << bo2.formatBundleOutputString(true,true);
    qDebug().noquote() << bo2.formatBundleOutputString(false,true);
    qDebug().noquote() << bo2.formatBundleOutputString(false);

    
    qDebug() << "    Set solve settings using with CAMSOLVE=ALL and TWIST=TRUE...";
    bo3.setSolveSettings(bsFromEmptyXml);

@@ -521,8 +525,9 @@ int main(int argc, char *argv[]) {
    // bo3.initializeBodyRotation(); //Seg fault

    qDebug() << "    output bundle observation...";
    qDebug().noquote() << bo3.formatBundleOutputString(false,true);
    qDebug().noquote() << bo3.formatBundleOutputString(false);
    qDebug().noquote() << bo3.formatBundleOutputString(true);
    qDebug().noquote() << bo3.formatBundleOutputString(true,true);
    qDebug() << "init exterior orientiation successful?  " 
             << toString(bo3.initializeExteriorOrientation());
    //TODO: We should not have to catch an exception here, we need to use an observation