ISIS Application Documentation
lrowaccal | Standard View | TOC | Home |
This program calibrates LRO WAC images
Description
Categories
Groups
History
This program applies dark, flat-field, radiometric, and temperature corrections for each framelet based on the band's filter number. There is also an optional mask to replace special pixels in the calibrated image. In order to output in I/F units, the cube must have spice data.
Corrections are applied in the following order: Dark, Flat-field, Radiometric, Special pixel mask, and Temperature.
If the DarkFile parameter is set, the given file(s) will be used for calibration. If DarkFile is set to "Default" or not set at all, the dark files will be looked up based on the time and temperature in the WAC being calibrated. The parameter,MiddleTemperatureFpa, is used for temperature and StartTime for time. This program, lrowaccal, will attempt to find the 2 dark files with closest time/temperature and interpolate/extrapolate from them. The method for finding dark files is as follows:
Once the dark files are found, the correction is applied:
output[pixel] -= (dark1[pixel] - dark2[pixel])/(dark1Temp - dark2Temp)*(frameTemp-dark2Temp) + dark2[pixel]where
dark1, dark2 = dark file cubes dark1Temp, dark2Temp = temperature of dark1 file and dark2 file frameTemp = (WAC EndTemperatureFpa - WAC BeginTemperatureFpa)/WAC NumFramelets * frame + WAC BeginTemperatureFpa
output[pixel] /= flatfield[pixel]If FlatfieldFile is not set, flat-field cube is loaded from $lro/calibration/wac_flats/WAC_<wac mode>_Flatfield.????.cub
output[pixel] /= WAC ExposureDuration if radiometricType == iof output[pixel] *= solarDistance2 / iofResponsivity[band] else output[pixel] /= radianceResponsivity[band]where
solarDistance is distance from the Moon to the SunIf RadiometricFile is not set, radiometric responsivity is loaded from $lro/calibration/WAC_RadiometricResponsivity.????.pvl
for each framelet in the output cube if specialPixelMask[pixel] is special outputFramelet[pixel] = specialPixelMask[pixel]If SpecialPixelsFile is not set, special pixel mask is loaded from $lro/calibration/wac_masks/WAC_<wac mode>_<temp>C_SpecialPixels.????.cub. temp is closest temperature to WAC MiddleTemperatureFpa.
for each framlet in the output cube if output[pixel] is special- leave it alone else preform the correctionCorrection:
inputPixel -------------------- a*(frameTemp) + b Where: 'a' and 'b' are band dependent constants, read in from a file. AND frameTemp = (WAC EndTemperatureFpa - WAC BeginTemperatureFpa)/WAC NumFramelets * frame + WAC BeginTemperatureFpaIf TEMPRATUREFILE is not set, the constants are loaded from $lro/calibration/WAC_TempratureConstants.????.pvl
The DN level in an uncalibrated image is the sum of the true signal from the scene, the bias, the dark current, and random noise in all 3 components. The random noise in the true signal and dark current is called shot noise and the random noise in the bias is called read noise. The true signal, bias, and dark current are defined as mean values so that if the random noise were averaged down to insignificance by taking a very large number of images and averaging them, the resulting image would be the true scene, bias, and dark current with no systematic error. That implies the statistical distribution of the random noise has an average of zero, and therefore the random noise has both positive and negative values, except for the trivial case of zero random noise.
The calibration equation is:
reportedDN = ObservedDN - MeanBias - DarkCurrentWhere:
ObservedDN = TrueDN + E E is a randomly sampled value from (mu, sigma^2) and mu=0 TrueDN is the signal that would be reported in an idealized case of an instrument with zero noise.
Let's look at the case of a calibrated image for which the true signal is zero, a dark image. In calibration the mean bias and dark current are subtracted. The random noise term is then randomly sampled from a known distribution with a mean of zero. Since the distribution has a mean of zero, values for the random noise can be positive or negative. Therefore, the addition of random noise to a pixel with true signal near zero can result in negative DN values.
Negative reported DNs are possible when E < -1 * TrueDN. These are pixels in a very dark image that happen to have a strongly negative random noise value.
Note: ObservedDN and TrueDN both must be greater than or equal to zero. For ObservedDN, it's because the hardware is not able to report negative DN values . For TrueDN, it's because radiance and reflectivity cannot be negative. The dimmest target is one that is completely dark, and for that target TrueDN = 0.
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.)
Name | Description |
---|---|
FROM | Input Image |
TO | Output Image |
Name | Description |
---|---|
Dark | Calibrate using a dark file. |
DarkFile | Dark file used for calibration. |
Name | Description |
---|---|
Flatfield | Calibrate using a flatfield file. |
FlatfieldFile | Flatfield file used for calibration. |
Name | Description |
---|---|
Radiometric | Do radiometric calibration. |
RadiometricType | Calibrated output cube units. |
RadiometricFile | Radiometric constants file used for calibration. |
Name | Description |
---|---|
SpecialPixels | |
SpecialPixelsFile | This option will apply a special pixel mask to the cub. The default is to use the system defined mask file with the matching WAC mode and closest Temperature to the input cub. Please see the main documentation for a detailed description of the Special Pixel Mask correction. |
Name | Description |
---|---|
Temperature | Calibrate using temperature base correction. |
TemperatureFile | Temperature gain and offset file. |
This is the non-calibrated, unprojected WAC cube
Type | cube |
---|---|
File Mode | input |
Filter | *.cub |
This is the calibrated WAC cube
Type | cube |
---|---|
File Mode | output |
Pixel Type | real |
Filter | *.cub |
Calibrate using a correction based off of a dark file. Please see the Dark Correction section at the beginning of this document for a detailed explanation of how the correction is applied
Type | boolean |
---|---|
Default | True |
Inclusions |
|
Dark file used for calibration. The default is to use the dark file with the closest time and temperature to the WAC image being calibrated. See the Dark Correction section at the beginning of this document for a detailed explanation of how dark files are chosen.
Type | filename |
---|---|
Default | Default |
Calibrate using a flatfield file.
Type | boolean |
---|---|
Default | True |
Inclusions |
|
Flatfield file used for calibration. The default is to use the system defined dark file with the highest version number.
Type | filename |
---|---|
Default | Default |
Perform a radiometric calibration on the input cub. This type of this correction is defined by the RadiometricType parameter.
Type | boolean |
---|---|
Default | True |
Inclusions |
|
Calibrated output cube units. I/F or radiance.
Type | string | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Default | IOF | |||||||||
Option List: |
|
Radiometric constants file used for calibration. The default is to use the system defined file with the highest version.
Type | filename |
---|---|
Default | Default |
This option will apply a special pixel mask to the input cub. The default is to use the system defined mask file with the matching WAC mode and closest Temperature to the input cub. Please see the main documentation for a detailed description of the Special Pixel Mask correction.
Type | boolean |
---|---|
Default | True |
Inclusions |
|
Type | filename |
---|---|
Default | Default |
Calibrate using temperature gain and offset. Please see this document, which outlines how the correction was derived.
Type | boolean |
---|---|
Default | True |
Inclusions |
|
Temperature gain and offset file. The default is to use the system defined temperature gain and offset file with the highest version number.
Type | filename |
---|---|
Default | Default |
Jacob Danton | 2009-07-01 | Original version |
Dan Clarke | 2012-08-13 | Updated use of deprecated methods (use ProcessCube instead of Start/EndProcess). Updated documentation/comments. Optimized/cleaned up code in Calibrate, GetDark, and GetMask. Changed the algorithm for finding dark files in GetDark. GetDark will now find the two closest available dark file temperatures matching the input WAC cube. Then, it will find the dark file at each temperature with the time closest to the WAC time. This should prevent failed calibrations from missing darks. |
Adam Licht | 2012-12-18 | Fixed an error which would apply band 1 corrections to a single passed in band, even if that band was not band 1. |
Adam Licht | 2013-04-16 | Implemented a temperature based correction to lrowaccal. This correction requires constants which are read from a pvl file. A file other than the default can be passed in via an argument. The correction may also be turned off via an argument. |
Stuart Sides | 2021-02-22 | Added ability to get the sun distance from the camera. |
Cordell Michaud | 2022-05-03 | Refactored lrowaccal to be callable for testing and to remove global variables and helper functions. Added units label "W/m2/sr/um" to RadiometricType keyword in output cube label when RadiometricType is AbsoluteRadiance. |