18#include "IException.h"
21#include "LeastSquares.h"
22#include "PolynomialBivariate.h"
23#include "Preference.h"
24#include "SpecialPixel.h"
38 CameraSkyMap(parent) {
64 QString stime = (QString) inst [
"NativeStartTime"];
65 QString intTime = stime.split(
".").first();
66 stime = stime.split(
".").last();
80 QString sampMode = QString((QString)inst [
"SamplingMode"]).toUpper();
83 int sampOffset = inst [
"XOffset"];
84 int lineOffset = inst [
"ZOffset"];
91 if (sampMode ==
"NORMAL") {
98 else if (sampMode ==
"HI-RES") {
108 string msg =
"Unsupported SamplingMode [" +
IString(sampMode) +
"]";
113 if (sampMode ==
"NORMAL") {
119 else if (sampMode ==
"HI-RES") {
128 string msg =
"Unsupported SamplingMode [" +
IString(sampMode) +
"]";
134 for(
int line = 0; line <
p_camera->ParentLines(); line++) {
135 for(
int samp = 0; samp <
p_camera->ParentSamples(); samp++) {
136 p_raMap[line][samp] = Isis::NULL8;
151 for(
int line = 0; line <
p_camera->ParentLines(); line++) {
165 for(
int samp = 0; samp <
p_camera->ParentSamples(); samp++) {
173 p_camera->SetImage((
double) samp + 1, (
double)line + 1);
174 double ra =
p_camera->RightAscension();
175 double dec =
p_camera->Declination();
210 if((imgLine < 0.5) || (imgLine >
p_camera->ParentLines() + 0.5) ||
211 (imgSamp < 0.5) || (imgSamp >
p_camera->ParentSamples() + 0.5)) {
231 SpiceDouble lookC[3];
234 SpiceDouble unitLookC[3];
235 vhat_c(lookC, unitLookC);
236 return p_camera->SetLookDirection(unitLookC);
248 if(ra < p_minRa || ra >
p_maxRa ||
253 double minDist = 9999.;
257 for(
int line = 0; line <
p_camera->ParentLines(); line++) {
259 for(
int samp = 0; samp <
p_camera->ParentSamples(); samp++) {
260 double mapRa =
p_raMap[line][samp];
261 if(mapRa == Isis::NULL8)
continue;
262 double mapDec =
p_decMap[line][samp];
263 if(mapDec == Isis::NULL8)
continue;
267 if(abs(mapRa - ra) > 180) {
268 if((ra - mapRa) > 0) {
269 mapRa = 360. + mapRa;
271 else if((ra - mapRa) < 0) {
272 mapRa = mapRa - 360.;
275 double dist = ((ra - mapRa) * (ra - mapRa)) +
276 ((dec - mapDec) * (dec - mapDec));
290 if(minDist >= 9999.)
return false;
301 vector<double> known(2);
303 for(
int line = minLine - 1; line < minLine + 2; line++) {
304 if(line < 0 || line >
p_camera->ParentLines() - 1)
continue;
305 for(
int samp = minSamp - 1; samp < minSamp + 2; samp++) {
307 if(samp < 0 || samp >
p_camera->ParentSamples() - 1)
continue;
309 double mapRa =
p_raMap[line][samp];
310 double mapDec =
p_decMap[line][samp];
311 if((mapRa == Isis::NULL8) || (mapDec == Isis::NULL8))
continue;
316 if(abs(mapRa - ra) > 180) {
317 if((ra - mapRa) > 0) {
318 mapRa = 360. + mapRa;
320 else if((ra - mapRa) < 0) {
321 mapRa = mapRa - 360.;
331 if(sampLsq.
Knowns() < 3)
return false;
339 double inSamp = sampLsq.
Evaluate(known);
340 double inLine = lineLsq.
Evaluate(known);
342 if(inSamp < 0 || inSamp >
p_camera->ParentSamples() + 0.5 ||
343 inLine < 0 || inLine >
p_camera->ParentLines() + 0.5) {
380 v[0] = sin(theta) * cos(phi);
382 v[2] = sin(theta) * sin(phi) / -1.;
Camera * p_camera
The main camera to calculate distortions on.
double p_focalPlaneY
Undistorted y value for the focal plane.
double p_focalPlaneX
Undistorted x value for the focal plane.
@ Programmer
This error is for when a programmer made an API call that was illegal.
Adds specific functionality to C++ strings.
Generic least square fitting class.
int Knowns() const
The number of knowns (or times AddKnown was invoked) linear combination of the variables.
double Evaluate(const std::vector< double > &input)
Invokes the BasisFunction Evaluate method.
int Solve(Isis::LeastSquares::SolveMethod method=SVD)
After all the data has been registered through AddKnown, invoke this method to solve the system of eq...
void AddKnown(const std::vector< double > &input, double expected, double weight=1.0)
Invoke this method for each set of knowns.
Nth degree Polynomial with two variables.
Contains multiple PvlContainers.
Container for cube-like labels.
@ Traverse
Search child objects.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
double p_decMap[64][64]
Declination map.
int p_camSampOffset
Sample offset.
double p_minRa
Minimum right ascension.
double p_maxDec
Maximum declination.
double p_xPixSize
X pixel size.
VimsSkyMap(Camera *parent, Pvl &lab)
Constructs the VimsSkyMap object.
void Init(Pvl &lab)
Initialize vims sky model.
double p_ux
Distorted focal plane x, in millimeters.
double p_yBore
Y boresight.
double p_interlineDelay
InterlineDelayDuration keyword value from the instrument group of the labels, divided by 1000.
void LookDirection(double v[3])
Determines the look direction in the camera coordinate system.
QString p_channel
Channel keyword value from the instrument group of the labels.
double p_uz
Distorted focal plane z, in millimeters.
double p_maxRa
Maximum right ascension.
double p_raMap[64][64]
Right ascension map.
double p_visExp
VIS exposure duration, divided by 1000.
double p_irExp
IR exposure duration, divided by 1000.
int p_swathLength
SwathLength keyword value from the instrument group of the labels.
double p_xBore
X boresight.
double p_minDec
Minimum declination.
double p_yPixSize
Y pixel size.
SpiceDouble p_etStart
Start ephemeris time.
virtual bool SetSky(const double ra, const double dec)
Sets the sky position to the given ra and dec.
virtual bool SetFocalPlane(const double ux, const double uy, const double uz)
Compute ground position from focal plane coordinate.
int p_swathWidth
SwathWidth keyword value from the instrument group of the labels.
double p_uy
Distorted focal plane y, in millimeters.
int p_camLineOffset
Line offset.
This is free and unencumbered software released into the public domain.
const double HALFPI
The mathematical constant PI/2.
double toDouble(const QString &string)
Global function to convert from a string to a double.
Namespace for the standard library.