1 #include "RosettaVirtisCamera.h" 12 #include <tnt/tnt_array2d_utils.h> 24 #include "NumericalApproximation.h" 52 QString mess =
"This data is apparently not from the VIRTIS instrument but " 58 int procLevel = inst[
"ProcessingLevelId"];
62 QString channelId = inst[
"ChannelId"];
64 QString instMode = inst[
"InstrumentModeId"];
74 if (channelId ==
"VIRTIS_M_VIS") {
76 virFrame = (hasArtCK) ? -226211 : -226112;
77 frameId =
"ROS_VIRTIS-M_VIS";
79 else if (channelId ==
"VIRTIS_M_IR") {
81 virFrame = (hasArtCK) ? -226213 : -226214;
82 frameId =
"ROS_VIRTIS-M_IR";
95 PvlKeyword &frameParam = inst[
"FrameParameter"];
120 double sampleBoreSight =
getDouble(ikernKey);
123 double lineBoreSight =
getDouble(ikernKey);
152 #if defined(DUMP_INFO) 154 cout <<
"Total Records: " << cache.
Records() <<
"\n";
156 for (
int i = 0 ; i < cache.
Records() ; i++) {
158 string separator(
"");
159 for (
int f = 0 ; f < rec.
Fields() ; f++) {
160 cout << separator << (double) rec[f];
295 std::vector<double> cacheTime;
296 Table hktable(
"VIRTISHouseKeeping", filename);
300 for (
int i = 0; i < hktable.
Records(); i++) {
302 QString scetString = trec[
"dataSCET"];
351 Table hktable(
"VIRTISHouseKeeping", filename);
356 for (
int i = 0; i < hktable.
Records(); i++) {
358 double scet = (double) trec[
"dataSCET"];
359 int shutterMode = (int) trec[
"Data Type__Shutter state"];
362 double mirrorSin = trec[
"M_MIRROR_SIN_HK"];
363 double mirrorCos = trec[
"M_MIRROR_COS_HK"];
364 double scanElecDeg = atan(mirrorSin/mirrorCos) * dpr_c();
365 double optAng = ((scanElecDeg - 3.7996979) * 0.25/0.257812);
373 bool isDark = (shutterMode == 1);
376 if ( ! isDark ) { angFit.
AddData(lineno, optAng); }
378 #if defined(DUMP_INFO) 379 cout <<
"Line(" << ((isDark) ?
"C): " :
"O): ") << i
380 <<
", OptAng(D): " << setprecision(12) << optAng * dpr_c()
381 <<
", MidExpTime(ET): " << lineMidTime
423 for (
unsigned int a = 0 ; a <
m_mirrorData.size() ; a++) {
433 mess <<
"Number housekeeping lines determined (" <<
m_lineRates.size()
434 <<
") is not equal to image lines(" <<
Lines() <<
")";
451 const int zeroFrame) {
474 Table quats(
"SpiceRotation", record);
475 int nfields = record.
Fields();
477 QString virZero = virChannel +
"_ZERO";
480 int nvals = nfields - 1;
483 SpiceDouble eulang[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
484 SpiceDouble xform[6][6], xform2[6][6];
486 SpiceDouble q_av[7], *av(&q_av[4]);
488 for (
int i = 0 ; i < nlines ; i++) {
489 int index = min(i, nlines-1);
498 eul2xf_c(eulang, 1, 2, 3, xform);
499 mxmg_c(xform, &state[0][0], 6, 6, 6, xform2);
502 xf2rav_c(xform2, m, av);
506 for (
int k = 0 ; k < nvals ; k++) {
511 record[nvals] = etTime;
516 mess <<
"Failed to get point state for line " << i+1;
527 int virZeroId =
getInteger(
"FRAME_" + virZero);
532 quats.
Label() += tdf;
539 SpiceDouble identity[3][3];
544 for (
int i = 0 ; i < 3 ; i++) {
545 for (
int j = 0 ; j < 3 ; j++) {
550 quats.
Label() += crot;
573 const QString &frame2,
574 const double &etTime)
580 sxform_c(frame1.toLatin1().data(), frame2.toLatin1().data(), etTime,
581 (SpiceDouble (*)[6]) state[0]);
587 pxform_c(frame1.toLatin1().data(), frame2.toLatin1().data(), etTime,
588 (SpiceDouble (*)[3]) rot[0]);
590 SpiceDouble av[3] = {0.0, 0.0, 0.0 };
591 rav2xf_c((SpiceDouble (*)[3]) rot[0], av,
592 (SpiceDouble (*)[6]) state[0]);
596 mess <<
"Could not get state rotation for Frame1 (" << frame1
597 <<
") to Frame2 (" << frame2 <<
") at time " << etTime;
622 QRegExp virCk(
"*ROS_VIRTIS_M_????_????_V?.BC");
623 virCk.setPatternSyntax(QRegExp::Wildcard);
624 for (
int i = 0 ; i < cks.size() ; i++) {
625 if ( virCk.exactMatch(cks[i]) )
return (
true);
Table Cache(const QString &tableName)
Return a table with J2000 to reference rotations.
double m_exposureTime
Line exposure time.
int Records() const
Returns the number of records.
double startTime() const
Return start time for the entire cube.
void SetFocalLength()
Reads the focal length from the instrument kernel.
double endTime() const
Return end time for the entire cube.
void MinimizeCache(DownsizeStatus status)
Set the downsize status to minimize cache.
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
Camera model for both Rosetta VIRTIS-M instruments.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
virtual int CkFrameId() const
CK Frame ID - Instrument Code from spacit run on CK.
Parse and return pieces of a time string.
QStringList getKernelList(const QString &ktype="") const
Provide a list of all the kernels found.
double lineStartTime(const double midExpTime) const
Return the start time for a given line exposure time.
void readSCET(const QString &filename)
For calibrated VIRTIS-M images, read the SCET values from the cube.
SpiceInt getInteger(const QString &key, int index=0)
This returns a value from the NAIF text pool.
QString m_instrumentNameLong
Full instrument name.
bool m_isDarkCurrent
If the line is dark current data.
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
void LoadCache(double startTime, double endTime, int size)
Cache J2000 rotation quaternion over a time range.
double m_opticalAngle
Optical angle in degrees.
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
SMatrix getStateRotation(const QString &frame1, const QString &frame2, const double &et) const
Compute the state rotation at a given time for given frames.
Namespace for the standard library.
char m_slitMode
Slit mode of the instrument.
Generic class for Line Scan Cameras.
Determine SPICE kernels defined in an ISIS file.
double lineEndTime(const double midExpTime) const
Return the end time for a given line exposure time.
NumericalApproximation provides various numerical analysis methods of interpolation, extrapolation and approximation of a tabulated set of x, y data.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Evaluate() returns the y-value of the nearest endpoint if a is outside of the domain.
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
int pixelSumming() const
Return the pixel summing rate.
double toDouble(const QString &string)
Global function to convert from a string to a double.
This error is for when a programmer made an API call that was illegal.
double m_scanLineEt
Center of line time in ET.
int hkLineCount() const
Returns number of housekeeping records found in the cube Table.
Convert between undistorted focal plane and ground coordinates.
Container class for storing timing information for a section of an image.
void SetFrame(int frameCode)
Change the frame to the given frame code.
double Evaluate(const double a, const ExtrapType &etype=ThrowError)
Calculates interpolated or extrapolated value of tabulated data set for given domain value...
double m_scanRate
Line scan rate.
double scanLineTime() const
Return the line scan rate.
Convert between distorted focal plane and detector coordinates.
std::vector< ScanMirrorInfo > m_mirrorData
vector of mirror info for each line
QString m_instrumentNameShort
Shortened instrument name.
QString instrumentId()
This method returns the InstrumentId as it appears in the cube.
Contains multiple PvlContainers.
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
#define _FILEINFO_
Macro for the filename and line number.
A type of error that could only have occurred due to a mistake on the user's part (e...
A single keyword-value pair.
iTime getClockTime(QString clockValue, int sclkCode=-1, bool clockTicks=false)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
Do not downsize the cache.
Distort/undistort focal plane coordinates.
void setTime(const iTime &time)
By setting the time you essential set the position of the spacecraft and body as indicated in the cla...
double m_mirrorCos
Raw mirror cosine value.
Convert between parent image coordinates and detector coordinates.
Container for cube-like labels.
The values in the field are 8 byte doubles.
CameraFocalPlaneMap * FocalPlaneMap()
Returns a pointer to the CameraFocalPlaneMap object.
Convert between undistorted focal plane and ra/dec coordinates.
void LoadCache()
This loads the spice cache big enough for this image.
int m_lineNum
The line the info is for.
TNT::Array2D< SpiceDouble > SMatrix
2-D buffer
QString m_spacecraftNameLong
Full spacecraft name.
bool m_is1BCalibrated
is determined by Archive/ProcessingLevelId
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Class for storing Table blobs information.
LineScanCameraDetectorMap * DetectorMap()
Returns a pointer to the LineScanCameraDetectorMap object.
virtual int CkReferenceId() const
CK Reference ID - J2000.
bool hasArticulationKernel(Pvl &label) const
determine if the CK articulation kernels are present/given
void AddData(const double x, const double y)
Add a datapoint to the set.
int Lines() const
Returns the number of lines in the image.
QString fileName() const
Returns the filename used to initialise the Pvl object.
std::vector< LineRateChange > m_lineRates
vector of timing info for each line
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
void readHouseKeeping(const QString &filename, double lineRate)
Read the VIRTIS houskeeping table from cube.
~RosettaVirtisCamera()
Destructor.
Namespace for ISIS/Bullet specific routines.
int Fields() const
Returns the number of fields that are currently in the record.
SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
QString m_spacecraftNameShort
Shortened spacecraft name.
Class for storing an Isis::Table's field information.
PvlObject & Label()
Accessor method that returns a PvlObject containing the Blob label.
SpiceInt naifSpkCode() const
This returns the NAIF SPK code to use when reading from SPK kernels.
double exposureTime() const
Return the exposure time.
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Table getPointingTable(const QString &channelId, const int zeroFrame)
Compute the pointing table for each line.
int m_summing
Summing/binnning mode.
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
void addValue(QString value, QString unit="")
Adds a value with units.
IO Handler for Isis Cubes.
double m_mirrorSin
Raw mirror sine value.