Index: trunk/doc/release.2015/ps1.detrend/detrend.tex
===================================================================
--- trunk/doc/release.2015/ps1.detrend/detrend.tex	(revision 41222)
+++ trunk/doc/release.2015/ps1.detrend/detrend.tex	(revision 41223)
@@ -21,7 +21,12 @@
 %\def\plotmode{bw}
 
+% journal images:
+\def\plotopt{}
+
 % arxiv needs small graphics, but publishers want full-scale
 %\def\plotopt{_sm}
-\def\plotopt{}
+
+% empty images for quick processing
+% \def\plotopt{_mt}
 
 % use this to make the figure picture path flexible:
@@ -41,4 +46,6 @@
 %\newcommand{\ippstage}[1]{\textsc{#1}}
 \newcommand{\asinh}{\mathop{\rm asinh}\nolimits}
+
+\newcommand{\SKIP}{}
 
 % Pick a terse version of the title here;
@@ -179,4 +186,21 @@
 improved calibration of the PV3 processing of that dataset.
 
+\begin{figure}[htpb]
+  \centering
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{{\picdir/gpc1.layout}.pdf}
+  \caption{Diagram illustrating layout of OTA devices in GPC1.  The
+    blue dots mark the locations of the amplifiers for xy00 cells in
+    each chip.  When cells are mosaicked to a single pixel grid, the
+    pixel in this corner is at chip coordinate (1,1).  The figure
+    illustrates the orientation of the OTA devices relative to the
+    parity of the sky.  An exposure taken with North at the top of the
+    field-of-view will have East to the left when the OTA devices are
+    mosaicked as shown.  Note that the devices OTA0Y - OTA3Y are
+    rotated by 180\degrees\ relative to the other half of the camera.
+    The labeling of the non-existent corner OTAs is provided to orient
+    the focal plane.}
+  \label{fig:gpc1.layout}
+\end{figure}
+
 This is the third in a series of seven papers describing the
 Pan-STARRS1 Surveys, the data reduction techniques and the resulting
@@ -229,4 +253,12 @@
 survey. The Medium Deep Survey is not part of Data Releases 1 or 2 and
 will be made available in a future data release.
+
+In this article, we use the following type-faces to distinguish
+different concepts:
+\begin{itemize}
+\item \ippstage{Small caps} for the analysis stages.
+\item \ippprog{Fixed-width} font for program names, variables, and
+  miscellaneous constants.
+\end{itemize}
 
 \section{Background}
@@ -276,21 +308,4 @@
 are provided in Paper IV.
 
-\begin{figure}[htpb]
-  \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{{\picdir/gpc1.layout}.pdf}
-  \caption{Diagram illustrating layout of OTA devices in GPC1.  The
-    blue dots mark the locations of the amplifiers for xy00 cells in
-    each chip.  When cells are mosaicked to a single pixel grid, the
-    pixel in this corner is at chip coordinate (1,1).  The figure
-    illustrates the orientation of the OTA devices relative to the
-    parity of the sky.  An exposure taken with North at the top of the
-    field-of-view will have East to the left when the OTA devices are
-    mosaicked as shown.  Note that the devices OTA0Y - OTA3Y are
-    rotated by 180\degrees\ relative to the other half of the camera.
-    The labeling of the non-existent corner OTAs is provided to orient
-    the focal plane.}
-  \label{fig:gpc1.layout}
-\end{figure}
-
 A limited version of the same reduction procedure described above is also
 performed in real time on new exposures as they are observed by the
@@ -306,34 +321,4 @@
 observations \citep{2015IAUGA..2251124W}.
 
-\begin{table*}
-\caption{\label{tab:detrend.steps} Detrend steps in order of application} % \vspace{-0.5cm}
-\begin{center}
-\footnotesize
-\begin{tabular}{lll}
-\hline
-\hline
-{\bf Detrend} & {\bf Stage} & {\bf Section} \\
-\hline
-  Burntool repair          & registration & \ref{sec:burntool} \\
-  Non-linearity correction & cell         & \ref{sec:nonlinearity} \\
-  Overscan Subtraction     & cell         & \ref{sec:overscan} \\
-  Dark \& Bias Subtraction & cell         & \ref{sec:dark} \\
-  Pattern Row correction   & cell         & \ref{sec:pattern.row} \\
-  Noisemap                 & cell         & \ref{sec:noisemap} \\
-  Flat-field Correction    & chip         & \ref{sec:flat} \\
-  Fringe Correction$^1$    & chip         & \ref{sec:fringe} \\
-  Pattern Continuity       & chip         & \ref{sec:pattern_continuity} \\
-  Static Masks             & chip         & \ref{sec:static_masks} \\
-  Crosstalk masks          & camera       & \ref{sec:crosstalk} \\
-  Optical ghost masks      & camera       & \ref{sec:optical_ghosts} \\
-  Optical glint masks      & camera       & \ref{sec:glints} \\
-  Diffraction spike masks  & camera       & \ref{sec:diffraction_spikes} \\
-  Saturated star masks     & camera       & \ref{sec:diffraction_spikes} \\
-\hline
-\multicolumn{3}{l}{$^1$ only \yps} \\
-\end{tabular}
-\end{center}
-\end{table*}
-
 Section \ref{sec:detrending} provides an overview of the detrending
 process that corrects the instrumental signatures of GPC1, with
@@ -346,16 +331,4 @@
 remaining issues and possible future improvements is presented in
 section \ref{sec:discussion}.
-
-\begin{figure*}[htpb]
-  \centering
-  \begin{minipage}{0.45\hsize}
-    \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o5677g0123o_M_OS_NL_XY23\plotopt.png}
-  \end{minipage}%
-  \begin{minipage}{0.45\hsize}
-    \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o5677g0123o_to_DARK_XY23\plotopt.png}
-  \end{minipage}
-  \caption{{\bf Dark Correction:} An example of the dark model application to exposure o5677g0123o, OTA23 (2011-04-26, 43s \gps{} filter).  The left panel shows the image data mosaicked to the OTA level, and has had the static mask applied, the overscan subtracted, and the detector non-linearity corrected.  The right panel, shows the same exposure with the dark applied in addition to the processing shown on the left, removing the amplifier glows in the cell corners.}
-  \label{fig:dark image}
-\end{figure*}
 
 As mentioned above, the GPC1 camera is composed of 60 orthogonal
@@ -403,4 +376,33 @@
 the detector surface.
 
+\begin{table}
+\caption{\label{tab:detrend.steps} Detrend steps in order of application} \vspace{-0.5cm}
+\begin{center}
+\begin{tabular}{lll}
+\hline
+\hline
+{\bf Detrend} & {\bf Stage} & {\bf Section} \\
+\hline
+  Burntool repair          & registration & \ref{sec:burntool} \\
+  Non-linearity correction & cell         & \ref{sec:nonlinearity} \\
+  Overscan Subtraction     & cell         & \ref{sec:overscan} \\
+  Dark \& Bias Subtraction & cell         & \ref{sec:dark} \\
+  Pattern Row correction   & cell         & \ref{sec:pattern.row} \\
+  Noisemap                 & cell         & \ref{sec:noisemap} \\
+  Flat-field Correction    & chip         & \ref{sec:flat} \\
+  Fringe Correction$^1$    & chip         & \ref{sec:fringe} \\
+  Pattern Continuity       & chip         & \ref{sec:pattern_continuity} \\
+  Static Masks             & chip         & \ref{sec:static_masks} \\
+  Crosstalk masks          & camera       & \ref{sec:dynamic_masks} \\
+  Optical ghost masks      & camera       & \ref{sec:dynamic_masks} \\
+  Optical glint masks      & camera       & \ref{sec:dynamic_masks} \\
+  Diffraction spike masks  & camera       & \ref{sec:dynamic_masks} \\
+  Saturated star masks     & camera       & \ref{sec:dynamic_masks} \\
+\hline
+\multicolumn{3}{l}{$^1$ Only \yps\ for GPC1} \\
+\end{tabular}
+\end{center} \vspace{-0.25cm}
+\end{table}
+
 These corrections assume that the detector response is linear across
 the full dynamic range and that the pixels contain only signals coming
@@ -455,4 +457,16 @@
 \label{sec:dark}
 
+\begin{figure*}[htpb]
+  \centering
+  \begin{minipage}{0.45\hsize}
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o5677g0123o_M_OS_NL_XY23\plotopt.png}
+  \end{minipage}%
+  \begin{minipage}{0.45\hsize}
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o5677g0123o_to_DARK_XY23\plotopt.png}
+  \end{minipage}
+  \caption{{\bf Dark Correction:} An example of the dark model application to exposure o5677g0123o, OTA23 (2011-04-26, 43s \gps{} filter).  The left panel shows the image data mosaicked to the OTA level, and has had the static mask applied, the overscan subtracted, and the detector non-linearity corrected.  The right panel, shows the same exposure with the dark applied in addition to the processing shown on the left, removing the amplifier glows in the cell corners.}
+  \label{fig:dark image}
+\end{figure*}
+
 The dark current in the GPC1 detectors has significant variations
 across each cell.  The model we make to remove this signal considers
@@ -476,9 +490,7 @@
 Figure \ref{fig:dark image} shows the results of the dark subtraction.
 
-\subsubsection{Time evolution}
-
 \begin{figure}[htpb]
   \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/B_profile_v1.pdf}
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/B_profile_v1\plotopt.pdf}
   \caption{Example showing a profile cut across exposure o5676g0195,
     OTA67 (2011-04-25, 43s \gps{} filter).  The entire first row of
@@ -503,4 +515,6 @@
 \end{figure}
 
+\subsubsection{Time evolution}
+
 The dark model is not consistently stable over the full survey, with
 significant drift over the course of multiple months.  Some of the
@@ -536,4 +550,16 @@
 gradient in the dark corrected data.  
 
+\begin{figure*}[htpb]
+  \centering
+  \begin{minipage}{0.45\hsize}
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o5677g0123o_VIDEODARK_VDim_Rdark_XY22\plotopt.png}
+  \end{minipage}%
+  \begin{minipage}{0.45\hsize}
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o5677g0123o_VIDEODARK_VDim_VDdark_XY22\plotopt.png}
+  \end{minipage}
+  \caption{{\bf Video Dark:} An example of the video dark model application to exposure o5677g0123o, OTA22 (2011-04-26, 43s \gps{} filter), which has a video cell located in cell xy16.  The left panel shows the image data mosaicked to the OTA level, and has had the static mask applied, the overscan subtracted, the detector non-linearity corrected, and a regular dark applied.  The right panel, shows the same exposure with a video dark applied instead of the standard dark.  The main impact of this change is the improved correction of the corner glows, which are over subtracted with the standard dark.}
+  \label{fig:video_darks}
+\end{figure*}
+
 The bias drift gradients of the mode switching can be visualized in
 Figure \ref{fig:dark switching}.  This figure shows the image profile
@@ -558,11 +584,17 @@
   \centering
   \begin{minipage}{0.45\hsize}
-    \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o5677g0123o_VIDEODARK_VDim_Rdark_XY22\plotopt.png}
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o5220g0025o_nofringe_XY53\plotopt.png}
   \end{minipage}%
   \begin{minipage}{0.45\hsize}
-    \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o5677g0123o_VIDEODARK_VDim_VDdark_XY22\plotopt.png}
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o5220g0025o_fringe_XY53\plotopt.png}
   \end{minipage}
-  \caption{{\bf Video Dark:} An example of the video dark model application to exposure o5677g0123o, OTA22 (2011-04-26, 43s \gps{} filter), which has a video cell located in cell xy16.  The left panel shows the image data mosaicked to the OTA level, and has had the static mask applied, the overscan subtracted, the detector non-linearity corrected, and a regular dark applied.  The right panel, shows the same exposure with a video dark applied instead of the standard dark.  The main impact of this change is the improved correction of the corner glows, which are over subtracted with the standard dark.}
-  \label{fig:video_darks}
+  \caption{{\bf Fringing:} Example of the \yps{} filter fringe pattern
+    on exposure o5220g0025o OTA53 (\yps{} filter 30s).  The left panel
+    shows the OTA mosaic with all detrending except the fringe
+    correction, while the right shows the same including the fringe
+    correction.  Both images have been smoothed with a Gaussian with
+    $\sigma = 3$ pixels to highlight the faint and large scale fringe
+    patterns.  }
+  \label{fig: fringe example}
 \end{figure*}
 
@@ -641,22 +673,4 @@
 from random Gaussian noise, we estimated the true read noise level.
 
-\begin{figure*}[htpb]
-  \centering
-  \begin{minipage}{0.45\hsize}
-    \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o5220g0025o_nofringe_XY53\plotopt.png}
-  \end{minipage}%
-  \begin{minipage}{0.45\hsize}
-    \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o5220g0025o_fringe_XY53\plotopt.png}
-  \end{minipage}
-  \caption{{\bf Fringing:} Example of the \yps{} filter fringe pattern
-    on exposure o5220g0025o OTA53 (\yps{} filter 30s).  The left panel
-    shows the OTA mosaic with all detrending except the fringe
-    correction, while the right shows the same including the fringe
-    correction.  Both images have been smoothed with a Gaussian with
-    $\sigma = 3$ pixels to highlight the faint and large scale fringe
-    patterns.  }
-  \label{fig: fringe example}
-\end{figure*}
-
 As the noisemap uses bias frames that have had a dark model
 subtracted, we constructed noisemaps for each dark model used for
@@ -677,70 +691,12 @@
 value.
 
-\subsection{Flat}
-\label{sec:flat}
-
-Determining a flat field correction for GPC1 is a challenging
-endeavor, as the wide field of view makes it difficult to construct a
-uniformly illuminated image.  Using a dome screen is not possible, as
-the variations in illumination and screen rigidity create large
-scatter between different images that are not caused by the detector
-response function.  Because of this, we use sky flat images taken at
-twilight, which are more consistently illuminated than screen flats.
-We calculate the mean of these images to determine the initial flat
-model.
-
-From this starting skyflat model, we construct a photometric
-correction to remove the effect of the illumination differences over
-the detector surface.  This is done by dithering a series of science
-exposures with a given pointing, as described in
-\citet{2004PASP..116..449M}.  By fully calibrating these exposures
-with the initial flat model, and then comparing the measured fluxes
-for the same star as a function of position on the detector, we can
-determine position dependent scaling factors.  From the set of scaling
-factors for the full catalog of stars observed in the dithered
-sequence, we can construct a model of the error in the initial flat
-model as a function of detector position.  Applying a correction that
-reduces the amplitude of these errors produces a flat field model that
-better represents the true detector response.
-
-In addition to this flat field applied to the individual images, the
-``ubercal'' analysis -- in which photometric data are used define
-image zero points
-\citep[][]{2012ApJ...756..158S,magnier2017.calibration} and in turn
-used used to calibrate the database of all detections -- constructs
-``in catalog'' flat field corrections.  Although a single set of image
-flat fields was used for the PV3 processing of the entire $3\pi$
-survey, five separate ``seasons'' of database flat fields were needed
-to ensure proper calibration.  This indicates that the flat field
-response is not completely fixed in time.  More details on this
-process are contained in Paper V.
-
-\subsection{Fringe correction}
-\label{sec:fringe}
-% det_id 296 is the fringe we use.
-
-Due to variations in the thickness of the detectors, we observe
-interference patterns at the infrared end of the filter set, as the
-wavelength of the light becomes comparable to the thickness of the
-detectors.  Visually inspecting the images shows that the fringing is
-most prevalent in the \yps{} filter images, with negligible fringing in the
-other bands.  As a result of this, we only apply a fringe correction
-to the \yps{} filter data.
-
-The fringe used for PV3 processing was constructed from a set of 20
-120s science exposures.  These exposures are overscan subtracted, and
-corrected for non-linearity, and have the dark and flat models
-applied.  These images are smoothed with a Gaussian kernel with
-$\sigma = 2$ pixels to minimize pixel to pixel noise.  The fringe
-image data is then constructed by calculating the clipped mean of the
-input images with two iteration of clipping at the $3\sigma$ level.
-
-\begin{deluxetable*}{ccl}[htp]
-  \tablecolumns{3}
-  \tablewidth{0pc}
-  \tablecaption{GPC1 Mask Values}
-  \tablehead{\colhead{Mask Name} & \colhead{Mask Value} &
-    \colhead{Description (static values listed in bold)}}
-  \startdata
+\begin{table*}
+\caption{\label{tab:mask_values} GPC1 Mask Values} \vspace{-0.5cm}
+\begin{center}
+\begin{tabular}{lll}
+\hline
+\hline
+{\bf Mask Name} & {\bf Mask Value} & {\bf Description (static values listed in bold)} \\
+\hline
   {\bf DETECTOR } & {\bf 0x0001}  & {\bf A detector defect is present.} \\
   {\bf FLAT     } & {\bf 0x0002}  & {\bf The flat field model does not calibrate the pixel reliably.} \\
@@ -760,7 +716,95 @@
   CONV.POOR& 0x4000 & The pixel is poor after convolution with a bad pixel. \\
   MARK     & 0x8000 & An internal flag for temporarily marking a pixel. \\
-  \enddata
-  \label{tab:mask_values}
-\end{deluxetable*}
+\hline
+\end{tabular}
+\end{center} \vspace{-0.25cm}
+\end{table*}
+
+%% \begin{deluxetable*}{ccl}[htp]
+%%   \tablecolumns{3}
+%%   \tablewidth{0pc}
+%%   \tablecaption{GPC1 Mask Values}
+%%   \tablehead{\colhead{Mask Name} & \colhead{Mask Value} &
+%%     \colhead{Description (static values listed in bold)}}
+%%   \startdata
+%%   {\bf DETECTOR } & {\bf 0x0001}  & {\bf A detector defect is present.} \\
+%%   {\bf FLAT     } & {\bf 0x0002}  & {\bf The flat field model does not calibrate the pixel reliably.} \\
+%%   {\bf DARK     } & {\bf 0x0004}  & {\bf The dark model does not calibrate the pixel reliably.} \\
+%%   {\bf BLANK    } & {\bf 0x0008}  & {\bf The pixel does not contain valid data.} \\
+%%   {\bf CTE      } & {\bf 0x0010}  & {\bf The pixel has poor charge transfer efficiency.} \\
+%%   SAT      & 0x0020 & The pixel is saturated. \\
+%%   LOW      & 0x0040 & The pixel has a lower value than expected. \\
+%%   SUSPECT  & 0x0080 & The pixel is suspected of being bad (overloaded with the BURNTOOL bit). \\
+%%   BURNTOOL & 0x0080 & The pixel contain an burntool repaired streak. \\
+%%   CR       & 0x0100 & A cosmic ray is present. \\
+%%   SPIKE    & 0x0200 & A diffraction spike is present. \\
+%%   GHOST    & 0x0400 & An optical ghost is present. \\
+%%   STREAK   & 0x0800 & A streak is present. \\
+%%   STARCORE & 0x1000 & A bright star core is present. \\
+%%   CONV.BAD & 0x2000 & The pixel is bad after convolution with a bad pixel. \\
+%%   CONV.POOR& 0x4000 & The pixel is poor after convolution with a bad pixel. \\
+%%   MARK     & 0x8000 & An internal flag for temporarily marking a pixel. \\
+%%   \enddata
+%%   \label{tab:mask_values}
+%% \end{deluxetable*}
+
+\subsection{Flat}
+\label{sec:flat}
+
+Determining a flat field correction for GPC1 is a challenging
+endeavor, as the wide field of view makes it difficult to construct a
+uniformly illuminated image.  Using a dome screen is not possible, as
+the variations in illumination and screen rigidity create large
+scatter between different images that are not caused by the detector
+response function.  Because of this, we use sky flat images taken at
+twilight, which are more consistently illuminated than screen flats.
+We calculate the mean of these images to determine the initial flat
+model.
+
+From this starting skyflat model, we construct a photometric
+correction to remove the effect of the illumination differences over
+the detector surface.  This is done by dithering a series of science
+exposures with a given pointing, as described in
+\citet{2004PASP..116..449M}.  By fully calibrating these exposures
+with the initial flat model, and then comparing the measured fluxes
+for the same star as a function of position on the detector, we can
+determine position dependent scaling factors.  From the set of scaling
+factors for the full catalog of stars observed in the dithered
+sequence, we can construct a model of the error in the initial flat
+model as a function of detector position.  Applying a correction that
+reduces the amplitude of these errors produces a flat field model that
+better represents the true detector response.
+
+In addition to this flat field applied to the individual images, the
+``ubercal'' analysis -- in which photometric data are used define
+image zero points
+\citep[][]{2012ApJ...756..158S,magnier2017.calibration} and in turn
+used used to calibrate the database of all detections -- constructs
+``in catalog'' flat field corrections.  Although a single set of image
+flat fields was used for the PV3 processing of the entire $3\pi$
+survey, five separate ``seasons'' of database flat fields were needed
+to ensure proper calibration.  This indicates that the flat field
+response is not completely fixed in time.  More details on this
+process are contained in Paper V.
+
+\subsection{Fringe correction}
+\label{sec:fringe}
+% det_id 296 is the fringe we use.
+
+Due to variations in the thickness of the detectors, we observe
+interference patterns at the infrared end of the filter set, as the
+wavelength of the light becomes comparable to the thickness of the
+detectors.  Visually inspecting the images shows that the fringing is
+most prevalent in the \yps{} filter images, with negligible fringing in the
+other bands.  As a result of this, we only apply a fringe correction
+to the \yps{} filter data.
+
+The fringe used for PV3 processing was constructed from a set of 20
+120s science exposures.  These exposures are overscan subtracted, and
+corrected for non-linearity, and have the dark and flat models
+applied.  These images are smoothed with a Gaussian kernel with
+$\sigma = 2$ pixels to minimize pixel to pixel noise.  The fringe
+image data is then constructed by calculating the clipped mean of the
+input images with two iteration of clipping at the $3\sigma$ level.
 
 A coarse background model for each cell is constructed by calculating
@@ -793,4 +837,11 @@
 calculated based on objects in the field, and so changes between
 images.  Construction of the static mask consists of three phases.
+
+\begin{figure}[b]
+  \centering
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/gpc1_mask_indexed.png}
+  \caption{Image map of the GPC1 static mask.  The CTE regions are clearly visible as roughly triangular patches covering the corners of some OTAs.  Some entire cells are masked, including an entire column of cells on OTA14.  Calcite cells remove large areas from OTA17 AND OTA76.}
+  \label{fig:static mask}
+\end{figure}
 
 First, regions in which the charge transfer efficiency (CTE) is low
@@ -813,4 +864,47 @@
 level are added to the static mask.
 
+\begin{table}[tpb]
+\caption{\label{tab:crosstalk_rules} GPC1 Crosstalk Rules} \vspace{-0.5cm}
+\begin{center}
+\begin{tabular}{lllc}
+\hline
+\hline
+{\bf Type} & {\bf Source OTA/Cell} & {\bf Ghost OTA/Cell} & {\bf $\Delta m$} \\
+\hline
+  Inter-OTA & OTA2Y XY3v & OTA3Y XY3v & 6.16 \\
+            & OTA3Y XY3v & OTA2Y XY3v &      \\
+            & OTA4Y XY3v & OTA5Y XY3v &      \\
+            & OTA5Y XY3v & OTA4Y XY3v &      \\
+  Intra-OTA & OTA2Y XY5v & OTA2Y XY6v & 7.07 \\
+            & OTA2Y XY6v & OTA2Y XY5v &      \\
+            & OTA5Y XY5v & OTA5Y XY6v &      \\
+            & OTA5Y XY6v & OTA5Y XY5v &      \\
+  One-way   & OTA2Y XY7v & OTA3Y XY2v & 7.34 \\
+            & OTA5Y XY7v & OTA4Y XY2v &      \\
+\hline
+\end{tabular}
+\end{center} \vspace{-0.25cm}
+\end{table}
+
+%% \begin{deluxetable}{lllc}[htpb]
+%%   \tablecolumns{4}
+%%   \tablewidth{0pc}
+%%   \tablecaption{GPC1 Crosstalk Rules}
+%%   \tablehead{\colhead{Type}&\colhead{Source OTA/Cell}&\colhead{Ghost OTA/Cell}&\colhead{$\Delta m$}}
+%%   \startdata
+%%   Inter-OTA & OTA2Y XY3v & OTA3Y XY3v & 6.16 \\
+%%             & OTA3Y XY3v & OTA2Y XY3v &      \\
+%%             & OTA4Y XY3v & OTA5Y XY3v &      \\
+%%             & OTA5Y XY3v & OTA4Y XY3v &      \\
+%%   Intra-OTA & OTA2Y XY5v & OTA2Y XY6v & 7.07 \\
+%%             & OTA2Y XY6v & OTA2Y XY5v &      \\
+%%             & OTA5Y XY5v & OTA5Y XY6v &      \\
+%%             & OTA5Y XY6v & OTA5Y XY5v &      \\
+%%   One-way   & OTA2Y XY7v & OTA3Y XY2v & 7.34 \\
+%%             & OTA5Y XY7v & OTA4Y XY2v &      \\
+%%   \enddata
+%%   \label{tab:crosstalk_rules}
+%% \end{deluxetable}
+
 The next step of mask construction is to examine the flat and dark
 models, and exclude pixels that appear to be poorly corrected by these
@@ -826,31 +920,4 @@
 the rest of image are assigned the FLAT mask bit in the static mask,
 removing the pixels that cannot be corrected to a linear response.
-
-\begin{figure}[b]
-  \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/gpc1_mask_indexed.png}
-  \caption{Image map of the GPC1 static mask.  The CTE regions are clearly visible as roughly triangular patches covering the corners of some OTAs.  Some entire cells are masked, including an entire column of cells on OTA14.  Calcite cells remove large areas from OTA17 AND OTA76.}
-  \label{fig:static mask}
-\end{figure}
-
-\begin{deluxetable}{lllc}[htpb]
-  \tablecolumns{4}
-  \tablewidth{0pc}
-  \tablecaption{GPC1 Crosstalk Rules}
-  \tablehead{\colhead{Type}&\colhead{Source OTA/Cell}&\colhead{Ghost OTA/Cell}&\colhead{$\Delta m$}}
-  \startdata
-  Inter-OTA & OTA2Y XY3v & OTA3Y XY3v & 6.16 \\
-            & OTA3Y XY3v & OTA2Y XY3v &      \\
-            & OTA4Y XY3v & OTA5Y XY3v &      \\
-            & OTA5Y XY3v & OTA4Y XY3v &      \\
-  Intra-OTA & OTA2Y XY5v & OTA2Y XY6v & 7.07 \\
-            & OTA2Y XY6v & OTA2Y XY5v &      \\
-            & OTA5Y XY5v & OTA5Y XY6v &      \\
-            & OTA5Y XY6v & OTA5Y XY5v &      \\
-  One-way   & OTA2Y XY7v & OTA3Y XY2v & 7.34 \\
-            & OTA5Y XY7v & OTA4Y XY2v &      \\
-  \enddata
-  \label{tab:crosstalk_rules}
-\end{deluxetable}
 
 % http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/StaticMasks20101215
@@ -886,4 +953,27 @@
 difference image construction, as they are more likely to have small
 deviations due to imperfections in the burntool correction.
+
+\begin{table}[tpb]
+\caption{\label{tab:ghost_centers} Optical Ghost Center Transformations} \vspace{-0.5cm}
+\begin{center}
+\begin{tabular}{lrr}
+\hline
+\hline
+{\bf Polynomial Term} & {\bf $L$ center} & {\bf $M$ center} \\
+\hline
+  $x^0 y^0$ & -1.215661e+02 &  2.422174e+01 \\
+  $x^1 y^0$ &  1.321875e-02 &  4.170486e-04 \\
+  $x^2 y^0$ & -4.017026e-09 & -1.934260e-08 \\
+  $x^3 y^0$ &  1.148288e-10 & -1.173657e-12 \\
+  $x^0 y^1$ & -1.908074e-03 &  1.189352e-02 \\
+  $x^1 y^1$ &  8.479150e-08 & -9.256748e-08 \\
+  $x^2 y^1$ &  1.635732e-11 &  1.140772e-10 \\
+  $x^0 y^2$ &  2.625405e-08 &  8.123932e-08 \\
+  $x^1 y^2$ &  1.125586e-10 &  1.328378e-11 \\
+  $x^0 y^3$ &  2.912432e-12 &  1.170865e-10 \\
+\hline
+\end{tabular}
+\end{center} \vspace{-0.25cm}
+\end{table}
 
 The remaining dynamic masks are generated in the IPP \IPPstage{camera}
@@ -926,4 +1016,20 @@
 electronic path for the crosstalk.
 
+\begin{figure*}[htpb]
+  \centering
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/GPC1_Ghosts_with_Zoom\plotopt.pdf}
+  \caption{{\bf Ghosts:} Example of optical ghosts in GPC1.  The
+    central $6 \times 6$ detectors from exposure o5677g0123o
+    (2011-04-26, 43s \gps{} filter) are shown.  The dashed red lines
+    link three example sets of stellar sources and the destinations of
+    the corresponding ghosts.  The insets zoom in on these ghosts and
+    highlight the increasingly distorted images away from the optical
+    axis.  The bright star on OTA33 results in a nearly circular ghost
+    on the opposite OTA.  In contrast, the trio of stars on OTA11
+    result in very elongated ghosts on OTA66, in the upper left
+    corner.}
+  \label{fig:optical ghosts}
+\end{figure*}
+
 For the very brightest sources ($m_{inst} < -15$), there can be
 crosstalk ghosts between all columns of cells during the readout.
@@ -935,24 +1041,4 @@
 magnitude, with $W = 5 \times \left(-15 - m_{inst,source}\right)$
 pixels.
-
-\begin{deluxetable}{lcc}[htpb]
-  \tablecolumns{3}
-  \tablewidth{0pc}
-  \tablecaption{Optical Ghost Center Transformations}
-  \tablehead{\colhead{Polynomial Term}&\colhead{$L$ center}&\colhead{$M$ center}}
-  \startdata 
-  $x^0 y^0$ & -1.215661e+02 &  2.422174e+01 \\
-  $x^1 y^0$ &  1.321875e-02 &  4.170486e-04 \\
-  $x^2 y^0$ & -4.017026e-09 & -1.934260e-08 \\
-  $x^3 y^0$ &  1.148288e-10 & -1.173657e-12 \\
-  $x^0 y^1$ & -1.908074e-03 &  1.189352e-02 \\
-  $x^1 y^1$ &  8.479150e-08 & -9.256748e-08 \\
-  $x^2 y^1$ &  1.635732e-11 &  1.140772e-10 \\
-  $x^0 y^2$ &  2.625405e-08 &  8.123932e-08 \\
-  $x^1 y^2$ &  1.125586e-10 &  1.328378e-11 \\
-  $x^0 y^3$ &  2.912432e-12 &  1.170865e-10 \\
-  \enddata
-  \label{tab:ghost_centers}
-\end{deluxetable}
 
 \paragraph{Optical ghosts}
@@ -972,16 +1058,31 @@
 several prominent optical ghosts.
 
-\begin{deluxetable*}{lcccc}[htpb]
-  \tablecolumns{5}
-  \tablewidth{0pc}
-  \tablecaption{Optical Ghost Annulus Axis Length}
-  \tablehead{\colhead{Radial Order}&\colhead{Inner Major Axis}&\colhead{Inner Minor Axis}&\colhead{Outer Major Axis}&\colhead{Outer Minor Axis}}
-  % \tablehead{\colhead{Order}&\colhead{Maj$_{\rm in}$}&\colhead{Min$_{\rm in}$}&    \colhead{Maj$_{\rm out}$}&\colhead{Min$_{\rm out}$}}
-  \startdata
+\begin{table*}[tphb]
+\caption{\label{tab:ghost_radii} Optical Ghost Annulus Axis Length} \vspace{-0.5cm}
+\begin{center}
+\begin{tabular}{lcccc}
+\hline
+\hline
+{\bf Radial Order} & {\bf Inner Major Axis} & {\bf Inner Minor Axis} & {\bf Outer Major Axis} & {\bf Outer Minor Axis} \\
+\hline
   $r^0$ & 3.926693e+01 & 5.287548e+01 & 7.928722e+01 & 1.314265e+02 \\
   $r^1$ & 5.325759e-03 &-2.191669e-03 & 1.722181e-02 & -2.627153e-03 \\
-  \enddata
-  \label{tab:ghost_radii}
-\end{deluxetable*}
+\hline
+\end{tabular}
+\end{center} \vspace{-0.25cm}
+\end{table*}
+
+%% \begin{deluxetable*}{lcccc}[htpb]
+%%   \tablecolumns{5}
+%%   \tablewidth{0pc}
+%%   \tablecaption{Optical Ghost Annulus Axis Length}
+%%   \tablehead{\colhead{Radial Order}&\colhead{Inner Major Axis}&\colhead{Inner Minor Axis}&\colhead{Outer Major Axis}&\colhead{Outer Minor Axis}}
+%%   % \tablehead{\colhead{Order}&\colhead{Maj$_{\rm in}$}&\colhead{Min$_{\rm in}$}&    \colhead{Maj$_{\rm out}$}&\colhead{Min$_{\rm out}$}}
+%%   \startdata
+%%   $r^0$ & 3.926693e+01 & 5.287548e+01 & 7.928722e+01 & 1.314265e+02 \\
+%%   $r^1$ & 5.325759e-03 &-2.191669e-03 & 1.722181e-02 & -2.627153e-03 \\
+%%   \enddata
+%%   \label{tab:ghost_radii}
+%% \end{deluxetable*}
 
 These optical ghosts can be modeled in the focal plane coordinates
@@ -992,30 +1093,11 @@
 in the focal plane $L$ and $M$ directions (as listed in Table
 \ref{tab:ghost_centers}).  An elliptical annulus mask is constructed
-at the expected ghost location, with the major and minor axes of the inner and outer elliptical annuli defined
-by linear functions of the ghost distance from the optical axis, and
-oriented with the ellipse major axis is along the radial direction
-(Table \ref{tab:ghost_radii}).  All stars brighter than a
-filter-dependent threshold (listed in Table
-\ref{tab:ghost_magnitudes}) have such masks constructed.
-
-%% \begin{table*}[htpb]
-%% \begin{center}
-%%   % \tablecolumns{5}
-%%   % \tablewidth{0pc}
-%%   % \tablecaption{Optical Ghost Annulus Axis Length}
-%%   \caption{Optical Ghost Annulus Axis Length\label{tab:ghost_radii}}
-%%   \begin{tabular}{lcccc}
-%%   % \tablehead{\colhead{Radial Order}&\colhead{Inner Major Axis}&\colhead{Inner Minor Axis}&\colhead{Outer Major Axis}&\colhead{Outer Minor Axis}}
-%%   % \startdata
-%%   \hline
-%%   \hline
-%%   {\bf Radial Order}&{\bf Inner Major Axis}&{\bf Inner Minor Axis}&{\bf Outer Major Axis}&{\bf Outer Minor Axis} \\
-%%   \hline
-%%   $r^0$ & 3.926693e+01 & 5.287548e+01 & 7.928722e+01 & 1.314265e+02 \\
-%%   $r^1$ & 5.325759e-03 &-2.191669e-03 & 1.722181e-02 & -2.627153e-03 \\
-%%   \hline
-%%   \end{tabular}
-%% \end{center}
-%% \end{table*}
+at the expected ghost location, with the major and minor axes of the
+inner and outer elliptical annuli defined by linear functions of the
+ghost distance from the optical axis, and oriented with the ellipse
+major axis is along the radial direction (Table
+\ref{tab:ghost_radii}).  All stars brighter than a filter-dependent
+threshold (listed in Table \ref{tab:ghost_magnitudes}) have such masks
+constructed.
 
 \paragraph{Optical glints}
@@ -1073,22 +1155,5 @@
 \begin{figure*}[htpb]
   \centering
-% \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/GPC1_Ghosts_with_Zoom.png}
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/GPC1_Ghosts_with_Zoom.pdf}
-  \caption{{\bf Ghosts:} Example of optical ghosts in GPC1.  The
-    central $6 \times 6$ detectors from exposure o5677g0123o
-    (2011-04-26, 43s \gps{} filter) are shown.  The dashed red lines
-    link three example sets of stellar sources and the destinations of
-    the corresponding ghosts.  The insets zoom in on these ghosts and
-    highlight the increasingly distorted images away from the optical
-    axis.  The bright star on OTA33 results in a nearly circular ghost
-    on the opposite OTA.  In contrast, the trio of stars on OTA11
-    result in very elongated ghosts on OTA66, in the upper left
-    corner.}
-  \label{fig:optical ghosts}
-\end{figure*}
-
-\begin{figure*}[htpb]
-  \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/full_fpa_glints\plotopt.png}
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/full_fpa_glints\plotopt.png}
   \caption{{\bf Glints:}  Example of a glint on exposure o5379g0103o (2010-07-02, 45s \ips{} filter).  The source star out of the field of view creates a long reflection that extends through OTA73 and OTA63.}
   \label{fig:optical glints}
@@ -1097,8 +1162,44 @@
 \begin{figure}[htpb]
   \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o6802g0338o_SATSTAR_XY51\plotopt.png}
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o6802g0338o_SATSTAR_XY51\plotopt.png}
   \caption{Example of saturated star, with diffraction spikes extending from the core on exposure o6802g0338o, OTA51 (2014-05-25, 45s \gps{} filter).}
   \label{fig:saturated star}
 \end{figure}
+
+\begin{table}[pb]
+\caption{\label{tab:ghost_magnitudes} Optical Ghost Magnitude Limits} \vspace{-0.5cm}
+\begin{center}
+\begin{tabular}{lrr}
+\hline
+\hline
+{\bf Filter} & {\bf $m_{inst}$} & {\bf Apparent mag} \\
+& & {\bf ($3\pi$)} \\
+\hline
+  \gps{} & -16.5 & 12.2 \\
+  \rps{} & -20.0 &  8.9 \\
+  \ips{} & -25.0 &  3.7 \\
+  \zps{} & -25.0 &  3.4 \\
+  \yps{} & -25.0 &  2.5 \\
+  \wps{} & -20.0 & 10.2 \\
+\hline
+\end{tabular}
+\end{center} \vspace{-0.25cm}
+\end{table}
+
+%% \begin{deluxetable}{lrr}[b]
+%%   \tablecolumns{3}
+%%   \tablewidth{0pc}
+%%   \tablecaption{Optical Ghost Magnitude Limits}
+%%   \tablehead{\colhead{Filter} & \colhead{$m_{inst}$} & \colhead{Apparent mag ($3\pi$)}}
+%%   \startdata
+%%   \gps{} & -16.5 & 12.2 \\
+%%   \rps{} & -20.0 &  8.9 \\
+%%   \ips{} & -25.0 &  3.7 \\
+%%   \zps{} & -25.0 &  3.4 \\
+%%   \yps{} & -25.0 &  2.5 \\
+%%   \wps{} & -20.0 & 10.2 \\
+%%   \enddata
+%%   \label{tab:ghost_magnitudes}
+%% \end{deluxetable}
 
 \subsubsection{Masking Fraction}
@@ -1156,21 +1257,4 @@
 %% Other = CR, SPIKE, GHOST, STARCORE [Ghost & Spike probably dominate]
 
-\begin{deluxetable}{lrr}[b]
-  \tablecolumns{3}
-  \tablewidth{0pc}
-  \tablecaption{Optical Ghost Magnitude Limits}
-% \tablehead{\colhead{Filter} & \colhead{$m_{inst}$} & \colhead{\parbox{2cm}{Apparent mag ($3\pi$)}}}
-  \tablehead{\colhead{Filter} & \colhead{$m_{inst}$} & \colhead{Apparent mag ($3\pi$)}}
-  \startdata
-  \gps{} & -16.5 & 12.2 \\
-  \rps{} & -20.0 &  8.9 \\
-  \ips{} & -25.0 &  3.7 \\
-  \zps{} & -25.0 &  3.4 \\
-  \yps{} & -25.0 &  2.5 \\
-  \wps{} & -20.0 & 10.2 \\
-  \enddata
-  \label{tab:ghost_magnitudes}
-\end{deluxetable}
-
 During the \IPPstage{camera} processing, a separate estimate of the
 mask fraction for a given exposure is calculated by counting the
@@ -1186,4 +1270,386 @@
 The significant advisory value is a result of applying such masks to
 all burntool corrected pixels.
+
+\begin{table}[htpb]
+\caption{\label{tab:mask fraction} Mask Fraction by Mask Source} \vspace{-0.5cm}
+\begin{center}
+\begin{tabular}{lcc}
+\hline
+\hline
+ & \multicolumn{2}{c}{\bf Field of View} \\
+{\bf Mask Source} & {\bf 3\degree} & {\bf 3.25\degree} \\
+\hline
+  Good pixel              & 78.9\% & 71.1\% \\
+  Unpopulated             & 13.1\% & 19.6\% \\
+  CTE issue               &  2.3\% &  2.6\% \\
+  Other issue             &  5.4\% &  6.4\% \\
+  Static advisory         &  0.3\% &  0.3\% \\
+\hline
+\end{tabular}
+\end{center} \vspace{-0.25cm}
+\end{table}
+
+%% \begin{deluxetable}{lcc}[htpb]
+%%   \tablecolumns{3}
+%%   \tablewidth{0pc}
+%%   \tablecaption{Mask Fraction by Mask Source}
+%%   \tablehead{
+%%     &\multicolumn{2}{c}{Field of View} \\
+%%     \colhead{Mask Source}&\colhead{3\degree}&\colhead{3.25\degree}}
+%%   \startdata
+%%   Good pixel              & 78.9\% & 71.1\% \\
+%%   Unpopulated             & 13.1\% & 19.6\% \\
+%%   CTE issue               &  2.3\% &  2.6\% \\
+%%   Other issue             &  5.4\% &  6.4\% \\
+%%   Static advisory         &  0.3\% &  0.3\% \\
+%%   \enddata
+%%   \label{tab:mask fraction}
+%% \end{deluxetable}
+
+\subsection{Burntool / Persistence effect}
+\label{sec:burntool}
+
+Pixels that approach the saturation point on GPC1 (see
+Section~\ref{sec:diffraction_spikes}) introduce ``persistent charge''
+on that and subsequent images.  During the read out process of a cell
+with such a bright pixel, some of the charge remains in the undepleted
+region of the silicon and is not shifted down the detector column
+toward the amplifier.  This charge remains in the starting pixel and
+slowly leaks out of the undepleted region, contaminating subsequent
+pixels during the read out process, resulting in a ``burn trail'' that
+extends from the center of the bright source away from the amplifier
+(vertically along the pixel columns toward the top of the cell).
+
+This incomplete charge shifting in nearly full wells continues as each
+row is read out.  This results in a remnant charge being deposited in
+the pixels that the full well was shifted through.  In following
+exposures, this remnant charge leaks out, resulting in a trail that
+extends from the initial location of the bright source on the previous
+image towards the amplifier (vertically down along the pixel column).
+This remnant charge can remain on the detector for up to thirty
+minutes.
+
+Both of these types of persistence trails are measured and optionally
+repaired via the \IPPprog{burntool} program.  This program does an
+initial scan of the image, and identifies objects with pixel values
+higher than a conservative threshold of 30000 DN.  The trail from the
+peak of that object is fit with a one-dimensional power law in each
+pixel column above the threshold, based on empirical evidence that
+this is the functional form of this persistence effect.  This fit also
+matches the expectation that a constant fraction of charge is
+incompletely transferred at each shift beyond the persistence
+threshold.  Once the fit is done, the model can be subtracted from
+the image.  The location of the source is stored in a table along
+with the exposure PONTIME, which denotes the number of seconds since
+the detector was last powered on and provides an internally
+consistent time scale.
+
+For subsequent exposures, the table associated with the previous image
+is read in, and after correcting trails from the stars on the new
+image, the positions of the bright stars from the table are used to
+check for remnant trails from previous exposures on the image.  These
+are fit and subtracted using a one-dimensional exponential model,
+again based on empirical studies.  The output table retains this
+remnant position for 2000 seconds after the initial PONTIME recorded.
+This allows fits to be attempted well beyond the nominal lifetime of
+these trails.  Figure \ref{fig:burntool images} shows an example of a
+cell with a persistence trail from a bright star, the post-correction
+result, as well as the pre and post correction versions of the same
+cell on the subsequent exposure.  The profiles along the detector
+columns for these two exposures are presented in Figure
+\ref{fig:burntool plot}.
+
+\begin{figure}[tpb]
+  \centering
+  %% need a small version of this for arxiv
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/persistent_charge\plotopt.png}
+  \caption{{\bf Persistent Charge:}  Example of OTA11 cell xy50 on exposures o5677g0123o (left) and o5677g0124o (right).  The top panels show the image with all appropriate detrending steps, but without burntool, and the bottom show the same with burntool applied.  There is some slight over subtraction in fitting the initial trail, but the impact of the trail is greatly reduced in both exposures.}
+  \label{fig:burntool images}
+\end{figure}
+
+Using this method of correcting the persistence trails has the
+challenge that it is based on fits to the raw image data, which may
+have other signal sources not determined by the persistence effect.
+The presence of other stars or artifacts in the detector column can
+result in a poor model to be fit, resulting in either an over- or
+under-subtraction of the trail.  For this reason, the image mask is
+marked with a value indicating that this correction has been applied.
+These pixels are not fully excluded, but they are marked as suspect,
+which allows them to be excluded from consideration in subsequent
+stages, such as image stacking.
+
+The cores of very bright stars can also be deformed by this process,
+as the burntool fitting subtracts flux from only one side of the star.
+As most stars that result in persistence trails already have saturated
+cores, they are already ignored for the purpose of PSF determination
+and are flagged as saturated by the photometry reduction.
+
+\begin{figure}[htpb]
+  \centering
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o5677g0123n4o_XY11_bt_trail.pdf}
+  \caption{{\bf Burntool Correction:} Example of a profile cut along
+    the y-axis through a bright star on exposure o5677g0123o OTA11 in
+    cell xy50 (left panel) and on the subsequent exposure o5677g0124o
+    (right panel).  In both figures, the blue pluses show the image
+    corrected with all appropriate detrending steps, but without
+    burntool applied, illustrating the amplitude of the persistence
+    trails.  The red circles show the same data after the burntool
+    correction, which reduces the impact of these features.  Both
+    exposures are in the \gps{} filter with exposure times of 43s}
+  \label{fig:burntool plot}
+\end{figure}
+
+\subsection{Non-linearity Correction}
+\label{sec:nonlinearity}
+
+The pixels of GPC1 are not uniformly linear at all flux levels.  In
+particular, at low flux levels, some pixels have a tendency to sag
+relative to the expected linear value.  This effect is most pronounced
+along the edges of the detector cells, although some entire cells show
+evidence of this effect.
+
+To correct this sag, we studied the behavior of a series of flat
+frames for a ramp of exposure times with approximate logarithmically
+equal spacing between 0.01s and 57.04s.  As the exposure time
+increases, the signal on each pixel also increases in what is expected
+to be a linear manner.  Each of the flat exposures in this ramp is
+overscan corrected, and then the median is calculated for each cell,
+as well as for the rows and columns within ten pixels of the edge of
+the science region.  From these median values at each exposure time
+value, we can construct the expected trend by fitting a linear model
+for the region considered.  This fitting was limited to only the range
+of fluxes between 12000 and 38000 counts, as these ranges were found
+to match the linear model well.  This range avoids the non-linearity
+at low fluxes, as well as the possibility of high-flux non-linearity
+effects.
+
+\begin{table}[tpb]
+\caption{\label{tab:pattern_row_cells} Cells which have \nocode{PATTERN.ROW} correction applied} \vspace{-0.5cm}
+\begin{center}
+\begin{tabular}{lcccc}
+\hline
+\hline
+{\bf OTA} & {\bf Cell columns} & {\bf Additional cells} \\
+\hline
+  OTA11 &  & xy02, xy03, xy04, xy07 \\
+  OTA14 &  & xy23 \\
+  OTA15 & 0 & \\
+  OTA27 & 0, 1, 2, 3, 7 & \\
+  OTA31 & 7 & \\
+  OTA32 & 3, 7 & \\
+  OTA45 & 3, 7 & \\
+  OTA47 & 0, 3, 5, 7 & \\
+  OTA57 & 0, 1, 2, 6, 7 & \\
+  OTA60 &  & xy55 \\
+  OTA74 & 2, 7 & \\
+\hline
+\end{tabular}
+\end{center} \vspace{-0.25cm}
+\end{table}
+
+%% \begin{deluxetable}{lcccc}[htpb]
+%%   \tablecolumns{3}
+%%   \tablewidth{0pc}
+%%   \tablecaption{Cells which have \nocode{PATTERN.ROW} correction applied}
+%%   \tablehead{\colhead{OTA} & \colhead{Cell columns} & \colhead{Additional cells}}
+%%   \startdata
+%%   OTA11 &  & xy02, xy03, xy04, xy07 \\
+%%   OTA14 &  & xy23 \\
+%%   OTA15 & 0 & \\
+%%   OTA27 & 0, 1, 2, 3, 7 & \\
+%%   OTA31 & 7 & \\
+%%   OTA32 & 3, 7 & \\
+%%   OTA45 & 3, 7 & \\
+%%   OTA47 & 0, 3, 5, 7 & \\
+%%   OTA57 & 0, 1, 2, 6, 7 & \\
+%%   OTA60 &  & xy55 \\
+%%   OTA74 & 2, 7 & \\
+%%   \enddata
+%%   \label{tab:pattern_row_cells}
+%% \end{deluxetable}
+
+We store the average flux measurement and deviation from the linear
+fit for each exposure time for each region on all detector cells in
+the linearity detrend look-up tables.  When this correction is
+applied to science data, these lookup tables are loaded, and a linear
+interpolation is performed to determine the correction needed for the
+flux in that pixel.  This look up is performed for both the row and
+column of each pixel, to allow the edge correction to be applied where
+applicable, and the full cell correction elsewhere.  The average of
+these two values is then applied to the pixel value, reducing the
+effects of pixel nonlinearity.
+
+This non-linearity effect appears to be stable in time for the
+majority of the detector pixels, with little evident change over the
+survey duration.  However, as the non-linearity is most pronounced at
+the edges of the detector cells, those are the regions where the
+correction is most likely to be incomplete.  Because of this fact,
+most pixels in the static mask with either the DARKMASK or FLATMASK
+bit set are found along these edges.  As the non-linearity correction
+is unable to reliably restore these pixels, they produce inconsistent
+values after the dark and flat have been applied, and are therefore
+rejected.
+
+\subsection{Pattern correction}
+\label{sec:pattern}
+
+\subsubsection{Pattern Row}
+\label{sec:pattern.row}
+%% Statistics so I have them written down somewhere
+%% chipProcessedImfile.bg/bg_stdev by filter for XY33 (a good chip)
+%% filter  bg_mean stdev median Qsig                              bg_stdev_mean stdev median Qsig
+%% g        36.37422026669   64.64175104057  32.693   6.10284     14.696938349131  78.80460307171  8.8401  0.5417843
+%% r       200.96143304525  471.87743546238 117.105  94.55608     33.854672792146  79.01642728089 13.4564  5.3771355
+%% i       447.00504994458  938.38517801037 286.810 154.71397     57.298335510188  99.38392923935 20.0217 24.2254723
+%% z       317.54933679054  390.38930252748 241.014 114.13316     48.359069000176  94.44452756094 17.9404  9.1535209
+%% y       371.09019536218  293.57439970375 288.481 133.38769     43.724342221691 135.04286534327 19.9029  7.5396461
+
+As discussed above in the dark and noisemap sections, certain
+detectors have significant bias offsets between adjacent rows, caused
+by drifts in the bias level due to cross talk.  The magnitude of these
+offsets increases as the distance from the readout amplifier and
+overscan region increases, resulting in horizontal streaks that are
+more pronounced along the large $x$ pixel edge of the cell.  As the
+level of the offset is apparently random between exposures, the dark
+correction cannot fully remove this structure from the images, and the
+noisemap value only indicates the level of the average variance added
+by these bias offsets.  Therefore, we apply the \ippmisc{PATTERN.ROW} correction
+in an attempt to mitigate the offsets and correct the image values.
+To force the rows to agree, a second order clipped polynomial is
+fitted to each row in the cell.  Four fit iterations are run and
+pixels $2.5\sigma$ deviant (chosen empirically) are excluded from
+subsequent fits in order to minimize the bias from stars and other
+astronomical sources in the pixels.  This final trend is then
+subtracted from that row.  Simply doing this subtraction will also
+have the effect of removing the background sky level.  To prevent
+this, the constant and linear terms for each row are stored, and
+linear fits are made to these parameters as a function of row,
+perpendicular to the initial fits.  This produces a plane that is
+added back to the image to restore the background offset and any
+linear ramp that exists in the sky.
+
+\begin{figure}[tpb]
+  \centering
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/pattern_row_edit.png}
+  \caption{Diagram illustrating in red which cells on GPC1 require the
+    \nocode{PATTERN.ROW} correction to be applied.  The footprint of
+    each OTA is outlined, and cell xy00 is marked with either a filled
+    box or an outline.  The labeling of the non-existent corner OTAs
+    is provided to orient the focal plane.}
+  \label{fig: pattern row cells}
+\end{figure}
+
+These row-by-row variations have the largest impact on data taken in
+the \gps{} filter, as the read noise is the dominant noise source in
+that filter.  At longer wavelengths, the noise from the Poissonian
+variation in the sky level increases.  The \ippmisc{PATTERN.ROW} correction is
+still applied to data taken in the other filters, as the increase in
+sky noise does not fully obscure the row-by-row noise.
+
+%% GPC1 tuning describe in email from Peter Onaka 2009.11.30,
+%% with notes in GPC1TuningTestLog.pdf
+
+This correction was required on all cells on all OTAs prior to
+2009-12-01, at which point a modification of the camera clocking phase
+delays reduced the scale of the row-by-row offsets for the majority of
+the OTAs.  As a result, we only apply this correction to the cells
+where it is still necessary, as shown in Figure \ref{fig: pattern row
+  cells}.  A list of these cells is in Table
+\ref{tab:pattern_row_cells}.
+
+\begin{figure*}[tpb]
+  \centering
+  %% need small version for arxiv
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/{correlated.noise\plotopt}.png}
+  \caption{{\bf Correlated Noise:} Example of the
+    \nocode{PATTERN.ROW} correction on exposure o5379g0103o OTA57
+    cell xy01 (\ips{} filter 45s).  The left panel shows the cell with
+    all appropriate detrending except the \nocode{PATTERN.ROW}, and
+    the right shows the same cell with \nocode{PATTERN.ROW} applied.
+    The correction reduces the correlated noise on the right side,
+    which is most distant from the read out amplifier.  There is a
+    slight over subtraction along the rows near the bright star.}
+  \label{fig: pattern row example}
+\end{figure*}
+
+Although this correction largely resolves the row-by-row offset issue
+in a satisfactory way, large and bright astronomical objects can bias
+the fit significantly.  This results in an oversubtraction of the
+offset near these objects.  As the offsets are calculated on the pixel
+rows, this oversubtraction is not uniform around the object, but is
+preferentially along the horizontal x axis of the object.  Most
+astronomical objects are not significantly distorted by this, with
+this only becoming on issue for only bright objects comparable to the
+size of the cell (598 pixels = 150").  Figure \ref{fig: pattern row example} 
+shows an example of a cell pre- and post-correction.
+
+\subsubsection{Pattern Continuity}
+\label{sec:pattern_continuity}
+
+\begin{figure*}[htpb]
+  \centering
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/{N157.v1\plotopt}.png}
+  \caption{These four panels illustrate the impact of the
+    \nocode{PATTERN.ROW}, \nocode{PATTERN.CONTINUITY}, and background
+    subtraction steps on a large galaxy.  Upper-left: all detrends
+    except \nocode{PATTERN.ROW}, \nocode{PATTERN.CONTINUITY}, and background
+    subtraction applied to a single GPC1 image of NGC 157.
+    Upper-right: same image as upper-left with \nocode{PATTERN.ROW} applied.
+    Lower-right: same image as upper-right with
+    \nocode{PATTERN.CONTINUITY} applied.  Lower-left: same image as
+    lower-right with background subtraction.}
+  \label{fig:ngc157.with.pattern}
+\end{figure*}
+
+\begin{figure*}[htpb]
+  \centering
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/{N157.v2\plotopt}.png}
+  \caption{These two panels illustrate the impact of the
+    \nocode{PATTERN.CONTINUITY}, and background subtraction steps on a
+    large galaxy, without \nocode{PATTERN.ROW}.  Left: all detrends
+    and \nocode{PATTERN.CONTINUITY}, but not \nocode{PATTERN.ROW} and
+    background subtraction, applied to a single GPC1 image of NGC 157.
+    Right: same image as left with background subtraction.  Without
+    the \nocode{PATTERN.ROW} correction, the background is much less affected.}
+  \label{fig:ngc157.without.pattern}
+\end{figure*}
+
+The background sky levels of cells on a single OTA do not always have
+the same value.  Despite having dark and flat corrections applied,
+adjacent cells may not match even for images of nominally empty sky.
+In addition, studies of the background level indicate that the
+row-by-row bias can introduce small background gradient variations
+along the rows of the cells that are not stable.  This common feature
+across the columns of cells results in a ``saw tooth'' pattern
+horizontally across the mosaicked OTA, and as the background model
+fits a smooth sky level, this induces over- and under subtraction at
+the cell boundaries.
+
+The \ippmisc{PATTERN.CONTINUITY} correction, attempts to match the edges of a
+cell to those of its neighbors.  For each cell, a thin box 10 pixels
+wide running the full length of each edge is extracted and the median
+of unmasked values is calculated for that box.  These median values
+are then used to construct a vector of the sum of the differences
+between that cell's edges and the corresponding edge on any adjacent
+cell $\Delta$.  A matrix $A$ of these associations is also
+constructed, with the diagonal containing the number of cells adjacent
+to that cell, and the off-diagonal values being set to -1 for each
+pair of adjacent cells.  The offsets needed for each chip, $\zeta$ can
+then be found by solving the system $A \zeta = \Delta$. A cell with the
+maximum number of neighbors, usually cell xy11, the first cell not on
+the edge of the OTA, is used to constrain the system, ensuring that
+that cell has zero correction and that there is a single solution.
+
+For OTAs that initially show the saw tooth pattern, the effect of this
+correction is to align the cells into a single ramp, at the expense of
+the absolute background level.  However, as we subtract off a smooth
+background model prior to doing photometry, these deviations from an
+absolute sky level do not affect photometry for point sources and
+extended sources smaller than a single cell.  The fact that the
+final ramp is smoother than it would be otherwise also allows for the
+background subtracted image to more closely match the astronomical
+sky, without significant errors at cell boundaries.  An example of the
+effect of this correction on an image profile is shown in Figure
+\ref{fig:dark switching}.
 
 \subsection{Background subtraction}
@@ -1291,371 +1757,38 @@
 model mean and standard deviation.
 
-\begin{deluxetable}{lcc}[htpb]
-  \tablecolumns{3}
-  \tablewidth{0pc}
-  \tablecaption{Mask Fraction by Mask Source}
-  \tablehead{
-    &\multicolumn{2}{c}{Field of View} \\
-    \colhead{Mask Source}&\colhead{3\degree}&\colhead{3.25\degree}}
-  \startdata
-  Good pixel              & 78.9\% & 71.1\% \\
-  Unpopulated             & 13.1\% & 19.6\% \\
-  CTE issue               &  2.3\% &  2.6\% \\
-  Other issue             &  5.4\% &  6.4\% \\
-  Static advisory         &  0.3\% &  0.3\% \\
-  \enddata
-  \label{tab:mask fraction}
-\end{deluxetable}
-
-Although this background modeling process works well for most of the
-sky, astronomical sources that are large compared to the
-$800\times{}800$ pixel subdivisions can bias the calculated background
-level high, resulting in an oversubtraction near that object.  The
-most common source that can cause this issue are large galaxies, which
-can have their own features modeled as being part of the background.
-For the specialized processing of M31, which covers an entire pointing
-of GPC1, the measured background was added back to the \IPPstage{chip}
-stage images, but this special processing was not used for the large
-scale $3\pi$ PV3 reduction.
-
-\subsection{Burntool / Persistence effect}
-\label{sec:burntool}
-
-Pixels that approach the saturation point on GPC1 (see
-Section~\ref{sec:diffraction_spikes}) introduce ``persistent charge''
-on that and subsequent images.  During the read out process of a cell
-with such a bright pixel, some of the charge remains in the undepleted
-region of the silicon and is not shifted down the detector column
-toward the amplifier.  This charge remains in the starting pixel and
-slowly leaks out of the undepleted region, contaminating subsequent
-pixels during the read out process, resulting in a ``burn trail'' that
-extends from the center of the bright source away from the amplifier
-(vertically along the pixel columns toward the top of the cell).
-
-This incomplete charge shifting in nearly full wells continues as each
-row is read out.  This results in a remnant charge being deposited in
-the pixels that the full well was shifted through.  In following
-exposures, this remnant charge leaks out, resulting in a trail that
-extends from the initial location of the bright source on the previous
-image towards the amplifier (vertically down along the pixel column).
-This remnant charge can remain on the detector for up to thirty
-minutes.
-
-\begin{figure}[htpb]
-  \centering
-  %% need a small version of this for arxiv
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/persistent_charge\plotopt.png}
-  \caption{{\bf Persistent Charge:}  Example of OTA11 cell xy50 on exposures o5677g0123o (left) and o5677g0124o (right).  The top panels show the image with all appropriate detrending steps, but without burntool, and the bottom show the same with burntool applied.  There is some slight over subtraction in fitting the initial trail, but the impact of the trail is greatly reduced in both exposures.}
-  \label{fig:burntool images}
-\end{figure}
-
-Both of these types of persistence trails are measured and optionally
-repaired via the \IPPprog{burntool} program.  This program does an
-initial scan of the image, and identifies objects with pixel values
-higher than a conservative threshold of 30000 DN.  The trail from the
-peak of that object is fit with a one-dimensional power law in each
-pixel column above the threshold, based on empirical evidence that
-this is the functional form of this persistence effect.  This fit also
-matches the expectation that a constant fraction of charge is
-incompletely transferred at each shift beyond the persistence
-threshold.  Once the fit is done, the model can be subtracted from
-the image.  The location of the source is stored in a table along
-with the exposure PONTIME, which denotes the number of seconds since
-the detector was last powered on and provides an internally
-consistent time scale.
-
-For subsequent exposures, the table associated with the previous image
-is read in, and after correcting trails from the stars on the new
-image, the positions of the bright stars from the table are used to
-check for remnant trails from previous exposures on the image.  These
-are fit and subtracted using a one-dimensional exponential model,
-again based on empirical studies.  The output table retains this
-remnant position for 2000 seconds after the initial PONTIME recorded.
-This allows fits to be attempted well beyond the nominal lifetime of
-these trails.  Figure \ref{fig:burntool images} shows an example of a
-cell with a persistence trail from a bright star, the post-correction
-result, as well as the pre and post correction versions of the same
-cell on the subsequent exposure.  The profiles along the detector
-columns for these two exposures are presented in Figure
-\ref{fig:burntool plot}.
-
-\begin{figure}[htpb]
-  \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/o5677g0123n4o_XY11_bt_trail.pdf}
-
-  \caption{{\bf Burntool Correction:} Example of a profile cut along
-    the y-axis through a bright star on exposure o5677g0123o OTA11 in
-    cell xy50 (left panel) and on the subsequent exposure o5677g0124o
-    (right panel).  In both figures, the blue pluses show the image
-    corrected with all appropriate detrending steps, but without
-    burntool applied, illustrating the amplitude of the persistence
-    trails.  The red circles show the same data after the burntool
-    correction, which reduces the impact of these features.  Both
-    exposures are in the \gps{} filter with exposure times of 43s}
-
-  \label{fig:burntool plot}
-\end{figure}
-
-Using this method of correcting the persistence trails has the
-challenge that it is based on fits to the raw image data, which may
-have other signal sources not determined by the persistence effect.
-The presence of other stars or artifacts in the detector column can
-result in a poor model to be fit, resulting in either an over- or
-under-subtraction of the trail.  For this reason, the image mask is
-marked with a value indicating that this correction has been applied.
-These pixels are not fully excluded, but they are marked as suspect,
-which allows them to be excluded from consideration in subsequent
-stages, such as image stacking.
-
-The cores of very bright stars can also be deformed by this process,
-as the burntool fitting subtracts flux from only one side of the star.
-As most stars that result in persistence trails already have saturated
-cores, they are already ignored for the purpose of PSF determination
-and are flagged as saturated by the photometry reduction.
-
-\subsection{Non-linearity Correction}
-\label{sec:nonlinearity}
-
-The pixels of GPC1 are not uniformly linear at all flux levels.  In
-particular, at low flux levels, some pixels have a tendency to sag
-relative to the expected linear value.  This effect is most pronounced
-along the edges of the detector cells, although some entire cells show
-evidence of this effect.
-
-To correct this sag, we studied the behavior of a series of flat
-frames for a ramp of exposure times with approximate logarithmically
-equal spacing between 0.01s and 57.04s.  As the exposure time
-increases, the signal on each pixel also increases in what is expected
-to be a linear manner.  Each of the flat exposures in this ramp is
-overscan corrected, and then the median is calculated for each cell,
-as well as for the rows and columns within ten pixels of the edge of
-the science region.  From these median values at each exposure time
-value, we can construct the expected trend by fitting a linear model
-for the region considered.  This fitting was limited to only the range
-of fluxes between 12000 and 38000 counts, as these ranges were found
-to match the linear model well.  This range avoids the non-linearity
-at low fluxes, as well as the possibility of high-flux non-linearity
-effects.
-
-% An example of this data is shown in Figure~\ref{fig: nonlinearity}.  
-
-We store the average flux measurement and deviation from the linear
-fit for each exposure time for each region on all detector cells in
-the linearity detrend look-up tables.  When this correction is
-applied to science data, these lookup tables are loaded, and a linear
-interpolation is performed to determine the correction needed for the
-flux in that pixel.  This look up is performed for both the row and
-column of each pixel, to allow the edge correction to be applied where
-applicable, and the full cell correction elsewhere.  The average of
-these two values is then applied to the pixel value, reducing the
-effects of pixel nonlinearity.
-
-This non-linearity effect appears to be stable in time for the
-majority of the detector pixels, with little evident change over the
-survey duration.  However, as the non-linearity is most pronounced at
-the edges of the detector cells, those are the regions where the
-correction is most likely to be incomplete.  Because of this fact,
-most pixels in the static mask with either the DARKMASK or FLATMASK
-bit set are found along these edges.  As the non-linearity correction
-is unable to reliably restore these pixels, they produce inconsistent
-values after the dark and flat have been applied, and are therefore
-rejected.
-
-\begin{deluxetable}{lcccc}[htpb]
-  \tablecolumns{3}
-  \tablewidth{0pc}
-  \tablecaption{Cells which have \nocode{PATTERN.ROW} correction applied}
-  \tablehead{\colhead{OTA} & \colhead{Cell columns} & \colhead{Additional cells}}
-  \startdata
-  OTA11 &  & xy02, xy03, xy04, xy07 \\
-  OTA14 &  & xy23 \\
-  OTA15 & 0 & \\
-  OTA27 & 0, 1, 2, 3, 7 & \\
-  OTA31 & 7 & \\
-  OTA32 & 3, 7 & \\
-  OTA45 & 3, 7 & \\
-  OTA47 & 0, 3, 5, 7 & \\
-  OTA57 & 0, 1, 2, 6, 7 & \\
-  OTA60 &  & xy55 \\
-  OTA74 & 2, 7 & \\
-  \enddata
-  \label{tab:pattern_row_cells}
-\end{deluxetable}
-
-\subsection{Pattern correction}
-\label{sec:pattern}
-
-\subsubsection{Pattern Row}
-\label{sec:pattern.row}
-%% Statistics so I have them written down somewhere
-%% chipProcessedImfile.bg/bg_stdev by filter for XY33 (a good chip)
-%% filter  bg_mean stdev median Qsig                              bg_stdev_mean stdev median Qsig
-%% g        36.37422026669   64.64175104057  32.693   6.10284     14.696938349131  78.80460307171  8.8401  0.5417843
-%% r       200.96143304525  471.87743546238 117.105  94.55608     33.854672792146  79.01642728089 13.4564  5.3771355
-%% i       447.00504994458  938.38517801037 286.810 154.71397     57.298335510188  99.38392923935 20.0217 24.2254723
-%% z       317.54933679054  390.38930252748 241.014 114.13316     48.359069000176  94.44452756094 17.9404  9.1535209
-%% y       371.09019536218  293.57439970375 288.481 133.38769     43.724342221691 135.04286534327 19.9029  7.5396461
-
-As discussed above in the dark and noisemap sections, certain
-detectors have significant bias offsets between adjacent rows, caused
-by drifts in the bias level due to cross talk.  The magnitude of these
-offsets increases as the distance from the readout amplifier and
-overscan region increases, resulting in horizontal streaks that are
-more pronounced along the large $x$ pixel edge of the cell.  As the
-level of the offset is apparently random between exposures, the dark
-correction cannot fully remove this structure from the images, and the
-noisemap value only indicates the level of the average variance added
-by these bias offsets.  Therefore, we apply the \ippmisc{PATTERN.ROW} correction
-in an attempt to mitigate the offsets and correct the image values.
-To force the rows to agree, a second order clipped polynomial is
-fitted to each row in the cell.  Four fit iterations are run and
-pixels $2.5\sigma$ deviant (chosen empirically) are excluded from
-subsequent fits in order to minimize the bias from stars and other
-astronomical sources in the pixels.  This final trend is then
-subtracted from that row.  Simply doing this subtraction will also
-have the effect of removing the background sky level.  To prevent
-this, the constant and linear terms for each row are stored, and
-linear fits are made to these parameters as a function of row,
-perpendicular to the initial fits.  This produces a plane that is
-added back to the image to restore the background offset and any
-linear ramp that exists in the sky.
-
-\begin{figure}[htpb]
-  \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/pattern_row_edit.png}
-  \caption{Diagram illustrating in red which cells on GPC1 require the
-    \nocode{PATTERN.ROW} correction to be applied.  The footprint of
-    each OTA is outlined, and cell xy00 is marked with either a filled
-    box or an outline.  The labeling of the non-existent corner OTAs
-    is provided to orient the focal plane.}
-  \label{fig: pattern row cells}
-\end{figure}
-
-These row-by-row variations have the largest impact on data taken in
-the \gps{} filter, as the read noise is the dominant noise source in
-that filter.  At longer wavelengths, the noise from the Poissonian
-variation in the sky level increases.  The \ippmisc{PATTERN.ROW} correction is
-still applied to data taken in the other filters, as the increase in
-sky noise does not fully obscure the row-by-row noise.
-
-%% GPC1 tuning describe in email from Peter Onaka 2009.11.30,
-%% with notes in GPC1TuningTestLog.pdf
-
-This correction was required on all cells on all OTAs prior to
-2009-12-01, at which point a modification of the camera clocking phase
-delays reduced the scale of the row-by-row offsets for the majority of
-the OTAs.  As a result, we only apply this correction to the cells
-where it is still necessary, as shown in Figure \ref{fig: pattern row
-  cells}.  A list of these cells is in Table
-\ref{tab:pattern_row_cells}.
-
-Although this correction largely resolves the row-by-row offset issue
-in a satisfactory way, large and bright astronomical objects can bias
-the fit significantly.  This results in an oversubtraction of the
-offset near these objects.  As the offsets are calculated on the pixel
-rows, this oversubtraction is not uniform around the object, but is
-preferentially along the horizontal x axis of the object.  Most
-astronomical objects are not significantly distorted by this, with
-this only becoming on issue for only bright objects comparable to the
-size of the cell (598 pixels = 150").  Figure \ref{fig: pattern row example} 
-shows an example of a cell pre- and post-correction.
-
-\begin{figure*}[htpb]
-  \centering
-  %% need small version for arxiv
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/{correlated.noise\plotopt}.png}
-  \caption{{\bf Correlated Noise:} Example of the
-    \nocode{PATTERN.ROW} correction on exposure o5379g0103o OTA57
-    cell xy01 (\ips{} filter 45s).  The left panel shows the cell with
-    all appropriate detrending except the \nocode{PATTERN.ROW}, and
-    the right shows the same cell with \nocode{PATTERN.ROW} applied.
-    The correction reduces the correlated noise on the right side,
-    which is most distant from the read out amplifier.  There is a
-    slight over subtraction along the rows near the bright star.}
-  \label{fig: pattern row example}
-\end{figure*}
-
-\subsubsection{Pattern Continuity}
-\label{sec:pattern_continuity}
-
-\begin{figure*}[htpb]
-  \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/{N157.v1\plotopt}.png}
-  \caption{These four panels illustrate the impact of the
-    \nocode{PATTERN.ROW}, \nocode{PATTERN.CONTINUITY}, and background
-    subtraction steps on a large galaxy.  Upper-left: all detrends
-    except \nocode{PATTERN.ROW}, \nocode{PATTERN.CONTINUITY}, and background
-    subtraction applied to a single GPC1 image of NGC 157.
-    Upper-right: same image as upper-left with \nocode{PATTERN.ROW} applied.
-    Lower-right: same image as upper-right with
-    \nocode{PATTERN.CONTINUITY} applied.  Lower-left: same image as
-    lower-right with background subtraction.}
-  \label{fig:ngc157.with.pattern}
-\end{figure*}
-
-\begin{figure*}[htpb]
-  \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/{N157.v2\plotopt}.png}
-  \caption{These two panels illustrate the impact of the
-    \nocode{PATTERN.CONTINUITY}, and background subtraction steps on a
-    large galaxy, without \nocode{PATTERN.ROW}.  Left: all detrends
-    and \nocode{PATTERN.CONTINUITY}, but not \nocode{PATTERN.ROW} and
-    background subtraction, applied to a single GPC1 image of NGC 157.
-    Right: same image as left with background subtraction.  Without
-    the \nocode{PATTERN.ROW} correction, the background is much less affected.}
-  \label{fig:ngc157.without.pattern}
-\end{figure*}
-
-The background sky levels of cells on a single OTA do not always have
-the same value.  Despite having dark and flat corrections applied,
-adjacent cells may not match even for images of nominally empty sky.
-In addition, studies of the background level indicate that the
-row-by-row bias can introduce small background gradient variations
-along the rows of the cells that are not stable.  This common feature
-across the columns of cells results in a ``saw tooth'' pattern
-horizontally across the mosaicked OTA, and as the background model
-fits a smooth sky level, this induces over- and under subtraction at
-the cell boundaries.
-
-The \ippmisc{PATTERN.CONTINUITY} correction, attempts to match the edges of a
-cell to those of its neighbors.  For each cell, a thin box 10 pixels
-wide running the full length of each edge is extracted and the median
-of unmasked values is calculated for that box.  These median values
-are then used to construct a vector of the sum of the differences
-between that cell's edges and the corresponding edge on any adjacent
-cell $\Delta$.  A matrix $A$ of these associations is also
-constructed, with the diagonal containing the number of cells adjacent
-to that cell, and the off-diagonal values being set to -1 for each
-pair of adjacent cells.  The offsets needed for each chip, $\zeta$ can
-then be found by solving the system $A \zeta = \Delta$. A cell with the
-maximum number of neighbors, usually cell xy11, the first cell not on
-the edge of the OTA, is used to constrain the system, ensuring that
-that cell has zero correction and that there is a single solution.
-
-For OTAs that initially show the saw tooth pattern, the effect of this
-correction is to align the cells into a single ramp, at the expense of
-the absolute background level.  However, as we subtract off a smooth
-background model prior to doing photometry, these deviations from an
-absolute sky level do not affect photometry for point sources and
-extended sources smaller than a single cell.  The fact that the
-final ramp is smoother than it would be otherwise also allows for the
-background subtracted image to more closely match the astronomical
-sky, without significant errors at cell boundaries.  An example of the
-effect of this correction on an image profile is shown in Figure
-\ref{fig:dark switching}.
-
-\subsection{Background (``Sky'') Subtraction}
-
-\note{does this section duplicate section 3.7 ??}
-
-During the \IPPstage{chip}-stage processing, after the detrending
-steps are done but before source detection begins, a model of the
-background light is subtracted from each chip image.  The decision to
-subtract a background model is somewhat tricky as the trade-offs are
-not clear in all possible cases.  It is helpful to consider the types
-of sources which contribute to the background light in astronomical
-images.
-
-First, there is ``scattered light'', which means flux that reaches the
+\subsection{Astrophysical vs Other Backgrounds}
+
+The model of the background light is subtracted from each chip image
+during the \IPPstage{chip}-stage processing before source detection
+begins.  The decision to subtract a background model is somewhat
+tricky as the trade-offs are not clear in all possible cases.  It is
+helpful to consider the types of sources which contribute to the
+background light in astronomical images.
+
+\begin{table*}[tpb]
+\caption{\label{tab:detrend ppMerge} Detrend Merge Options} \vspace{-0.5cm}
+\begin{center}
+\begin{tabular}{lcccc}
+\hline
+\hline
+{\bf Detrend Type} & {\bf Preprocess$^1$} & {\bf Iterations} & {\bf Threshold} & {\bf Combination Method} \\
+\hline
+  DARK      & ON   & 2 & $3\sigma$ & Clipped mean \\
+  FLAT      & OND  & 1 & $3\sigma$ & Clip Top $30\%$ \& Bottom $10\%$; Mean \\
+  FRINGE    & ONDF & 2 & $3\sigma$ & Clipped mean \\
+  DARKMASK  & OND  & 3 & $8\sigma$ & Mask if $>10\%$ rejected \\
+  FLATMASK  & ONDF & 3 & $3\sigma$ & Mask if $>10\%$ rejected \\
+  CTEMASK   & ONDF & 2 & $2\sigma$ & Clipped mean; mask if $\sigma^2/\langle I\rangle < 0.5$ \\
+  NOISEMAP  & ON   & 2 & $3\sigma$ & Mean \\
+\hline
+\multicolumn{5}{l}{$^1$O: Overscan subtraction; N: Non-linearity correction; D: Dark correction; F: Flat-field correction} \\
+\end{tabular}
+\end{center} \vspace{-0.25cm}
+\end{table*}
+
+First, there is ``scattered'' light\footnote{We put the term ``scattered'' in quotes because this
+  background may include light which reaches the detector directly
+  from the sky or other light source rather than scattering off
+  elements of the optical system.}, which means flux that reaches the
 detector from a path that is different from the path through the
 optics taken by the light from the imaged stars.  In an ideal
@@ -1664,11 +1797,8 @@
 systems such as the Pan-STARRS telescopes, it is impossible to
 sufficiently baffle the optical path to prevent ``scattered''
-light\footnote{We put the term ``scattered'' in quotes because this
-  background may include light which reaches the detector directly
-  from the sky or other light source rather than scattering off
-  elements of the optical system.}  from reaching the detector without
+light from reaching the detector without
 blocking the main optical path.  This class of background light may
 include sharp features such as the glints discussed
-above(Section~\ref{sec:glints}), but in this discussion we are
+above (Section~\ref{sec:dynamic_masks}), but in this discussion we are
 primarily concerned with large-scale structures.  Another type of
 ``scattered'' background light source would be the large out-of-focus
@@ -1681,13 +1811,13 @@
 telescope.  This may include glow from emission lines in the
 atmosphere, light from the moon or terrestrial sources scattered off
-thin (or thick!) clouds or just scattered in the clear atmosphere via
-Rayleigh off dust particles and gas molecules in the atmosphere.  Both
-``scattered'' and direct terrestrial contributions to the background
-light are not expected to be consistent for a given location on the
-sky, though the pupil ghost image may well be the same for a fixed
+thin (or thick!) clouds or just scattered in the cloud-free atmosphere
+off dust particles and gas molecules.  Both ``scattered'' and direct
+terrestrial contributions to the background light vary with time and
+are not expected to be repeatable for a given location on the sky,
+though the pupil ghost image may well be the same for a fixed
 telescope pointing and night sky brighness.
 
 Finally, there are astrophysical contributions to the background
-light.  These range from the nearby zodiacal light to the
+light.  These range from the (relatively) nearby zodiacal light to the
 extragalactic background.  Depending on the context and the source
 being measured, astrophysical background sources may even include the
@@ -1695,6 +1825,6 @@
 sources, it is necessary to subtract (or otherwise model) any
 large-scale diffuse background component.  When measuring a larger
-object, e.g., a well-resolved galaxy, it is necessary to make a
-decision what portion of the large-scale flux is a background and what
+object, e.g., a well-resolved galaxy, it is necessary to 
+decide what portion of the large-scale flux is a background and what
 is part of the flux of the object being measured.
 
@@ -1713,17 +1843,11 @@
 combined to make a deep stack.  
 
-The details of the background model are discussed in Paper IV.
-Briefly, the background subtraction is performed on each chip
-independently.  The image is divided into a grid of points with a
-spacing of 400 pixels.  A superpixel of size $800 \times 800$ pixels
-is used to measure the background corresponding to each point.
-Bilinear interpolation is used to estimate the background value at any
-point in the full image.  This approach works well to follow the
-large-scale background structures from the terrestrial and scattered
+The IPP background subtraction works well to remove the large-scale
+background structures from the terrestrial and scattered-light
 sources, and to subtract the background light of large-scale
-astronomical feasures for the analysis of point sources or small-scale
-feasures such as small galaxies.  However, this process acts as a
+astronomical features for the analysis of point sources or small-scale
+features such as small galaxies.  However, this process acts as a
 high-pass filter, with the result that galaxies larger than a certain
-size will have a significant portion of their light subtracted.  In
+size have a significant portion of their light subtracted.  In
 addition, the \ippmisc{PATTERN.ROW} and \ippmisc{PATTERN.CONTINUITY}
 corrections described above (Section~\ref{sec:pattern}) also
@@ -1732,5 +1856,8 @@
 \ref{fig:ngc157.without.pattern} illustrate the impact of the
 background subtraction on a large galaxy both with and withouth the
-\ippmisc{PATTERN.ROW} correction.
+\ippmisc{PATTERN.ROW} correction.  For the specialized processing of
+M31, which covers an entire pointing of GPC1, the measured background
+was added back to the \IPPstage{chip} stage images.  This special
+processing was not used for the large scale $3\pi$ PV3 reduction.
 
 \section{GPC1 Detrend Construction}
@@ -1744,5 +1871,5 @@
 detrend to be constructed.  In general, the input exposures to the
 detrend have all prior stages of detrend processing applied.  Table
-\ref{tab:detrend ppImage} summarizes stages applied for the detrends
+\ref{tab:detrend ppMerge} summarizes stages applied for the detrends
 we construct.
 
@@ -1770,51 +1897,34 @@
 the PV3 processing.
 
-\begin{deluxetable*}{lcccc}[htpb]
-  \tablecolumns{5}
-  \tablewidth{0pc}
-  \tablecaption{Detrend Construction Processing}
-  \tablehead{\colhead{Detrend Type} & \colhead{Overscan Subtracted} & \colhead{Nonlinearity Correction} & \colhead{Dark Subtracted} & \colhead{Flat Applied} }
-  \startdata
-  LINEARITY & Y & & & \\
-%%  DARKMASK  & Y & Y & Y & \\
-%%  FLATMASK  & Y & Y & Y & Y \\
-%%  CTEMASK   & Y & Y & Y & Y \\
-  DARK      & Y & Y & & \\
-%%  NOISEMAP  & Y & Y & & \\
-  FLAT      & Y & Y & Y & \\
-  FRINGE    & Y & Y & Y & Y \\
-  DARKMASK  & Y & Y & Y & \\
-  FLATMASK  & Y & Y & Y & Y \\
-  CTEMASK   & Y & Y & Y & Y \\
-  NOISEMAP  & Y & Y & & \\
-  \enddata
-  \label{tab:detrend ppImage}
-\end{deluxetable*}
-
-
-\begin{deluxetable*}{lcccc}[htpb]
-  \tablecolumns{5}
-  \tablewidth{0pc}
-  \tablecaption{Detrend Merge Options}
-  \tablehead{\colhead{Detrend Type} & \colhead{Iterations} & \colhead{Threshold} & \colhead{Additional Clipping} & \colhead{Combination Method} }
-  \startdata
-  DARKMASK  & 3 & $8\sigma$ & & Mask if $>10\%$ rejected \\
-  FLATMASK  & 3 & $3\sigma$ & & Mask if $>10\%$ rejected \\
-  CTEMASK   & 2 & $2\sigma$ & & Clipped mean; mask if $\sigma^2/\langle I\rangle < 0.5$ \\
-  DARK      & 2 & $3\sigma$ & & Clipped mean \\
-  NOISEMAP  & 2 & $3\sigma$ & & Mean \\
-  FLAT      & 1 & $3\sigma$ & Top $30\%$; Bottom $10\%$ & Mean \\
-  FRINGE    & 2 & $3\sigma$ & & Clipped mean \\
-  \enddata
-  \label{tab:detrend ppMerge}
-\end{deluxetable*}
-
-\begin{deluxetable*}{lclll}[htpb]
-  \tablecolumns{5}
-  \tablewidth{0pc}
-  \tablecaption{PV3 Detrends}
-  \tablehead{\colhead{Detrend Type} & \colhead{Detrend ID} &
-    \colhead{Start Date (UT)} & \colhead{End Date (UT)} & \colhead{Note} }
-  \startdata
+%% \begin{table*}
+%% \caption{\label{tab:detrend ppImage} Detrend Construction Processing} \vspace{-0.5cm}
+%% \begin{center}
+%% \footnotesize
+%% \begin{tabular}{lcccc}
+%% \hline
+%% \hline
+%% {\bf Detrend Type} & {\bf Overscan Subtracted} & {\bf Nonlinearity Correction} & {\bf Dark Subtracted} & {\bf Flat Applied} \\
+%% \hline
+%%   LINEARITY & Y &   &   &   \\
+%%   DARK      & Y & Y &   &   \\
+%%   FLAT      & Y & Y & Y &   \\
+%%   FRINGE    & Y & Y & Y & Y \\
+%%   DARKMASK  & Y & Y & Y &   \\
+%%   FLATMASK  & Y & Y & Y & Y \\
+%%   CTEMASK   & Y & Y & Y & Y \\
+%%   NOISEMAP  & Y & Y &   &   \\
+%% \hline
+%% \end{tabular}
+%% \end{center} \vspace{-0.25cm}
+%% \end{table*}
+
+\begin{table*}
+\caption{\label{tab:detrend list} PV3 Detrends} \vspace{-0.5cm}
+\begin{center}
+\begin{tabular}{lclll}
+\hline
+\hline
+{\bf Detrend Type} & {\bf Detrend ID} & {\bf Start Date (UT)} & {\bf End Date (UT)} & {\bf Note} \\
+\hline
   LINEARITY & 421  & 2009-01-01 00:00:00 & & \\
   MASK      & 945  & 2009-01-01 00:00:00 & & \\
@@ -1851,8 +1961,94 @@
   FRINGE    & 296  & 2009-12-09 00:00:00 & & \\
   ASTROM    & 1064 & 2008-05-06 00:00:00 & & \\
-  \enddata
-  \tablenotetext{a}{These dates mark the beginning and ending of the two-mode dark models, between which multiple dates use the B-mode dark.}
-  \label{tab:detrend list}
-\end{deluxetable*}
+\hline
+\multicolumn{5}{l}{$^a$These dates mark the beginning and ending of the two-mode dark models, between which multiple dates use the B-mode dark.} \\
+\end{tabular}
+\end{center} \vspace{-0.25cm}
+\end{table*}
+
+%% \begin{deluxetable*}{lcccc}[htpb]
+%%   \tablecolumns{5}
+%%   \tablewidth{0pc}
+%%   \tablecaption{Detrend Construction Processing}
+%%   \tablehead{\colhead{Detrend Type} & \colhead{Overscan Subtracted} & \colhead{Nonlinearity Correction} & \colhead{Dark Subtracted} & \colhead{Flat Applied} }
+%%   \startdata
+%%   LINEARITY & Y & & & \\
+%% %%  DARKMASK  & Y & Y & Y & \\
+%% %%  FLATMASK  & Y & Y & Y & Y \\
+%% %%  CTEMASK   & Y & Y & Y & Y \\
+%%   DARK      & Y & Y & & \\
+%% %%  NOISEMAP  & Y & Y & & \\
+%%   FLAT      & Y & Y & Y & \\
+%%   FRINGE    & Y & Y & Y & Y \\
+%%   DARKMASK  & Y & Y & Y & \\
+%%   FLATMASK  & Y & Y & Y & Y \\
+%%   CTEMASK   & Y & Y & Y & Y \\
+%%   NOISEMAP  & Y & Y & & \\
+%%   \enddata
+%%   \label{tab:detrend ppImage}
+%% \end{deluxetable*}
+%% 
+%% \begin{deluxetable*}{lcccc}[htpb]
+%%   \tablecolumns{5}
+%%   \tablewidth{0pc}
+%%   \tablecaption{Detrend Merge Options}
+%%   \tablehead{\colhead{Detrend Type} & \colhead{Iterations} & \colhead{Threshold} & \colhead{Additional Clipping} & \colhead{Combination Method} }
+%%   \startdata
+%%   DARKMASK  & 3 & $8\sigma$ & & Mask if $>10\%$ rejected \\
+%%   FLATMASK  & 3 & $3\sigma$ & & Mask if $>10\%$ rejected \\
+%%   CTEMASK   & 2 & $2\sigma$ & & Clipped mean; mask if $\sigma^2/\langle I\rangle < 0.5$ \\
+%%   DARK      & 2 & $3\sigma$ & & Clipped mean \\
+%%   NOISEMAP  & 2 & $3\sigma$ & & Mean \\
+%%   FLAT      & 1 & $3\sigma$ & Top $30\%$; Bottom $10\%$ & Mean \\
+%%   FRINGE    & 2 & $3\sigma$ & & Clipped mean \\
+%%   \enddata
+%%   \label{tab:detrend ppMerge}
+%% \end{deluxetable*}
+%% 
+%% \begin{deluxetable*}{lclll}[htpb]
+%%   \tablecolumns{5}
+%%   \tablewidth{0pc}
+%%   \tablecaption{PV3 Detrends}
+%%   \tablehead{\colhead{Detrend Type} & \colhead{Detrend ID} &
+%%     \colhead{Start Date (UT)} & \colhead{End Date (UT)} & \colhead{Note} }
+%%   \startdata
+%%   LINEARITY & 421  & 2009-01-01 00:00:00 & & \\
+%%   MASK      & 945  & 2009-01-01 00:00:00 & & \\
+%%             & 946  & 2009-12-09 00:00:00 & & \\
+%%             & 947  & 2010-01-01 00:00:00 & & \\
+%%             & 948  & 2011-01-06 00:00:00 & & \\
+%%             & 949  & 2011-03-09 00:00:00 & 2011-03-10 23:59:59 & \\
+%%             & 950  & 2011-08-02 00:00:00 & & \\
+%%             & 1072 & 2015-12-17 00:00:00 & & Update OTA62 mask \\
+%%   DARK      & 223  & 2009-01-01 00:00:00 & 2009-12-09 00:00:00 & \\
+%%             & 229  & 2009-12-09 00:00:00 & & \\
+%%             & 863  & 2010-01-23 00:00:00 & 2011-05-01 00:00:00 & A-mode \\
+%%             & 864  & 2011-05-01 00:00:00 & 2011-08-01 00:00:00 & \\
+%%             & 865  & 2011-08-01 00:00:00 & 2011-11-01 00:00:00 & \\
+%%             & 866  & 2011-11-01 00:00:00 & 2019-04-01 00:00:00 & \\
+%%             & 869-935 & 2010-01-25 00:00:00\tablenotemark{a} & 2011-04-25 23:59:59\tablenotemark{a} & B-mode \\
+%%   VIDEODARK & 976  & 2009-01-01 00:00:00 & 2009-12-09 00:00:00 & \\
+%%             & 977  & 2009-12-09 00:00:00 & 2010-01-23 00:00:00 & \\
+%%             & 978  & 2010-01-23 00:00:00 & 2011-05-01 00:00:00 & A-mode \\
+%%             & 979  & 2011-05-01 00:00:00 & 2011-08-01 00:00:00 & \\
+%%             & 980  & 2011-08-01 00:00:00 & 2011-11-01 00:00:00 & \\
+%%             & 981  & 2011-11-01 00:00:00 & 2019-04-01 00:00:00 & \\
+%%             & 982-1048 & 2010-01-25 00:00:00\tablenotemark{a} & 2011-04-25 23:59:59\tablenotemark{a} & B-mode \\
+%%             & 1049 & 2010-09-12 00:00:00 & 2011-05-01 00:00:00 & A-mode with OTA47fix \\
+%%   NOISEMAP  & 963  & 2008-01-01 00:00:00 & 2010-09-01 00:00:00 & \\
+%%             & 964  & 2010-09-01 00:00:00 & 2011-05-01 00:00:00 & \\
+%%             & 965  & 2011-05-01 00:00:00 & & \\
+%%   FLAT      & 300  & 2009-12-09 00:00:00 & & \gps{} filter \\
+%%             & 301  & 2009-12-09 00:00:00 & & \rps{} filter \\ 
+%%             & 302  & 2009-12-09 00:00:00 & & \ips{} filter \\
+%%             & 303  & 2009-12-09 00:00:00 & & \zps{} filter \\
+%%             & 304  & 2009-12-09 00:00:00 & & \yps{} filter \\
+%%             & 305  & 2009-12-09 00:00:00 & & \wps{} filter \\
+%%   FRINGE    & 296  & 2009-12-09 00:00:00 & & \\
+%%   ASTROM    & 1064 & 2008-05-06 00:00:00 & & \\
+%%   \enddata
+%%   \tablenotetext{a}{These dates mark the beginning and ending of the two-mode dark models, between which multiple dates use the B-mode dark.}
+%%   \label{tab:detrend list}
+%% \end{deluxetable*}
 
 \section{Warping}
@@ -1861,5 +2057,5 @@
 \begin{figure*}[htpb]
   \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/{warp.and.stack.demo}.pdf}
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/{warp.and.stack.demo}.pdf}
   \caption{Warping and Stacking Flowchart.  The diagram on the
     upper right shows an example of two neighboring GPC1 exposures
@@ -1901,5 +2097,5 @@
 \begin{figure}[htpb]
   \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/warp_2046019_sci\plotopt.png}
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/warp_2046019_sci\plotopt.png}
   \caption{Example of the warp image for skycell skycell.1146.095
     centered at ($\alpha,\delta$) = (11.934, -4.197) for exposure
@@ -1914,5 +2110,5 @@
 \begin{figure}[htpb]
   \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/warp_2046019_var\plotopt.png}
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/warp_2046019_var\plotopt.png}
   \caption{Example of the warp variance image for skycell
     skycell.1146.095 of exposure o5104g0266o, the same as in Figure
@@ -1929,5 +2125,5 @@
 \begin{figure}[htpb]
   \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/warp_2046019_mask.png}
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/warp_2046019_mask.png}
   \caption{Example of the warp mask image for skycell skycell.1146.095
     of exposure o5104g0266o, the same as in Figure \ref{fig:warp
@@ -1992,20 +2188,4 @@
 change.
 
-\begin{figure}[t]
-  \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/stack_3956997_sci\plotopt.png}
-  \caption{Example of the stack image for skycell skycell.1146.095
-    centered at ($\alpha,\delta$) = (11.934, -4.197) in the \rps{}
-    filter, stack\_id 3956997.  This stack includes 39 input images
-    including o5104g0266o, the warp image in Figure \ref{fig:warp
-      image}, and has a combined exposure time of 1880s.  Combining
-    such a large number of input images removes the inter-cell and
-    inter-chip gaps, providing a fully populated image.  In addition,
-    the combined signal allows many more faint objects to be found
-    than were visible on the single frame warp image.}
-
-  \label{fig:stack image}
-\end{figure}
-
 The interpolation constructs the output pixels from more than one
 input pixel, which introduces covariance between pixels.  For each
@@ -2039,18 +2219,4 @@
 \label{sec:stacking}
 
-\begin{figure}[t]
-  \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/stack_3956997_var\plotopt.png}
-  \caption{Example of the stack variance image for skycell 
-    skycell.1146.095 centered at ($\alpha,\delta$) = (11.934, -4.197)
-    in the \rps{} filter, stack\_id 3956997.  The variance
-    map for this stack is reasonably smooth, with the mottled pattern
-    from the inter-chip and inter-cell gaps printing through.  Some
-    regions with higher variance are found where the number of inputs
-    is lower.}
-
-  \label{fig:stack wt image}
-\end{figure}
-
 Once individual exposures have been warped onto a common projection
 system, they can be combined pixel-by-pixel regardless of their
@@ -2075,21 +2241,24 @@
 detect inconsistent pixels even in the sensitive wings of bright objects.
 
+\begin{figure}[t]
+  \centering
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/stack_3956997_sci\plotopt.png}
+  \caption{Example of the stack image for skycell skycell.1146.095
+    centered at ($\alpha,\delta$) = (11.934, -4.197) in the \rps{}
+    filter, stack\_id 3956997.  This stack includes 39 input images
+    including o5104g0266o, the warp image in Figure \ref{fig:warp
+      image}, and has a combined exposure time of 1880s.  Combining
+    such a large number of input images removes the inter-cell and
+    inter-chip gaps, providing a fully populated image.  In addition,
+    the combined signal allows many more faint objects to be found
+    than were visible on the single frame warp image.}
+
+  \label{fig:stack image}
+\end{figure}
+
 For the $3\pi$ survey, the stacked image is comprised of all warp
 frames for a given skycell in a single filter.  The source catalogs
 and image components are loaded into the \IPPprog{ppStack} program to
 prepare the inputs and stack the frames.
-
-\begin{figure}[t]
-  \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/stack_3956997_mask.png}
-  \caption{Example of the stack mask image for skycell
-    skycell.1146.095 centered at ($\alpha,\delta$) = (11.934, -4.197)
-    in the \rps{} filter, stack\_id 3956997.  The entire frame is
-    largely unmasked after combining inputs, with the only remaining
-    masks falling on the cores of bright stars, and in small regions
-    around the brightest objects where the overlapping of diffraction
-    spike masks have removed all inputs.}
-  \label{fig:stack mask image}
-\end{figure}
 
 Once all files are ingested, the first step is to measure the size and
@@ -2130,13 +2299,14 @@
 \begin{figure}[t]
   \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/stack_3956997_num\plotopt.png}
-  \caption{Example of the stack number image for skycell
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/stack_3956997_var\plotopt.png}
+  \caption{Example of the stack variance image for skycell 
     skycell.1146.095 centered at ($\alpha,\delta$) = (11.934, -4.197)
-    in the \rps{} filter, stack\_id 3956997.  This map shows
-    the number of inputs contributing to each pixel of the output
-    stack.  Again, the pattern of the inter-chip and inter-cell gaps
-    is visible, along with other mask features. }
-
-  \label{fig:stack num image}
+    in the \rps{} filter, stack\_id 3956997.  The variance
+    map for this stack is reasonably smooth, with the mottled pattern
+    from the inter-chip and inter-cell gaps printing through.  Some
+    regions with higher variance are found where the number of inputs
+    is lower.}
+
+  \label{fig:stack wt image}
 \end{figure}
 
@@ -2169,4 +2339,17 @@
 convolution kernel is returned.
 
+\begin{figure}[t]
+  \centering
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/stack_3956997_mask.png}
+  \caption{Example of the stack mask image for skycell
+    skycell.1146.095 centered at ($\alpha,\delta$) = (11.934, -4.197)
+    in the \rps{} filter, stack\_id 3956997.  The entire frame is
+    largely unmasked after combining inputs, with the only remaining
+    masks falling on the cores of bright stars, and in small regions
+    around the brightest objects where the overlapping of diffraction
+    spike masks have removed all inputs.}
+  \label{fig:stack mask image}
+\end{figure}
+
 This convolution may change the image flux scaling, so the kernel is
 normalized to account for this.  The normalization factor is equal to
@@ -2174,16 +2357,4 @@
 kernel.  The image is multiplied by this factor, and the variance by
 the square of it, scaling all inputs to the common zeropoint.
-
-\begin{figure}[t]
-  \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/stack_3956997_exp\plotopt.png}
-  \caption{Example of the stack exposure time image for skycell
-    skycell.1146.095 centered at ($\alpha,\delta$) = (11.934, -4.197)
-    in the \rps{} filter, stack\_id 3956997.  Since the input
-    exposures had exposures times of 40 and 60 seconds, the pattern
-    observed here similar to, but subtly different from the number
-    map.}
-  \label{fig:stack exp image}
-\end{figure}
 
 Once the convolution kernels are defined for each image, they are used
@@ -2218,4 +2389,17 @@
 image:
 
+\begin{figure}[t]
+  \centering
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/stack_3956997_num\plotopt.png}
+  \caption{Example of the stack number image for skycell
+    skycell.1146.095 centered at ($\alpha,\delta$) = (11.934, -4.197)
+    in the \rps{} filter, stack\_id 3956997.  This map shows
+    the number of inputs contributing to each pixel of the output
+    stack.  Again, the pattern of the inter-chip and inter-cell gaps
+    is visible, along with other mask features. }
+
+  \label{fig:stack num image}
+\end{figure}
+
 \begin{eqnarray}
   \mathrm{Stack}_\mathrm{value} &=& \sum_i\left(\mathrm{value}_\mathrm{input} \times W_\mathrm{input}\right) / \sum_\mathrm{inputs}\left(W_\mathrm{input}\right) \\
@@ -2231,17 +2415,4 @@
 The output mask value is taken to be zero (no masked bits), unless
 there were no valid inputs, in which case the BLANK mask bit is set.
-
-\begin{figure}[t]
-  \centering
-  \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/stack_3956997_expwt\plotopt.png}
-  \caption{Example of the stack weighted exposure image for skycell
-    skycell.1146.095 centered at ($\alpha,\delta$) = (11.934, -4.197)
-    in the \rps{} filter, stack\_id 3956997.  This map shows
-    the weighted average exposure time, as described in the text.  It
-    is similar to the simple exposure time map, but shows how some
-    input exposures have their contributions weighted down due to the
-    observed larger image variances.}
-  \label{fig:stack exp wtimage}
-\end{figure}
 
 Due to uncorrected artifacts that can occur on GPC1, and the fact that
@@ -2264,4 +2435,16 @@
 higher pixel value outliers than lower pixel values, as described below.
 
+\begin{figure}[t]
+  \centering
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/stack_3956997_exp\plotopt.png}
+  \caption{Example of the stack exposure time image for skycell
+    skycell.1146.095 centered at ($\alpha,\delta$) = (11.934, -4.197)
+    in the \rps{} filter, stack\_id 3956997.  Since the input
+    exposures had exposures times of 40 and 60 seconds, the pattern
+    observed here similar to, but subtly different from the number
+    map.}
+  \label{fig:stack exp image}
+\end{figure}
+
 Following the initial combination, a ``testing'' loop iterates in an
 attempt to identify outlier points.  Again, if only one input is
@@ -2309,4 +2492,17 @@
   \mathrm{limit}_\mathrm{default} &=& 4^2 \times (\sigma^2_\mathrm{input} + (0.1 \times \mathrm{value}_\mathrm{input})^2)
 \end{eqnarray}
+
+\begin{figure}[t]
+  \centering
+\SKIP \includegraphics[width=0.9\hsize,angle=0,clip]{\picdir/stack_3956997_expwt\plotopt.png}
+  \caption{Example of the stack weighted exposure image for skycell
+    skycell.1146.095 centered at ($\alpha,\delta$) = (11.934, -4.197)
+    in the \rps{} filter, stack\_id 3956997.  This map shows
+    the weighted average exposure time, as described in the text.  It
+    is similar to the simple exposure time map, but shows how some
+    input exposures have their contributions weighted down due to the
+    observed larger image variances.}
+  \label{fig:stack exp wtimage}
+\end{figure}
 
 Each input pixel is then compared against this limit, and the most
