Skip to content

Commit

Permalink
Used CK quality for PCK selection in spiceinit (#3716)
Browse files Browse the repository at this point in the history
* Changed PCK to use CK quality in spiceinit

* Added spiceinit history for change
  • Loading branch information
jessemapel authored Feb 28, 2020
1 parent 79e652e commit 834b5b5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 30 deletions.
48 changes: 24 additions & 24 deletions isis/src/base/apps/spiceinit/spiceinit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

using namespace std;

namespace Isis {
namespace Isis {

void getUserEnteredKernel(UserInterface &ui, const QString &param, Kernel &kernel);
bool tryKernels(Cube *icube, Process &p, UserInterface &ui, Pvl *log,
Expand All @@ -42,16 +42,16 @@ namespace Isis {
* @param ui The Application UI
* @param(out) log The Pvl that attempted kernel sets will be logged to
*/
void spiceinit(UserInterface &ui, Pvl *log) {
void spiceinit(UserInterface &ui, Pvl *log) {
// Open the input cube
Process p;

CubeAttributeInput cai;
Cube *icube = p.SetInputCube(ui.GetFileName("FROM"), cai, ReadWrite);
spiceinit(icube, ui, log);
p.EndProcess();
}


/**
* Spiceinit a Cube
Expand All @@ -76,7 +76,7 @@ namespace Isis {
QString msg = "At least one SPK quality must be selected";
throw IException(IException::User, msg, _FILEINFO_);
}

// Make sure it is not projected
Projection *proj = NULL;
try {
Expand All @@ -92,7 +92,7 @@ namespace Isis {
}

Pvl lab = *icube->label();

// if cube has existing polygon delete it
if (icube->label()->hasObject("Polygon")) {
icube->label()->deleteObject("Polygon");
Expand Down Expand Up @@ -144,15 +144,15 @@ namespace Isis {
Kernel lk, pck, targetSpk, fk, ik, sclk, spk, iak, dem, exk;
QList< priority_queue<Kernel> > ck;
lk = baseKernels.leapSecond(lab);
pck = baseKernels.targetAttitudeShape(lab);
pck = ckKernels.targetAttitudeShape(lab);
targetSpk = baseKernels.targetPosition(lab);
ik = baseKernels.instrument(lab);
sclk = baseKernels.spacecraftClock(lab);
iak = baseKernels.instrumentAddendum(lab);
fk = ckKernels.frame(lab);
ck = ckKernels.spacecraftPointing(lab);
spk = spkKernels.spacecraftPosition(lab);

if (ui.GetBoolean("CKNADIR")) {
// Only add nadir if no spacecraft pointing found, so we will set (priority) type to 0.
QStringList nadirCk;
Expand Down Expand Up @@ -198,7 +198,7 @@ namespace Isis {
_FILEINFO_);
}
else if (ui.WasEntered("CK")) {
// if user entered ck
// if user entered ck
// empty ck queue list found in system
while (ck.size()) {
ck.pop_back();
Expand All @@ -209,10 +209,10 @@ namespace Isis {
emptyKernelQueue.push(Kernel());
ck.push_back(emptyKernelQueue);
}

// while the first queue is not empty, loop through it until tryKernels() succeeds
while (ck.at(0).size() != 0 && !kernelSuccess) {
// create an empty kernel
// create an empty kernel
Kernel realCkKernel;
QStringList ckKernelList;

Expand All @@ -236,13 +236,13 @@ namespace Isis {
Kernel topPriority = ck.at(i).top();
ckKernelList.append(topPriority.kernels());
// set the type to equal the type of the to priority of the first
//queue
realCkKernel.setType(topPriority.type());
//queue
realCkKernel.setType(topPriority.type());
}
}

}
// pop the top priority ck off only the first queue so that the next
// pop the top priority ck off only the first queue so that the next
// iteration will test the next highest priority of the first queue with
// the top priority of each of the other queues.
ck[0].pop();
Expand All @@ -267,14 +267,14 @@ namespace Isis {
}

/**
* If the user entered the parameter param, then kernel is replaced by the
* If the user entered the parameter param, then kernel is replaced by the
* user's values and quality is reset to 0. Otherwise, the kernels loaded by the
* KernelDb class will be kept.
*
* @param param Name of the kernel input parameter
*
* @param kernel Kernel object to be overwritten if the specified user parameter
* was entered.
*
* @param kernel Kernel object to be overwritten if the specified user parameter
* was entered.
*/
void getUserEnteredKernel(UserInterface &ui, const QString &param, Kernel &kernel) {
if (ui.WasEntered(param)) {
Expand Down Expand Up @@ -395,7 +395,7 @@ namespace Isis {
// Get rid of old keywords from previously inited cubes
if (currentKernels.hasKeyword("Source"))
currentKernels.deleteKeyword("Source");

if (currentKernels.hasKeyword("SpacecraftPointing"))
currentKernels.deleteKeyword("SpacecraftPointing");

Expand Down Expand Up @@ -450,7 +450,7 @@ namespace Isis {
try {
cam = icube->camera();
currentKernels = icube->group("Kernels");

PvlKeyword source("Source");

if (cam->isUsingAle()) {
Expand All @@ -461,11 +461,11 @@ namespace Isis {
}

currentKernels += source;
icube->putGroup(currentKernels);
icube->putGroup(currentKernels);
if (log){
log->addGroup(currentKernels);
}
}

}
catch(IException &e) {
Pvl errPvl = e.toPvl();
Expand Down Expand Up @@ -665,7 +665,7 @@ namespace Isis {
continue;
}
}

if (log) {
log->addGroup(logGrp);
}
Expand Down
17 changes: 11 additions & 6 deletions isis/src/base/apps/spiceinit/spiceinit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@
not have their paths expanded. This is to allow variables like $msg/ to work correctly.
</p>
<p>
The spiceinit program will also add the RayTraceEngine, OnError, and Tolerance keywords to the Kernels
group if specified in the IsisPreferences file. If included, these keywords specify the ray-tracing engine to use and how to use it for shapemodels.
Please see the IsisPreferences file for more details.
The spiceinit program will also add the RayTraceEngine, OnError, and Tolerance keywords to the Kernels
group if specified in the IsisPreferences file. If included, these keywords specify the ray-tracing engine to use and how to use it for shapemodels.
Please see the IsisPreferences file for more details.

</p>
<p><b>Troubleshooting:</b> If spiceinit is failing with the error
Expand Down Expand Up @@ -279,17 +279,22 @@
</change>
<change name="Kristin Berry" date="2017-06-06">
Updated spiceinit to retain ShapeModel-related keywords set by the ShapeModelFactory and add them to the kernel
group. Like other keywords in the kernels group, if they are present at the beginning of a spiceinit run (if we are re-spiceiniting)
they are removed.
group. Like other keywords in the kernels group, if they are present at the beginning of a spiceinit run (if we are re-spiceiniting)
they are removed.
</change>
<change name="Kristin Berry" date="2017-08-06">
Updated spiceinit to remove code dealing with the CubeSupported Pvl Keyword, from the ShapeModel group in the IsisPreferences file,
Updated spiceinit to remove code dealing with the CubeSupported Pvl Keyword, from the ShapeModel group in the IsisPreferences file,
which has been removed.
</change>
<change name="Christopher Combs" date="2018-01-11">
Made change to camera construction error throw for better reporting on uninstantiated cameras.
Fixes #5163.
</change>
<change name="Jesse Mapel" date="2020-02-26">
Changed PCK selection to use the same qualities as CK so that target body parameters
derived from bundle adjustment can be used alongside CKs derived from bundle adjustment.
Fixes #3669.
</change>
</history>

<oldName>
Expand Down

0 comments on commit 834b5b5

Please sign in to comment.