Level 2 Help for GALGEN

INP

 STRING--REQUIRED
	INP=(D1,D2,D3,...,Dn)
 Inputs are flat-field images in order of increasing exposure.  If multiple
 frames are acquired at a given exposure, these frames may be combined
 via PICSUM.


OUT

 STRING--REQUIRED
	OUT=(CAL,SAT,ERR,RMS,DC)
 The output files (CAL,SAT,ERR,RMS,DC) are images in the same format as the
 input flat-field frames (400x400 or 800x800 for Galileo, 256x256, 512x512, or
 1024x1024 for Cassini):).  If the keyword  LINEAR is specified (the default),
 all five outputs are required.  If SLOPE  is specified, then DC should not be
 specified, and SAT, ERR, and RMS are optional.

 CAL is the Radiometric File, and contains the inverse slope term of the
 light-transfer function for each pixel position (i,j).  The elements of CAL
 are REAL*4 values z(i,j) such that:
	z(i,j) = SCALE/c  for normal pixels (inverse slope term)
	       = 0.0   for an unsuccessful fit.	
 
 SAT contains the saturation DN value (DNfw) for each low-full-well pixel.
 The elements of SAT are 16-bit integers s(i,j) such that:
	s(i,j) = 32767  for normal pixels
	       = DNfw   for low-full-well pixels
	       = -1     for an unsuccessful fit.
 
 ERR contains the maximum absolute deviation (Emax) of the input pixels
 from the fitted light-transfer curve.  The elements of ERR are 16-bit
 integers f(i,j) such that:
	f(i,j) = -1           for an unsuccessful fit
	       = Emax*FSCALE  otherwise.
 where FSCALE is specified by the FITSCALE parameter (default=1.0).
 
 RMS contains the RMS error (Erms) resulting from the fit.  The elements
 of RMS are 16-bit integers r(i,j) such that:
	r(i,j) = -1           for an unsuccessful fit
	       = Erms*FSCALE  otherwise.
 where FSCALE is specified by the FITSCALE parameter (default=1.0).

 If the keyword LINEAR is specified, the output Dark-Current File (DC)
 contains the offset terms (Do) resulting from the fit.  The elements of DC
 are 16-bit integers d(i,j) such that:
	d(i,j) = 0  for an unsuccessful fit
	       = 128*Do  otherwise.


DC

 STRING--OPTIONAL
 Specifies the input Dark-current file.  This parameter is required when the
 parameter FIT is equal to SLOPE.


EDC

 STRING--OPTIONAL
 Specifies the input extended Dark-current file.  This paremter is required
 when extened exposure flat fields are used in conjuntion with normal exposure
 flat fields as input.
 NOTE:  The parameters DC & EXTEXP must also be specified.


GAIN

 INTEGER--REQUIRED for Galileo
 Specifies camera gain state.  Valid values are 10, 40, 100, 400 for Galileo,
 40, 100, 400, 1400 for Cassini.  This parameter must be given for Galileo, but
 if not given for Cassini is extracted from the VICAR label.


UNITS

 Specifies whether LIGHT is in LUMINANC (Relative-foot-Lamberts ) or RADIANCE
 (nanowatts/cm**2/sr/nanometer).  UNITS should be LUMINANC for Galileo and
 RADIANCE for Cassini).


LIGHT

 REAL-REQUIRED for Galileo
 LIGHT gives the light cannon setting (in foot-lamberts or nanowatts/cm**2/sr/
 nanometer) at which the flat  field images were exposed (assumed to be
 constant throughout the sequence).  This parameter must be given for Galileo,
 but if not given for Cassini is extracted from the VICAR label.


EXPOSURE

 REAL--OPTIONAL
 Specifies the commanded exposure times (in milliseconds) for each input
 frame in the light-transfer sequence.  The exposures must be input either
 via the EXPOSURE or SHUTTER parameter (see below).  Not needed for the
 DC or EDC input frames.  EXPOSURE or SHUTTER  must be given for Galileo, but
 if not given for Cassini is extracted from the VICAR label.


SHUTTER

 INTEGER--OPTIONAL
 This parameter is for Galileo only.   Gives the shutter setting for each flat
 field input image.  The shutter setting is related to commanded exposure time
 as follows:

       Shutter          Exposure     | Shutter           Exposure
       Setting          time (ms)    | Setting           time (ms)
      -------------------------------|---------------------------------
         0                 0         |   16                 800
         1                 4 1/6     |   17                1066 2/3
         2                 6 1/4     |   18                1600
         3                 8 1/3     |   19                2133 1/3
         4                12 1/2     |   20                3200
         5                16 2/3     |   21                4266 2/3
         6                25         |   22                6400
         7                33 1/3     |   23                8533 1/3
         8                50         |   24               12800
         9                66 2/3     |   25               17066 2/3
        10               100         |   26               25600
        11               133 1/3     |   27               34133 1/3
        12               200         |   28               51200
        13               266 2/3     |   29                   0
        14               400         |   30                   0
        15               533 1/3     |   31                   0


NUMB

 INTEGER--OPTIONAL
 Specifies the picture scale for each input frame.
     E.g. NUMB=([Ndc,]N1,N2,N3,...,Nn[,Nedc])
 If an input frame Di represents multiple frames that have been combined via
 PICSUM, then Ni should equal the number of frames added together (=1 for
 single frames).  When either a dark-current (DC) or an extended-dark-current
 frame (EDC) are specified, then the picture scales: "Ndc" and "Nedc" should
 be included, as needed.  If NUMB is defaulted, the picture scale is retrieved
 from the image labels.


EXTEXPO

 INTEGER--OPTIONAL - GALILEO only
 EXTEXPO specifies the exposure at which the extended-dark-current
 correction is to be applied.
    galgen (D1,D2,D3,D4,D5,D6,D7) CAL DC=DC EDC=EDC EXTEXPO=5
 The correction will be applied here to frames D5, D6, and D7.
 NOTE:  The parameters DC & EDC must also be specified.


SCALE

 REAL--OPTIONAL--Default=1.0
 SCALE specifies scaling of the output slope terms.  Instead of outputing
 1/c in the slope file, SCALE/C is output.


FIT

 KEYWORD--OPTIONAL--Default=LINEAR
 FIT specifies whether, while fitting the input data points to the light-
 transfer curve, to solve for the slope term only (FIT=SLOPE) or to solve
 for both the slope and offset terms (FIT=LINEAR).

 If FIT=LINEAR is specified, the input data points D1,D2,D3,...,Dn are
 fitted to the curve:
		Di = C*Ei + DC
 where the exposures Ei are computed from the commanded exposure times,
 light-cannon setting, and shutter-offsets (see EXPOSURE, SHUTTER, LUMINANC, and
 OFFSET parameters).  The inverses of the resulting slopes (1/C) are output
 to the Radiometric File (CAL).  The resulting offsets are output to the
 output dark-current file (DC).  Even though the input DC frame is not used
 in any calculations, it still must be included as the last input frame.

 If FIT=SLOPE is specified, the input data points D1,D2,D3,...,Dn are fitted
 to the curve:
		Di = C*Ei + DC
 and DC is the input dark-current extracted from the DC parameter.
 The inverses of the resulting slopes (1/C) are output to the Radiometric File
 (CAL).


FITSCALE

 REAL--OPTIONAL--Default=1.0
 Specifies a number (FSCALE) used to scale the maximum residual error (ERR)
 and rms error (RMS) resulting from the least squares fit.  See OUT parameter
 for details.


LFWPT

 KEYWORD--OPTIONAL
 The keyword LFWPT enables the low-full-well-pixel test for automatically
 scanning for low-full-well pixels by checking for non-linearities in the
 input data points.  Starting with the first n data points (where n is
 specified via the SKIP parameter), the points are iteratively included
 in the fit.  The next point (not yet included) is checked to see if it
 falls more than a certain distance (determined from the ERROR parameter)
 below the fitted curve (in units of DN).  If a point is rejected, then
 all points above this level are also thrown out, and the raw dn of the last
 pixel used in the fit is placed into the SAT file as a record of the
 saturated DN level (low-full-well for the CCD).

 If the keyword LFWPT is not specified, then the test is suppressed, and
 the positions of the low-full-well pixels are retrieved from tables built
 into the program.


SKIP

 INTEGER--OPTIONAL--Default=4
 Specifies number of exposures at low end to skip before applying the low
 full well pixel test.  See LFWPT for details.


ERROR

 REAL--OPTIONAL-Default=(.05,1.)
      ERROR=(delta1,delta2)
 The ERROR parameter specifies the error threshold EPS (in DN) as a linear
 function of the exposure e (in relative-foot-Lambert-msec or picoamp-msec):
      EPS = delta1*e + delta2
 The error threshold is applied in the low-full-well-pixel test (see
 parameter LFWPT).


OFFSETS

 STRING--REQUIRED
 Specifies the Shutter-Offset File.  The file is generated by program
 CCDRECIP.


LIST

 STRING--OPTIONAL
 Specifies the name of the SRCH-format text file containing the names of
 the input files to be processed.  This is an alternative to listing the 
 filenames on the command line with the INP parameter.  

 Inputs are flat-field images in order of increasing exposure.  If multiple
 frames are acquired at a given exposure, these frames may be combined
 via PICSUM.