Commit cb35ebf9 authored by Kristin Berry's avatar Kristin Berry
Browse files

Corrected StartTime and SpacecraftClockStartCount in calibrated VIRTIS-M...

Corrected StartTime and SpacecraftClockStartCount in calibrated VIRTIS-M ingested images and initial camera model cleanup
parent 9f429582
Loading
Loading
Loading
Loading
+54 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "UserInterface.h"
#include "PolynomialUnivariate.h"
#include "VirtisHK.h"
#include "iTime.h"

using namespace std;
using namespace Isis;
@@ -341,7 +342,7 @@ void IsisMain ()
    Table table("VIRTISHouseKeeping", rec);

    std::vector<std::vector<char *> > dataSuffix = p.DataSuffix();

    double startScet = 0; 
    for (unsigned int i=0; i < dataSuffix.size(); i++) {
      std::vector<char*> dataSuffixRecord = dataSuffix[i];

@@ -356,9 +357,60 @@ void IsisMain ()
      
      // Calculate the SCET and add it to the table
      rec[0] = translateScet(scetWords[0], scetWords[1], scetWords[2]); 
      if ((i==0)) {
        startScet = translateScet(scetWords[0], scetWords[1], scetWords[2]); 
      }
      table += rec; 
    }
    outcube->write(table);
    std::cout << "starting SCET: " << toString(startScet) << std::endl;

    // translate to SSSSSSSSSS:FFFFF format
    QString scetString = toString(startScet);
    std::cout << "scetString: " << scetString << std::endl; 

    // seconds stay the same
    QStringList scetStringList = scetString.split('.');

    // final format needs to be: SSSSSSSSSS:FFFFF

    //  SSSSSSSSSS:
    QString scetFinal = scetStringList[0];
    scetFinal.append(":");

    // FFFFF
    double fractValue = toDouble(scetStringList[1])/65536.0;
    scetStringList = toString(fractValue).split(".");
    
    scetFinal.append(scetStringList[1].left(5));
    std::cout << "final scet value: " << scetFinal << std::endl; 

    // pass this value to naif to get the utc time. 

    // change this to ask the kerneldb to return the most recent rosetta sclk kernel? 
    // actually 
    // add this to the changeset
/*    KernelDb baseKernels(0);
    baseKernels.loadSystemDb("rosetta", lab); // do we have a label at this point... is there another 
                                              // possible input? 
    
    sclk      = baseKernels.spacecraftClock(lab);
    lsk       = baseKernels.leapSecond(lab);
*/

    furnsh_c("/usgs/cpkgs/isis3/data/rosetta/kernels/sclk/ROS_160929_STEP.TSC");
    furnsh_c("/usgs/cpkgs/isis3/data/base/kernels/lsk/naif0012.tls"); 

    SpiceDouble et; 
    scs2e_c( (SpiceInt) -226, scetFinal.toLatin1().data(), &et);
  
    std::cout << "starting SCET: " << iTime(et).UTC() << std::endl; 

    SpiceChar sclkString[50]; 
    sce2s_c( (SpiceInt) -226, et, (SpiceInt) 50, sclkString);
    
    std::cout << "starting spacecraft clock start count: " << sclkString << std::endl; 

  }


+48 −3
Original line number Diff line number Diff line
@@ -93,7 +93,10 @@ namespace Isis {

    // Get other info from labels
    PvlKeyword &frameParam = inst["FrameParameter"];
    m_exposureTime = toDouble(frameParam[0]);

    // convert milliseconds to seconds

    m_exposureTime = toDouble(frameParam[0]) * 0.001;
    m_summing  = toDouble(frameParam[1]);
    m_scanRate = toDouble(frameParam[2]);

@@ -296,7 +299,49 @@ namespace Isis {
     TableRecord &trec = hktable[i];
     double scet = (double) trec["dataSCET"];
     double lineMidTime;
     lineMidTime = getClockTime(toString(scet), naifSpkCode()).Et();

/*
SCLK Format
--------------------------------------------------------

     The on-board clock, the conversion for which is provided by this SCLK
     file, consists of two fields:

          SSSSSSSSSS:FFFFF

     where:

          SSSSSSSSSS -- count of on-board seconds

          FFFFF      -- count of fractions of a second with one fraction
                        being 1/65536 of a second


*/
     QString scetString = toString(scet);
     std::cout << "scetString: " << scetString << std::endl; 

     // seconds stay the same
     QStringList scetStringList = scetString.split('.');

     // final format needs to be: SSSSSSSSSS:FFFFF

     //  SSSSSSSSSS:
     QString scetFinal = scetStringList[0];
     scetFinal.append(":");

     // FFFFF
     double fractValue = toDouble(scetStringList[1])/65536.0;
     scetStringList = toString(fractValue).split(".");

     scetFinal.append(scetStringList[1].left(5));
     std::cout << "final scet value: " << scetFinal << std::endl; 

/*     if (i==0) {
       setTime(iTime(scetFinal)); 
     }*/

     lineMidTime = getClockTime(scetString, naifSpkCode()).Et();
     m_lineRates.push_back(LineRateChange(lineno,
                                          lineStartTime(lineMidTime),
                                          exposureTime()));