Index: trunk/doc/release.2015/ps1.analysis/Makefile
===================================================================
--- trunk/doc/release.2015/ps1.analysis/Makefile	(revision 41323)
+++ trunk/doc/release.2015/ps1.analysis/Makefile	(revision 41324)
@@ -24,5 +24,6 @@
 PDFPICS = \
 pics/peaks.pdf \
-pics/FWHM.smooth.trend.ps1.pdf \
+pics/galplanecut.pdf \
+pics/FWHM.smooth.trend.v1.ps1.pdf \
 pics/radial.profiles.pdf \
 pics/moment.class.pdf \
Index: trunk/doc/release.2015/ps1.analysis/analysis.tex
===================================================================
--- trunk/doc/release.2015/ps1.analysis/analysis.tex	(revision 41323)
+++ trunk/doc/release.2015/ps1.analysis/analysis.tex	(revision 41324)
@@ -595,5 +595,5 @@
   Footprints                 & Y & Y & N & Y     & \ref{sec:footprints}             & All detections \\
   Moments                    & Y & Y & Y & Y     & \ref{sec:moments}                & All detections \\
-  PSF Model                  & Y & Y & Y & N$^2$ & \ref{sec:PSF.Model}              & Uses bright, unsat. stars \\
+  PSF Model                  & Y & Y & Y & N$^2$ & \ref{sec:PSF.Model}              & Selected bright stars \\
   Bright Star Profile        & Y & Y & N & Y     & \ref{sec:very.bright.star}       & Saturated Stars \\
   Radial Profiles v1         & Y & Y & N & Y     & \ref{sec:radial.profile}         & All detections \\
@@ -615,5 +615,5 @@
 \hline
 \multicolumn{5}{l}{$^1$ Background subtraction is performed by {\tt ppSub} before calling {\tt psphot}} \\
-\multicolumn{5}{l}{$^2$ PSF modeling is perform by {\tt ppSub} on the input warps before calling {\tt psphot}} \\
+\multicolumn{5}{l}{$^2$ PSF modeling is performed by {\tt ppSub} on the input warps before calling {\tt psphot}} \\
 \end{tabular}
 \end{center}
@@ -961,4 +961,5 @@
 
 \subsection{Initial Source Detection}
+\label{sec:source.detection}
 
 \subsubsection{Peak Detection}
@@ -1136,20 +1137,19 @@
   \caption{\label{fig:moments.window} Example of the biases
     encountered when measuring the second moments.  A simulated image
-    was generated using the PS1 PSF profile.  Each panel corresponds
-    to a different value of $\sigma_w$, corresponding to the window
-    FWHM values as marked.  The solid red line is the true FWHM of the
-    PSF used to generate the stars (1.4 arcsec in all cases).  The
-    blue solid line is the FWHM of the window function.  The gray dots
-    are the FWHM derived from the measured second moments for stars in
-    the image.  The median of this distribution (mag $< -10$) is
-    listed as ``obs''.  The ratio of the median FWHM to the FWHM of
-    the window function is listed as ``ratio'', while the ratio of the
-    median FWHM to the true stellar FWHM is listed as ``bias''.  The
-    dotted blue line is the target (65\% of the window function).  In
-    this example, we would choose $\sigma_w$ between 0.5 and 0.8
-    arcseconds so the dotted blue line would match the bright end of
-    the gray dots.   See discussion in the text for the choice of
-    target window.
-}
+    was generated using the PS1 PSF profile.  Panels (a) - (e)
+    corresponds to a different value of $\sigma_w$, corresponding to
+    the window FWHM values as marked.  The solid red line is the true
+    FWHM of the PSF used to generate the stars (1.4 arcsec in all
+    cases).  The blue solid line is the FWHM of the window function.
+    The gray dots are the FWHM derived from the measured second
+    moments for stars in the image.  The median of this distribution
+    (mag $< -10$) is listed as ``obs''.  The ratio of the median FWHM
+    to the FWHM of the window function is listed as ``ratio'', while
+    the ratio of the median FWHM to the true stellar FWHM is listed as
+    ``bias''.  The dotted blue line is the target (65\% of the window
+    function).  In this example, we would choose $\sigma_w$ between
+    0.5 and 0.8 arcseconds (FWHM between 2.64 and 3.52 arcseconds), so
+    the dotted blue line would match the bright end of the gray dots.
+    See discussion in the text for the choice of target window.  }
   \end{center}
 \end{figure}
@@ -1458,6 +1458,7 @@
     arcsec (blue).  The red and blue points are individual pixel
     values.  The black line shows the PSF model with radial trend of
-    the form $(1 + \kappa r^2 + r^{3.33})^{-1}$.}
-
+    the form $(1 + \kappa r^2 + r^{3.33})^{-1}$.  The models use a 1D
+    average of the 2D analytical portion of the PSF models fitted
+    to these specific stars in their standard analysis.  }
   \end{center}
 \end{figure}
@@ -1556,10 +1557,12 @@
   \includegraphics[width=\hsize]{{\picdir/moment.class}.\plotext}
   \caption{\label{fig:moment.class} Illustration of PSF star selection
-    using the second moments in $X_{\rm ccd}$ and $Y_{\rm ccd}$
-    directions.  The dominant clump is located in this diagram.
-    Galaxies tend to have a range of sizes and thus spread out above
-    the stars.  Cosmic rays also have a range of sizes, with one
-    dimension smaller than the PSF.  The red circle represents the PSF
-    star candidates. }
+    using the second moments. \textadd{Each point represents the
+      second moments in the $X_{\rm ccd}$ and $Y_{\rm ccd}$ directions
+      for sources measured in one chip (XY32) from a particular PS\,1
+      exposure (o6065g0428o)}.  The dominant clump is located in this
+    diagram \textadd{to identify the stars.}  Galaxies tend to have a range of
+    sizes and thus spread out above the stars.  Cosmic rays also have
+    a range of sizes, with one dimension smaller than the PSF.  The
+    red circle represents the PSF star candidates. }
   \end{center}
 \end{figure}
@@ -1894,5 +1897,6 @@
 sky radius.  These values are saved in the \textmod{output FITS catalog files}, but
 not sent to the PSPS.  The sky radius value is used below in the
-calculation of the Kron magnitude.
+calculation of the Kron magnitude. \note{used in both versions?}
+\note{calculated for the second pass?}
 
 \subsubsection{Kron Magnitudes}
@@ -2237,19 +2241,59 @@
 After a first pass through the image, in which the brighter sources
 above a high threshold level have been detected, measured, and
-subtracted, \ippprog{psphot} optionally begins a second pass at the image.  In
-this stage, the new peaks are detected on the image with the bright
-sources subtracted.  In this pass, the peak detection process uses the
-variance image to test the validity of the individual peaks.  All peaks
-with a significance greater than a user-defined minimum threshold are
-accepted as sources of potential interest.  
-
-The sources which are measured in this faint-source stage are clearly
-low significance detections.  The PV3 threshold for the bright source
-analysis is a signal-to-noise of 20.  The flag bit
-\code{PM_SOURCE_MODE2_PASS1_SRC} is raised for sources detected in
-this initial analysis stage.  The lower limit cutoff for the faint
-source analysis in PV3 is a signal-to-noise of 5.0.  Sources detected
-in the faint source stage are fitted with the PSF model using the
-linear, ensemble fitting process.
+subtracted, \ippprog{psphot} optionally begins a second pass at the
+image.  \textadd{Some of the steps described in the previous sections
+  are repeated in this analysis, though with some modifications as
+  discussed below.}
+
+\textadd{The source detection steps described in
+  Section~\ref{sec:source.detection} are repeated.  To start, the
+  sources detected in the previous steps are subtracted from the
+  image, and the variance enhanced by adding the variance predicted by
+  the model to the variance image, doubling the effective variance at
+  the location of previously detected sources.  As in
+  Section~\ref{sec:peaks}, the image is smoothed, but in this pass it
+  is convolved with the PSF determined above, not a place-holder
+  Gaussian.  The new peaks are detected on the smoothed image. The
+  peak detection process again uses the variance image to test the
+  significance of the individual peaks.  All peaks with a significance
+  greater than a user-defined minimum threshold are accepted as
+  sources of potential interest.  Footprints are again generated as in
+  Section~\ref{sec:footprints}.}
+
+\textadd{Next, moments are measured as in Section~\ref{sec:moments}.
+  In this pass, however, the size of the window function applied for
+  the measurement of the moments is fixed at the value determined from
+  the bright source analysis.  All sources, including those measured
+  in the bright-source analysis (which are re-added to the image and
+  their variance reset), are then simultaneously fit for their flux
+  normalizations as in Section~\ref{sec:ensemble.fitting}.  In this
+  step, the `best' model is used for each source, either a PSF model
+  or the unconvolved extended source model determined in
+  Section~\ref{sec:nonlinear.galaxy.model}.  For the newly detected
+  sources, the PSF model is used, with the position set by the
+  centroids.}
+
+\textadd{After the flux-normalization is calculated, the moments
+  are used to calculate the preliminary Kron radius and flux (see
+  Section~\ref{sec:kron.mags}).  These are in turn used to assess the
+  source sizes as in Section~\ref{sec:source.size}.  However, the
+  non-linear fitting steps for the PSF model fits
+  (Section~\ref{sec:nonlinear.psf.model}) and the extended source
+  model fits (Section~\ref{sec:nonlinear.galaxy.model}) are not
+  performed for these faint sources.  These steps are skipped for two
+  reasons: First, the non-linear fitting steps are costly in terms of
+  computation time and the faint sources usually far out-number the
+  brighter sources.  Second, since these are faint sources they do not
+  have the signal-to-noise to constrain models with many additional
+  parameters.  In addition, the positions (for PSF sources) are not
+  much improved using the non-linear fitting compared with the
+  non-parametric centroid measurement for these faint sources.
+  \note{show with a model}.}
+
+The PV3 threshold for the bright source analysis is a signal-to-noise
+of 20.  The flag bit \code{PM_SOURCE_MODE2_PASS1_SRC} is raised for
+sources detected in this initial analysis stage.  The lower limit
+cutoff for the faint source analysis in PV3 is a signal-to-noise of
+5.0.
 
 In the \ippprog{psphotStack} version of the code, the 5 filter images
@@ -2333,6 +2377,6 @@
     pointing compared to the next 17 images, after correction for a
     relative zero point, as a function of the instrumental magnitudes
-    above the detection threshold.  Black dots are from stars for
-    which both measurements have {\tt PSF\_QF} $> 0.95$, while grey
+    above the detection threshold.  Gray dots are from stars for
+    which both measurements have {\tt PSF\_QF} $> 0.95$, while light red
     dots have lower {\tt PSF\_QF} values.  The top three panels (a) -
     (c) show histograms in three magnitude ranges for the magnitude
@@ -3066,15 +3110,16 @@
  \includegraphics[width=\hsize,clip]{\picdir/{galaxy.exp.complete}.\plotext}
  \includegraphics[width=\hsize,clip]{\picdir/{galaxy.dev.complete}.\plotext}
-  \caption{\label{fig:galaxy.complete} Top: Completeness curves for
-    simulated galaxies with Exponential profiles.  Bottom:
-    Completeness curves for simulated galaxies with DeVaucouleur
-    profiles.  The curves are shown as a function of the difference
-    between the injected instrumental magnitude of the galaxy and the
-    magnitude corresponding to the $5\sigma$ detection threshold for a
-    PSF-like source.  The black curves shows the compleness for all
-    galaxies.  The three colored curves show the completeness for
-    three major axis ranges. Compact galaxies are more likely to be
-    detected since peaks are detected after convolution with the
-    PSF. }
+  \caption{\label{fig:galaxy.complete} {\bf Panel (a):} Completeness
+    curves for simulated galaxies with Exponential profiles.  {\bf
+      Panel (b):} Completeness curves for simulated galaxies with
+    DeVaucouleur profiles.  The curves are shown as a function of the
+    difference between the injected instrumental magnitude of the
+    galaxy and the magnitude corresponding to the $5\sigma$ detection
+    threshold for a PSF-like source.  The black curves shows the
+    compleness for all galaxies.  The three colored curves show the
+    completeness for three major axis ranges. Compact galaxies are
+    more likely to be detected since peaks are detected after
+    convolution with the PSF. \textadd{The simulated images have seeing of
+    1\arcsec, equal to pixels.}}
   \end{center}
 \end{figure}
@@ -3084,8 +3129,12 @@
 the Exponential and DeVaucouleur models, respectively.  
 Both figures show the reliability of the measured magnitudes, major
-and minor axis sizes, and ellipticities.  For all recovered
+and minor axis sizes, and \textadd{ellipticities, which we represent as
+$\frac{R_{\rm Major} - R_{\rm Minor}}{R_{\rm Major} + R_{\rm
+    Minor}}$. Galaxies are grouped in 0.1 magnitude bins based
+on their injected magnitudes.  
+For all recovered
 parameters, the standard deviation of the difference between the
-measured parameter and the truth value is shown for all galaxies as a
-function of magnitude, as well as for subsets in major-axis ranges.
+measured parameter and the truth value is shown for all galaxies in
+each magnitude bin, as well as for subsets in major-axis ranges.}
 The mean of the difference, illustrating any biases, is also given
 for all galaxies.  The comparison for the major and minor axis sizes
@@ -3106,6 +3155,19 @@
   \begin{center}
  \includegraphics[width=\hsize,clip]{\picdir/{galaxy.exp.params}.\plotext}
+
   \caption{\label{fig:exp.params} Parameter recovery for simulated
-    galaxies with Exponential profiles.  }
+    galaxies with Exponential profiles.  In each panel, we show
+    several statistics for the difference between the truth parameter
+    and the measured value for galaxies in a series of brightness
+    bins, ranging from 5 magnitudes to 0.5 magnitudes brighter than
+    the PSF $5-\sigma$ detection threshold.  Statistics, as shown in
+    the legend, include the average difference, the standard deviation
+    for all galaxies in the bin, and the standard deviations for 3
+    major axis ranges.  Panel (a) through (d) show in order the
+    recovered magnitudes, ellipticity, major axis size; minor axis
+    size.  Panels (e) and (f) show statistics for the major and minor
+    axis difference as a fraction of the truth value.  The average
+    magnitude difference is plotted so that positive numbers mean the
+    fitted flux is brighter than the injected flux.  }
   \end{center}
 \end{figure*}
@@ -3116,5 +3178,6 @@
  \includegraphics[width=\hsize,clip]{\picdir/{galaxy.dev.params}.\plotext}
   \caption{\label{fig:dev.params} Parameter recovery for simulated
-    galaxies with DeVaucouleur profiles.  } 
+    galaxies with DeVaucouleur profiles.  See
+    Figure~\ref{fig:exp.params} for complete explanation.} 
   \end{center}
 \end{figure*}
Index: trunk/doc/release.2015/ps1.analysis/response.txt
===================================================================
--- trunk/doc/release.2015/ps1.analysis/response.txt	(revision 41323)
+++ trunk/doc/release.2015/ps1.analysis/response.txt	(revision 41324)
@@ -77,5 +77,5 @@
 state the same for galaxy astrometry, fluxes and colors.
 
-****
+**** TBD
 
 A detail of the code is presented (variable names, etc) that imply
@@ -96,5 +96,5 @@
 that the photometric goals are achieved
 
-**** see note section Forced PSF Phot
+**** TBD see note section Forced PSF Phot
 
 - Sec 7, where the image differencing detections and photometry is used
@@ -437,5 +437,5 @@
 range.
 
-**** TDB: was the turned on for PV3?
+**** TBD: was the turned on for PV3?
 
 Sec 4.7:
@@ -719,5 +719,5 @@
 each of the sub-panels (a), (b), etc, and describe in the caption.
 
-**** TBD: fixed for Figures 2, 5, 6 TBD: 8, 9, 10
+** fixed for Figures 2, 5, 6, 8, 9, 10
 
 Figure 2:
@@ -746,5 +746,5 @@
 particular stars
 
-**** TBD: NEED to examine how figure was created
+** the lines are a 1D average of the PSF models fitted to these stars (added to caption)
 
 Figure 4:
@@ -752,5 +752,5 @@
 denoted by a point.
 
-**** TBD
+** updated the caption
 
 Figures 5 and 6:
@@ -766,5 +766,5 @@
 - Caption should specify the seeing of these images (not in the text either).
 
-**** TBD
+** added to caption and text
 
 Figures 8 and 9:
@@ -774,5 +774,5 @@
 in the text. The other 4 panels could refer to the explanation in Sec 5.5.
 
-**** TBD
+** captions update to be more informative.
 
 References:
