Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctxcal now uses cam #4304

Merged
merged 4 commits into from
Feb 24, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 25 additions & 15 deletions isis/src/mro/apps/ctxcal/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ find files of those names at the top level of this repository. **/
#include "LineManager.h"
#include "Brick.h"
#include "Table.h"
#include "Camera.h"

using namespace std;
using namespace Isis;
Expand Down Expand Up @@ -139,21 +140,30 @@ void IsisMain() {
// iof = conversion factor from counts/ms to i/f
bool convertIOF = ui.GetBoolean("IOF");
if(convertIOF) {
// Get the distance between Mars and the Sun at the given time in
// Astronomical Units (AU)
QString bspKernel = p.MissionData("base", "/kernels/spk/de???.bsp", true);
furnsh_c(bspKernel.toLatin1().data());
QString satKernel = p.MissionData("base", "/kernels/spk/mar???.bsp", true);
furnsh_c(satKernel.toLatin1().data());
QString pckKernel = p.MissionData("base", "/kernels/pck/pck?????.tpc", true);
furnsh_c(pckKernel.toLatin1().data());
double sunpos[6], lt;
spkezr_c("sun", etStart, "iau_mars", "LT+S", "mars", sunpos, &lt);
double dist1 = vnorm_c(sunpos);
unload_c(bspKernel.toLatin1().data());
unload_c(satKernel.toLatin1().data());
unload_c(pckKernel.toLatin1().data());

double dist1 = 1;
try {
Camera *cam;
cam = icube->camera();
cam->setTime(startTime);
dist1 = cam->sunToBodyDist();
}
catch(IException &e) {
// Get the distance between Mars and the Sun at the given time in
// Astronomical Units (AU)
QString bspKernel = p.MissionData("base", "/kernels/spk/de???.bsp", true);
furnsh_c(bspKernel.toLatin1().data());
QString satKernel = p.MissionData("base", "/kernels/spk/mar???.bsp", true);
furnsh_c(satKernel.toLatin1().data());
QString pckKernel = p.MissionData("base", "/kernels/pck/pck?????.tpc", true);
furnsh_c(pckKernel.toLatin1().data());
double sunpos[6], lt;
spkezr_c("sun", etStart, "iau_mars", "LT+S", "mars", sunpos, &lt);
dist1 = vnorm_c(sunpos);
unload_c(bspKernel.toLatin1().data());
unload_c(satKernel.toLatin1().data());
unload_c(pckKernel.toLatin1().data());
scsides marked this conversation as resolved.
Show resolved Hide resolved
}

double dist = 2.07E8;
double w0 = 3660.5;
double w1 = w0 * ((dist * dist) / (dist1 * dist1));
Expand Down