KPL/IK

\beginlabel
PDS_VERSION_ID               = PDS3
RECORD_TYPE                  = STREAM
RECORD_BYTES                 = "N/A"
^SPICE_KERNEL                = "mro_ctx_v11.ti"
MISSION_NAME                 = "MARS RECONNAISSANCE ORBITER"
SPACECRAFT_NAME              = "MARS RECONNAISSANCE ORBITER"
DATA_SET_ID                  = "MRO-M-SPICE-6-V1.0"
KERNEL_TYPE_ID               = IK
PRODUCT_ID                   = "mro_ctx_v11.ti"
PRODUCT_CREATION_TIME        = 2012-08-23T16:12:39
PRODUCER_ID                  = "NAIF/JPL"
MISSION_PHASE_NAME           = "N/A"
PRODUCT_VERSION_TYPE         = ACTUAL
PLATFORM_OR_MOUNTING_NAME    = "MRO SPACECRAFT"
START_TIME                   = "N/A"
STOP_TIME                    = "N/A"
SPACECRAFT_CLOCK_START_COUNT = "N/A"
SPACECRAFT_CLOCK_STOP_COUNT  = "N/A"
TARGET_NAME                  = MARS
INSTRUMENT_NAME              = "CONTEXT CAMERA"
NAIF_INSTRUMENT_ID           = -74021
SOURCE_PRODUCT_ID            = "N/A"
NOTE                         = "See comments in the file for details"
OBJECT                       = SPICE_KERNEL
  INTERCHANGE_FORMAT         = ASCII
  KERNEL_TYPE                = INSTRUMENT
  DESCRIPTION                = "MRO SPICE IK file for Context Camera (CTX)
providing FOV definition and other geometric parameters for the instrument,
created by NAIF, JPL with input from USGS, Flagstaff. "
END_OBJECT                   = SPICE_KERNEL
\endlabel


CTX Instrument kernel
===========================================================================

   This instrument kernel (I-kernel) contains MRO Context Camera (CTX)
   optics, detector, and field-of-view parameters.


Version and Date
---------------------------------------------------------------------------

   Version 1.1 -- August 23, 2012 -- Boris Semenov, NAIF/JPL

      Replaced ``mroctxAddendum001.ti'' with ``mroctxAddendum005.ti''.
      

   Version 1.0 -- June 7, 2007 -- Boris Semenov, NAIF/JPL

      Initial release.


References
---------------------------------------------------------------------------

   1. ``Kernel Pool Required Reading''

   2. ``C-kernel Required Reading''

   3. MRO Frames Definition Kernel (FK), latest version.

   4. MRO CTX CDR Package, March 20, 2003.

   5. ``mroctxAddendum005.ti'' IK file by USGS, Flagstaff, included 
      ``as is'' at the bottom of this IK.

   6. CTX Description, MSSS Web Site,
      http://www.msss.com/mro/ctx/ctx_description.html


Implementation Notes
--------------------------------------------------------

   Applications that need SPICE I-kernel data must ``load'' the I-kernel
   file, normally during program initialization.

   Loading the kernel using the SPICELIB routine FURNSH causes the data
   items and their associated values present in the kernel to become
   associated with a data structure called the ``kernel pool''. The
   application program may then obtain the value(s) for any IK data
   item using the SPICELIB routines GDPOOL, GIPOOL, GCPOOL. Routine
   GETFOV may be used if the file contains instrument field-of-view
   (FOV) specification. See [1] for details.

   This file was created with, and can be updated with a text editor or
   word processor.


Conventions for Specifying Data
--------------------------------------------------------

   Data items are specified using ``keyword=value'' assignments [1].
   All keywords referencing values in this I-kernel start with the
   characters `INS' followed by the NAIF MRO instrument ID code,
   constructed using the spacecraft ID number (-74) followed by the
   NAIF three digit ID number for CTX (021). This ID is defined in [3] 
   as follows:

               Instrument name                ID
               --------------------         -------
               MRO_CTX                       -74021

   The remainder of the keyword is an underscore character followed by
   the unique name of the data item. For example, the focal length of
   the CTX is specified by

               INS-74021_FOCAL_LENGTH

   The upper bound on the length of all keywords is 32 characters.

   If a keyword is included in more than one file, or if the same
   keyword appears more than once within a single file, the last
   assignment supersedes any earlier assignments.


Overview
--------------------------------------------------------

   From [5]:

      From its 3 p.m. circular, polar orbit, the MRO Context Camera
      (CTX) will obtain grayscale (black-and-white) images of the
      martian surface with a spatial resolution of about 6 meters (20
      feet) per pixel over a swath that is about 30 kilometers (18.6
      miles) wide. CTX is a Facility Instrument, operated by Malin
      Space Science Systems and the MRO MARCI science team.
 
      As its name implies, CTX will provide context for images acquired
      by other instruments onboard the Mars Reconnaissance Orbiter,
      particularly the High Resolution Imaging Science Experiment
      (HiRISE) and the Compact Reconnaissance Imaging Spectrometer for
      Mars (CRISM).
 
      The instrument consists of a 350 mm focal length, 6 degree field
      of view, catadioptric Cassegrain (Maksutov-type) telescope that
      images onto a 5064 pixels-wide charge coupled device (CDD) line
      array. The CCD detects a broad band of visible light from 500 to
      800 nanometers in wavelength. The instrument includes a 256 MB
      DRAM buffer, so that it can acquire pictures that have downtrack
      lengths greater than 160 kilometers (99 miles). In other words, a
      typical CTX image can be as wide as 30 km and as long as 160 km,
      or more.


Mounting Alignment
--------------------------------------------------------

   Refer to the latest version of the MRO Frames Definition Kernel
   (FK) [3] for the CTX reference frame definitions and mounting
   alignment information.


Apparent FOV Layout
--------------------------------------------------------

   This diagram illustrates the CTX apparent FOV layout in the 
   corresponding reference frame and the CCD corner based pixel
   scheme:

                                  ^
                                  | direction of 
                                  |   flight
                                  |


                                  ^ +Xctx (along track)
                                  | 
        |                         | 
        | ~0.001146 degrees       |
        |                         | 
        v         Pixel 1         |      Pixel 5000
       ---              +---------|---------+
        |       1 line  |   2500.5x-------------> +Yctx (cross track)
       ---              +-------------------+     
        ^                  5000 pixels/line
        |
                        |   ~5.73 degrees   |
                        |<----------------->|
                        |                   |      Boresight (+Zctx axis)
                                                    is into the page


   This diagram illustrates the CCD center based pixel scheme used in
   USGS ISIS 3 camera model ([5]):
 
                                  ^
                                  | direction of 
                                  |   flight
                                  |


                                  ^ +Xctx (along track)
                                  | 
        |                         | 
        | ~0.001146 degrees       |
        |                         | 
        v        Pixel -2499.5    |      Pixel 2499.5
       ---              +---------|---------+
        |       1 line  |       0 x-------------> +Yctx (cross track)
       ---              +-------------------+     
        ^                  5000 pixels/line
        |
                        |   ~5.73 degrees   |
                        |<----------------->|
                        |                   |      Boresight (+Zctx axis)
                                                    is into the page


Optical Parameters
--------------------------------------------------------

   The following CTX nominal first order optical parameters are included 
   in the data section below, from [4]:

      -----------------------------------------------------------------
           Parameter         
      -----------------------------------------------------------------
      Focal Length, mm      350.0      
      f/ratio                 3.25
      IFOV, rad/pixel                     
          Cross-track         0.00002   
          Along-track         0.00002   
      Field of view (deg) 
          Cross-track         5.73    
          Along-track         0.001146   
      -----------------------------------------------------------------

   The keywords below provide nominal values from the table above.
   Angular size values in the keywords are given radians, with the
   cross-track size being the first value and the along-track size
   being the second value in each pair.

   The nominal focal length is omitted from this set because an updated
   value for it included in [5] is provided later in this file.

      \begindata

         INS-74021_F/RATIO            = (   3.25              )
         INS-74021_FOV_ANGULAR_SIZE   = (   5.73,    0.001146 )
         INS-74021_IFOV               = (   0.00002, 0.00002  )

      \begintext


Detector Parameters
--------------------------------------------------------

   The nominal CTX detector parameters from [4] are:

      -----------------------------------------------------------------
           Parameter            
      -----------------------------------------------------------------
      Detector Array Size 
          Cross-track                 5000  
          Along-track                 1
      Detector Array Center
          Cross-track                 2500.5 
          Along-track                 0.5 
      Pixel Size, microns
          Cross-track                 7 
          Along-track                 7 
      -----------------------------------------------------------------

   The values are given in millimeters for PIXEL_SIZE keywords and in counts
   for PIXEL_SAMPLES, PIXEL_LINES, and CENTER keywords.

      \begindata

         INS-74021_PIXEL_SIZE         = ( 0.007, 0.007 )
         INS-74021_PIXEL_SAMPLES      = ( 5000 )
         INS-74021_PIXEL_LINES        = ( 1 )
         INS-74021_CCD_CENTER         = ( 2500.5, 0.5 )

      \begintext


FOV Definition 
---------------------------------------------------------------------------

   This section contains definitions for the CTX FOV. These
   definitions are provided in the format required by the SPICE
   (CSPICE) function GETFOV (getfov_c).
   
   The set of assignments in the data section below defines the
   CTX FOV with respect to the CTX instrument frame to be a rectangles 
   with the corners defined by the first and last pixels of CCD line 
   array and the boresight along the +Z axis. This FOV definition uses
   angular extent style specification with the cross and along track
   angular sizes taken from the ``Optics Parameters'' section above.

      \begindata

         INS-74021_FOV_FRAME                 = 'MRO_CTX'
         INS-74021_FOV_SHAPE                 = 'RECTANGLE'
         INS-74021_BORESIGHT                 = (
                                            0.000000     0.000000     1.000000
                                                )
         INS-74021_FOV_CLASS_SPEC            = 'ANGLES'
         INS-74021_FOV_REF_VECTOR            = (
                                            0.000000     1.000000     0.000000
                                                )
         INS-74021_FOV_REF_ANGLE             = ( 2.86478898 )
         INS-74021_FOV_CROSS_ANGLE           = ( 0.00057296 )
         INS-74021_FOV_ANGLE_UNITS           = 'DEGREES'

      \begintext


Optical Distortion
--------------------------------------------------------

   See ``mroctxAddendum005.ti'' below.


Platform ID
---------------------------------------------------------------------------

   This number is the NAIF instrument ID of the platform on which the
   instrument is mounted. CTX is mounted on the spacecraft bus.

      \begindata

      INS-74021_PLATFORM_ID  = ( -74000 )

      \begintext


MROCTX Instrument Kernel ``mroctxAddendum005.ti''
=============================================================

   This instrument kernel (I-kernel) contains parameters that describe
   the Mars Reconnaissance Orbiter CTX instrument model used by UGSG's
   ISIS 3.

   This model is defined with respect to the MRO_CTX frame.


``mroctxAddendum005.ti'' Version and Date
-------------------------------------------------------------

   Version 1.0 -- December 12, 2006 -- Elizabeth Miller, USGS, Flagstaff, AZ

       Initial version.

   Version 2.0 -- February 13, 2008 -- Steven Lambright, USGS, Flagstaff, AZ

       Added BORESIGHT keywords

   Version 3.0 -- February 21, 2008 -- Steven Lambright, USGS, Flagstaff, AZ

       Corrected the OD_K keyword

   Version 4.0 -- Mar 23, 2010 -- Debbie A. Cook, USGS, Flagstaff, AZ

       Update to include CK_FRAME_ID and CK_REFERENCE_ID

   Version 5.0 -- Apr 17, 2012 -- Annie HKraus,  USGS, Flagstaff, AZ

       Updated FOCAL_LENGTH, OD_K, BORESIGHT_SAMPLE
       and BORESIGHT_LINE based on inflight calibration
       by Orrin Thomas and Randy Kirk.  This involved
       tiepointing 6 overlapping CTX images to a HRSC
       orthoimage/DTM dataset in Gale crater and fitting
       the center and coefficients of a radial distortion
       polynomial.  The focal length was then adjusted to
       its "calibrated" value which results in equal and
       opposite positive/negative excursions of the 
       distortion polynomial over the field of view.

       Note also that the earlier versions of this kernel
       contained a sign error for all OD_K distortion
       coefficients, causing the use of the polynomial to
       double rather than remove the distortion.


``mroctxAddendum005.ti'' Data
-------------------------------------------------------------

   The following is the focal length, which is expressed in MILLIMETERS.
   This value comes from Randy Kirk's spreadsheet (2012) presenting the
   results of Orrin Thomas's inflight calibration of CTX based on 
   comparison of 6 CTX images (3 adjacent stereopairs) to an HRSC
   orthoimage and DTM in Gale crater.  CTX-HRSC tiepoints were measured
   and then projected into the CTX images with the focal length set
   to a nominal value and the distortion model temporarily to zero. 
   This allowed straightforward fitting of a new radial distortion
   polynomial.  Finally, the focal length was adjusted to its so-called
   calibrated value.  The first distortion coefficient is varied at the
   same time so that the overall geometric model is unchanged, but at
   the calibrated focal length the overall distortion polynomial has
   equal and opposite positive and negative excursions over the field
   of view. 

   The boresight samples and lines are used to specify the center of the
   detector device.  There are two methods to specify the center of the
   detector array. The BORESIGHT parameters are expressed in pixels.

      \begindata

         INS-74021_FOCAL_LENGTH = 352.9271664 
         INS-74021_BORESIGHT_SAMPLE = 2543.46099
         INS-74021_BORESIGHT_LINE = 0.430442527

      \begintext

   The following is the pixel pitch, which is the distance between
   adjacent pixels on the CCD arrays.  This is expressed in
   MILLIMETERS per pixel.

      \begindata

         INS-74021_PIXEL_PITCH = 7.0E-3

      \begintext

   The following are the optical distortion parameters.
   These are used to transform from observed (distorted)
   coordinates (unprimed, e.g., x) to ideal coordinates
   (primed, e.g., xp).  Both sets of coordinates are expressed
   in millimeters. 

      r=sqrt(x^2 + y^2)
      dr = k0*r + k1*r3 + k2*r^5
      rp = r - dr
      xp = x * (rp/r), similarly for yp

   or, rearranging a bit, we have a more efficient version:

      r^2 = x^2 + y^2
      dr/r = k0 + r^2*(k1 + r^2*k2)
      xp = x - (dr/r)*x
      yp = y - (dr/r)*y

   The optical distortion parameters below come from Randy
   Kirk's spreadsheet (2012 inflight calibration).  Note
   that the sign of the leading terms is opposite that in
   the previous versions of this kernel.  Earlier kernels
   had mistakenly negated the distortion coefficients.  As
   a result, their use in the formulae given above doubled
   rather than removing the optical distortion.

      \begindata

         INS-74021_OD_K = ( 
                            -0.00734339259200545000000, 
                             0.00002837587863624170000, 
                             0.00000001284198912402710 
                          )

      \begintext

   The following are the parameters for computing focal plane
   coords from CCD coords. 

   x = transx[0] + transx[1]*ccdSample_c + transx[2]*ccdLine_c
   y = transy[0] + transy[1]*ccdSample_c + transy[2]*ccdLine_c

      \begindata

          INS-74021_TRANSX=(   0.0,     0.0,  0.007)
          INS-74021_TRANSY=(   0.0,   0.007,    0.0)

      \begintext

   Parameters for computing CCD coords from focal plane coords

      \begindata

         INS-74021_ITRANSS=(    0.0,                 0.0,   142.85714285714)
         INS-74021_ITRANSL=(    0.0,     142.85714285714,               0.0)

      \begintext

   These are the parameters for writing c-kernels.  Isis will create ck
   with the same frame endpoints as the mission ck. For Hirise the ck
   instrument frame is  MRO_SPACECRAFT (-74000) and the ck reference frame
   is MRO_MME_OF_DATE (-74900).

      \begindata

         INS-74021_CK_FRAME_ID=-74000
         INS-74021_CK_REFERENCE_ID=-74900

      \begintext

End of IK file.

