Index: /trunk/doc/modules/ModulesSDRS.tex
===================================================================
--- /trunk/doc/modules/ModulesSDRS.tex	(revision 1448)
+++ /trunk/doc/modules/ModulesSDRS.tex	(revision 1449)
@@ -1,3 +1,3 @@
-%%% $Id: ModulesSDRS.tex,v 1.10 2004-08-09 23:20:02 price Exp $
+%%% $Id: ModulesSDRS.tex,v 1.11 2004-08-10 01:56:47 price Exp $
 \documentclass[panstarrs]{panstarrs}
 
@@ -52,11 +52,15 @@
 
 This document describes the Pan-STARRS Image Processing Pipeline (IPP)
-image processing modules.  The modules use the functionality \PS{}
-Library (PSLib) perform more complex tasks.
+image processing modules.  The modules use the functionality of the
+\PS{} Library (PSLib) to perform more complex tasks.  They will
+eventually be tied together, employing a script written in a
+high-level language to form a ``processing stage''.  Modules will be
+constructed to support each of the required processing stages, and are
+listed in this document according to the particular processing stage
+for which they will primarily be used.
 
 In order to preserve name space, globally-visible structures and
 functions shall be prefixed with \code{pm}, for ``\PS{} Modules''.
 
-Modules will be constructed to support each of the processing stages.
 
 \section{Phase 2}
@@ -65,13 +69,4 @@
 are removed from the detector images, in preparation for the
 combination of multiple images in Phase 4.
-
-The Phase 2 processing stage is composed of several modules which
-perform the individual steps in the processing, each of which will act
-upon a data element of the appropriate size.  For example, the bias
-subtraction module will act upon a detector ``readout''
-(\code{psReadout}).  It will be the responsibility of the caller of
-the Phase 2 processing modules (i.e., the Phase 2 processing stage,
-which will likely be a script written in a high-level language such as
-\tbd{Python}) to iterate over the components with which it is charged.
 
 The Phase 2 processing modules are:
@@ -107,5 +102,5 @@
 psReadout *pmSubtractBias(psReadout *in, void *fitSpec, const psList *overscans,
                           pmOverscanAxis overscanAxis, const psStats *stat,
-                          int nBin, psFit fit, const psReadout *bias);
+                          int nBin, pmFit fit, const psReadout *bias);
 \end{verbatim}
 
@@ -130,11 +125,15 @@
 appropriate type (\code{psPolynomial1D} for \code{PM_FIT_POLYNOMIAL},
 and \code{psSpline1D} for \code{PM_FIT_SPLINE}), and the overscan
-shall be fit using the specified functional form.  Upon return, the
-\code{fitSpec} shall contain the coefficients of the overscan fit.
+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.
 
 The prescan and/or overscan regions to be used are specified in
-\code{overscans}, which is a linked list of subimages.  If
-\code{overscans} is non-\code{NULL} and \code{overscanAxis} is not
-\code{PM_OVERSCAN_NONE}, then the function shall generate a warning.
+\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.
 
 The \code{overscanAxis} specifies how the prescan/overscan subtraction
@@ -151,11 +150,11 @@
 
 If the \code{overscanAxis} is \code{PM_OVERSCAN_NONE}, then the
-function shall not perform any overscan subtraction.  If the
-\code{overscanAxis} is \code{PM_OVERSCAN_ALL}, then all the overscan
-regions shall be used to generate a single statistic (specified by
-\code{stat}) which shall be subtracted from the entire image.  A
-warning shall be generated if the \code{overscanAxis} is
-\code{PM_OVERSCAN_NONE} or \code{PM_OVERSCAN_ALL} and the \code{fit}
-is not \code{PM_FIT_NONE}.
+function shall not perform any overscan subtraction, but proceed to
+the full-frame bias subtraction.  If the \code{overscanAxis} is
+\code{PM_OVERSCAN_ALL}, then all the overscan regions shall be used to
+generate a single statistic (specified by \code{stat}) which shall be
+subtracted from the entire image.  A warning shall be generated if the
+\code{overscanAxis} is \code{PM_OVERSCAN_NONE} or
+\code{PM_OVERSCAN_ALL} and the \code{fit} is not \code{PM_FIT_NONE}.
 
 If the \code{overscanAxis} is \code{PM_OVERSCAN_ROWS} or
@@ -175,11 +174,12 @@
 \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 down into
-\code{nBin} bins, again using the specified statistic (\code{stat}).
+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 the overscan is not defined for each row/column, then the function
 shall generate a warning and then interpolate using the provided
-functional form if \code{fit} is not \code{PM_FIT_NONE};
-otherwise, the function shall generate an error.
+functional form if \code{fit} is not \code{PM_FIT_NONE}; otherwise,
+the function shall generate an error.
 
 Following any binning, the vector shall be fit by the functional form
@@ -205,12 +205,11 @@
 \subsection{Non-linearity}
 
-We shall specify two functions to perform the non-linearity
-correction, in order to implement the possible methods of specifying
-the correction.
+We here specify two functions to perform the non-linearity correction,
+since either (or both) might be used to specify the correction.
 
 The first, \code{pmNonLinearityPolynomial} shall correct the input
-image for non-linearity by applying the given polynomial,
-\code{coeff}, to the flux of each pixel in the input image, \code{in}.
-The API shall be the following:
+image for non-linearity by replacing the flux in each pixel of the
+input image, \code{in}, with the result of the specified polynomial,
+\code{coeff}, acting on the flux.  The API shall be the following:
 
 \begin{verbatim}
@@ -239,9 +238,13 @@
 If the particular value of a pixel is not found in the \code{inFlux}
 vector, the corresponding \code{outFlux} shall be calculated through
-linear interpolation.
+linear interpolation.  If the value of a pixel is beyond the range of
+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).
 
 In the event that the \code{inFlux} vector does not contain two or
-more entries (necessary for linear interpolation), then the function
-shall generate a warning, and make no correction to any of the pixels.
+more entries (being the lower limit required for linear
+interpolation), then the function shall generate a warning, and make
+no correction to any of the pixels.
 
 Both \code{pmNonLinearityPolynomial} and \code{pmNonLinearityLookup}
@@ -270,6 +273,7 @@
 in the input image with the value \code{PM_MASK_FLAT} (see
 \S\ref{sec:maskValues}).  Negative pixels in the \code{flat} may be
-set to zero so that they are treated identically to zeroes.  And
-pixels masked in the \code{flat} shall be masked in the \code{output}.
+set to zero so that they are treated identically to zeroes.  Any
+pixels masked in the \code{flat} shall be masked with corresponding
+values in the \code{output}.
 
 The function shall not normalize the \code{flat}; this responsibility
@@ -283,6 +287,4 @@
 \subsection{Masking}
 
-The following modules mask various defects on an image.
-
 \subsubsection{Mask values}
 \label{sec:maskValues}
@@ -295,6 +297,5 @@
     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_CR_MORPH                    ///< The pixel is determined to be a cosmic ray, from morphology
+    PM_MASK_FLAT                        ///< The pixel is non-positive in the flat-field
 } pmMaskValue;
 \end{verbatim}
