Unverified Commit b7342f38 authored by kledmundson's avatar kledmundson Committed by GitHub
Browse files

Merge pull request #355 from makaylas/apolloPan

Updated histories and documentation
parents 292abd36 36ccf273
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
ifeq ($(ISISROOT), $(BLANK))
.SILENT:
error:
	echo "Please set ISISROOT";
else
	include $(ISISROOT)/make/isismake.apps
endif
 No newline at end of file
+1130 −0

File added.

Preview size limit exceeded, changes collapsed.

+55 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>

<application name="apollopangenck" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://isis.astrogeology.usgs.gov/Schemas/Application/application.xsd">

  <brief>
    Generate files to be used as input to NAIF utility msopck.
  </brief>

  <description>
    Generate files to be used as input to NAIF utility msopck. Location of Apollo Pan metadata csv
    is /archive/missions/apollo_pan/AS15/CriticalData/PanData/MetadataCSVVersions/.
  </description>

  <history>
    <change name="Ken Edmundson" date="2018-07-06">
      TODO
    </change>
  </history>

  <category>
    <missionItem>Apollo</missionItem>
  </category>

  <seeAlso>
    <applications>
      <item>isis2std</item>
    </applications>
  </seeAlso>

  <groups>
    <group name="Files">
      <parameter name="FROM">
        <type>filename</type>
        <fileMode>input</fileMode>
        <brief>
          Input Apollo Pan metadata csv file.
        </brief>
        <description>
          Use this parameter to select the filename to import.
        </description>
        <filter>
          *.csv
        </filter>
      </parameter>
    </group>

    <group name="Time">
      <parameter name="GMT">
        <type>string</type>
        <brief>GMT format: YYYY-MM-DD HH:MM:SS.SSS</brief>
        <description>GMT is space deliniated Year Month Day Hour Minute Seconds</description>
      </parameter>
    </group>    
  </groups>
</application>
+117 −90
Original line number Diff line number Diff line
/**
 * @file
 * $Revision: 1.7 $
 * $Date: 2010/06/17 18:59:11 $
 *
 *   Unless noted otherwise, the portions of Isis written by the USGS are
 *   public domain. See individual third-party library and package descriptions
 *   for intellectual property information, user agreements, and related
 *   information.
 *
 *   Although Isis has been used by the USGS, no warranty, expressed or
 *   implied, is made by the USGS as to the accuracy and functioning of such
 *   software and related material nor shall the fact of distribution
 *   constitute any such warranty, and no responsibility is assumed by the
 *   USGS in connection therewith.
 *
 *   For additional information, launch
 *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html
 *   in a browser or see the Privacy &amp; Disclaimers page on the Isis website,
 *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
 *   http://www.usgs.gov/privacy.html.
 */
#include "ApolloPanoramicCamera.h"

#include "ApolloPanIO.h"
//#include "ApolloPanIO.h"
#include "ApolloPanoramicCameraFiducialMap.h"
#include "ApolloPanoramicDetectorMap.h"

#include <QString>

#include "Affine.h"

#include "CameraDistortionMap.h"
#include "CameraFocalPlaneMap.h"
#include "IException.h"
#include "IString.h"
#include "iTime.h"
#include "LineScanCameraDetectorMap.h"
#include "LineScanCameraGroundMap.h"
#include "LineScanCameraSkyMap.h"
#include "PvlGroup.h"
#include "PvlKeyword.h"
//#include "SampleScanCameraDetectorMap.h"
#include "SampleScanCameraGroundMap.h"
#include "SampleScanCameraSkyMap.h"
#include "NaifStatus.h"
//#include "VariableSampleScanCameraDetectorMap.h"
//#include "PvlGroup.h"
//#include "PvlKeyword.h"

using namespace std;
namespace Isis {
  /**
   * Constructs an Apollo Panoramic Camera object using the image labels.
   * Constructs the Apollo Panoramic Camera model object from the labels.
   *
   * @param lab Pvl label from an Apollo Panoramic image.
   * This constructor uses the Pvl labels for Apollo Panoramic Camera Images.
   *
   * @param lab Pvl label from an Apollo Panoramic Camera image.
   * @internal
   *   @history 2016-09-12 Ken Edmundson - Original version, sort of. Orrin Thomas did the original
   *                       original. The camera model has changed significantly since.
   *
   */
  ApolloPanoramicCamera::ApolloPanoramicCamera(Isis::Cube &cube) : Isis::LineScanCamera(cube) {
    // Set up the camera info from ik/iak kernels
    SetFocalLength(610.0);  //nominal (uncalibrated) focal length in mm from "Apollo 15 SIM Bay
    // Photographic Equipment and Mission Summary" August, 1971
    SetPixelPitch(0.005);   //internally all images are modeled as if they have 5 micron pixels
    
    double  constantTimeOffset = 0.0,
    additionalPreroll = 0.0,
    additiveLineTimeError = 0.0,
    multiplicativeLineTimeError = 0.0;
    
    // Set up naming info
  ApolloPanoramicCamera::ApolloPanoramicCamera(Isis::Cube &cube) : Isis::SampleScanCamera(cube) {
    NaifStatus::CheckErrors();

    m_instrumentNameLong = "Panoramic Camera";
    m_instrumentNameShort = "Pan";

@@ -43,95 +65,100 @@ namespace Isis {
    if (naifIkCode() == -915230) {
      m_spacecraftNameLong = "Apollo 15";
      m_spacecraftNameShort = "Apollo15";
      m_ckFrameId = -915230;
    }
    // Apollo16 Pan naif code = -916230
    else if (naifIkCode() == -916230) {
      m_spacecraftNameLong = "Apollo 16";
      m_spacecraftNameShort = "Apollo16";
      m_ckFrameId = -916230;
    }
    // Apollo17 Pan naif code = -917230
    else if (naifIkCode() == -917230) {
      m_spacecraftNameLong = "Apollo 17";
      m_spacecraftNameShort = "Apollo17";
      m_ckFrameId = -917230;
    }
    else {
      QString msg = "File does not appear to be an Apollo image";
      throw IException(IException::User, msg, _FILEINFO_);
      QString msg = "File does not appear to be an Apollo Panoramic image";
      msg += QString::number(naifIkCode());
      msg += " is not a supported instrument kernel code for Apollo.";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }

    //following keywords in InstrumentAddendum file
    QString ikernKey = "INS" + toString((int)naifIkCode()) + "_CONSTANT_TIME_OFFSET";
    constantTimeOffset = getDouble(ikernKey);
    // Get the Instrument label information needed to define the camera for this frame
    Pvl &lab = *cube.label();
    PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
    QString spacecraft = (QString)inst["SpacecraftName"];
    QString instId = (QString)inst["InstrumentId"];

    ikernKey = "INS" + toString((int)naifIkCode()) + "_ADDITIONAL_PREROLL";
    additionalPreroll = getDouble(ikernKey);
    // read focal length and pixel pitch from the instrument kernel
    SetFocalLength();
    SetPixelPitch();

    ikernKey = "INS" + toString((int)naifIkCode()) + "_ADDITIVE_LINE_ERROR";
    additiveLineTimeError = getDouble(ikernKey);
    ReadSampleRates(lab.fileName());

    ikernKey = "INS" + toString((int)naifIkCode()) + "_MULTIPLI_LINE_ERROR";
    multiplicativeLineTimeError = getDouble(ikernKey);
    SpiceDouble etStart = iTime((QString)inst["StartTime"]).Et();
    setTime(etStart);

    Pvl &lab = *cube.label(); 
    PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
    QString stime = (QString)inst["StartTime"];  
    SpiceDouble etStart;
    str2et_c(stime.toLatin1().data(), &etStart);
    stime = (QString) inst["StopTime"];
    SpiceDouble etStop;
    str2et_c(stime.toLatin1().data(), &etStop);
    iTime isisTime( (QString) inst["StartTime"]);
    
    // Get other info from labels
    // line exposure duration, sec/mm
    double lineRate = ( (double) inst["LineExposureDuration"] )*0.005;    
    
    lineRate *= 1.0 + multiplicativeLineTimeError;
    lineRate += additiveLineTimeError;
    etStart += additionalPreroll * lineRate;
    etStart += constantTimeOffset;
    
    setTime(isisTime);
    
    // Setup detector map
    //note (etStart+etStop)/2.0 is the time in the middle of image 
    //  (line = 0 after interior orientation)
    ApolloPanoramicDetectorMap *detectorMap = 
    new ApolloPanoramicDetectorMap((Camera *)this, 
                                   (etStart+etStop)/2.0, 
                                   (double)lineRate, &lab);
    //interior orientation residual stats
    m_residualMean = detectorMap->meanResidual();
    m_residualMax = detectorMap->maxResidual();
    m_residualStdev = detectorMap->stdevResidual();
    
    detectorMap->SetDetectorSampleSumming(1.0);
    detectorMap->SetStartingDetectorSample(0.0);
    // Setup focal plane map
    PvlGroup &kernel = lab.findGroup("Kernels", Pvl::Traverse);
    CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, (int) kernel["NaifFrameCode"]);
    // Setup fiducial mark affine transformation (in pixels)
    PvlGroup &fiducials = lab.findGroup("Fiducials", Pvl::Traverse);
    ApolloPanoramicCameraFiducialMap fid(fiducials, naifIkCode());

    //  Retrieve boresight location from instrument kernel (IK) (addendum?)
    double sampleBoreSight = 0.0;  //Presently no NAIF keywords for this sensor
    double lineBoreSight = 0.0;  //Presently no NAIF keywords for this sensor
    Affine* fiducialMap = fid.CreateTrans();

    focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight);
    // Setup detector map for transform of parent image pixels to "detector" pixels
    new VariableSampleScanCameraDetectorMap(this, p_sampleRates, fiducialMap);

    // Setup focal plane map
    CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());

//    focalMap->SetDetectorOrigin(114374.916541692, 11490.0);
    focalMap->SetDetectorOrigin(0.0, 11490.0);
    focalMap->SetDetectorOffset(0.0, 0.0);

    //  Retrieve boresight location from instrument kernel (IK) (addendum?)
//    double sampleBoreSight = 0.0;  //Presently no NAIF keywords for this sensor
//    double lineBoreSight = 0.0;  //Presently no NAIF keywords for this sensor

    // Setup distortion map
    new CameraDistortionMap(this, -1.0);
    //distMap->SetDistortion(naifIkCode());    Presently no NAIF keywords for this sensor

    //Setup the ground and sky map
    new LineScanCameraGroundMap(this);
    new LineScanCameraSkyMap(this);
    
    PvlGroup &instP = lab.findGroup("Kernels", Pvl::Traverse);
    m_CkFrameId = toInt(instP["NaifFrameCode"][0]);
    m_CkFrameId = -int(-m_CkFrameId/1000)*1000;
    new SampleScanCameraGroundMap(this);
    new SampleScanCameraSkyMap(this);

    LoadCache();
    NaifStatus::CheckErrors();

    delete fiducialMap;
  }

  /**
   * @param filename
   */
  void ApolloPanoramicCamera::ReadSampleRates(QString filename) {
    Table timesTable("SampleScanTimes", filename);

    if(timesTable.Records() <= 0) {
      QString msg = "Table [SampleScanTimes] in [";
      msg += filename + "] must not be empty";
      throw IException(IException::Unknown, msg, _FILEINFO_);
    }

    for(int i = 0; i < timesTable.Records(); i++) {
      p_sampleRates.push_back(SampleRateChange((int)timesTable[i][2],
                                           (double)timesTable[i][0],
                                           timesTable[i][1]));
    }

    if(p_sampleRates.size() <= 0) {
      QString msg = "There is a problem with the data within the Table ";
      msg += "[SampleScanTimes] in [" + filename + "]";
      throw IException(IException::Unknown, msg, _FILEINFO_);
    }
  }

}// end Isis namespace


+9 −41
Original line number Diff line number Diff line
@@ -24,7 +24,8 @@
 *   http://www.usgs.gov/privacy.html.                                    
 */                                                                       

#include "LineScanCamera.h"
#include "SampleScanCamera.h"
#include "VariableSampleScanCameraDetectorMap.h"

namespace Isis {
  class PvlGroup;
@@ -48,9 +49,9 @@ namespace Isis {
     *                           members and methods and removed implementation of these methods
     *                           since Camera now handles this. References #2335. Fixed 
     *                           indentation.
     *   @history 2017-06-28 Makayla Shepherd - Updated documentation. References #4807.
     *   @history 2016-09-12 Ken Edmundson - Major changes, deriving now from SampleScanCamera.
     */
    class ApolloPanoramicCamera : public LineScanCamera {
    class ApolloPanoramicCamera : public SampleScanCamera {
    public:
      ApolloPanoramicCamera(Cube &lab);

@@ -64,7 +65,7 @@ namespace Isis {
      *         Kernel Frame ID
      */
      //this sensor was used on multiple missions so it is necessary to check which Apollo 
      virtual int CkFrameId() const {return m_CkFrameId; }  
      virtual int CkFrameId() const {return m_ckFrameId; }

      /** 
      * CK Reference ID - J2000
@@ -82,46 +83,13 @@ namespace Isis {
      */
      virtual int SpkReferenceId() const { return (1); }

      /** 
       * Returns residual summary statistics from interior orientation as a PvlGroup
       * 
       * @return PvlGroup Residuals report.
       */
      PvlGroup intOriResidualsReport();

      /**
       * Max interior orientation residual vector length, accesor
       * 
       * @return double Residual max
       */
      double intOriResidualMax()   const { return m_residualMax; }

      /**
       * Mean (average) of interior orientation residual vector length, accesor
       * 
       * @return double Residual mean
       */
      double intOriResidualMean()  const { return m_residualMean; }

      /**
       * Standard deviation of interior orientation residual vector length, accesor
       * 
       * @return double Residual standard deviation
       */
      double intOriResidualStdev() const { return m_residualStdev; }

    private:
      //! Max interior orientation residual vector length
      double m_residualMean;

      //! Mean (average) of interior orientation residual vector length
      double m_residualMax;
      void ReadSampleRates(QString filename);

      //! Standard deviation of interior orientation residual vector length
      double m_residualStdev;
      std::vector<SampleRateChange> p_sampleRates;

      //! CK "Camera Matrix" kernel frame ID
      int m_CkFrameId;
      int m_ckFrameId;
    };
};

Loading