Index: /trunk/doc/modules/ModulesSDRS.tex
===================================================================
--- /trunk/doc/modules/ModulesSDRS.tex	(revision 1466)
+++ /trunk/doc/modules/ModulesSDRS.tex	(revision 1467)
@@ -1,3 +1,3 @@
-%%% $Id: ModulesSDRS.tex,v 1.12 2004-08-10 02:00:00 price Exp $
+%%% $Id: ModulesSDRS.tex,v 1.13 2004-08-11 02:48:44 price Exp $
 \documentclass[panstarrs]{panstarrs}
 
@@ -105,35 +105,24 @@
 \end{verbatim}
 
+Two types of bias correction may optionally be performed on the input
+image, \code{in}.  The first is the subtraction of an overscan.
+Multiple overscan regions may be specified and fit as a function of
+row (or column).  The second is the subtraction of a full-frame bias
+image (or a ``dark'' image).
+
 The input image, \code{in}, shall have the bias subtracted in-place.
 
 The type of the overscan fit function, \code{fitSpec}, shall be
 dependent upon the value of \code{fit}, which specifies the type of
-fit to be employed.  \code{fit} is an enumerated type:
-
-\begin{verbatim}
-/** Fit types */
-typedef enum {
-    PM_FIT_NONE,                        ///< No fit
-    PM_FIT_POLYNOMIAL,                  ///< Fit polynomial
-    PM_FIT_SPLINE                       ///< Fit cubic splines
-} pmFit;
-\end{verbatim}
-
-If \code{fitSpec} is \code{NULL}, or \code{fit} is \code{PM_FIT_NONE},
-then no fit shall be performed to the overscan.  Otherwise,
-\code{fitSpec} shall be interpreted to be a structure of the
-appropriate type (\code{psPolynomial1D} for \code{PM_FIT_POLYNOMIAL},
-and \code{psSpline1D} for \code{PM_FIT_SPLINE}), and the overscan
-shall (after reduction of the vector and binning) be fit using the
-specified functional form.  Upon return, the \code{fitSpec} shall
-contain the coefficients of the overscan fit.
+fit to be employed and is described below.
 
 The prescan and/or overscan regions to be used are specified in
 \code{overscans}, which is a linked list of subimages.  In cases where
 \code{overscans} is \code{NULL} and \code{overscanAxis} is not
-\code{PM_OVERSCAN_NONE}, or if \code{overscans} is non-\code{NULL} and
-\code{overscanAxis} is \code{PM_OVERSCAN_NONE}, then the function
-shall generate a warning, no overscan subtraction shall be performed,
-and the function shall proceed to the full-frame bias subtraction.
+\code{PM_OVERSCAN_NONE}, the function shall generate an error.  If
+\code{overscans} is non-\code{NULL} and \code{overscanAxis} is
+\code{PM_OVERSCAN_NONE}, then the function shall generate a warning,
+no overscan subtraction shall be performed, and the function shall
+proceed to the full-frame bias subtraction.
 
 The \code{overscanAxis} specifies how the prescan/overscan subtraction
@@ -174,7 +163,27 @@
 \code{PS_STAT_ROBUST_MODE}.
 
-If \code{nBin} is positive and less than the dimension of the vector,
-then the vector shall subsequently be binned into \code{nBin} bins,
-again using the specified statistic (\code{stat}).
+If \code{nBin} is positive and less than the size of the vector, then
+the vector shall subsequently be binned into bins that are a relative
+size of \code{nBin} compared to the original pixels, again using the
+specified statistic (\code{stat}).
+
+\code{fit} is an enumerated type:
+\begin{verbatim}
+/** Fit types */
+typedef enum {
+    PM_FIT_NONE,                        ///< No fit
+    PM_FIT_POLYNOMIAL,                  ///< Fit polynomial
+    PM_FIT_SPLINE                       ///< Fit cubic splines
+} pmFit;
+\end{verbatim}
+
+If \code{fitSpec} is \code{NULL}, or \code{fit} is \code{PM_FIT_NONE},
+then no fit shall be performed to the overscan.  Otherwise,
+\code{fitSpec} shall be interpreted to be a structure of the
+appropriate type (\code{psPolynomial1D} for \code{PM_FIT_POLYNOMIAL},
+and \code{psSpline1D} for \code{PM_FIT_SPLINE}), and the overscan
+shall (after reduction of the vector and binning) be fit using the
+specified functional form.  Upon return, the \code{fitSpec} shall
+contain the coefficients of the overscan fit.
 
 If the overscan is not defined for each row/column, then the function
@@ -184,9 +193,9 @@
 
 Following any binning, the vector shall be fit by the functional form
-specified by \code{fit} (see above).  Then the overscan shall be
-subtracted from the image, using values from the fit if \code{fit} is
-not \code{PM_FIT_NONE}; otherwise using values from the overscan vector
-if \code{overscanAxis} is not \code{PM_OVERSCAN_ALL}; otherwise using
-the appropriate statistic applied to all the prescan/overscan pixels.
+specified by \code{fit}.  Then the overscan shall be subtracted from
+the image, using values from the fit if \code{fit} is not
+\code{PM_FIT_NONE}; otherwise using values from the overscan vector if
+\code{overscanAxis} is not \code{PM_OVERSCAN_ALL}; otherwise using the
+appropriate statistic applied to all the prescan/overscan pixels.
 
 A bias (or dark) image shall be subtracted pixel-by-pixel from the
@@ -234,5 +243,5 @@
 shall generate a warning, and the longer vector shall be truncated to
 the length of the shorter.  The \code{inFlux} vector may be assumed
-to be pre-sorted.
+to be pre-sorted and not contain duplicate values.
 
 If the particular value of a pixel is not found in the \code{inFlux}
@@ -241,5 +250,8 @@
 values specified in the \code{inFlux} vector, then the function shall
 generate a warning (at most one warning of this type per call,
-preferably mentioning the number of pixels out of bounds).
+preferably mentioning the number of pixels out of bounds), and replace
+that pixel value with the \code{outFlux} value corresponding to the
+minimum or the maximum, depending on whether the pixel value is below
+or above the range of \code{inFlux} values.
 
 In the event that the \code{inFlux} vector does not contain two or
@@ -294,8 +306,8 @@
 /** Mask values */
 typedef enum {
-    PM_MASK_TRAP,                       ///< The pixel is a charge trap
-    PM_MASK_BADCOL,                     ///< The pixel is a bad column
-    PM_MASK_SAT,                        ///< The pixel is saturated
-    PM_MASK_FLAT                        ///< The pixel is non-positive in the flat-field
+    PM_MASK_TRAP       = 0x0001,        ///< The pixel is a charge trap
+    PM_MASK_BADCOL     = 0x0002,        ///< The pixel is a bad column
+    PM_MASK_SAT        = 0x0004,        ///< The pixel is saturated
+    PM_MASK_FLAT       = 0x0008,        ///< The pixel is non-positive in the flat-field
 } pmMaskValue;
 \end{verbatim}
@@ -315,12 +327,15 @@
 shall be the following:
 \begin{verbatim}
-psReadout *pmMaskBadPixels(psReadout *in, const psImage *mask, int maskVal, float sat, int grow);
+psReadout *pmMaskBadPixels(psReadout *in, const psImage *mask, unsigned int maskVal,
+                           float sat, unsigned int growVal, int grow);
 \end{verbatim}
 
 Note that the input image, \code{in}, is modified in-place.  All
 pixels in the \code{mask} which satisfy the \code{maskVal} shall have
-their corresponding pixels in the input image, \code{in}, along with
-all pixels within the \code{grow} radius masked.  Pixels which have
-flux greater than \code{sat} shall also be masked, but not grown.
+their corresponding pixels masked in the input image, \code{in}.  All
+pixels which satisfy the \code{growVal} shall have their corresponding
+pixels, along with all pixels within the \code{grow} radius masked.
+Pixels which have flux greater than \code{sat} shall also be masked,
+but not grown.
 
 Note that the input image, \code{in}, and the \code{mask} need not be
