This program is used to radiometrically correct flight images using a
    linear model of the light-transfer function.  This program is specific to
    the Galileo SSI camera.
    
    References:
    
 
      - 
        D-4264 MIPL Software Structural Design for the Instrument Calibration
        of GLL SSI Science Processing.
      
 
      - 
        K. Klaasen, "Reduction in Number of Unique SSI Calibration Files",
        29 May 1987.
      
 
      - 
        625-210,"Galileo SSI Calibration Report Part 1", K. Klaasen, H. 
        Breneman, November 1, 1988.
      
 
      - 
        
          JPL VICAR GALSOS application help page.
        
      
 
    
    
    This program will radiometrically correct the input image, converting the
    input DN values to some specified radiometric unit (either I/F or
    radiance).  The program requires a radiometric file generated from
    calibration data acquired at the same filter position as the input image,
    and a dark-current file acquired at the same camera gain-state, frame-rate,
    PNI, and BPM settings.  Also, extended exposure mode frames require an
    extended-exposure mode dark-current file.
    
    
    This program extracts the filter position, exposure time, and frame-rate
    from the label of the input file to determine the required gain file
    to use.  The file $ISISDATA/galileo/calibration/gll_gain.sav defines the 
    gain file to use for the given filter, gain state, and frame mode.  The
    file $ISISDATA/galileo/calibration/gll_dc.sav defines the DC file to use
    for the given, gain state, frame mode, frame rate, blemish protection mode,
    clock mode, and extended exposure mode.
    
    
    This program performs the following processing steps on each pixel:
    
      - 
        The radiometric correction is applied:
        
          e = z(d - dc)
          where:
            z is retrieved from the Radiometric File.
            d is the DN.
            dc is retrieved from the Dark-Current File.
        
       
      - 
        The output pixel is scaled to radiometric units R (units of reflectance
        or units of radiance). If output units are I/F, the following equation
        is used:
        
 
    		     S1       K
          r = e * -------- * --- (D/5.2)2
    		  A1(t-to)    Ko
          where:
            S1 = filter-dependent conversion factor from ft-Lamberts to
                 I/F units for a reference distance of 5.2 AU from the Sun.
            A1 = output picture scale factor (see SCALE parameter for more info).
            t  = commanded exposure time of the input image (msec).
            to = line-dependent shutter offset.
            K  = system gain constant for the gain-state of the image.
            Ko = system gain constant for the calibration file gain-state.
            D  = target distance from the Sun (in AU).
        
        If output units are in radiance, the following equation is used:
        
    		     S2       K
          r = e * -------- * ---
    		  A2(t-to)    Ko
          where:
            S2 = filter-dependent conversion factor from ft-Lamberts to
                 units of nanowatts/cm2/steradian/nanometer.
            A2 = output picture scale factor (see SCALE parameter for more info).
            t  = commanded exposure time of the input image (msec).
            to = line-dependent shutter offset.
            K  = system gain constant for the gain-state of the image.
            Ko = system gain constant for the calibration file gain-state.
        
        Note: The original version of this equation (found in GALSOS) was
        multiplied by 10,000. The Isis 2 version of the program chose to
        remove this scaling factor, so we do the same here.
       
      - 
        The output DN is usually in the range of 0.0 to 1.0.
      
 
    
    If the uneven bit weighting correction is enabled, the input DN values (d)
    will be corrected for uneven-bit-weighting due to the ADC.  If the input
    dark-current file is in byte format (i.e. an individual
    dark-current frame), then the correction will be applied to the
    dark-current as well. The current correction table was supplied by Herb
    Breneman, 2 Mar 89, and is based on 1975 calibration data.
    
    Please note that the original Isis 2 version of this app (ssical) included
    negative I/F values in the output. We will not be supporting this behavior
    as negative I/F are not useful and do not make sense. Thus, this app
    outputs LRS for any negative I/F values that are encountered.
    
 
    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.)
    
   
| Steven Lambright | 2008-01-09 | 
      Original version
     | 
| Steven Lambright | 2008-05-13 | 
      Removed references to CubeInfo 
     | 
| Janet Barrett | 2011-02-02 | 
      Fixed the calculateScaleFactor subroutine so that it uses the CalTargetCode
      instead of the TargetName to determine which radiometric scale factors to 
      obtain from the $galileo/calibration/conversionFactors_v???.sav file. Also,
      had to subtract 1 from the getGainModeID value because the GainRatio
      values are zero based and the gain mode id is 1 based.
      based.
     | 
| Jai Rideout | 2011-04-14 | 
      Fixed bug where shutter file buffers were being accessed out of array
      bounds.
     | 
| Jai Rideout | 2011-05-06 | 
      Added SCALE and UNITS parameters so that radiance output is supported in
      addition to I/F. Added more user documentation and comments in order to
      make the radiometric correction equation clearer. Fixed formatting of
      equations in XML description section.
     | 
| Tracie Sucharski | 2012-08-01 | 
      Print calibration parameters and coefficients to print.prt and RadiometricCalibration
      group in cube labels.
     | 
| Janet Barrett | 2013-11-26 | 
      Modified code that it doesn't require a camera model to calculate the I/F.
      Fixes #1740.
     | 
| Kristin Berry | 2021-02-23 | 
      Modified code to try to use the camera to get the target-sun distance to calculate the IOF.
     |