Skip to content

Commit

Permalink
Add hooks for csm bundle settings to jigsaw (DOI-USGS#4438)
Browse files Browse the repository at this point in the history
* In progress

* Added tests and Pvl support

* Add missing 'y' to docs

Co-authored-by: Kristin Berry <kberry@usgs.gov>
  • Loading branch information
2 people authored and tgiroux committed Jun 8, 2021
1 parent 3581aa5 commit 6291ec5
Show file tree
Hide file tree
Showing 6 changed files with 285 additions and 7 deletions.
24 changes: 24 additions & 0 deletions isis/src/control/apps/jigsaw/jigsaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,13 +443,37 @@ 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));
}

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

}


Expand Down
79 changes: 78 additions & 1 deletion isis/src/control/apps/jigsaw/jigsaw.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,84 @@
<item>No</item>
</default>
</parameter>
</group>
</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">
Expand Down
3 changes: 0 additions & 3 deletions isis/src/control/objs/BundleSettings/BundleSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,6 @@ namespace Isis {
}
}
return defaultSolveSettings;
//QString msg = "Unable to find BundleObservationSolveSettings for observation number ["
// + observationNumber + "].";
// throw IException(IException::Unknown, msg, _FILEINFO_);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ namespace Isis {
BundleObservationSolveSettings::BundleObservationSolveSettings(const PvlGroup &scParameterGroup) {
initialize();

// group name must be instrument id
// group name must be instrument id
m_instrumentId = (QString)scParameterGroup.nameKeyword();

// If CKDEGREE is not specified, then a default of 2 is used
if (scParameterGroup.hasKeyword("CKDEGREE")) {
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"));
}
Expand Down Expand Up @@ -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);
}
}


Expand Down Expand Up @@ -443,7 +459,7 @@ namespace Isis {
// =============================================================================================//


BundleObservationSolveSettings::CSMSolveOption
BundleObservationSolveSettings::CSMSolveOption
BundleObservationSolveSettings::stringToCSMSolveOption(QString option) {
if (option.compare("NoCSMParameters", Qt::CaseInsensitive) == 0) {
return BundleObservationSolveSettings::NoCSMParameters;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 6291ec5

Please sign in to comment.