Index: trunk/doc/pslib/psLibSDRS.tex
===================================================================
--- trunk/doc/pslib/psLibSDRS.tex	(revision 3767)
+++ trunk/doc/pslib/psLibSDRS.tex	(revision 3772)
@@ -1,3 +1,3 @@
-%%% $Id: psLibSDRS.tex,v 1.207 2005-04-25 21:20:41 price Exp $
+%%% $Id: psLibSDRS.tex,v 1.208 2005-04-27 19:59:04 eugene Exp $
 \documentclass[panstarrs,spec]{panstarrs}
 
@@ -11,5 +11,5 @@
 \project{Pan-STARRS Image Processing Pipeline}
 \organization{Institute for Astronomy}
-\version{13}
+\version{14}
 \docnumber{PSDC-430-007}
 
@@ -44,4 +44,6 @@
 11 & 2005 Jan 21 & draft for cycle 5 \\ \hline
 12 & 2005 Feb 09 & final for cycle 5 \\
+13 & 2005 Mar 30 & draft for cycle 6 \\
+14 & 2005 Apr 27 & final for cycle 6 \\
 \RevisionsEnd
 
@@ -1374,4 +1376,33 @@
 If the value of \code{vector} is \code{NULL}, then
 \code{psVectorRealloc} must return an error.
+
+\begin{verbatim}
+psVector *psVectorExtend(psVector *vector, int delta, int nExtend);
+\end{verbatim}
+
+This function increments \code{psVector.n}, the number of elements in
+the vector by \code{nExtend}.  If the current length of the vector
+plus {\em twice} the number of new elements is greater than the
+allocated space, an additional \code{delta} elements are allocated.
+If the value of \code{delta} is less than 1, 10 shall be used.  
+
+Here is an example of how \code{psVectorExtend} is used to
+automatically increment the vector length.
+\begin{verbatim}
+  // create data vector
+  psVector *y = psVectorAlloc (100);
+  y->n = 0;
+  for (int i = 0; i < 1000; i++) {
+    y->data.F32[y->n + 0] = 2*i;
+    y->data.F32[y->n + 1] = 2*i;
+    y->data.F32[y->n + 2] = 2*i;
+    psVectorExtend (y, 100, 3);
+    // increments n by 1, extends length if needed by 100
+  }
+\end{verbatim}
+Note that the specification that the allocation always be greater than
+the number of elements by twice the number of new elements implies
+that there will be room on the next loop for \code{nExtend} new
+elements, as in this example.
 
 \subsection{Simple Images}
@@ -1492,4 +1523,13 @@
 \code{delta} defines how many elements to add on each pass (if this
 value is less than 1, 10 shall be used).
+
+\begin{verbatim}
+psBool psArrayRemove(psArray *array, psPtr value);
+\end{verbatim}
+
+This function removes all entries of \code{value} in the \code{array},
+reducing the total number of elements of \code{array} as needed.
+Returns \code{TRUE} if any elements were removed, otherwise
+\code{FALSE}.
 
 \begin{verbatim}
@@ -2679,7 +2719,12 @@
 } psImageCutDirection;
 
-psVector *psImageSlice(psVector *out, psVector *coords, const psImage *input,
-                       const psImage *mask, unsigned int maskVal, int x0, int y0,
-                       int x1, int y1, psImageCutDirection direction, const psStats *stats);
+psVector *psImageSlice(psVector *out, 
+                       psVector *coords, 
+		       const psImage *input,
+                       const psImage *mask, 
+		       unsigned int maskVal, 
+		       int x0, int y0, int x1, int y1,
+		       psImageCutDirection direction, 
+		       const psStats *stats);
 \end{verbatim}
 Extract pixels from rectlinear region to a vector (array of floats).
@@ -3916,8 +3961,8 @@
 the conventions of the \code{psList} iterators.
 \begin{verbatim}
-psListIterator *psMetadataIteratorAlloc(psMetadata *md, int location, bool mutable);
+psListIterator *psMetadataIteratorAlloc(psMetadata *md, int location, const char *regex);
 bool psMetadataIteratorSet(psListIterator *iterator, int location);
-psMetadataItem *psMetadataGetAndIncrement(psListIterator *iterator, const char *regex);
-psMetadataItem *psMetadataGetAndDecrement(psListIterator *iterator, const char *regex);
+psMetadataItem *psMetadataGetAndIncrement(psListIterator *iterator);
+psMetadataItem *psMetadataGetAndDecrement(psListIterator *iterator);
 \end{verbatim}
 
@@ -4509,5 +4554,4 @@
 bool psFitsUpdateImage(psFits *fits, const psImage *input, psRegion region, int z);
 \end{verbatim}
-\tbd{we have discussed this as the alternate name} 
 Write an image section to the open \code{psFits} file pointer.  This
 operation may write a portion of an image over the existing bytes of
@@ -4609,5 +4653,5 @@
 
 \begin{verbatim}
-bool psFitsUpdateTable(psFits* fits, psMetadata *header, psMetadata* data, int row); 
+bool psFitsUpdateTable(psFits* fits, psMetadata* data, int row); 
 \end{verbatim}
 Writes the \code{psMetadata} data to a FITS table at the specified row
@@ -5364,4 +5408,9 @@
 \tbd{supply the velocity as an un-normalized 3 vector?}
 
+\tbd{MHPCC: please code this section as currently specified.  We will
+  define a function, and algorithm, to return the current velocity
+  vector given a time and position, which can be fed to this
+  function}.
+
 \paragraph{Aberration}
 The following function calculates the \code{apparent} position of a
@@ -5369,12 +5418,25 @@
 observer, represented as a speed and a direction:
 \begin{verbatim}
-psAberration(psSphere *apparent, psSphere *actual, psSphere direction, double speed);
+psSphere *psAberration(psSphere *apparent, psSphere *actual, psSphere direction, double speed);
 \end{verbatim}
 The \code{actual} and \code{apparent} positions are represented as
 \code{psSphere} entries, as is the \code{direction} of motion.  The
-speed in that direction is given in units of the speed of light.
+speed in that direction is given in units of the speed of light.  If
+the value of \code{apparent} is NULL, a new \code{psSphere} is
+allocated, otherwise the point to \code{apparent} is used for the
+result.
 
 \paragraph{Gravitational Deflection}
 
+The following function calculates the \code{apparent} position of a
+star, given its \code{actual} position and the position of the sun:
+\begin{verbatim}
+psSphere *psGravityDeflection(psSphere *apparent, psSphere *actual, psSphere *sun);
+\end{verbatim}
+The \code{actual} and \code{apparent} positions are represented as
+\code{psSphere} entries, as is position of the sun.  If the value of
+\code{apparent} is NULL, a new \code{psSphere} is allocated, otherwise
+the point to \code{apparent} is used for the result.
+
 \paragraph{Parallax}
 
@@ -5385,4 +5447,18 @@
 
 \subsubsection{Transformation from GCRS to ITRS}
+
+The following functions calculate the components, $X$, $Y$, and $s$,
+representing the location of the earth's pole at any moment, or they
+determine the velocity of the pole $X'$, $Y'$, $s'$.  We use the
+following structure to carry the polar coordinate information.  This
+representation may be converted to a rotation between the frames.
+
+\begin{verbatim}
+typedef struct {
+  double x;
+  double y;
+  double s;
+} psEarthPole;
+\end{verbatim}
 
 \paragraph{Precession/Nutation}
@@ -5393,5 +5469,5 @@
 %
 \begin{verbatim}
-psSphere *psEOC_PrecessionModel(double *s, const psTime *time)
+psEarthPole *psEOC_PrecessionModel(const psTime *time)
 \end{verbatim}
 %
@@ -5401,20 +5477,20 @@
 machine accuracy.
 
-The following function provides interpolated corrections to $X$ and
-$Y$ from the tables provided by the IERS, just as it does for UT1 and
-polar motion.  
-
-\begin{verbatim}
-psSphere *psEOC_GetPolarCorr(const psTime *time, psTimeBulletin bulletin);
+The following function provides interpolated corrections to the $X$
+and $Y$ components of the polar coordinates from the tables provided
+by the IERS, just as it does for UT1 and polar motion.
+
+\begin{verbatim}
+psEarthPole *psEOC_PrecessionCorr(const psTime *time, psTimeBulletin bulletin);
 \end{verbatim}
 
 The polar correction is applied to the $X$ and $Y$ elements of the
 rotation to provide higher accuracy.  The spherical rotation term is
-generated by providing the three elements of the rotation to the
-following function:
-\begin{verbatim}
-psSphereRot *psSphereRot_CEOtoGCRS(double s, const psSphere *pole)
-\end{verbatim}
-The retulting \code{psSphereRot} may be used to determine the rotation
+generated by providing the polar coordinate to the following function:
+\begin{verbatim}
+psSphereRot *psSphereRot_CEOtoGCRS(const psEarthPole *pole)
+\end{verbatim}
+This function constructs the rotation element as described in the ADD (
+The resulting \code{psSphereRot} may be used to determine the rotation
 from CIP/CEO to GCRS.  This function must give results identical to
 the IERS BPN2000, within the limits of machine accuracy.
@@ -5434,5 +5510,5 @@
 motion components, $x_p$ and $y_p$, extracted from the IERS tables.  
 \begin{verbatim}
-psSphere *psEOC_GetPoleCoords(const psTime *time, psTimeBulletin bulletin);
+psEarthPole *psEOC_GetPolarMotion(const psTime *time, psTimeBulletin bulletin);
 \end{verbatim}
 
@@ -5441,20 +5517,21 @@
 ADD).
 \begin{verbatim}
-psSphere *psEOC_TidePolarCorr(const psTime *time);
+psEarthPole *psEOC_PolarTideCorr(const psTime *time);
 \end{verbatim}
 
 The following function provides the additional corrections due to nutation
-terms with periods less than or equal to two days:
-\begin{verbatim}
-psSphere *psEOC_NutationCorr(psTime *time);
-\end{verbatim}
-
-The following function should generate the \code{psSphereRot} transform from
-ITRS to CIP/TEO:
-\begin{verbatim}
-psSphereRot *psSphereRot_ITRStoTEO(psSphere pole, psTime *time);
-\end{verbatim}
-The time argument should be used to internally calculate $s'$.
-This function should give identical results to the IERS POM2000 subroutine.
+terms with periods less than or equal to two days, as well as the
+correction to the $s'$ component of the polar motion:
+\begin{verbatim}
+psEarthPole *psEOC_NutationCorr(psTime *time);
+\end{verbatim}
+
+The following function converts the polar motion corrections to a
+spherical rotation using the prescription in the ADD:
+\begin{verbatim}
+psSphereRot *psSphereRot_ITRStoTEO(const psEarthPole *motion);
+\end{verbatim}
+This function should give identical results to the IERS POM2000
+subroutine.
 
 \subsubsection{Earth Orientation Wrappers}
