Index: /trunk/doc/release.2015/ps1.calibration/calibration.tex
===================================================================
--- /trunk/doc/release.2015/ps1.calibration/calibration.tex	(revision 40078)
+++ /trunk/doc/release.2015/ps1.calibration/calibration.tex	(revision 40079)
@@ -1,3 +1,4 @@
-\documentclass[iop,floatfix]{emulateapj}
+\documentclass[10pt,preprint]{aastex}
+% \documentclass[iop,floatfix]{emulateapj}
 % \pdfoutput=1
 
@@ -392,4 +393,5 @@
 
 \subsection{Reference Catalogs}
+\label{sec:synthdb}
 
 During the course of the PS1SC Survey, several reference databases
@@ -721,4 +723,22 @@
 \code{ID_IMAGE_PHOTOM_UBERCAL = 0x00000200}
 
+\begin{table}[hb]
+\begin{center}
+\caption{PS1 / GPC1 Zero Points and Coefficients\label{tab:zpts}}
+\begin{tabular}{llll}
+\hline
+\hline
+{\bf Filter} & {\bf Zero Point (Raw)} & {\bf Zero Point (Calspec)} & {\bf Airmass Slope} \\
+\hline
+\gps & 24.563 & 24.583 & 0.147 \\
+\rps & 24.750 & 24.783 & 0.085 \\
+\ips & 24.611 & 24.635 & 0.044 \\
+\zps & 24.240 & 24.278 & 0.033 \\
+\yps & 23.320 & 23.331 & 0.073 \\
+\hline
+\end{tabular}
+\end{center}
+\end{table}
+
 %% \note{give airmass formula for completeness?}.
 
@@ -891,5 +911,5 @@
    \includegraphics[width=\textwidth,clip]{{pics/photflat.example}.png}
   \end{minipage}
-  \hspace{-3.0in}
+  \hspace{-2.75in}
   \begin{minipage}{0.4\linewidth}
    \vspace{3.25in}
@@ -944,5 +964,6 @@
 \begin{figure}[htbp]
   \begin{center}
- \includegraphics[width=\hsize,clip]{{pics/allsky.photom.sigma}.png}
+%width=\hsize
+ \includegraphics[height=\vsize,clip]{{pics/allsky.photom.sigma}.png}
   \caption{\label{fig:allsky.photom.sigma} Consistency of photometry
     measurements across the sky.  Each panel shows a map of the
@@ -1175,5 +1196,5 @@
 number of different time ranges and found the effect to be quite
 stable, in the period where it was present.  The effect only appeared
-in the serial direction.  Figure~\ref{fig:koppenhoefer} shows the KE
+in the serial direction.  Figure~\ref{fig:KHexample} shows the KE
 trend for a typical affected chip both before and after the
 correction.  For the PV3 dataset, we re-measured the KE trends using
@@ -1213,5 +1234,5 @@
 the difference between the star color and the reference star color,
 using the red or blue color approriate to the particular filter, times
-the tangent of the zenith distance.  Figure~\ref{fig:DCR} shows the
+the tangent of the zenith distance.  Figure~\ref{fig:DCRexample} shows the
 DCR trend for the 5 filters \grizy, as well as the measured
 displacement in the direction perpendicular to the parallactic angle.
@@ -1485,5 +1506,5 @@
 After the full relative astrometry analysis was performed for the PV3
 database, the Gaia Data Release 1 became available
-\citep{2016A&A...595A...2G, 2016A&A...595A...4L}.  This afforded us
+\citep{2016AA...595A...2G,2016AA...595A...4L}.  This afforded us
 the opportunity to constrain the astrometry on the basis of the Gaia
 observations.  Gaia DR1 objects which are bright enough to have proper
@@ -1603,29 +1624,102 @@
 \subsubsection{Iteratively Reweighted Least Squares Fitting}
 
-\begin{verbatim}
-subsection outline
-* motivation (high outlier rate -- quantify?)
-* data prep:
-  * all R,D values are projected to a locally-linear coordinate system
-  * the time is modified to refer to the mean epoch (why?)
-  * parallax factors are calculated for each epoch
-* data: X + dX, Y + dY
-* sequence
-  * ordinary least-squares fit
-  * calculate deviations from the fit
-  * calculate a weight-factor based on (Rx / sigmax)
-  * multiply standard weight by weight-factor
-  * fit using modified weights
-  * check for convergence:
-    * if (B_i - B^\prime_i) > Tol * |B_i|
-    * if (B_i - B^\prime_i) > Tol_value
-  * if not converged, repeat 
-  * once done, calculate the weight-factors again
-    * points with weight-factors < THRESHOLD * ave weight factor : mask
-    * calculate chi-square value using unmasked points
-  * run bootstrap re-sampling (with unmasked points) to determine the errors
-\end{verbatim}
-
-\subsubsection{Seletion of Measurements}
+After the entire database has been calibrated using the relative
+astrometric analysis, we attempt to determine parallax and proper
+motions for all objects in the database.  We require a minimum of 5
+detections and 1 year of data for any object in order for it to be
+fitted for proper motion.  For a parallax fit, we require at least 7
+detections, 1 year of data, and a parallax factor range of at least
+0.25; no object is fitted to parallax without proper motion as well.
+If an object is fitted for parallax, it is also fitted with a model
+including only proper motion and only a mean position.  The chisq for
+all three fits is saved.  Currently, the highest order fit allowed is
+saved in the database.  The resulting parallax and proper motion
+measurements are inserted back into the DVO database for use by
+science queries.
+
+With an automatic process applied to hundreds of millions of stars, it
+is important for the analysis to provide a measurement of the
+astrometry of each object which is robust against failures.  The
+Pan-STARRS\,1 detections have a relatively high rate of non-Gaussian
+outliers, partly because of the high degree of structure in the
+astrometric transformations introduced by the camera optics and the
+atmosphere, and partly due to the high masked fraction and other
+detector effects.  We have used a techinique called Iteratively
+Reweighted Least Squares (IRLS) fitting to reduce the sensitivity of
+the fits to outlier measurements.  We have also used bootstrap
+resampling to determine confidence limits on our fits given the
+observed collection of position measurements.
+
+We begin the astrometric analysis for each object by projecting the
+sky coordinates ($\alpha,\delta$) to a locally linear coordinate
+system ($\eta,\zeta$).  We choose as a reference a single measurement
+from the full set of measurements.  It is not critical which
+measurement we choose as long as the value is recorded during the
+analysis so the results can be deprojected back to the sky using the
+same reference coordinate.  We also work in a time system which has
+been adjusted with reference to the average epoch from the collection
+of measurements.  The resulting proper motions are thus determined
+with the minimum degeneracy with respect to the average position
+solution.
+
+The IRLS analysis starts with an ordinary least squares fit, using the
+weights for each measurement as determined from Poisson statistics.
+After the astrometric parameters have been fitted, the deviations from
+the fit for each position are calculated for both the local $\eta$ and
+$\zeta$ coordinate directions.  The deviation, normalized by the
+Poisson error, is used to modify the standard weight.  We use a Cauchy
+function to define a new weight:
+\begin{eqnarray}
+\omega_\eta^\prime = \frac{\omega_\eta}{1 + r_\eta^2}\\
+\omega_\zeta^\prime = \frac{\omega_\zeta}{1 + r_\zeta^2}\\
+\end{eqnarray}
+using
+\begin{eqnarray}
+r_\eta = \frac{\eta_o - \eta_i}{\sigma_\eta} \\
+r_\zeta = \frac{\zeta_o - \zeta_i}{\sigma_\zeta}
+\end{eqnarray}
+where $\eta_o$ is the model position in the $\eta$ direction, $\eta_i$
+is the measured position in the $\eta$ direction, $\sigma_\eta$ is the
+standard error on the position in the $\eta$ direction, and
+$\omega_\eta$ is the ordinary Poisson weight in the $\eta$ direction
+($\sigma_\eta^{-2}$), and equivalently for the $\zeta$ direction.
+This modified weight has the behavior that if the observed position
+differs from the model by a substantial amount, the weight is greatly
+reduced, while the weight approaches the standard weight if the model
+and observed positions agree well.  Thus, this procedure is equivalent
+to sigma clipping, but allows the outliers to be reduced in impact in
+a continuous way, rather than rigidly accepting or rejecting them.
+
+The object astrometric parameters are re-fitted with these modified
+weights.  New values for $\omega_\eta,\omega_\zeta$ are calculated,
+and the fit is tried again.  On each iteration, the fitted parameters
+are compared to the values from the previous iteration.  If they
+parameters have not changed significantly ($< 10^{-6}$) or if the
+fractional change is less than some tolerance ($10^{-4}$), then
+iterations are halted and the last fitted parameters are used.  If
+convergence is not reached in 10 iterations, the process is halted in
+any case and a flag raised for the object to note that IRLS did not
+converge.
+
+% \note{did this happen for any of our targets?}
+
+To calculate a fit $\chi^2$ value and to determine an appropriate set
+of errors for the model parameters, it is necessary to transform the
+modified weights into explicit cuts.  We have used the rubric that if
+the modified weight is less than 30\% of the standard weight
+($\omega^\prime_\eta < 0.3 \omega_\eta$) then the point is treated as
+clipped.  If a data point would be clipped based on the modified
+weight in either dimension, it is clipped in both (thus a point is
+either used to calculate both RA and Declination terms, or neither).
+The $\chi^2$ is determined from the unclipped points in the standard
+way.  Bootstrap analysis is used to assess the errors on the fit
+parameters: A number of measurements equal to the number of unclipped
+data points are randomly selected from the set of unclipped data
+points, with replacement after each selection.  These data points are
+then used to fit for the astrometric parameters, using ordinary least
+squares fitting.  The parameters are recorded and the process re-run
+100 times.  For each astrometric parameter, the error is determined as
+half of the 68\% confidence range for the distribution of fitted
+parameter values.
 
 \section{Discussion}
