9 #include "BundleTargetBody.h"
14 #include "BundleSettings.h"
15 #include "IException.h"
17 #include "PvlKeyword.h"
18 #include "PvlObject.h"
73 m_pm = target->pmCoefs();
217 Angle aprioriVelocityPoleRA,
218 Angle sigmaVelocityPoleRA,
220 Angle aprioriVelocityPoleDec,
221 Angle sigmaVelocityPoleDec,
223 Angle aprioriVelocityPM,
224 Angle sigmaVelocityPM,
247 m_raPole[1] = aprioriVelocityPoleRA;
253 m_pm[1] = aprioriVelocityPM;
263 if (sigmaPoleRA.
degrees() > 0.0) {
276 m_raPole[1] = aprioriVelocityPoleRA;
278 if (sigmaVelocityPoleRA.
degrees() > 0.0) {
297 if (sigmaPoleDec.
degrees() > 0.0) {
311 if (sigmaVelocityPoleDec.
degrees() > 0.0) {
344 m_pm[1] = aprioriVelocityPM;
346 if (sigmaVelocityPM.
degrees() > 0.0) {
583 QString msg =
"In BundleTargetBody::applyParameterCorrections: "
584 "correction and m_targetParameter vectors sizes don't match.\n";
603 case AccelerationPoleRA:
609 case VelocityPoleDec:
612 case AccelerationPoleDec:
624 case TriaxialRadiusA:
626 double c =
m_radii[0].kilometers();
627 double d = c + corrections[n];
632 case TriaxialRadiusB:
634 double c =
m_radii[1].kilometers();
635 double d = c + corrections[n];
640 case TriaxialRadiusC:
642 double c =
m_radii[2].kilometers();
643 double d = c + corrections[n];
651 double d = c + corrections[n];
666 QString msg =
"Unable to apply parameter corrections to BundleTargetBody.";
683 if (method.compare(
"NONE", Qt::CaseInsensitive) == 0) {
686 else if (method.compare(
"MEAN", Qt::CaseInsensitive) == 0) {
689 else if (method.compare(
"ALL", Qt::CaseInsensitive) == 0) {
694 "Unknown target body radius solution method [" + method +
"].",
712 else if (method ==
Mean)
714 else if (method ==
All)
717 "Unknown target body radius solve method enum [" +
toString(method) +
"].",
908 QString msg =
"The triaxial radii can only be accessed when solving for triaxial radii.";
925 QString msg =
"The mean radius can only be accessed when solving for mean radius.";
948 for (
int i = 0; i < nParameters; i++) {
969 std::vector<double> finalParameterValues;
972 int nAngleParameters = 0;
973 int nRadiusParameters = 0;
975 finalParameterValues.push_back(
m_raPole[0].degrees());
976 parameterNamesList.append( str.arg(
"POLE RA ") );
980 finalParameterValues.push_back(
m_raPole[1].degrees());
981 parameterNamesList.append( str.arg(
"POLE RAv ") );
985 finalParameterValues.push_back(
m_raPole[2].degrees());
986 parameterNamesList.append( str.arg(
"POLE RAa ") );
990 finalParameterValues.push_back(
m_decPole[0].degrees());
991 parameterNamesList.append( str.arg(
"POLE DEC ") );
995 finalParameterValues.push_back(
m_decPole[1].degrees());
996 parameterNamesList.append( str.arg(
"POLE DECv ") );
1000 finalParameterValues.push_back(
m_decPole[2].degrees());
1001 parameterNamesList.append( str.arg(
"POLE DECa ") );
1005 finalParameterValues.push_back(
m_pm[0].degrees());
1006 parameterNamesList.append( str.arg(
" PM ") );
1010 finalParameterValues.push_back(
m_pm[1].degrees());
1011 parameterNamesList.append( str.arg(
" PMv ") );
1015 finalParameterValues.push_back(
m_pm[2].degrees());
1016 parameterNamesList.append( str.arg(
" PMa ") );
1020 finalParameterValues.push_back(
m_radii[0].kilometers());
1021 finalParameterValues.push_back(
m_radii[1].kilometers());
1022 finalParameterValues.push_back(
m_radii[2].kilometers());
1023 parameterNamesList.append( str.arg(
" RadiusA ") );
1024 parameterNamesList.append( str.arg(
" RadiusB ") );
1025 parameterNamesList.append( str.arg(
" RadiusC ") );
1026 nRadiusParameters += 3;
1030 parameterNamesList.append( str.arg(
"MeanRadius ") );
1031 nRadiusParameters++;
1034 int nParameters = nAngleParameters + nRadiusParameters;
1037 QString finalqStr =
"";
1042 for (
int i = 0; i < nAngleParameters; i++) {
1049 if (errorPropagation) {
1051 qStr = QString(
"%1%2%3%4%5%6\n").
1052 arg( parameterNamesList.at(i) ).
1053 arg(finalParameterValues[i] - corr_temp.
degrees(), 17,
'f', 8).
1054 arg(corr_temp.
degrees(), 21,
'f', 8).
1055 arg(finalParameterValues[i], 20,
'f', 8).
1061 qStr = QString(
"%1%2%3%4%5%6\n").
1062 arg( parameterNamesList.at(i) ).
1063 arg(finalParameterValues[i] - corr_temp.
degrees(), 17,
'f', 8).
1064 arg(corr_temp.
degrees(), 21,
'f', 8).
1065 arg(finalParameterValues[i], 20,
'f', 8).
1072 for (
int i = nAngleParameters; i < nParameters; i++) {
1079 if (errorPropagation) {
1080 double d1 = finalParameterValues[i];
1082 qStr = QString(
"%1%2%3%4%5%6\n").
1083 arg( parameterNamesList.at(i) ).
1084 arg(d1 - d2, 17,
'f', 8).
1085 arg(d2, 21,
'f', 8).
1086 arg(d1, 20,
'f', 8).
1091 double d1 = finalParameterValues[i];
1093 qStr = QString(
"%1%2%3%4%5%6\n").
1094 arg( parameterNamesList.at(i) ).
1095 arg(d1 - d2, 17,
'f', 8).
1096 arg(d2, 21,
'f', 8).
1097 arg(d1, 20,
'f', 8).
1191 std::set<int> targetParameterSolveCodes;
1194 if (g->hasKeyword(
"Ra")) {
1196 str = g->findKeyword(
"Ra")[0];
1199 QString msg =
"Ra must be given as none, position, velocity, or acceleration";
1202 if (str ==
"position") {
1203 targetParameterSolveCodes.insert(BundleTargetBody::PoleRA);
1205 else if (str ==
"velocity") {
1206 targetParameterSolveCodes.insert(BundleTargetBody::PoleRA);
1207 targetParameterSolveCodes.insert(BundleTargetBody::VelocityPoleRA);
1209 else if (str ==
"acceleration") {
1210 targetParameterSolveCodes.insert(BundleTargetBody::PoleRA);
1211 targetParameterSolveCodes.insert(BundleTargetBody::VelocityPoleRA);
1212 targetParameterSolveCodes.insert(BundleTargetBody::AccelerationPoleRA);
1216 if (g->hasKeyword(
"Dec")) {
1218 str = g->findKeyword(
"Dec")[0];
1221 QString msg =
"Dec must be given as none, position, velocity, or acceleration";
1224 if (str ==
"position") {
1225 targetParameterSolveCodes.insert(BundleTargetBody::PoleDec);
1227 else if (str ==
"velocity") {
1228 targetParameterSolveCodes.insert(BundleTargetBody::PoleDec);
1229 targetParameterSolveCodes.insert(BundleTargetBody::VelocityPoleDec);
1231 else if (str ==
"acceleration") {
1232 targetParameterSolveCodes.insert(BundleTargetBody::PoleDec);
1233 targetParameterSolveCodes.insert(BundleTargetBody::VelocityPoleDec);
1234 targetParameterSolveCodes.insert(BundleTargetBody::AccelerationPoleDec);
1238 if (g->hasKeyword(
"Pm")) {
1240 str = g->findKeyword(
"Pm")[0];
1243 QString msg =
"Pm must be given as none, position, velocity, or acceleration";
1246 if (str ==
"position") {
1247 targetParameterSolveCodes.insert(BundleTargetBody::PM);
1249 else if (str ==
"velocity") {
1250 targetParameterSolveCodes.insert(BundleTargetBody::PM);
1251 targetParameterSolveCodes.insert(BundleTargetBody::VelocityPM);
1253 else if (str ==
"acceleration") {
1254 targetParameterSolveCodes.insert(BundleTargetBody::PM);
1255 targetParameterSolveCodes.insert(BundleTargetBody::VelocityPM);
1256 targetParameterSolveCodes.insert(BundleTargetBody::AccelerationPM);
1260 if (g->hasKeyword(
"RadiiSolveOption")) {
1262 str = g->findKeyword(
"RadiiSolveOption")[0];
1265 QString msg =
"RadiiSolveOption must be given as none, triaxial, or mean";
1268 if (str ==
"triaxial") {
1269 targetParameterSolveCodes.insert(BundleTargetBody::TriaxialRadiusA);
1270 targetParameterSolveCodes.insert(BundleTargetBody::TriaxialRadiusB);
1271 targetParameterSolveCodes.insert(BundleTargetBody::TriaxialRadiusC);
1272 solveRadiiMethod =
All;
1274 else if (str ==
"mean") {
1275 targetParameterSolveCodes.insert(BundleTargetBody::MeanRadius);
1276 solveRadiiMethod =
Mean;
1279 solveRadiiMethod =
None;
1283 Angle aprioriPoleRA;
1285 Angle aprioriVelocityPoleRA;
1286 Angle poleRAVelocitySigma;
1287 Angle aprioriAccelerationPoleRA;
1288 Angle poleRAAccelerationSigma;
1289 Angle aprioriPoleDec;
1291 Angle aprioriVelocityPoleDec;
1292 Angle sigmaVelocityPoleDec;
1293 Angle aprioriAccelerationPoleDec;
1294 Angle sigmaAccelerationPoleDec;
1297 Angle aprioriVelocityPM;
1298 Angle sigmaVelocityPM;
1299 Angle aprioriAccelerationPM;
1300 Angle pmAccelerationSigma;
1313 if (g->hasKeyword(
"RaValue")) {
1315 d = (double)(g->findKeyword(
"RaValue"));
1318 QString msg =
"RaValue must be a valid double (>= 0; blank defaults to 0).";
1324 if (g->hasKeyword(
"RaSigma")) {
1326 d = (double)(g->findKeyword(
"RaSigma"));
1329 QString msg =
"RaSigma must be a valid double (>= 0; blank defaults to 0).";
1335 if (g->hasKeyword(
"RaVelocityValue")) {
1337 d = (double)(g->findKeyword(
"RaVelocityValue"));
1340 QString msg =
"RaVelocityValue must be a valid double (>= 0; blank defaults to 0).";
1346 if (g->hasKeyword(
"RaVelocitySigma")) {
1348 d = (double)(g->findKeyword(
"RaVelocitySigma"));
1351 QString msg =
"RaVelocitySigma must be a valid double (>= 0; blank defaults to 0).";
1357 if (g->hasKeyword(
"RaAccelerationValue")) {
1359 d = (double)(g->findKeyword(
"RaAccelerationValue"));
1362 QString msg =
"RaAccelerationValue must be a valid double (>= 0; blank defaults to 0).";
1368 if (g->hasKeyword(
"RaAccelerationSigma")) {
1370 d = (double)(g->findKeyword(
"RaAccelerationSigma"));
1373 QString msg =
"RaAccelerationSigma must be a valid double (>= 0; blank defaults to 0).";
1379 if (g->hasKeyword(
"DecValue")) {
1381 d = (double)(g->findKeyword(
"DecValue"));
1384 QString msg =
"DecValue must be a valid double (>= 0; blank defaults to 0).";
1390 if (g->hasKeyword(
"DecSigma")) {
1392 d = (double)(g->findKeyword(
"DecSigma"));
1395 QString msg =
"DecSigma must be a valid double (>= 0; blank defaults to 0).";
1401 if (g->hasKeyword(
"DecVelocityValue")) {
1403 d = (double)(g->findKeyword(
"DecVelocityValue"));
1406 QString msg =
"DecVelocityValue must be a valid double (>= 0; blank defaults to 0).";
1412 if (g->hasKeyword(
"DecVelocitySigma")) {
1414 d = (double)(g->findKeyword(
"DecVelocitySigma"));
1417 QString msg =
"DecVelocitySigma must be a valid double (>= 0; blank defaults to 0).";
1423 if (g->hasKeyword(
"DecAccelerationValue")) {
1425 d = (double)(g->findKeyword(
"DecAccelerationValue"));
1428 QString msg =
"DecAccelerationValue must be a valid double (>= 0; blank defaults to 0).";
1434 if (g->hasKeyword(
"DecAccelerationSigma")) {
1436 d = (double)(g->findKeyword(
"DecAccelerationSigma"));
1439 QString msg =
"DecAccelerationSigma must be a valid double (>= 0; blank defaults to 0).";
1445 if (g->hasKeyword(
"PmValue")) {
1447 d = (double)(g->findKeyword(
"PmValue"));
1450 QString msg =
"PmValue must be a valid double (>= 0; blank defaults to 0).";
1456 if (g->hasKeyword(
"PmSigma")) {
1458 d = (double)(g->findKeyword(
"PmSigma"));
1461 QString msg =
"PmSigma must be a valid double (>= 0; blank defaults to 0).";
1468 if (g->hasKeyword(
"PmVelocityValue")) {
1470 d = (double)(g->findKeyword(
"PmVelocityValue"));
1473 QString msg =
"PmVelocityValue must be a valid double (>= 0; blank defaults to 0).";
1479 if (g->hasKeyword(
"PmVelocitySigma")) {
1481 d = (double)(g->findKeyword(
"PmVelocitySigma"));
1484 QString msg =
"PmVelocitySigma must be a valid double (>= 0; blank defaults to 0).";
1490 if (g->hasKeyword(
"PmAccelerationValue")) {
1492 d = (double)(g->findKeyword(
"PmAccelerationValue"));
1495 QString msg =
"PmAccelerationValue must be a valid double (>= 0; blank defaults to 0).";
1501 if (g->hasKeyword(
"PmAccelerationSigma")) {
1503 d = (double)(g->findKeyword(
"PmAccelerationSigma"));
1506 QString msg =
"PmAccelerationSigma must be a valid double (>= 0; blank defaults to 0).";
1512 if (g->hasKeyword(
"RadiusAValue")) {
1514 d = (double)(g->findKeyword(
"RadiusAValue"));
1517 QString msg =
"RadiusAValue must be a valid double (blank defaults to 0).";
1524 QString msg =
"RadiusAValue must be >= 0.";
1529 if (g->hasKeyword(
"RadiusASigma")) {
1531 d = (double)(g->findKeyword(
"RadiusASigma"));
1534 QString msg =
"RadiusASigma must be a valid double (blank defaults to 0).";
1541 QString msg =
"RadiusASigma must be >= 0.";
1546 if (g->hasKeyword(
"RadiusBValue")) {
1548 d = (double)(g->findKeyword(
"RadiusBValue"));
1551 QString msg =
"RadiusBValue must be a valid double (blank defaults to 0).";
1558 QString msg =
"RadiusBValue must be >= 0.";
1563 if (g->hasKeyword(
"RadiusBSigma")) {
1565 d = (double)(g->findKeyword(
"RadiusBSigma"));
1568 QString msg =
"RadiusBSigma must be a valid double (blank defaults to 0).";
1575 QString msg =
"RadiusBSigma must be >= 0.";
1580 if (g->hasKeyword(
"RadiusCValue")) {
1582 d = (double)(g->findKeyword(
"RadiusCValue"));
1585 QString msg =
"RadiusCValue must be a valid double (blank defaults to 0).";
1592 QString msg =
"RadiusCValue must be >= 0.";
1597 if (g->hasKeyword(
"RadiusCSigma")) {
1599 d = (double)(g->findKeyword(
"RadiusCSigma"));
1602 QString msg =
"RadiusCSigma must be a valid double (blank defaults to 0).";
1609 QString msg =
"RadiusCSigma must be >= 0.";
1614 if (g->hasKeyword(
"MeanRadiusValue")) {
1616 d = (double)(g->findKeyword(
"MeanRadiusValue"));
1619 QString msg =
"MeanRadiusValue must be a valid double (blank defaults to 0).";
1626 QString msg =
"MeanRadiusValue must be >= 0.";
1631 if (g->hasKeyword(
"MeanRadiusSigma")) {
1633 d = (double)(g->findKeyword(
"MeanRadiusSigma"));
1636 QString msg =
"MeanRadiusSigma must be a valid double (blank defaults to 0).";
1643 QString msg =
"MeanRadiusSigma must be >= 0.";
1662 aprioriPoleRA, poleRASigma,
1663 aprioriVelocityPoleRA, poleRAVelocitySigma,
1664 aprioriPoleDec, poleDecSigma,
1665 aprioriVelocityPoleDec, sigmaVelocityPoleDec,
1667 aprioriVelocityPM, sigmaVelocityPM,
1669 aprioriRadiusA, sigmaRadiusA,
1670 aprioriRadiusB, sigmaRadiusB,
1671 aprioriRadiusC, sigmaRadiusC,
1672 aprioriMeanRadius, sigmaMeanRadius);
1693 QString msg =
"Local radius can only be found if triaxial radii were solved for.";
1697 double a =
m_radii[0].kilometers();
1698 double b =
m_radii[1].kilometers();
1699 double c =
m_radii[2].kilometers();
1704 double xyradius = a * b / sqrt(pow(b * cos(rlon), 2) +
1705 pow(a * sin(rlon), 2));
1706 const double &radius = xyradius * c / sqrt(pow(c * cos(rlat), 2) +
1707 pow(xyradius * sin(rlat), 2));