9#include "RosettaVirtisCamera.h"
20#include <tnt/tnt_array2d_utils.h>
23#include "CameraFocalPlaneMap.h"
24#include "IException.h"
28#include "LineScanCameraDetectorMap.h"
29#include "LineScanCameraGroundMap.h"
30#include "LineScanCameraSkyMap.h"
31#include "NaifStatus.h"
32#include "NumericalApproximation.h"
60 QString mess =
"This data is apparently not from the VIRTIS instrument but "
66 int procLevel = inst[
"ProcessingLevelId"];
70 QString channelId = inst[
"ChannelId"];
72 QString instMode = inst[
"InstrumentModeId"];
82 if (channelId ==
"VIRTIS_M_VIS") {
84 virFrame = (hasArtCK) ? -226211 : -226112;
85 frameId =
"ROS_VIRTIS-M_VIS";
87 else if (channelId ==
"VIRTIS_M_IR") {
89 virFrame = (hasArtCK) ? -226213 : -226214;
90 frameId =
"ROS_VIRTIS-M_IR";
103 PvlKeyword &frameParam = inst[
"FrameParameter"];
128 double sampleBoreSight =
getDouble(ikernKey);
131 double lineBoreSight =
getDouble(ikernKey);
160#if defined(DUMP_INFO)
162 cout <<
"Total Records: " << cache.Records() <<
"\n";
164 for (
int i = 0 ; i < cache.Records() ; i++) {
166 string separator(
"");
167 for (
int f = 0 ; f < rec.Fields() ; f++) {
168 cout << separator << (double) rec[f];
303 std::vector<double> cacheTime;
304 Table hktable(
"VIRTISHouseKeeping", filename);
308 for (
int i = 0; i < hktable.Records(); i++) {
310 QString scetString = trec[
"dataSCET"];
359 Table hktable(
"VIRTISHouseKeeping", filename);
364 for (
int i = 0; i < hktable.Records(); i++) {
366 double scet = (double) trec[
"dataSCET"];
367 int shutterMode = (int) trec[
"Data Type__Shutter state"];
370 double mirrorSin = trec[
"M_MIRROR_SIN_HK"];
371 double mirrorCos = trec[
"M_MIRROR_COS_HK"];
372 double scanElecDeg = atan(mirrorSin/mirrorCos) * dpr_c();
373 double optAng = ((scanElecDeg - 3.7996979) * 0.25/0.257812);
381 bool isDark = (shutterMode == 1);
384 if ( ! isDark ) { angFit.AddData(lineno, optAng); }
386#if defined(DUMP_INFO)
387 cout <<
"Line(" << ((isDark) ?
"C): " :
"O): ") << i
388 <<
", OptAng(D): " << setprecision(12) << optAng * dpr_c()
389 <<
", MidExpTime(ET): " << lineMidTime
394 smInfo.m_lineNum = lineno;
395 smInfo.m_scanLineEt = lineMidTime;
396 smInfo.m_mirrorSin = mirrorSin;
397 smInfo.m_mirrorCos = mirrorCos;
398 smInfo.m_opticalAngle = optAng;
399 smInfo.m_isDarkCurrent = isDark;
431 for (
unsigned int a = 0 ; a <
m_mirrorData.size() ; a++) {
441 mess <<
"Number housekeeping lines determined (" <<
m_lineRates.size()
442 <<
") is not equal to image lines(" <<
Lines() <<
")";
459 const int zeroFrame) {
482 Table quats(
"SpiceRotation", record);
483 int nfields = record.
Fields();
485 QString virZero = virChannel +
"_ZERO";
488 int nvals = nfields - 1;
491 SpiceDouble eulang[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
492 SpiceDouble xform[6][6], xform2[6][6];
494 SpiceDouble q_av[7], *av(&q_av[4]);
496 for (
int i = 0 ; i < nlines ; i++) {
497 int index = min(i, nlines-1);
506 eul2xf_c(eulang, 1, 2, 3, xform);
507 mxmg_c(xform, &state[0][0], 6, 6, 6, xform2);
510 xf2rav_c(xform2, m, av);
514 for (
int k = 0 ; k < nvals ; k++) {
519 record[nvals] = etTime;
524 mess <<
"Failed to get point state for line " << i+1;
535 int virZeroId =
getInteger(
"FRAME_" + virZero);
537 tdf.addValue(
"-226200");
538 tdf.addValue(
"-226000");
540 quats.Label() += tdf;
547 SpiceDouble identity[3][3];
552 for (
int i = 0 ; i < 3 ; i++) {
553 for (
int j = 0 ; j < 3 ; j++) {
554 crot.addValue(
toString(identity[i][j]));
558 quats.Label() += crot;
581 const QString &frame2,
582 const double &etTime)
588 sxform_c(frame1.toLatin1().data(), frame2.toLatin1().data(), etTime,
589 (SpiceDouble (*)[6]) state[0]);
595 pxform_c(frame1.toLatin1().data(), frame2.toLatin1().data(), etTime,
596 (SpiceDouble (*)[3]) rot[0]);
598 SpiceDouble av[3] = {0.0, 0.0, 0.0 };
599 rav2xf_c((SpiceDouble (*)[3]) rot[0], av,
600 (SpiceDouble (*)[6]) state[0]);
604 mess <<
"Could not get state rotation for Frame1 (" << frame1
605 <<
") to Frame2 (" << frame2 <<
") at time " << etTime;
630 QRegExp virCk(
"*ROS_VIRTIS_M_????_????_V?.BC");
631 virCk.setPatternSyntax(QRegExp::Wildcard);
632 for (
int i = 0 ; i < cks.size() ; i++) {
633 if ( virCk.exactMatch(cks[i]) )
return (
true);
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
Distort/undistort focal plane coordinates.
Convert between distorted focal plane and detector coordinates.
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
QString m_spacecraftNameLong
Full spacecraft name.
int Lines() const
Returns the number of lines in the image.
void SetFocalLength()
Reads the focal length from the instrument kernel.
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
void LoadCache()
This loads the spice cache big enough for this image.
QString m_instrumentNameShort
Shortened instrument name.
QString instrumentId()
This method returns the InstrumentId as it appears in the cube.
QString m_spacecraftNameShort
Shortened spacecraft name.
CameraFocalPlaneMap * FocalPlaneMap()
Returns a pointer to the CameraFocalPlaneMap object.
QString m_instrumentNameLong
Full instrument name.
IO Handler for Isis Cubes.
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
@ Programmer
This error is for when a programmer made an API call that was illegal.
Determine SPICE kernels defined in an ISIS file.
Container class for storing timing information for a section of an image.
Convert between undistorted focal plane and ground coordinates.
Generic class for Line Scan Cameras.
LineScanCameraDetectorMap * DetectorMap()
Returns a pointer to the LineScanCameraDetectorMap object.
Convert between undistorted focal plane and ra/dec coordinates.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
NumericalApproximation provides various numerical analysis methods of interpolation,...
@ NearestEndpoint
Evaluate() returns the y-value of the nearest endpoint if a is outside of the domain.
Contains multiple PvlContainers.
Container for cube-like labels.
A single keyword-value pair.
@ Traverse
Search child objects.
Camera model for both Rosetta VIRTIS-M instruments.
double startTime() const
Return start time for the entire cube.
double m_scanRate
Line scan rate.
double lineStartTime(const double midExpTime) const
Return the start time for a given line exposure time.
std::vector< ScanMirrorInfo > m_mirrorData
vector of mirror info for each line
double exposureTime() const
Return the exposure time.
RosettaVirtisCamera(Cube &cube)
Creates a camera for a Rosetta VIRTIS-M cube.
std::vector< LineRateChange > m_lineRates
vector of timing info for each line
char m_slitMode
Slit mode of the instrument.
double endTime() const
Return end time for the entire cube.
virtual int CkReferenceId() const
CK Reference ID - J2000.
int pixelSumming() const
Return the pixel summing rate.
void readHouseKeeping(const QString &filename, double lineRate)
Read the VIRTIS houskeeping table from cube.
int m_summing
Summing/binnning mode.
int hkLineCount() const
Returns number of housekeeping records found in the cube Table.
Table getPointingTable(const QString &channelId, const int zeroFrame)
Compute the pointing table for each line.
TNT::Array2D< SpiceDouble > SMatrix
2-D buffer
bool m_is1BCalibrated
is determined by Archive/ProcessingLevelId
virtual int CkFrameId() const
CK Frame ID - Instrument Code from spacit run on CK.
double scanLineTime() const
Return the line scan rate.
~RosettaVirtisCamera()
Destructor.
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
SMatrix getStateRotation(const QString &frame1, const QString &frame2, const double &et) const
Compute the state rotation at a given time for given frames.
bool hasArticulationKernel(Pvl &label) const
determine if the CK articulation kernels are present/given
double m_exposureTime
Line exposure time.
double lineEndTime(const double midExpTime) const
Return the end time for a given line exposure time.
void readSCET(const QString &filename)
For calibrated VIRTIS-M images, read the SCET values from the cube.
void setTime(const iTime &time)
By setting the time you essential set the position of the spacecraft and body as indicated in the cla...
virtual iTime getClockTime(QString clockValue, int sclkCode=-1, bool clockTicks=false)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
SpiceInt naifSpkCode() const
This returns the NAIF SPK code to use when reading from SPK kernels.
virtual SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
SpiceInt getInteger(const QString &key, int index=0)
This returns a value from the NAIF text pool.
@ No
Do not downsize the cache.
Class for storing an Isis::Table's field information.
@ Double
The values in the field are 8 byte doubles.
Class for storing Table blobs information.
int Fields() const
Returns the number of fields that are currently in the record.
Convert between parent image coordinates and detector coordinates.
Parse and return pieces of a time string.
This is free and unencumbered software released into the public domain.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
double toDouble(const QString &string)
Global function to convert from a string to a double.
Namespace for the standard library.