Unverified Commit 16abf8fd authored by Stuart Sides's avatar Stuart Sides Committed by GitHub
Browse files

Update to use camera for time (#4334)

* Update to use camera for time

* Update documentation and match non-camera output

* Update hijitreg.xml
parent faa2ce61
Loading
Loading
Loading
Loading
+26 −5
Original line number Diff line number Diff line
@@ -12,10 +12,12 @@ find files of those names at the top level of this repository. **/

#include <SpiceUsr.h>

#include "Camera.h"
#include "FileName.h"
#include "HiJitCube.h"
#include "IException.h"
#include "Instrument.hh"
#include "iTime.h"
#include "Pvl.h"
#include "PvlGroup.h"
#include "NaifStatus.h"
@@ -145,11 +147,13 @@ namespace Isis {
      sclk = sclk.highestVersion();

//  Load the kernels
      NaifStatus::CheckErrors();
      QString lsk = leapseconds.expanded();
      QString sClock = sclk.expanded();
      NaifStatus::CheckErrors();
      furnsh_c(lsk.toLatin1().data());
      NaifStatus::CheckErrors();
      furnsh_c(sClock.toLatin1().data());
      NaifStatus::CheckErrors();

//  Ensure it is loaded only once
      naifLoaded = true;
@@ -158,7 +162,6 @@ namespace Isis {
  }

  void HiJitCube::computeStartTime() {
    loadNaifTiming();

//  Compute the unbinned and binned linerates in seconds
    jdata.unBinnedRate = ((Instrument::LINE_TIME_PRE_OFFSET +
@@ -167,9 +170,27 @@ namespace Isis {
    jdata.linerate = jdata.unBinnedRate * ((double) jdata.summing);

    if(!jdata.scStartTime.isEmpty()) {

      try {
        Camera *cam;
        cam = camera();
        // This SetImage at (1,1) is used to match the non-camera code below. (0.5, 0.5) should match the start
        // clock count of the image, but instead (1, 1) matches. This suggests something odd in the Camera
        cam->SetImage (1.0, 1.0);
        jdata.obsStartTime = cam->time().Et();
      } catch (IException &e) {
        try {
          loadNaifTiming();
          QString scStartTimeString = jdata.scStartTime;
          NaifStatus::CheckErrors();
          scs2e_c(-74999, scStartTimeString.toLatin1().data(), &jdata.obsStartTime);
          NaifStatus::CheckErrors();
        } catch (IException &e) {
            QString message = "Start time of the image can not be determined.";
            throw IException(e, IException::User, message, _FILEINFO_);
        }
      }

      // Adjust the start time so that it is the effective time for
      // the first line in the image file
      jdata.obsStartTime -= (jdata.unBinnedRate * (((double(jdata.tdiMode / 2.0)
+27 −19
Original line number Diff line number Diff line
@@ -37,6 +37,14 @@
        characterize the two image sections.  See the documentation for the
        SHIFTDEF parameter for <i>hiccdstitch</i> for further details.
      </p>
      <p>
        For this program to work properly, the image starting time is required. The
        starting time can be determined using the camera model if the image has been
        run through spiceinit or it can be determined using the starting clock count
        and the SPICE clock kernel. Both ways produce identical results. Using the
        camera model has the advantage of not requiring local mission specific kernels
        be available. See spiceinit web=true.
      </p>
      <p>
        The type of registration algorithm and appropriate parameters for its
        use is determined by the REGDEF parameter.  This follows the Isis
+5 −0
Original line number Diff line number Diff line
@@ -3,8 +3,13 @@ APPNAME = hijitreg
include $(ISISROOT)/make/isismake.tsts

PSP_001446_1790_RED.flat.txt.IGNORELINES = RunDate: FROM MATCH RegFile
PSP_001446_1790_RED.flat.nospiceinit.txt.IGNORELINES = RunDate: FROM MATCH RegFile

commands:
	$(APPNAME) from=$(INPUT)/PSP_001446_1790_RED2.balance.nospiceinit.cub \
	           match=$(INPUT)/PSP_001446_1790_RED3.balance.nospiceinit.cub \
	           flatfile=$(OUTPUT)/PSP_001446_1790_RED.flat.nospiceinit.txt \
	           cnetfile=$(OUTPUT)/PSP_001446_1790_RED.nospiceinit.net > /dev/null;
	$(APPNAME) from=$(INPUT)/PSP_001446_1790_RED2.balance.cub \
	           match=$(INPUT)/PSP_001446_1790_RED3.balance.cub \
	           flatfile=$(OUTPUT)/PSP_001446_1790_RED.flat.txt \