Unverified Commit 1a4e41c1 authored by Tracie Sucharski's avatar Tracie Sucharski Committed by GitHub
Browse files

Merge pull request #110 from kledmundson/ipce

Ipce
parents 8dbdf571 476fd45f
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -10,10 +10,6 @@
#include <QXmlStreamWriter>
#include <QXmlInputSource>

#include <H5Cpp.h>
#include <hdf5_hl.h>
#include <hdf5.h>

#include "BundleObservationSolveSettings.h"
//#include "FileName.h"currently only used in commented code
#include "IException.h"
@@ -52,7 +48,7 @@ namespace Isis {
    m_solveRadius          = false;
    m_updateCubeLabel      = false;
    m_errorPropagation     = false;
    m_createInverseMatrix  = true;
    m_createInverseMatrix  = false;

    m_outlierRejection     = false;
    m_outlierRejectionMultiplier = 1.0;
+5 −0
Original line number Diff line number Diff line
@@ -101,6 +101,11 @@ namespace Isis {
   *   @history 2016-10-17 Jesse Mapel - Removed m_SCPVLFilename parameter in accordance with
   *                           USEPVL being removed from jigsaw.  References #4316.
   *   @history 2017-04-24 Ian Humphrey - Removed pvlObject(). Fixes #4797.
   *   @history 2018-03-20 Ken Edmundson
   *                           1) Temporarily set default for m_createInverseMatrix to false. This
   *                              is for creating and displaying the correlation matrix, which is
   *                              currently not working.
   *                           2) commented out hdf5 header includes in cpp
   *
   *   @todo Determine which XmlStackedHandlerReader constructor is preferred
   *   @todo Determine which XmlStackedHandler needs a Project pointer (see constructors)
+82 −50
Original line number Diff line number Diff line
@@ -40,21 +40,13 @@ namespace Isis {
                                         QList<ImageList *> imgList,
                                         QObject *parent) : QObject(parent) {
    m_id = new QUuid(QUuid::createUuid());

    m_runTime = "";

    m_name = m_runTime;

    m_inputControlNetFileName = new FileName(controlNetworkFileName);

    m_outputControlNetFileName = new FileName();

    m_outputControl = NULL;
    m_settings = inputSettings;

    m_statisticsResults = new BundleResults(outputStatistics);

    m_images = new QList<ImageList *>(imgList);

    m_adjustedImages = new QList<ImageList *>;
  }

@@ -74,7 +66,7 @@ namespace Isis {
    m_runTime = "";
    m_name = m_runTime;
    m_inputControlNetFileName = NULL;
    m_outputControlNetFileName = NULL;
    m_outputControl = NULL;
    m_statisticsResults = NULL;
    // what about the rest of the member data ? should we set defaults ??? CREATE INITIALIZE METHOD
    m_images = new QList<ImageList *>;
@@ -95,14 +87,16 @@ namespace Isis {
        m_name(src.m_name),
        m_runTime(src.m_runTime),
        m_inputControlNetFileName(new FileName(src.m_inputControlNetFileName->expanded())),
        m_outputControlNetFileName(new FileName(src.m_outputControlNetFileName->expanded())),
        m_settings(new BundleSettings(*src.m_settings)),
        m_statisticsResults(new BundleResults(*src.m_statisticsResults)),
        m_images(new QList<ImageList *>(*src.m_images)),
        m_adjustedImages(new QList<ImageList *>(*src.m_adjustedImages)),
        m_txtBundleOutputFilename(src.m_txtBundleOutputFilename),
        m_csvSavedImagesFilename(src.m_csvSavedImagesFilename),
        m_csvSavedPointsFilename(src.m_csvSavedPointsFilename),
        m_csvSavedResidualsFilename(src.m_csvSavedResidualsFilename) {

    m_outputControl = new Control(src.m_outputControl->fileName());
  }


@@ -115,8 +109,8 @@ namespace Isis {
    delete m_inputControlNetFileName;
    m_inputControlNetFileName = NULL;

    delete m_outputControlNetFileName;
    m_outputControlNetFileName = NULL;
    delete m_outputControl;
    m_outputControl = NULL;

    delete m_statisticsResults;
    m_statisticsResults = NULL;
@@ -161,8 +155,8 @@ namespace Isis {
      delete m_inputControlNetFileName;
      m_inputControlNetFileName = new FileName(src.m_inputControlNetFileName->expanded());

      delete m_outputControlNetFileName;
      m_outputControlNetFileName = new FileName(src.m_outputControlNetFileName->expanded());
      delete m_outputControl;
      m_outputControl = new Control(src.m_outputControl->fileName());

      m_settings = src.m_settings;

@@ -179,6 +173,16 @@ namespace Isis {
  }


  /**
   * Returns bundleout text filename.
   *
   * @return QString Bundleout text filename.
   */
  QString BundleSolutionInfo::savedBundleOutputFilename() {
    return m_txtBundleOutputFilename;
  }


  /**
   * Returns filename of output bundle images csv file.
   *
@@ -232,6 +236,8 @@ namespace Isis {


  /**
   * TODO: change description below to something more like english.
   *
   * Change the on-disk file name for the control network used to be where the control network
   * ought to be in the given project.
   *
@@ -250,10 +256,14 @@ namespace Isis {
                     oldInputFileName.dir().dirName() + "/" + oldInputFileName.name());
    *m_inputControlNetFileName = newInputFileName.expanded();

    FileName oldOutputFileName(*m_outputControlNetFileName);
    FileName oldOutputFileName(m_outputControl->fileName());
    FileName newOutputFileName(project->cnetRoot() + "/" +
                     oldOutputFileName.dir().dirName() + "/" + oldOutputFileName.name());
    *m_outputControlNetFileName = newOutputFileName.expanded();

    if (m_outputControl) {
      delete m_outputControl;
    }
    m_outputControl = new Control(newOutputFileName.expanded());
  }


@@ -278,16 +288,6 @@ namespace Isis {
  }


  /**
   * Sets the output control network filename.
   *
   * @param fileName The the output control network filename..
   */
  void BundleSolutionInfo::setOutputControlNetworkFileName(FileName fileName) {
    *m_outputControlNetFileName = fileName;
  }


  /**
   * Sets the run time, and the name if a name is not already set.
   *
@@ -336,14 +336,34 @@ namespace Isis {
   * @return @b QString The name of the output control network.
   */
  QString BundleSolutionInfo::outputControlNetFileName() const {
    return m_outputControlNetFileName->expanded();
    return m_outputControl->fileName();
  }


  /**
   * Returns the bundle settings.
   * Returns the name of the output control network.
   *
   * @return @b QString The name of the output control network.
   */
  void BundleSolutionInfo::setOutputControl(Control *outputControl) {
    m_outputControl = outputControl;
  }


  /**
   * Returns bundle output Control object.
   *
   * @return Control* Pointer to bundle output Control object.
   */
  Control *BundleSolutionInfo::control() const {
    return m_outputControl;
  }


  /**
   * Returns bundle settings.
   *
   * @return @b BundleSettingsQsp The bundle settings.
   * @return BundleSettingsQsp Bundle settings.
   */
  BundleSettingsQsp BundleSolutionInfo::bundleSettings() {
    return m_settings;
@@ -1170,6 +1190,8 @@ namespace Isis {
      return false;
    }

    m_txtBundleOutputFilename = ofname;

    char buf[1056];
    BundleObservationQsp observation;

@@ -1365,19 +1387,16 @@ namespace Isis {

    // print column headers
    if (m_settings->errorPropagation()) {
      sprintf(buf, "Point,Point,Accepted,Rejected,Residual,3-d,3-d,3-d,Sigma,"
              "Sigma,Sigma,Correction,Correction,Correction,Coordinate,"
              "Coordinate,Coordinate\nID,,,,,Latitude,Longitude,Radius,"
              "Latitude,Longitude,Radius,Latitude,Longitude,Radius,X,Y,Z\n"
              "Label,Status,Measures,Measures,RMS,(dd),(dd),(km),(m),(m),(m),"
              "(m),(m),(m),(km),(km),(km)\n");
      sprintf(buf, ",,,,,3-d,3-d,3-d,Sigma,Sigma,Sigma,Correction,Correction,Correction,Coordinate,"
              "Coordinate,Coordinate\nPoint,Point,Accepted,Rejected,Residual,Latitude,Longitude,"
              "Radius,Latitude,Longitude,Radius,Latitude,Longitude,Radius,X,Y,Z\nLabel,Status,"
              "Measures,Measures,RMS,(dd),(dd),(km),(m),(m),(m),(m),(m),(m),(km),(km),(km)\n");
    }
    else {
      sprintf(buf, "Point,Point,Accepted,Rejected,Residual,3-d,3-d,3-d,"
              "Correction,Correction,Correction,Coordinate,Coordinate,"
              "Coordinate\n,,,,,Latitude,Longitude,Radius,Latitude,"
              "Longitude,Radius,X,Y,Z\nLabel,Status,Measures,Measures,"
              "RMS,(dd),(dd),(km),(m),(m),(m),(km),(km),(km)\n");
      sprintf(buf, ",,,,,3-d,3-d,3-d,Correction,Correction,Correction,Coordinate,Coordinate,"
              "Coordinate\nPoint,Point,Accepted,Rejected,Residual,Latitude,Longitude,Radius,"
              "Latitude,Longitude,Radius,X,Y,Z\nLabel,Status,Measures,Measures,RMS,(dd),(dd),(km),"
              "(m),(m),(m),(km),(km),(km)\n");
    }
    fpOut << buf;

@@ -1584,12 +1603,19 @@ namespace Isis {
                             .arg(m_inputControlNetFileName->name()).arg(newFile),
                           _FILEINFO_);
        }
        oldFile = oldPath + "/" + m_outputControlNetFileName->name();
        newFile = newPath + "/" + m_outputControlNetFileName->name();
        oldFile = oldPath + "/" + m_outputControl->fileName();
        newFile = newPath + "/" + m_outputControl->fileName();
        if (!QFile::copy(oldFile, newFile)) {
          throw IException(IException::Io,
                           QString("Failed to copy file [%1] to new file [%2]")
                             .arg(m_outputControlNetFileName->name()).arg(newFile),
                             .arg(m_outputControl->fileName()).arg(newFile),
                           _FILEINFO_);
        }
        newFile = newPath + "/" + FileName(m_txtBundleOutputFilename).name();
        if (!QFile::copy(m_txtBundleOutputFilename, newFile)) {
          throw IException(IException::Io,
                           QString("Failed to copy file [%1] to new file [%2]")
                             .arg(m_txtBundleOutputFilename).arg(newFile),
                           _FILEINFO_);
        }
        newFile = newPath + "/" + FileName(m_csvSavedImagesFilename).name();
@@ -1643,9 +1669,10 @@ namespace Isis {

    stream.writeTextElement("inputFileName",
                            relativePath);

    stream.writeTextElement("outputFileName",
                            relativeBundlePath + m_outputControlNetFileName->name());
                            relativeBundlePath + FileName(m_outputControl->fileName()).name());
    stream.writeTextElement("bundleOutTXT",
                            relativeBundlePath + FileName(m_txtBundleOutputFilename).name());
    stream.writeTextElement("imagesCSV",
                            relativeBundlePath + FileName(m_csvSavedImagesFilename).name());
    stream.writeTextElement("pointsCSV",
@@ -1736,7 +1763,6 @@ namespace Isis {
                                                                                reader());
      }
      else if (localName == "imageList") {
        // m_xmlHandlerBundleSolutionInfo->m_images->append(new ImageList(m_xmlHandlerProject, reader()));
        m_xmlHandlerBundleSolutionInfo->m_adjustedImages->append(
            new ImageList(m_xmlHandlerProject, reader()));
      }
@@ -1781,9 +1807,15 @@ namespace Isis {
        projectRoot + m_xmlHandlerCharacters);
    }
    else if (localName == "outputFileName") {
      assert(m_xmlHandlerBundleSolutionInfo->m_outputControlNetFileName == NULL);
      m_xmlHandlerBundleSolutionInfo->m_outputControlNetFileName = new FileName(
        projectRoot + m_xmlHandlerCharacters);
      assert(m_xmlHandlerBundleSolutionInfo->m_outputControl == NULL);
      delete m_xmlHandlerBundleSolutionInfo->m_outputControl;
      FileName fname(projectRoot + m_xmlHandlerCharacters);
      m_xmlHandlerBundleSolutionInfo->m_outputControl
          = new Control(fname.expanded());
    }
    else if (localName == "bundleOutTXT") {
      m_xmlHandlerBundleSolutionInfo->m_txtBundleOutputFilename =
        projectRoot + m_xmlHandlerCharacters;
    }
    else if (localName == "imagesCSV") {
      m_xmlHandlerBundleSolutionInfo->m_csvSavedImagesFilename = 
+14 −5
Original line number Diff line number Diff line
@@ -120,8 +120,14 @@ namespace Isis {
   *   @history 2018-01-17 Tracie Sucharski - Added conditional code to check for null project in
   *                           xml serialization to allow the unitTest to use xml serialization
   *                           without having a project. References #5104.
   *   @history 2018-03-15 Ken Edmundson - Save input and output control and added methods to return
   *                           input control and output control.  Update documentation.
   *   @history 2018-03-21 Ken Edmundson - Added...
   *                           1) member variable m_inputControlNetFileName, accessor method, and
   *                              serialization support. Also added input control net filename to
   *                              constructor.
   *                           2) member variable m_outputControl, associated mutator/accessor, and
   *                              serialization support.
   *                           3) member variable m_txtBundleOutputFilename and associated accessor
   *                              for bundleout.txt file.
   */
  class BundleSolutionInfo : public QObject {
    Q_OBJECT
@@ -138,13 +144,14 @@ namespace Isis {
      ~BundleSolutionInfo();
      BundleSolutionInfo &operator=(const BundleSolutionInfo &src);

      QString savedBundleOutputFilename();
      QString savedImagesFilename();
      QString savedPointsFilename();
      QString savedResidualsFilename();

      void addAdjustedImages(ImageList *images);
      void setOutputStatistics(BundleResults statisticsResults);
      void setOutputControlNetworkFileName(FileName fileName);
      void setOutputControl(Control *outputControl);
      void setRunTime(QString runTime);
      void setName(QString name);

@@ -152,6 +159,7 @@ namespace Isis {
      QString id() const;
      QString inputControlNetFileName() const;
      QString outputControlNetFileName() const;
      Control *control() const;
      BundleSettingsQsp bundleSettings();
      BundleResults bundleResults();
      QList<ImageList *> imageList();
@@ -210,8 +218,8 @@ namespace Isis {
      QUuid              *m_id;
      QString             m_name;                        //!< Name of the bundle. Defaults to the id
      QString             m_runTime;                     //!< Run time of the bundle adjustment
      FileName           *m_inputControlNetFileName;     //!< Input control network name
      FileName           *m_outputControlNetFileName;    //!< Output control network name
      FileName           *m_inputControlNetFileName;     //!< Input control network file name
      Control            *m_outputControl;               //!< Output control
      BundleSettingsQsp   m_settings;                    //!< Bundle settings
      BundleResults      *m_statisticsResults;           //!< Bundle statistical results
      QList<ImageList *> *m_images;                      //!< Input image list
@@ -219,6 +227,7 @@ namespace Isis {

      // In theory the path in the BundleSettings can change while running. So we save the
      // filenames actually used when the most recent save of the file was done.
      QString m_txtBundleOutputFilename;
      QString m_csvSavedImagesFilename;
      QString m_csvSavedPointsFilename;
      QString m_csvSavedResidualsFilename;
+0 −8
Original line number Diff line number Diff line
Image,rms,rms,rms,X,X,X,X,X,Y,Y,Y,Y,Y,Z,Z,Z,Z,Z,RA,RA,RA,RA,RA,DEC,DEC,DEC,DEC,DEC,TWIST,TWIST,TWIST,TWIST,TWIST,
Filename,sample res,line res,total res,Initial,Correction,Final,Apriori Sigma,Adj Sigma,Initial,Correction,Final,Apriori Sigma,Adj Sigma,Initial,Correction,Final,Apriori Sigma,Adj Sigma,Initial,Correction,Final,Apriori Sigma,Adj Sigma,Initial,Correction,Final,Apriori Sigma,Adj Sigma,Initial,Correction,Final,Apriori Sigma,Adj Sigma,
/work/projects/ApolloMetric/METRIC/Calibrated/AS15/SUB4_MSK_InstrumentStartTime/Sub4-AS15-M-1757_msk.cub,0.51845694436147,0.97524424269876,0.78099261714619,-1676.1866244276,0.3170026774516,-1675.8696217502,500.0,0.1690797492717,776.01842700262,0.18308214004334,776.20150914267,500.0,0.17709880748748,190.83692567603,0.67934738703117,191.51627306306,500.0,0.16934724936719,-114.81847479623,0.14786430851052,-114.67061048772,0.5,0.097887257746279,84.286744189607,0.14301001677591,84.429754206383,0.5,0.085518977881851,135.10580640169,-0.073755435116957,135.03205096657,0.5,0.10209077775713
/work/projects/ApolloMetric/METRIC/Calibrated/AS15/SUB4_MSK_InstrumentStartTime/Sub4-AS15-M-1758_msk.cub,0.48914157340128,0.96409831563102,0.76444262081337,-1661.0556247296,0.24305052799097,-1660.8125742016,500.0,0.17883341616719,800.60462193458,0.26766384701447,800.87228578159,500.0,0.17894270116668,219.62524418461,0.81713498430798,220.44237916892,500.0,0.17548613324839,-115.68927691479,0.15112876410579,-115.53814815068,0.5,0.097663328471951,83.287864615961,0.14571379590631,83.433578411867,0.5,0.085317156538059,135.24236174012,-0.081063071500818,135.16129866862,0.5,0.10243445718908
/work/projects/ApolloMetric/METRIC/Calibrated/AS15/SUB4_MSK_InstrumentStartTime/Sub4-AS15-M-1759_msk.cub,0.3234786200299,1.0445725353158,0.77323030177063,-1645.118297281,0.18547301310201,-1644.9328242679,500.0,0.20684835804294,824.80203432912,0.37787280348465,825.17990713261,500.0,0.20520137756462,248.30682152756,0.97427898916589,249.28110051673,500.0,0.20458947672359,-116.55201321842,0.1414520464547,-116.41056117197,0.5,0.097506040940435,82.310079123292,0.14270993562181,82.452789058913,0.5,0.085163168400858,135.38610126297,-0.069324655588454,135.31677660738,0.5,0.10281378780214
/work/projects/ApolloMetric/METRIC/Calibrated/AS16/SUB4_MSK_NewStartTime/Sub4-AS16-M-0392_msk.cub,0.49188485000562,1.1397636203373,0.8777846592159,1747.0424536016,-0.25503937331921,1746.7874142282,500.0,0.18429641470036,633.3492820035,0.49395906374671,633.84324106725,500.0,0.1830184566499,81.070798243394,-0.49125912498146,80.579539118413,500.0,0.19512758266095,110.34149860419,0.3735945369789,110.71509314116,0.5,0.088850090823099,87.09334362033,-0.10691005392567,86.986433566404,0.5,0.094783462079425,-149.90233460871,-0.036238357509029,-149.93857296621,0.5,0.10327678221121
/work/projects/ApolloMetric/METRIC/Calibrated/AS16/SUB4_MSK_NewStartTime/Sub4-AS16-M-0393_msk.cub,0.745496019873,1.1426404871033,0.96472576373138,1760.2742054268,-0.034511936246684,1760.2396934906,500.0,0.17301063061067,597.66419620361,0.45091683878255,598.11511304239,500.0,0.1749682885975,58.98892575481,-0.51847411988065,58.47045163493,500.0,0.17712241769798,109.18883286426,0.37607709864275,109.56490996291,0.5,0.088840587895256,87.796840611543,-0.09134753252743,87.705493079016,0.5,0.094319465492397,-149.84701529934,-0.033154227141492,-149.88016952649,0.5,0.10364410342365
/work/projects/ApolloMetric/METRIC/Calibrated/AS16/SUB4_MSK_NewStartTime/Sub4-AS16-M-0394_msk.cub,0.57994567220543,1.0445737373178,0.84482876235478,1772.5152690217,0.19274695792245,1772.7080159796,500.0,0.18900862793942,561.64149498279,0.39235269508021,562.03384767787,500.0,0.19507829017625,36.873141324453,-0.50650471222111,36.366636612232,500.0,0.18962962942032,108.01512683489,0.38747308139741,108.40259991629,0.5,0.088957785858698,88.534523650897,-0.1083766713918,88.426146979505,0.5,0.093815486035816,-149.80439189401,-0.018129130140166,-149.82252102415,0.5,0.10404865355201
Loading