User Documentation

Getting Started
Learn More
Explore in Detail
Get Inspired

Contributor Documentation

Getting Started
Learn More
Explore in Detail
Get Inspired

Quick Links

Software Manual
API Reference

Documentation Versions

Public Release


Technical Documents

ISIS Application Documentation


Standard View | TOC | Home

Radiometrically calibrates a CTX image



ctxcal performs radiometric corrections to images acquired by the Context Imager aboard the Mars Reconnaissance Orbiter spacecraft. The CTX camera will make observations simulteously with the HiRise camera.

The MRO CTX detector has a total of 5000 pixels, divided among an A channel and a B channel. The pixels alternate between the two channels: ABABABAB, etc. Images from CTX may or may not include all pixels in the acquired image. There are special summing modes that are utilized on-board the spacecraft to average detector pixels to combine them into a single output pixel value. The value of the ISIS label keyord, SpatialSumming, indicates the number of samples that were summed and averaged to result in the pixel values stored in the file. Note that this will reduce the number of samples in the output image by a factor of at most the SpatialSumming mode value.

The CTX camera has the ability to acquire images of differing sizes in both line and sample. The starting hardware detector pixel for the acquired image is specified by the ISIS label keyword, SampleFirstPixel. The first pixel in the detector is indicated by a value of 0.

Dark current pixels are taken for each line and are stored in the Isis cube as a table, named "Ctx Prefix Dark Pixels". The number of dark current pixels in this table is dependent on the SpatialSumming and the SampleFirstPixel keywords from the labels. The following table shows the association between these keywords and dark current pixels.

Association between keywords the number of dark current pixels
SpatialSumming SampleFirstPixel Number of Dark current pixels in the table
1 0 24 (12 for each channel, stored as ABABABABABABABABABABABAB)
1 >0 16 (8 for each channel, stored as ABABABABABABABAB)
2 0 12 (The dc pixels for the A and B channel have been summed together)
2 >0 8 (The dc pixels for the A and B channel have been summed together)

If SpatialSumming is 1, the dark current pixels for the A and B channel are averaged separately, then the A channel dark average is subtracted from the A channel image pixels and the B channel dark average is subtracted from the B channel image pixels. If SpatialSumming is 2 the dark current pixels are averaged together then this average is subtracted from all image pixels.

The equation ctxcal implements is as follows:

    For any pixel i, on line L, compute r in counts/msec

    r(i,L) = ( inputPixel(i,L) - darkCurrent(L) ) / (flatPixel(i,L) * exposure)
where r is the average signal being generated at the focal plane (in DN/msec), darkCurrent is the dark current term (in DN/msec), flatPixel is the pixel dependent gain, and exposure is the exposure time in milliseconds.

If the IOF parameter is chosen, the output pixels are converted to relative reflectance (I/F) using the solar radiance, with an albedo 1 target at normal incidence at Mars perihelion distance (2.07e+08 km) and a CTX response of 3660.5 DN/msec.

    For any pixel i, on line L

      r(i,L) = ( inputPixel(i,L) - darkCurrent(L) ) / flatPixel(i,L) ) / iof

    iof = 1.0 / (exposure * w1)
    w1 = w0 * (2.07E8)^2 / dist^2
    w0 = 3660.5 dn/msec
    dist = distance between Sun and Mars in kilometers
    exposure = line exposure duration in milliseconds

If run on a non-spiceinited cube, this program requires access to local mission-specific SPICE kernels, in order to find the distance between the sun and the target body. When run on a spiceinited cube, this can be determined using the camera model. Using a spiceinited cube as input has the advantage of not requiring that local mission-specific kernels be available. (See spiceinit web=true.)


Related Objects and Documents


Parameter Groups


Name Description
FROM Level 0 CTX image
TO Level 1 CTX image
FLATFILE Flat Field file (pixel dependent gain)
MONTHLYFLAT Change the default flat file to a monthly mission flat file

Calibration Parameters

Name Description
IOF Convert to I/F

Files: FROM


An uncalibrated CTX image.

Type cube
File Mode input
Filter *.cub

Files: TO


The resultant radiometrically calibrated cube

Type cube
File Mode output
Pixel Type real



Flat Field file (pixel dependent gain). If no file is entered, the default will be used.

Type cube
File Mode input
Pixel Type real
Internal Default Internal Default



If turned on, ctxcal will use the default mission monthly flat file for calibration.

Type boolean
Default No

Calibration Parameters: IOF


The user has the option to request the output of ctxcal to be in either units of percent reflectance (IOF="YES") or in average signal level at the focal plane (IOF="NO") in DN/msec. Ctxcal has a default I/F (percent reflectance) factor of 3660.5 DN/msecond response with an albedo 1 target a normal incidence at Mars perihelion distance (2.07 e+08). Conversion to I/F takes place after calibration and pixel-to-pixel variation corrections.

Type boolean
Default True


Tracie Sucharski2006-11-02 Original version
Tracie Sucharski2007-01-19 Moved the flat file into the mro calibration data area and changed the code to point to that area.
Tracie Sucharski2007-03-16 Make sure input cube is a ctx image.
Steven Lambright2007-08-15 Added an application test
Steven Lambright2008-05-13 Removed references to CubeInfo
Steven Koechle2008-12-04 Removed hard coded flatfile, now searchs for highest version
Ian Humphrey2014-06-23 Modified hard coded flatfile in app tests to relative paths using $ISISDATA. Fixes #2054.
Jesse Mapel2019-05-15 Now loads latest Mars satellites kernel because the planets kernel (de430) only provides Mars Barycenter.
Kelvin Rodriguez2021-02-24 Added ability to get the sun distance from the camera.
Adam Paquette2023-11-15 Exposed new calibration files to users via a new flag. Addresses #5338