From 33b5f10a4c37bdc77a4fe31062e233040b28161b Mon Sep 17 00:00:00 2001 From: jessemapel Date: Tue, 4 May 2021 09:56:24 -0700 Subject: [PATCH 1/3] In progress --- isis/src/control/apps/jigsaw/jigsaw.cpp | 24 ++++++ isis/src/control/apps/jigsaw/jigsaw.xml | 79 ++++++++++++++++- .../objs/BundleSettings/BundleSettings.cpp | 3 - .../BundleObservationSolveSettings.cpp | 84 ++++++++++++++++++- .../BundleObservationSolveSettings.h | 4 + 5 files changed, 187 insertions(+), 7 deletions(-) diff --git a/isis/src/control/apps/jigsaw/jigsaw.cpp b/isis/src/control/apps/jigsaw/jigsaw.cpp index 6038368ef2..52f5582477 100644 --- a/isis/src/control/apps/jigsaw/jigsaw.cpp +++ b/isis/src/control/apps/jigsaw/jigsaw.cpp @@ -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 csmParamVector; + ui.GetString("CSMSOLVELIST", csmParamVector); + QStringList csmParamList = QStringList::fromVector(QVector::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); + } diff --git a/isis/src/control/apps/jigsaw/jigsaw.xml b/isis/src/control/apps/jigsaw/jigsaw.xml index a3bdb4520e..825ee4b9d7 100644 --- a/isis/src/control/apps/jigsaw/jigsaw.xml +++ b/isis/src/control/apps/jigsaw/jigsaw.xml @@ -1018,7 +1018,84 @@ No - + + + + + string + Specify a set of a CSM parameters to solve for. + + 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. + + + CSMSOLVETYPE + CSMSOLVELIST + + + + + + + + + + string + Specify a type of a CSM parameters to solve for. + + Specify a parameter type from the CSM GeometricModel API to solve for. + All parameters of the specified type will be solved for. + + + CSMSOLVESET + CSMSOLVELIST + + + + + + + + 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. + + + + + + string + Specify an explicit list of CSM parameters to solve for. + + 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. + + + CSMSOLVESET + CSMSOLVETYPE + + + diff --git a/isis/src/control/objs/BundleSettings/BundleSettings.cpp b/isis/src/control/objs/BundleSettings/BundleSettings.cpp index 5d59ee3d68..87100ff498 100644 --- a/isis/src/control/objs/BundleSettings/BundleSettings.cpp +++ b/isis/src/control/objs/BundleSettings/BundleSettings.cpp @@ -541,9 +541,6 @@ namespace Isis { } } return defaultSolveSettings; - //QString msg = "Unable to find BundleObservationSolveSettings for observation number [" - // + observationNumber + "]."; - // throw IException(IException::Unknown, msg, _FILEINFO_); } diff --git a/isis/src/control/objs/BundleUtilities/BundleObservationSolveSettings.cpp b/isis/src/control/objs/BundleUtilities/BundleObservationSolveSettings.cpp index a560628fa3..9ec6802d31 100644 --- a/isis/src/control/objs/BundleUtilities/BundleObservationSolveSettings.cpp +++ b/isis/src/control/objs/BundleUtilities/BundleObservationSolveSettings.cpp @@ -58,7 +58,7 @@ 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 @@ -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")); } @@ -443,7 +443,7 @@ namespace Isis { // =============================================================================================// - BundleObservationSolveSettings::CSMSolveOption + BundleObservationSolveSettings::CSMSolveOption BundleObservationSolveSettings::stringToCSMSolveOption(QString option) { if (option.compare("NoCSMParameters", Qt::CaseInsensitive) == 0) { return BundleObservationSolveSettings::NoCSMParameters; @@ -486,6 +486,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; diff --git a/isis/src/control/objs/BundleUtilities/BundleObservationSolveSettings.h b/isis/src/control/objs/BundleUtilities/BundleObservationSolveSettings.h index 11801e9bb0..76154dc61a 100644 --- a/isis/src/control/objs/BundleUtilities/BundleObservationSolveSettings.h +++ b/isis/src/control/objs/BundleUtilities/BundleObservationSolveSettings.h @@ -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); From 612c908abcf010c9e888139cd6a5535e23223128 Mon Sep 17 00:00:00 2001 From: Jesse Mapel Date: Wed, 5 May 2021 09:16:18 -0700 Subject: [PATCH 2/3] Added tests and Pvl support --- .../BundleObservationSolveSettings.cpp | 16 ++++ .../BundleObservationSolveSettingsTests.cpp | 82 +++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/isis/src/control/objs/BundleUtilities/BundleObservationSolveSettings.cpp b/isis/src/control/objs/BundleUtilities/BundleObservationSolveSettings.cpp index 9ec6802d31..f69deda9c9 100644 --- a/isis/src/control/objs/BundleUtilities/BundleObservationSolveSettings.cpp +++ b/isis/src/control/objs/BundleUtilities/BundleObservationSolveSettings.cpp @@ -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); + } } diff --git a/isis/tests/BundleObservationSolveSettingsTests.cpp b/isis/tests/BundleObservationSolveSettingsTests.cpp index bab7dd50a3..d6e286ac4f 100644 --- a/isis/tests/BundleObservationSolveSettingsTests.cpp +++ b/isis/tests/BundleObservationSolveSettingsTests.cpp @@ -27,6 +27,12 @@ QDomDocument saveToQDomDocument(BundleObservationSolveSettings &boss) { class CSMSolveOptionStrings : public testing::TestWithParam> { }; +class CSMSolveSetStrings : public testing::TestWithParam> { +}; +class CSMSolveTypeStrings : public testing::TestWithParam> { +}; class PointingSolveOptionStrings : public testing::TestWithParam> { }; @@ -88,12 +94,15 @@ TEST(BundleObservationSolveSettings, PvlGroupConstructor) { PvlKeyword camsolve("CamSolve"); PvlKeyword twist("Twist"); PvlKeyword spsolve("SPSolve"); + PvlKeyword csmsolveset("CSMSOLVESET"); camsolve = "Angles"; twist = "yes"; spsolve = "None"; + csmsolveset = "ADJUSTABLE"; settingsGroup += camsolve; settingsGroup += twist; settingsGroup += spsolve; + settingsGroup += csmsolveset; BundleObservationSolveSettings boss(settingsGroup); @@ -111,6 +120,48 @@ TEST(BundleObservationSolveSettings, PvlGroupConstructor) { EXPECT_FALSE(boss.solvePositionOverHermite()); EXPECT_EQ(boss.positionInterpolationType(), SpiceRotation::PolyFunction); EXPECT_TRUE(boss.aprioriPositionSigmas().isEmpty()); + EXPECT_EQ(boss.csmSolveOption(), BundleObservationSolveSettings::Set); + EXPECT_EQ(boss.csmParameterSet(), csm::param::ADJUSTABLE); +} + +TEST(BundleObservationSolveSettings, PvlGroupCSMTypeConstructor) { + PvlGroup settingsGroup("VO1/VISA"); + PvlKeyword camsolve("CamSolve"); + PvlKeyword spsolve("SPSolve"); + PvlKeyword csmsolvetype("CSMSOLVETYPE"); + camsolve = "None"; + spsolve = "None"; + csmsolvetype = "REAL"; + settingsGroup += camsolve; + settingsGroup += spsolve; + settingsGroup += csmsolvetype; + + BundleObservationSolveSettings boss(settingsGroup); + + EXPECT_EQ(boss.csmSolveOption(), BundleObservationSolveSettings::Type); + EXPECT_EQ(boss.csmParameterType(), csm::param::REAL); +} + +TEST(BundleObservationSolveSettings, PvlGroupCSMListConstructor) { + PvlGroup settingsGroup("VO1/VISA"); + PvlKeyword camsolve("CamSolve"); + PvlKeyword spsolve("SPSolve"); + PvlKeyword csmsolvelist("CSMSOLVELIST"); + camsolve = "None"; + spsolve = "None"; + csmsolvelist += "Param 1"; + csmsolvelist += "Param 2"; + settingsGroup += camsolve; + settingsGroup += spsolve; + settingsGroup += csmsolvelist; + + BundleObservationSolveSettings boss(settingsGroup); + + EXPECT_EQ(boss.csmSolveOption(), BundleObservationSolveSettings::List); + QStringList csmParamList = boss.csmParameterList(); + ASSERT_EQ(csmParamList.size(), 2); + EXPECT_EQ(csmParamList[0].toStdString(), "Param 1"); + EXPECT_EQ(csmParamList[1].toStdString(), "Param 2"); } TEST(BundleObservationSolveSettings, AssignmentOperator) { @@ -402,6 +453,26 @@ TEST_P(CSMSolveOptionStrings, OptionToString) { BundleObservationSolveSettings::csmSolveOptionToString(GetParam().first)); } +TEST_P(CSMSolveSetStrings, StringToOption) { + EXPECT_EQ(GetParam().first, + BundleObservationSolveSettings::stringToCSMSolveSet(GetParam().second)); +} + +TEST_P(CSMSolveSetStrings, OptionToString) { + EXPECT_PRED_FORMAT2(AssertQStringsEqual, GetParam().second, + BundleObservationSolveSettings::csmSolveSetToString(GetParam().first)); +} + +TEST_P(CSMSolveTypeStrings, StringToOption) { + EXPECT_EQ(GetParam().first, + BundleObservationSolveSettings::stringToCSMSolveType(GetParam().second)); +} + +TEST_P(CSMSolveTypeStrings, OptionToString) { + EXPECT_PRED_FORMAT2(AssertQStringsEqual, GetParam().second, + BundleObservationSolveSettings::csmSolveTypeToString(GetParam().first)); +} + TEST_P(PointingSolveOptionStrings, StringToOption) { EXPECT_EQ(GetParam().first, BundleObservationSolveSettings::stringToInstrumentPointingSolveOption(GetParam().second)); @@ -428,6 +499,17 @@ INSTANTIATE_TEST_SUITE_P(BundleObservationSolveSettings, CSMSolveOptionStrings, qMakePair(BundleObservationSolveSettings::Type, QString("Type")), qMakePair(BundleObservationSolveSettings::List, QString("List")))); +INSTANTIATE_TEST_SUITE_P(BundleObservationSolveSettings, CSMSolveSetStrings, ::testing::Values( + qMakePair(csm::param::VALID, QString("VALID")), + qMakePair(csm::param::ADJUSTABLE, QString("ADJUSTABLE")), + qMakePair(csm::param::NON_ADJUSTABLE, QString("NON_ADJUSTABLE")))); + +INSTANTIATE_TEST_SUITE_P(BundleObservationSolveSettings, CSMSolveTypeStrings, ::testing::Values( + qMakePair(csm::param::NONE, QString("NONE")), + qMakePair(csm::param::FICTITIOUS, QString("FICTITIOUS")), + qMakePair(csm::param::REAL, QString("REAL")), + qMakePair(csm::param::FIXED, QString("FIXED")))); + INSTANTIATE_TEST_SUITE_P(BundleObservationSolveSettings, PointingSolveOptionStrings, ::testing::Values( qMakePair(BundleObservationSolveSettings::NoPointingFactors, QString("None")), qMakePair(BundleObservationSolveSettings::AnglesOnly, QString("AnglesOnly")), From 590c5a9619e478d4479827ac775fb8c1b3c876cc Mon Sep 17 00:00:00 2001 From: Kristin Berry Date: Wed, 5 May 2021 16:13:55 -0700 Subject: [PATCH 3/3] Add missing 'y' to docs --- isis/src/control/apps/jigsaw/jigsaw.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/isis/src/control/apps/jigsaw/jigsaw.xml b/isis/src/control/apps/jigsaw/jigsaw.xml index 825ee4b9d7..9c989f2cee 100644 --- a/isis/src/control/apps/jigsaw/jigsaw.xml +++ b/isis/src/control/apps/jigsaw/jigsaw.xml @@ -1020,7 +1020,7 @@ - + string Specify a set of a CSM parameters to solve for.