Index: trunk/doc/modules/ModulesSDRS.tex
===================================================================
--- trunk/doc/modules/ModulesSDRS.tex	(revision 1113)
+++ trunk/doc/modules/ModulesSDRS.tex	(revision 1117)
@@ -1,3 +1,3 @@
-%%% $Id: ModulesSDRS.tex,v 1.5 2004-06-29 01:44:23 price Exp $
+%%% $Id: ModulesSDRS.tex,v 1.6 2004-06-29 02:23:47 price Exp $
 \documentclass[panstarrs]{panstarrs}
 
@@ -76,5 +76,5 @@
 \item Subtract the background;
 \item Mask bad pixels;
-\item Mask cosmic rays;
+\item \tbd{Mask cosmic rays;}
 \item \tbd{Mask optical defects;}
 \item \tbd{Measure the PSF;}
@@ -85,5 +85,6 @@
 
 Each of these shall be discussed in turn, below.  Those modules which
-are \tbd{TBD} will be deferred until they may be properly defined.
+are \tbd{TBD} will be deferred until they may be properly defined,
+some of which requires further research to define the best algorithm.
 
 These modules are built on top of, and are dependent upon, the \PS{}
@@ -121,13 +122,12 @@
 \end{verbatim}
 
-The \code{kernel} member shall point to an image that contains the
-kernel values.  The kernel has both positive and negative indices to
-convey the positive and negative shifts.  The maximum extent of these
-shifts shall be defined by the \code{xMin}, \code{xMax}, \code{yMin}
-and \code{yMax} members.  Note that \code{xMin} and \code{yMin}, under
-normal circumstances, should be negative numbers.  That is,
-\code{myKernel->kernel[-3][-2]} may be defined if \code{yMin} and
-\code{xMin} are equal to or more negative than -3 and -2,
-respectively.
+The \code{kernel} shall contain the kernel values.  The kernel has
+both positive and negative indices to convey the positive and negative
+shifts.  The maximum extent of these shifts shall be defined by the
+\code{xMin}, \code{xMax}, \code{yMin} and \code{yMax} members.  Note
+that \code{xMin} and \code{yMin}, under normal circumstances, should
+be negative numbers.  That is, \code{myKernel->kernel[-3][-2]} may be
+defined if \code{yMin} and \code{xMin} are equal to or more negative
+than -3 and -2, respectively.
 
 Of course, we require the appropriate constructor and destructor:
@@ -137,10 +137,14 @@
 \end{verbatim}
 
+\code{psKernelAlloc} shall allocate a kernel.  In the event that one
+of the minimum values is greater than the corresponding maximum value,
+the function shall generate a warning, and the offending values shall
+be exchanged.
 
 \subsection{Calculate the convolution kernel}
 
 Given a list of pixel shifts made in the course of OT guiding,
-\code{psPhase2GetKernel} shall return the kernel.  The API shall be
-the following:
+\code{psPhase2GetKernel} shall return the appropriate kernel.  The API
+shall be the following:
 \begin{verbatim}
 psKernel *psPhase2GetKernel(const psVector *xShifts, const psVector *yShifts);
@@ -150,5 +154,5 @@
 by the user, most probably from the FITS file containing the image.
 
-The elements of the shift vectors should be of an integer type,
+The elements of the shift vectors should be of an integer type;
 otherwise the values shall be truncated to integers.  The output
 kernel shall be normalised such that the sum over the kernel is unity.
@@ -185,6 +189,7 @@
 \subsection{PSLib Routines}
 
-\code{psKernel} and \code{psImageConvolve} shall be part of the \PS{}
-Library, \code{PSLib}, so that they may be re-used for other modules.
+\code{psKernel} and \code{psImageConvolve} shall be incorporated into
+the \PS{} Library, \code{PSLib}, so that they may be re-used for other
+modules.
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -215,13 +220,6 @@
 We also require a corresponding constructor and destructor:
 \begin{verbatim}
-/** Constructor */
-psImageRegion *psImageRegionAlloc(int x0, ///< x offset to region
-                                  int y0, ///< y offset to region
-                                  int nX, ///< Size of region in x
-                                  int nY ///< Size of region in y
-                                  );
-/** Destructor */
-void psImageRegionFree(psImageRegion *reg ///< Region to destroy
-                       );
+psImageRegion *psImageRegionAlloc(int x0, int y0, int nX, int nY);
+void psImageRegionFree(psImageRegion *reg);
 \end{verbatim}
 
@@ -234,5 +232,5 @@
 but we neglected to define them for PSLib.  We now define
 one-dimensional cubic splines, \code{psSpline1D}, which shall be
-included into PSLib:
+incorporated into PSLib:
 
 \begin{verbatim}
@@ -261,5 +259,4 @@
 Of course, we require the appropriate constructors and destructor:
 \begin{verbatim}
-/** Constructors */
 psSpline1D *psSpline1DAlloc(int n, float min, float max);
 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds);
@@ -286,8 +283,5 @@
 
 \begin{verbatim}
-/** Evaluator */
-float psSpline1DEval(const psSpline1D *spline, ///< Spline to evaluate
-		     float x	///< Normalised (-1,1) coordinates at which to evaluate
-		     );
+float psSpline1DEval(const psSpline1D *spline, float x);
 \end{verbatim}
 
@@ -409,4 +403,10 @@
 the bounds of the input image.
 
+\subsection{PSLib}
+
+The \code{psSpline1D} and \code{psFit} shall be incorporated into
+PSLib.
+
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
@@ -484,5 +484,5 @@
 \subsection{Subtract sky}
 
-\tbd{This is a simply sky subtraction routine.  A more complicated
+\tbd{This is a simple sky subtraction routine.  A more complicated
 routine will be specified in the future, following research into the
 best algorithm.}
@@ -494,12 +494,6 @@
 the following:
 \begin{verbatim}
-/** Simple sky subtraction */
-psReadout *psPhase2SubtractSky(psReadout *in, ///< Input image to be sky-subtracted, and output
-			       void *fitSpec, ///< Polynomial/Spline specification, returns coeffcients
-			       psFit fit, ///< Fit type
-			       int binFactor, ///< Binning factor to use on image before solving for polynomial
-			       psStats *stats, ///< Statistics to use in binning
-			       float clipSD ///< Standard deviations to clip at after binning.
-			       );
+psReadout *psPhase2SubtractSky(psReadout *in, void *fitSpec, psFit fit, int binFactor, psStats *stats,
+                               float clipSD);
 \end{verbatim}
 
@@ -514,6 +508,6 @@
 spline on the basis of \code{fit} (in the same manner as for bias
 subtraction; \S\ref{sec:bias}).  If \code{fitSpec} is \code{NULL} or
-\code{fit} is \code{PS_FIT_NONE}, then no fit shall be performed, and
-the function shall simply return.
+\code{fit} is \code{PS_FIT_NONE} or \code{PS_FIT_LINEAR}, then no fit
+shall be performed, and the function shall simply return.
 
 When fitting the polynomial, the function shall first bin the input
@@ -534,6 +528,7 @@
 Binned pixels deviating more than \code{clipSD} standard deviations
 from the mean of the binned pixels shall be clipped in a single
-clipping iteration.  If the \code{clipSD} is non-positive, then the
-function shall generate a warning and not perform any clipping.
+clipping iteration before polynomial fitting.  If the \code{clipSD} is
+non-positive, then the function shall generate a warning and not
+perform any clipping.
 
 
@@ -566,9 +561,10 @@
 \subsection{Bad pixels}
 
-Given an input image, a bad pixel mask, a corresponding value in the
-bad pixel mask to mask in the input image, a saturation level, and a
-growing radius, \code{psPhase2MaskBadPixels} shall mask in the input
-image those pixels in the bad pixel mask that match the value to mask.
-The API shall be the following:
+Given an input image, \code{in}, a bad pixel \code{mask}, a
+corresponding value in the bad pixel mask to mask in the input image,
+\code{maskVal}, a saturation level, and a growing radius,
+\code{psPhase2MaskBadPixels} shall mask in the input image those
+pixels in the bad pixel mask that match the value to mask.  The API
+shall be the following:
 \begin{verbatim}
 /** Returns an image that has the bad pixels masked.  Also masks saturated pixels */
@@ -582,8 +578,19 @@
 
 Note that the input image, \code{in}, is modified in-place.  All
-pixels in the \code{mask} which satisfy the \code{maskVal} or have
-corresponding flux greater than \code{sat}, shall have their
-corresponding pixels in the input image, \code{in}, along with all
-pixels within the \code{grow} radius masked.
+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.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\bibliographystyle{plain}
+\bibliography{panstarrs}
+
+\end{document}
 
 \subsection{Cosmic rays}
@@ -624,5 +631,4 @@
 optical model of the camera.  Put this one on the backburner?}
 
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \section{Objects}
@@ -732,10 +738,2 @@
 not all of which may correspond to legal positions on the input chip,
 \code{in}.
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\bibliographystyle{plain}
-\bibliography{panstarrs}
-
-\end{document}
-
