Index: trunk/doc/psphot/psphot.tex
===================================================================
--- trunk/doc/psphot/psphot.tex	(revision 21443)
+++ trunk/doc/psphot/psphot.tex	(revision 21455)
@@ -389,4 +389,70 @@
 likely that the `peak' was identified in a region of flat flux
 distribution or many saturated or edge pixels.
+
+\subsubsection{Determination of the Peak Coordinates and Errors}
+
+We use the 9 pixels which include the source peak to fit for the
+position and position errors.  We model the peak of the sources as a
+2D quadratic polynomial, and use a very simple bi-quadratic fit to
+these pixels.  We use the following function to describe the peak
+
+\[ f(x,y) = C_{00} + C_{10}x + C_{01} y + C_{11} x y + C_{20} x^2 + C_{02} y^2 \]
+
+and write the Chi-Square equation:
+
+\[ \Chi^2 = \sum_{i,j} (F_{i,j} - f(x,y))^2 / \sigma_{i,j}^2 \]
+
+By approximating the error per pixel as the error on just the peak,
+and pulling that term out of the above equation, and recognizing that
+the values x,y in the 3x3 grid centered on the peak pixel have values
+of only 0 or 1, we can greatly simplify the chi-square equation to a
+square matrix equation with the following values:
+
+%% fix this:
+\begin{verbatim}
+| 9 0 0 0 6 6 | C_00 | = \sum F_{i,j}
+| 0 6 0 0 0 0 | C_10 | = \sum F_{i,j} x
+| 0 0 6 0 0 0 | C_01 | = \sum F_{i,j} y
+| 0 0 0 6 0 0 | C_11 | = \sum F_{i,j} x y
+| 6 0 0 0 6 4 | C_20 | = \sum F_{i,j} x^2
+| 6 0 0 0 4 6 | C_02 | = \sum F_{i,j} y^2
+\end{verbatim}
+
+The inverse of the 3x3 matrix terms for C_{00}, C_{20}, and C_{02} is:
+\begin{verbatim}
+| +5/9 -1/3 -1/3 | 
+| -1/3 +1/2    0 | 
+| -1/3    0 +1/2 | 
+\end{verbatim}
+
+which can be used to determine the errors on the coefficients: 
+
+\begin{eqnarray}
+\sigma^2_{00} & = & \sigma^2 (5/9) \\
+\sigma^2_{10} & = & \sigma^2 (1/6) \\
+\sigma^2_{01} & = & \sigma^2 (1/6) \\
+\sigma^2_{11} & = & \sigma^2 (1/6) \\
+\sigma^2_{20} & = & \sigma^2 (1/2) \\
+\sigma^2_{02} & = & \sigma^2 (1/2) \\
+\end{eqnarray}
+
+The location of the peak is determined from the minimum of the
+bi-quadratic function above, and is given by:
+
+\begin{eqnarray}
+Det    & = & 4 C_{20} C_{02} - C_{11}^2 \\
+x_{min} & = & (C_{11} C_{01} - 2 C_{02} C_{10}) / Det \\
+y_{min} & = & (C_{11} C_{10} - 2 C_{20} C_{01}) / Det \\
+\end{eqnarray}
+
+Applying error propagation to the above, we find:
+
+\begin{eqnarray}
+\sigma_{Det}^2  & = & \sigma_{11}^2 (4 C_{11}^2) + \sigma_{20}^2 (16 C_{02}^2) + \sigma_{02}^2 (16 C_{20}^2) \\
+\sigma_{xn}^2   & = & \sigma_{11}^2 C_{01}^2 + \sigma_{01}^2 C_{11}^2 + \sigma_{02}^2 (4 C_{10}^2) + \sigma_{10}^2 (4 C_{02}^2) \\
+\sigma_{yn}^2   & = & \sigma_{11}^2 C_{10}^2 + \sigma_{10}^2 C_{11}^2 + \sigma_{20}^2 (4 C_{01}^2) + \sigma_{01}^2 (4 C_{20}^2) \\
+\sigma_{x}^2    & = & x^2 (\sigma_{xn}^2 / xn^2 + \sigma_{Det}^2 / Det^2) \\
+\sigma_{y}^2    & = & y^2 (\sigma_{yn}^2 / yn^2 + \sigma_{Det}^2 / Det^2) \\
+\end{eqnarray}
 
 \subsection{PSF Determination}
