1 #include "DawnVirCamera.h"
12 #include <tnt/tnt_array2d_utils.h>
24 #include "NumericalApproximation.h"
48 int procLevel = archive[
"ProcessingLevelId"];
53 QString channelId = inst[
"ChannelId"];
55 QString instMode = inst[
"InstrumentModeId"];
63 if (channelId ==
"VIS") {
65 virFrame = (hasArtCK) ? -203211 : -203221;
69 virFrame = (hasArtCK) ? -203213 : -203223;
82 PvlKeyword &frameParam = inst[
"FrameParameter"];
98 double sampleBoreSight =
getDouble(ikernKey);
101 double lineBoreSight =
getDouble(ikernKey);
132 #if defined(DUMP_INFO)
134 cout <<
"Total Records: " << cache.
Records() <<
"\n";
136 for (
int i = 0 ; i < cache.
Records() ; i++) {
138 string separator(
"");
139 for (
int f = 0 ; f < rec.
Fields() ; f++) {
140 cout << separator << (double) rec[f];
199 for (
int i = 0 ; i < text.size() ; i++) {
200 if ((text[i] >
' ') && (text[i] <=
'z')) ostr += text[i];
303 Table hktable(
"VIRHouseKeeping", filename);
308 for (
int i = 0; i < hktable.
Records(); i++) {
310 QString scet =
scrub(trec[
"ScetTimeClock"]);
311 QString shutterMode =
scrub(trec[
"ShutterStatus"]);
314 double mirrorSin = trec[
"MirrorSin"];
315 double mirrorCos = trec[
"MirrorCos"];
316 double scanElecDeg = atan(mirrorSin/mirrorCos) * dpr_c();
317 double optAng = ((scanElecDeg - 3.7996979) * 0.25/0.257812);
325 bool isDark = shutterMode.toLower() ==
"closed";
328 if ( ! isDark ) { angFit.
AddData(lineno, optAng); }
330 #if defined(DUMP_INFO)
331 cout <<
"Line(" << ((isDark) ?
"C): " :
"O): ") << i
332 <<
", OptAng(D): " << setprecision(12) << optAng * dpr_c()
333 <<
", MidExpTime(ET): " << lineMidTime
375 for (
unsigned int a = 0 ; a <
m_mirrorData.size() ; a++) {
385 mess <<
"Number housekeeping lines determined (" <<
m_lineRates.size()
386 <<
") is not equal to image lines(" <<
Lines() <<
")";
403 const int zeroFrame) {
426 Table quats(
"SpiceRotation", record);
427 int nfields = record.
Fields();
429 QString virId =
"DAWN_VIR_" + virChannel;
430 QString virZero = virId +
"_ZERO";
433 int nvals = nfields - 1;
436 SpiceDouble eulang[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
437 SpiceDouble xform[6][6], xform2[6][6];
439 SpiceDouble q_av[7], *av(&q_av[4]);
441 for (
int i = 0 ; i < nlines ; i++) {
442 int index = min(i, nlines-1);
451 eul2xf_c(eulang, 1, 2, 3, xform);
452 mxmg_c(xform, &state[0][0], 6, 6, 6, xform2);
455 xf2rav_c(xform2, m, av);
459 for (
int k = 0 ; k < nvals ; k++) {
464 record[nvals] = etTime;
469 mess <<
"Failed to get point state for line " << i+1;
480 int virZeroId =
getInteger(
"FRAME_" + virZero);
485 quats.
Label() += tdf;
492 SpiceDouble identity[3][3];
497 for (
int i = 0 ; i < 3 ; i++) {
498 for (
int j = 0 ; j < 3 ; j++) {
503 quats.
Label() += crot;
526 const QString &frame2,
527 const double &etTime)
533 sxform_c(frame1.toLatin1().data(), frame2.toLatin1().data(), etTime,
534 (SpiceDouble (*)[6]) state[0]);
540 pxform_c(frame1.toLatin1().data(), frame2.toLatin1().data(), etTime,
541 (SpiceDouble (*)[3]) rot[0]);
543 SpiceDouble av[3] = {0.0, 0.0, 0.0 };
544 rav2xf_c((SpiceDouble (*)[3]) rot[0], av,
545 (SpiceDouble (*)[6]) state[0]);
549 mess <<
"Could not get state rotation for Frame1 (" << frame1
550 <<
") to Frame2 (" << frame2 <<
") at time " << etTime;
575 QRegExp virCk(
"*dawn_vir_?????????_?.bc");
576 virCk.setPatternSyntax(QRegExp::Wildcard);
577 for (
int i = 0 ; i < cks.size() ; i++) {
578 if ( virCk.exactMatch(cks[i]) )
return (
true);
Table Cache(const QString &tableName)
Return a table with J2000 to reference rotations.
void SetFocalLength()
Reads the focal length from the instrument kernel.
int Records() const
Returns the number of records.
void MinimizeCache(DownsizeStatus status)
Set the downsize status to minimize cache.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
double m_mirrorSin
Raw mirror sine value.
double endTime() const
Return end time for the entire cube.
Parse and return pieces of a time string.
Table getPointingTable(const QString &channelId, const int zeroFrame)
Compute the pointing table for each line.
SpiceInt getInteger(const QString &key, int index=0)
This returns a value from the NAIF text pool.
SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
double lineStartTime(const double midExpTime) const
Return the start time for a given line exposure time.
QString m_instrumentNameLong
Full instrument name.
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.
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
double m_scanLineEt
Center of line time in ET.
bool m_isDarkCurrent
If the line is dark current data.
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
TNT::Array2D< SpiceDouble > SMatrix
2-D buffer
Generic class for Line Scan Cameras.
Determine SPICE kernels defined in an ISIS file.
Camera model for both Danw VIR VIS and IR instruments.
QString fileName() const
Returns the filename used to initialise the Pvl object.
double scanLineTime() const
Return the line scan rate.
virtual int CkFrameId() const
CK Frame ID - Instrument Code from spacit run on CK.
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.
~DawnVirCamera()
Destructor.
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_opticalAngle
Optical angle in degrees.
std::vector< ScanMirrorInfo > m_mirrorData
vector of mirror info for each line
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
SpiceInt naifSpkCode() const
This returns the NAIF SPK code to use when reading from SPK kernels.
Convert between undistorted focal plane and ground coordinates.
Container class for storing timing information for a section of an image.
int m_lineNum
The line the info is for.
void SetFrame(int frameCode)
Change the frame to the given frame code.
bool m_is1BCalibrated
is determined by Archive/ProcessingLevelId
double lineEndTime(const double midExpTime) const
Return the end time for a given line exposure time.
double Evaluate(const double a, const ExtrapType &etype=ThrowError)
Calculates interpolated or extrapolated value of tabulated data set for given domain value...
Convert between distorted focal plane and detector coordinates.
int m_summing
Summing/binnning mode.
QString m_instrumentNameShort
Shortened instrument name.
int Fields() const
Returns the number of fields that are currently in the record.
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
Contains multiple PvlContainers.
#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.
double m_scanRate
Line scan rate.
Do not downsize the cache.
Distort/undistort focal plane coordinates.
QStringList getKernelList(const QString &ktype="") const
Provide a list of all the kernels found.
void setTime(const iTime &time)
By setting the time you essential set the position of the spacecraft and body as indicated in the cla...
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.
SMatrix getStateRotation(const QString &frame1, const QString &frame2, const double &et) const
Compute the state rotation at a given time for given frames.
QString m_spacecraftNameLong
Full spacecraft name.
double startTime() const
Return start time for the entire cube.
double m_mirrorCos
Raw mirror cosine value.
Class for storing Table blobs information.
LineScanCameraDetectorMap * DetectorMap()
Returns a pointer to the LineScanCameraDetectorMap object.
QString scrub(const QString &text) const
Scrubs a string coming out of the housekeeping table.
void AddData(const double x, const double y)
Add a datapoint to the set.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
iTime getClockTime(QString clockValue, int sclkCode=-1)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
QString m_spacecraftNameShort
Shortened spacecraft name.
Class for storing an Isis::Table's field information.
double m_exposureTime
Line exposure time.
PvlObject & Label()
Accessor method that returns a PvlObject containing the Blob label.
double exposureTime() const
Return the exposure time.
std::vector< LineRateChange > m_lineRates
vector of timing info for each line
virtual int CkReferenceId() const
CK Reference ID - J2000.
char m_slitMode
Slit mode of the instrument.
bool hasArticulationKernel(Pvl &label) const
determine if the CK articulation kernels are present/given
int pixelSumming() const
Return the pixel summing rate.
int Lines() const
Returns the number of lines in the image.
int hkLineCount() const
Returns number of housekeeping records found in the cube Table.
void readHouseKeeping(const QString &filename, double lineRate)
Read the VIR houskeeping table from cube.
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.