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

Multisensor (#3792)



* added SCCONFIG parameter to jigsaw

* fixed problem with how I was assigning observation numbers, added history comments

* fixed problem with how I was removing observation numbers

* cleaned up BOSS constructor

* more fixes to BOSS constructor

* added BOSS gtest

* Added jigsaw scconfig app test

* Added scconfig with heldlist app test

* more updates to xml save test

* finished xml save test

* Updated with Themis VO data

* Updating jigsaw errors

Co-authored-by: default avatarPeter Aaron Giroux <pgiroux@contractor.usgs.gov>
parent 47316b7b
Loading
Loading
Loading
Loading
+131 −155
Original line number Original line Diff line number Diff line
@@ -277,6 +277,12 @@
      Cleaned up the bundleout.txt file and added new information in the header.
      Cleaned up the bundleout.txt file and added new information in the header.
      Fixes #3267.
      Fixes #3267.
    </change>
    </change>
    <change name="Aaron Giroux" date="2019-12-19">
      Added SCCONFIG parameter which allows users to pass in a pvl file with different
      settings for different instrumentIDs. Added logic into the observationSolveSettings
      function to construct BundleObservationSolveSettings objects based off of the settings
      in the pvl file.
    </change>
  </history>
  </history>


  <groups>
  <groups>
@@ -347,54 +353,24 @@
        </filter>
        </filter>
      </parameter>
      </parameter>


 <!-- Turning off USEPVL and SC_PARAMETERS for now. Since we are now using observation numbers
      <parameter name="SCCONFIG">
      to obtain the BundleObservationSolveSettings for a BundleObservation (instead of inst. id),
      this would require using a PVL that contains names of lists of images to group by.
      E.g. Group = "listA." would create a BundleObservationSolveSettings object that is associated
      with the images' observation numbers. Group = "listB.lis" would create another BOSS object
      that is associated with listB's images' observation numbers. Use of these lists could
      introduce unintended behaviors if not properly verified (e.g. would need to make sure the
      lists are sublists of the FROMLIST, that these sublists are all mutually exclusive ...).
      <parameter name="USEPVL">
        <type>boolean</type>
        <default><item>false</item></default>
        <brief>
          Enter Camera/Spacecraft parameters using a PVL file
        </brief>
        <description>
          This option indicates that the Camera and Spacecraft parameters are to be
          obtained from the PVL file specified by SC_PARAMETERS. All of the following
          parameters must be entered through the PVL file if this option is chosen:
          HELDLIST, CKDEGREE, CKSOLVEDEGREE, CAMSOLVE, TWIST, OVEREXISTING, SPKDEGREE,
          SPKSOLVEDEGREE, SPSOLVE, OVERHERMITE, SPACECRAFT_POSITION_SIGMA,
          SPACECRAFT_VELOCITY_SIGMA, SPACECRAFT_ACCELERATION_SIGMA, CAMERA_ANGLES_SIGMA,
          CAMERA_ANGULAR_VELOCITY_SIGMA, CAMERA_ANGULAR_ACCELERATION_SIGMA. An example
          template is located at $base/templates/jigsaw/SC_Parameters.pvl.
        </description>
        <exclusions>
        <exclusions>
          <item>HELDLIST</item>
          <item>CKDEGREE</item>
          <item>CKDEGREE</item>
          <item>CKSOLVEDEGREE</item>
          <item>CKSOLVEDEGREE</item>
          <item>CAMSOLVE</item>
          <item>CAMSOLVE</item>
          <item>TWIST</item>
          <item>OVEREXISTING</item>
          <item>OVEREXISTING</item>
          <item>SPKDEGREE</item>
          <item>SPKDEGREE</item>
          <item>SPKSOLVEDEGREE</item>
          <item>SPKSOLVEDEGREE</item>
          <item>SPSOLVE</item>
          <item>SPSOLVE</item>
          <!-- <item>TWIST</item> -->
          <item>OVERHERMITE</item>
          <item>OVERHERMITE</item>
          <item>SPACECRAFT_POSITION_SIGMA</item>
          <item>SPACECRAFT_VELOCITY_SIGMA</item>
          <item>SPACECRAFT_ACCELERATION_SIGMA</item>
          <item>CAMERA_ANGLES_SIGMA</item>
          <item>CAMERA_ANGLES_SIGMA</item>
          <item>CAMERA_ANGULAR_VELOCITY_SIGMA</item>
          <item>CAMERA_ANGULAR_VELOCITY_SIGMA</item>
          <item>CAMERA_ANGULAR_ACCELERATION_SIGMA</item>
          <item>CAMERA_ANGULAR_ACCELERATION_SIGMA</item>
          <item>SPACECRAFT_POSITION_SIGMA</item>
          <item>SPACECRAFT_VELOCITY_SIGMA</item>
          <item>SPACECRAFT_ACCELERATION_SIGMA</item>
        </exclusions>
        </exclusions>
        <inclusions>
          <item>SC_PARAMETERS</item>
        </inclusions>
      </parameter>

      <parameter name="SC_PARAMETERS">
        <type>filename</type>
        <type>filename</type>
        <fileMode>input</fileMode>
        <fileMode>input</fileMode>
        <brief>
        <brief>
@@ -418,7 +394,7 @@
        <filter>
        <filter>
          *.pvl
          *.pvl
        </filter>
        </filter>
      </parameter>-->
      </parameter>
    </group>
    </group>


    <group name="Solve Options">
    <group name="Solve Options">
+138 −83
Original line number Original line Diff line number Diff line
@@ -323,7 +323,47 @@ BundleSettingsQsp bundleSettings(UserInterface &ui) {
QList<BundleObservationSolveSettings> observationSolveSettings(UserInterface &ui) {
QList<BundleObservationSolveSettings> observationSolveSettings(UserInterface &ui) {
  //************************************************************************************************
  //************************************************************************************************
  QList<BundleObservationSolveSettings> observationSolveSettingsList;
  QList<BundleObservationSolveSettings> observationSolveSettingsList;
  QString fromList = ui.GetFileName("FROMLIST");
  SerialNumberList cubeSNs(fromList);
  // QVector<BundleObservationSolveSettings*> cubeSolveSettings(cubeSNs.size(), nullptr);

  if (ui.WasEntered("SCCONFIG")) {
    PvlObject obj;
    Pvl scConfig(FileName(ui.GetFileName("SCCONFIG")).expanded());
    // QMap<QString, BundleObservationSolveSettings*> instIDtoBOSS;
    if (!scConfig.hasObject("SensorParameters")) {
      QString msg = "Input SCCONFIG file missing SensorParameters object";
      throw IException(IException::User, msg, _FILEINFO_);
    }

    // loop over parameter groups, read settings for each sensor into a
    // BundleObservationSolveSettings object, and append to observationSolveSettingsList
    obj = scConfig.findObject("SensorParameters");
    PvlObject::PvlGroupIterator g;
    for(g = obj.beginGroup(); g != obj.endGroup(); ++g) {
      BundleObservationSolveSettings solveSettings(*g);
      observationSolveSettingsList.append(solveSettings);
    }

    // loop through serial number list, check if current instrumentID matches
    // any of the BOSS's instrumentID. If so, add observationNumber to BOSS.
    for (int snIndex = 0; snIndex < cubeSNs.size(); snIndex++) {
      QString snInstId = cubeSNs.spacecraftInstrumentId(snIndex);
      bool found = false;
      for (auto bossIt = observationSolveSettingsList.begin(); bossIt != observationSolveSettingsList.end(); bossIt++) {
        if (bossIt->instrumentId() == snInstId) {
          bossIt->addObservationNumber(cubeSNs.observationNumber(snIndex));
          found = true;
        }
      }
      if (!found){
        QString msg = "No BundleObservationSolveSettings found for " + snInstId;
        throw IException(IException::User, msg, _FILEINFO_);
      }
    }
  }


  else {
    // We are not using the PVL, so get what will be solve settings for all images from gui
    // We are not using the PVL, so get what will be solve settings for all images from gui
    BundleObservationSolveSettings observationSolveSettings;
    BundleObservationSolveSettings observationSolveSettings;


@@ -377,16 +417,31 @@ QList<BundleObservationSolveSettings> observationSolveSettings(UserInterface &ui
                                                            positionVelocityAprioriSigma,
                                                            positionVelocityAprioriSigma,
                                                            positionAccelerationAprioriSigma);
                                                            positionAccelerationAprioriSigma);


    // add all image observation numbers to this BOSS.
    for (int sn = 0; sn < cubeSNs.size(); sn++) {
      observationSolveSettings.addObservationNumber(cubeSNs.observationNumber(sn));
    }

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


  // If we are holding any images, then we need a BundleObservationSolveSettings for the held
  // If we are holding any images, then we need a BundleObservationSolveSettings for the held
  // images, and another one for the non-held images
  // images, and another one for the non-held images
  if (ui.WasEntered("HELDLIST")) {
  if (ui.WasEntered("HELDLIST")) {
    // Check that the held images are present in the input image list
    // Check that the held images are present in the input image list
    QString heldList = ui.GetFileName("HELDLIST");
    QString heldList = ui.GetFileName("HELDLIST");
    QString fromList = ui.GetFileName("FROMLIST");
    SerialNumberList heldSNs(heldList);
    SerialNumberList heldSNs(heldList);
    SerialNumberList cubeSNs(fromList);
    checkImageList(heldSNs, cubeSNs);
    checkImageList(heldSNs, cubeSNs);


    double anglesAprioriSigma, angularVelocityAprioriSigma, angularAccelerationAprioriSigma;
    anglesAprioriSigma = angularVelocityAprioriSigma = angularAccelerationAprioriSigma = Isis::Null;

    double positionAprioriSigma, positionVelocityAprioriSigma, positionAccelerationAprioriSigma;
    positionAprioriSigma = positionVelocityAprioriSigma = positionAccelerationAprioriSigma
                          = Isis::Null;

    // The settings for the held images will have no pointing or position factors considered
    // The settings for the held images will have no pointing or position factors considered
    BundleObservationSolveSettings heldSettings;
    BundleObservationSolveSettings heldSettings;
    BundleObservationSolveSettings::InstrumentPointingSolveOption noPointing =
    BundleObservationSolveSettings::InstrumentPointingSolveOption noPointing =
@@ -397,7 +452,7 @@ QList<BundleObservationSolveSettings> observationSolveSettings(UserInterface &ui
                                                ui.GetInteger("CKDEGREE"),
                                                ui.GetInteger("CKDEGREE"),
                                                ui.GetInteger("CKSOLVEDEGREE"),
                                                ui.GetInteger("CKSOLVEDEGREE"),
                                                ui.GetBoolean("OVEREXISTING"),
                                                ui.GetBoolean("OVEREXISTING"),
                                                positionAprioriSigma,
                                                anglesAprioriSigma,
                                                angularVelocityAprioriSigma,
                                                angularVelocityAprioriSigma,
                                                angularAccelerationAprioriSigma);
                                                angularAccelerationAprioriSigma);
    BundleObservationSolveSettings::InstrumentPositionSolveOption noPosition =
    BundleObservationSolveSettings::InstrumentPositionSolveOption noPosition =
@@ -417,20 +472,20 @@ QList<BundleObservationSolveSettings> observationSolveSettings(UserInterface &ui
        // For held images, we want to set pointing and position settings to NONE, effectively
        // For held images, we want to set pointing and position settings to NONE, effectively
        // ensuring that the number of pointing and position parameters for the holds are 0
        // ensuring that the number of pointing and position parameters for the holds are 0
        heldSettings.addObservationNumber(cubeSNs.observationNumber(sn));
        heldSettings.addObservationNumber(cubeSNs.observationNumber(sn));
        QString snInstId = cubeSNs.spacecraftInstrumentId(sn);
        //for each held serial number, locate corresponding BOSS in BOSSlist, remove.
        for (auto bossIt = observationSolveSettingsList.begin(); bossIt != observationSolveSettingsList.end(); bossIt++) {
          if (bossIt->instrumentId() == snInstId) {
            bossIt->removeObservationNumber(cubeSNs.observationNumber(sn));
          }
        }
        }
      else {
        observationSolveSettings.addObservationNumber(cubeSNs.observationNumber(sn));
      }
      }
    }
    }
    // Add both the non-held and held observation solve settings to the list of solve settings
    // Add the held observation solve settings to the list of solve settings
    // for the BundleAdjust
    // for the BundleAdjust
    observationSolveSettingsList.append(observationSolveSettings);
    observationSolveSettingsList.append(heldSettings);
    observationSolveSettingsList.append(heldSettings);
  }
  }
  // If not using a held list, we just append the GUI acquired solve parameters

  else {
    observationSolveSettingsList.append(observationSolveSettings);
  }
  //************************************************************************************************
  //************************************************************************************************
  return observationSolveSettingsList;
  return observationSolveSettingsList;
}
}
+5 −3
Original line number Original line Diff line number Diff line
@@ -14,6 +14,7 @@ APPNAME = jigsaw
include $(ISISROOT)/make/isismake.tsts
include $(ISISROOT)/make/isismake.tsts


commands:
commands:
	$(LS) -1 $(INPUT)/*cub > $(OUTPUT)/cubes.lis;
# TEST A: CAMSOLVE=None and SPSOLVE=None
# TEST A: CAMSOLVE=None and SPSOLVE=None
	echo -e "Error Test A:" > $(OUTPUT)/error_temp.txt;
	echo -e "Error Test A:" > $(OUTPUT)/error_temp.txt;
	if [[ `$(APPNAME) \
	if [[ `$(APPNAME) \
@@ -32,7 +33,7 @@ commands:
# TEST C: SOLVETARGETBODY=yes and TBPARAMETERS file missing Target object
# TEST C: SOLVETARGETBODY=yes and TBPARAMETERS file missing Target object
	echo -e "Error Test C:" >> $(OUTPUT)/error_temp.txt;
	echo -e "Error Test C:" >> $(OUTPUT)/error_temp.txt;
	if [[ `$(APPNAME) \
	if [[ `$(APPNAME) \
	  fromlist=$(INPUT)/empty.lis \
	  fromlist=$(OUTPUT)/cubes.lis \
	  cnet=$(INPUT)/empty.net \
	  cnet=$(INPUT)/empty.net \
	  onet=$(OUTPUT)/out.net \
	  onet=$(OUTPUT)/out.net \
	  solvetargetbody=yes \
	  solvetargetbody=yes \
@@ -45,7 +46,7 @@ commands:
# TEST D: SOLVETARGETBODY=yes and # of parameters to solve is 0
# TEST D: SOLVETARGETBODY=yes and # of parameters to solve is 0
	echo -e "Error Test D:" >> $(OUTPUT)/error_temp.txt;
	echo -e "Error Test D:" >> $(OUTPUT)/error_temp.txt;
	if [[ `$(APPNAME) \
	if [[ `$(APPNAME) \
	  fromlist=$(INPUT)/empty.lis \
	  fromlist=$(OUTPUT)/cubes.lis \
	  cnet=$(INPUT)/empty.net \
	  cnet=$(INPUT)/empty.net \
	  onet=$(OUTPUT)/out.net \
	  onet=$(OUTPUT)/out.net \
	  solvetargetbody=yes \
	  solvetargetbody=yes \
@@ -58,7 +59,7 @@ commands:
# TEST F: CNET=[invalid control net file]
# TEST F: CNET=[invalid control net file]
	echo -e "Error Test F:" >> $(OUTPUT)/error_temp.txt;
	echo -e "Error Test F:" >> $(OUTPUT)/error_temp.txt;
	if [[ `$(APPNAME) \
	if [[ `$(APPNAME) \
	  fromlist=$(INPUT)/empty.lis \
	  fromlist=$(OUTPUT)/cubes.lis \
	  cnet=$(INPUT)/notacnet.net \
	  cnet=$(INPUT)/notacnet.net \
	  onet=$(OUTPUT)/out.net \
	  onet=$(OUTPUT)/out.net \
	  radius=yes \
	  radius=yes \
@@ -74,3 +75,4 @@ commands:
# Remove paths from errors file
# Remove paths from errors file
	$(SED) 's/\(\[\)\/.*\(input\)/\1\2/g' $(OUTPUT)/error_temp.txt > $(OUTPUT)/error.txt;
	$(SED) 's/\(\[\)\/.*\(input\)/\1\2/g' $(OUTPUT)/error_temp.txt > $(OUTPUT)/error.txt;
	$(RM) $(OUTPUT)/error_temp.txt;
	$(RM) $(OUTPUT)/error_temp.txt;
	$(RM) $(OUTPUT)/cubes.lis > /dev/null;
+21 −0
Original line number Original line Diff line number Diff line
APPNAME = jigsaw

include $(ISISROOT)/make/isismake.tsts

commands:
	$(LS) -1 $(INPUT)/*cub > $(OUTPUT)/cubes.lis;
	$(APPNAME) fromlist=$(OUTPUT)/cubes.lis \
	  cnet=$(INPUT)/themis_dayir_VO_arcadia_extract_hand.net \
	  onet=$(OUTPUT)/themis_dayir_VO_arcadia_extract_hand_jig.net \
	  scconfig=$(INPUT)/themis_vo.pvl \
	  radius=true \
	  point_radius_sigma=50\
	  bundleout_txt=no \
	  output_csv=no \
	  residuals_csv=no > /dev/null;
	$(CAT) bundleout_images.csv \
	  | perl -pe 's/(^|,|: )([^,:]+\/)([^,\/:]*\.)(net|cub)/\1\3\4/g' 2> /dev/null \
	  > $(OUTPUT)/bundleout_scconfig_images.csv;
	$(RM) $(OUTPUT)/cubes.lis > /dev/null;
	$(RM) $(OUTPUT)/*.net > /dev/null;
	$(RM) *.csv > /dev/null;
+22 −0
Original line number Original line Diff line number Diff line
APPNAME = jigsaw

include $(ISISROOT)/make/isismake.tsts

commands:
	$(LS) -1 $(INPUT)/*cub > $(OUTPUT)/cubes.lis;
	$(LS) $(INPUT)/I28234014RDR.cub > $(OUTPUT)/hold.lis;
	$(APPNAME) fromlist=$(OUTPUT)/cubes.lis \
	  heldlist=$(OUTPUT)/hold.lis \
	  cnet=$(INPUT)/themis_dayir_VO_arcadia_extract_hand.net \
	  onet=$(OUTPUT)/themis_dayir_VO_arcadia_extract_hand_jig.net \
	  scconfig=$(INPUT)/themis_vo.pvl \
	  bundleout_txt=no \
	  output_csv=no \
	  residuals_csv=no > /dev/null;
	$(CAT) bundleout_images.csv \
	  | perl -pe 's/(^|,|: )([^,:]+\/)([^,\/:]*\.)(net|cub)/\1\3\4/g' 2> /dev/null \
	  > $(OUTPUT)/bundleout_scconfig_images.csv;
	$(RM) $(OUTPUT)/cubes.lis > /dev/null;
	$(RM) $(OUTPUT)/hold.lis > /dev/null;
	$(RM) $(OUTPUT)/*.net > /dev/null;
	$(RM) *.csv > /dev/null;
Loading