IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39946


Ignore:
Timestamp:
Jan 14, 2017, 5:06:45 PM (10 years ago)
Author:
eugene
Message:

updates to the text and layout

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/release.2015/ps1.analysis/analysis.tex

    r39940 r39946  
    8585\begin{abstract}
    8686
    87 Over 3 billion astronomical objects have been detected in the more
     87Over 3 billion astronomical sources have been detected in the more
    8888than 22 million orthogonal transfer CCD images obtained as part of the
    8989Pan-STARRS\,1 $3\pi$ survey.  Over 85 billion instances of those
    90 objects have been automatically detected and characterized by the
     90sources have been automatically detected and characterized by the
    9191Pan-STARRS Image Processing Pipeline photometry software,
    9292\code{psphot}.  This fast, automatic, and reliable software was
    9393developed for the Pan-STARRS project, but is easily adaptable to
    9494images from other telescopes.  We describe the analysis of the
    95 astronomical objects by \code{psphot} in general as well as for the
     95astronomical sources by \code{psphot} in general as well as for the
    9696specific case of the 3rd processing version used for the first public
    9797release of the Pan-STARRS $3\pi$ survey data.
     
    180180and photometric measurements and the high data rate (and a finite
    181181computing budget) mean that the process of detecting, classifying, and
    182 measuring the astronomical objects in the image data stream in a
     182measuring the astronomical sources in the image data stream in a
    183183timely fashion are a significant challenge.
    184184
    185 In order to achieve these ambitious goals, the object detection,
     185In order to achieve these ambitious goals, the source detection,
    186186classification, and measurement process must be both precise and
    187187efficient.  Not only is it necessary to make a careful measurement of
    188 the flux of individual objects, it is also critical to characterize
     188the flux of individual sources, it is also critical to characterize
    189189the image point-spread-function, and its variations across the field
    190190and from image to image.  Since comparisons between images must be
     
    192192astrometry.
    193193
    194 A variety of astronomical software packages perform the basic object
     194A variety of astronomical software packages perform the basic source
    195195detection, measurement, and classification tasks needed by the
    196196Pan-STARRS IPP.  Each of these programs have their own advantages and
     
    211211  automated fashion, does it handle 2D variations well? \citep{1987PASP...99..191S}.
    212212
    213 \item Sextractor : pure aperture measurement with rudimentary object
     213\item Sextractor : pure aperture measurement with rudimentary source
    214214  subtraction.  pro: fast, widely used, easy to automate.  con: poor
    215   object separation in crowded regions, PSF-modeling was only in beta,
     215  source separation in crowded regions, PSF-modeling was only in beta,
    216216  not widely used at the time \citep{sextractor}.
    217217
    218 \item galfit : detailed galaxy modeling.  not a multi-object PSF
     218\item galfit : detailed galaxy modeling.  not a multi-source PSF
    219219  analysis tool.  con: does not provide a PSF model, not easily
    220220  automated.  very detailed results in very slow processing.  only a
     
    233233re-integrated into the Pan-STARRS pipeline.  A new photometry analysis
    234234package was developed using lessons learned from the existing
    235 photometry systems.  In the process, the object analysis software was
     235photometry systems.  In the process, the source analysis software was
    236236written using the data analysis C-code library written for the IPP,
    237237\code{psLib}.  Components of the photometry code were integrated into
     
    285285\begin{itemize}
    286286\item {\bf 10 millimagnitude photometric accuracy}.  For PSPhot, this
    287   implies that the measured photometry of stellar objects must be
     287  implies that the measured photometry of stellar sources must be
    288288  substantially better than this 10 mmag since the photometry error
    289289  per image is combined with an error in the flat-field calibration
     
    299299  astrometric calibration depends on the consistency of the individual
    300300  measurements.  The measurements from PSPhot must be sufficiently
    301   representative of the true object position to enable astrometric
     301  representative of the true source position to enable astrometric
    302302  calibration at the 10mas level.  The error in the individual
    303303  measurements will be folded together with the errors introduced by
     
    329329
    330330\item {\bf Flexible non-PSF models} PSPhot must be able to represent
    331   PSF-like objects as well as non-PSF sources (e.g., galaxies).  It
    332   must be easy to add new object models as interesting representations
     331  PSF-like sources as well as non-PSF sources (e.g., galaxies).  It
     332  must be easy to add new source models as interesting representations
    333333  of sources are invented.
    334334
     
    357357
    358358\begin{enumerate}
    359 \item {\bf Image preparation} Load data, characterize the image
     359\item {\bf Image Preparation} Load data, characterize the image
    360360  background, load or construct variance and mask images.
    361361
    362 \item {\bf Initial object detection} Smooth, find peaks, measure basic
     362\item {\bf Initial Source Detection} Smooth, find peaks, measure basic
    363363  properties.
    364364
    365 \item {\bf PSF determination} Select PSF candidates, perform model
     365\item {\bf PSF Determination} Select PSF candidates, perform model
    366366  fits, build PSF model from fits, select best PSF model class.
    367367
    368 \item {\bf Bright object analysis} Fit objects with PSFs, determine
    369   PSF validity, subtract PSF-like objects, fit non-PSF model(s),
     368\item {\bf Bright Source Analysis} Fit sources with PSFs, determine
     369  PSF validity, subtract PSF-like sources, fit non-PSF model(s),
    370370  select best model class, subtract model.
    371371
    372 \item {\bf Low S/N sources} Detect low-level sources, measure
     372\item {\bf Faint Source Analysis} Detect low-level sources, measure
    373373  properties (aperture or PSF)
    374374
     
    379379  aperture variations, and background-error corrections. 
    380380
    381 \item {\bf Output} Write out objects in selected format, write out
     381\item {\bf Output} Write out sources in selected format, write out
    382382  difference image, variance image, etc, as selected.
    383383\end{enumerate}
     
    389389case the PSF modeling stage can be skipped.
    390390
     391{\bf A note on nomenclature:}
     392
    391393\subsection{Image Preparation}
    392394
    393395The first step is to prepare the image for detection of the
    394 astronomical objects.  We need three separate images: the measured
     396astronomical sources.  We need three separate images: the measured
    395397flux (signal image), the corresponding variance image, and a mask
    396398defining which pixels are valid and which should be ignored.  The
     
    405407be constructed automatically by PSPhot.
    406408
    407 The mask is represented as 16-bit integer image in which a value of 0
    408 represents a valid pixel.  Each of the 16 bits define different
     409The mask is represented as a 16-bit integer image in which a value of
     4100 represents a valid pixel.  Each of the 16 bits define different
    409411reasons a pixel should be ignored.  This allows us to optionally
    410412respect or ignore the mask depending on the circumstance.  For
     
    413415saturated pixel.  In addition, the mask pixels are used to define the
    414416pixels available during a model fit, and which should be ignored for
    415 that specific fit.  The initial mask, if not supplied by the user, is
    416 constructed by default from the image by applying three rules: 1)
    417 Pixels which are above a specified saturation level are marked as
    418 saturated (configuration keyword: \code{SATURATE}).  2) Pixels which
    419 are below a user-defined value are considered unresponsive and masked
    420 as dead.  3) Pixels which lie outside of a user-defined coordinate
    421 window are considered non-data pixels (eg, overscan) and are marked as
    422 invalid.  The valid window is defined by the configuration variables
    423 \code{XMIN}, \code{XMAX}, \code{YMIN}, \code{YMAX}.
    424 
    425 PSPhot (and other IPP) functions understand two types of masked
    426 pixels: ``bad'' and ``suspect''.  Bad pixels are those which should
    427 not be used in any operations, while suspect pixels are those for
    428 which the reported signal may be contaminated or biased, but may be
    429 useable in some contexts.  For example, a pixel with poor charge
     417that specific fit (\code{MARK = 0x8000}).  The initial mask, if not
     418supplied by the user, is constructed by default from the image by
     419applying three rules: 1) Pixels which are above a specified saturation
     420level are marked as saturated.  The level is specified by the camera
     421format keyword \code{CELL.SATURATION}, which may specify a value or
     422define a header keyword which in turn specifies the value in the image
     423header.  In the case of PS1 PV3, the header keyword \code{MAXLIN}
     424specifies the saturation level for each chip. \note{refer to detrend
     425  paper here?  what are GPC1 saturation levels?}. 2) Pixels which are
     426below a user-defined value are considered unresponsive and masked as
     427dead.  (camera format keyword \code{CELL.BAD} = 0 for PS1 PV3).  3)
     428Pixels which lie outside of a user-defined coordinate window are
     429considered non-data pixels (eg, overscan) and are marked as invalid.
     430(psphot recipe keywords \code{XMIN}, \code{XMAX}, \code{YMIN},
     431\code{YMAX}, all set to 0 for PS1 PV3 -- invalid pixels were specified
     432for PS1 PV3 with a supplied mask image, see \cite{waters2017}.
     433
     434The library functions used by \code{psphot} understand two types of
     435masked pixels: ``bad'' and ``suspect''.  Bad pixels are those which
     436should not be used in any operations, while suspect pixels are those
     437for which the reported signal may be contaminated or biased, but may
     438be useable in some contexts.  For example, a pixel with poor charge
    430439transfer efficiency is likely to be too untrustworthy to use in any
    431440circumstance, while a pixel in which persistence ghosts have been
     
    465474\end{table*}
    466475
    467 The variance image, if not supplied is constructed by default from the
    468 flux image using the configuration supplied values of \code{GAIN} and
    469 \code{READ_NOISE} to calculate the appropriate Poisson statistics for
    470 each pixel.  In this case, the image is assumed to represent the
    471 readout from a single detector, with well-defined gain and read noise
    472 characteristics.  This assumption is not always valid.  For example,
    473 if the input flux image is the result of an image stack with a
    474 variable number of input measurements per pixel (due to masking and
    475 dithering), the variance cannot be calculated from the signal image
    476 alone.  It is necessary in such a case to supply a variance image which
    477 accurately represents the variance as a function of position in the
    478 image.
     476The variance image, if not supplied, is constructed by default from
     477the flux image using the configuration supplied gain and read noise
     478values to calculate the appropriate Poisson statistics for each pixel.
     479The parameters are determined based on the camera format keywords
     480\code{CELL.GAIN} and \code{CELL.READNOISE}, which in the case of PS1
     481PV3 refer to the header keywords \code{GAIN} and \code{RDNOISE}.  In
     482this case, the image is assumed to represent the readout from a single
     483detector, with well-defined gain and read noise characteristics.  This
     484assumption is not always valid.  For example, if the input flux image
     485is the result of an image stack with a variable number of input
     486measurements per pixel (due to masking and dithering), the variance
     487cannot be calculated from the signal image alone.  It is necessary in
     488such a case to supply a variance image which accurately represents the
     489variance as a function of position in the image.
    479490
    480491Some image processing steps introduce cross-correlation between pixel
     
    489500covariance image is prohibitive. 
    490501
     502\note{describe the way we handle covariance}
     503
    491504Before sources are detected in the image, a model of the background is
    492505subtracted.  The image is divided into a grid of background points
    493 with a spacing of 400 pixels.  Superpixels of size $800\times 800$
    494 pixels are used to measure the local background for each background
    495 grid point, thus over-sampling the background spatial variations by a
    496 factor of 2.  In the interest of speed, 10,000 randomly selected {\em
    497   unmasked} pixels in these regions are sampled to determine the
    498 background.  Bilinear interpolation is used to generate a
    499 full-resolution image from the grid of background points, and this
    500 image is then subtracted from the science image.  The background image
    501 and the background standard deviation image are kept in memory from
    502 which the values of \code{SKY} and \code{SKY_SIGMA} are calculated for
    503 each object in the output catalog.  See also the discussion in
    504 \cite{waters2017}.
    505 
    506 \subsection{Initial Object Detection}
     506with a spacing defined by the psphot recipe values
     507\code{BACKGROUND.XBIN, BACKGROUND.YBIN}, set to 400 pixels for PS1
     508PV3.  Superpixels of size \code{BACKGROUND.XSAMPLE,
     509  BACKGROUND.YSAMPLE} ($2 \times 2$ for PS1 PV3) times larger than
     510this spacing are used to measure the local background for each
     511background grid point, thus over-sampling the background spatial
     512variations.  In the interest of speed, a subset of \code{IMSTATS_NPIX}
     513(10,000 for PS1 PV3) randomly selected {\em unmasked} pixels in these
     514regions are used to determine the background.  The background value
     515for each superpixel is determined by fitting a Gaussian distribution
     516to the histogram of pixels values. 
     517
     518If the image were empty of stars and only contained flux from a
     519uniform background sky, we would expect the distribution to be Poisson
     520distributed, and in general in a high-enough signal range to be
     521essentially Gaussian.  We fit a symmetric Gaussian to all histogram
     522bins within 15\% of the peak bin value to determine the mean and
     523standard deviation values for the background. 
     524
     525If, however, the sky is not empty of stars or other sources, and we
     526have correctly masked the large majority of non-responsive pixels,
     527then we expect the flux distribution of the pixels to be asymmetric
     528with a Gaussian core representing the sky and a tail to the high end
     529representing the pixels with astronomical source flux contributions.
     530We would like to determine the mean of the underlying Gaussian without
     531suffering bias from the stellar flux.  We thus perform a second
     532Gaussian fit using an asymmetric subset of the histogram pixels,
     533fitting those histogram bins which are left of the peak but above 25\% of
     534the peak value, or right of the peak but above 50\% of the peak
     535value. 
     536
     537If the fit to the asymmetric lower fraction of the curve is less than
     538the symmetric fit, but greater than the above lower-bound of the full
     539symmetric fit, then the lower fraction value is kept as the true mean
     540sky value for this superpixel.
     541
     542Bilinear interpolation is used to generate a full-resolution image
     543from the grid of background points, and this image is then subtracted
     544from the science image.  The background image and the background
     545standard deviation image are kept in memory from which the values of
     546\code{SKY} and \code{SKY_SIGMA} are calculated for each source in the
     547output catalog.  See also the discussion in \cite{waters2017}.
     548
     549\note{give examples with simulations and show examples of over-subtraction}
     550
     551\subsection{Initial Source Detection}
    507552
    508553\subsubsection{Peak Detection}
    509554\label{sec:peaks}
    510555
    511 The objects are initially detected by finding the location of local
     556\note{add a ref to the Kaiser paper}
     557
     558The sources are initially detected by finding the location of local
    512559peaks in the image.  The flux and variance images are smoothed with a
    513560small circularly symmetric kernel using a two-pass 1D Gaussian.  The
     
    516563the covariance, if known. At this stage, the goal is only to detect
    517564the brighter sources, above a user defined S/N limit (configuration
    518 keyword: \code{PEAKS_NSIGMA_LIMIT}).  A maximum of
    519 \code{PEAKS_NMAX} are found at this stage.  The detection efficiency
    520 for the brighter sources is not strongly dependent on the form of this
    521 smoothing function.
     565keyword: \code{PEAKS_NSIGMA_LIMIT} = 20.0 for PS1 PV3).  A maximum of
     566\code{PEAKS_NMAX} (5000 of PS1 PV3) are found at this stage.  The
     567detection efficiency for the brighter sources is not strongly
     568dependent on the form of this smoothing function.
    522569
    523570The local peaks in the smoothed image are found by first detecting
     
    529576any of the other 8 pixels is kept if the pixel $X$ and $Y$ coordinates
    530577are greater than or equal to the other equal value pixels.  This
    531 simple rule set means that a flat-topped region will maintain peaks at
     578simple rule set means that a flat-topped region will result peaks at
    532579the maximum $X$ and $Y$ corners of the region.
    533580
     
    585632\end{eqnarray}
    586633
     634The resulting peak position, ($x_{min}, y_{min}$), is used as the
     635default starting coordinate for the source.  Later in the
     636\code{psphot} analysis, improved measurements of the source positions
     637are calculated as discussed below.
     638
    587639\begin{figure}[htbp]
    588640  \begin{center}
     
    601653formally significant, but are not locally significant.  It first
    602654generates a set of ``footprints'', contiguous collections of pixels in
    603 the smoothed significance image above the detection threshold.  These
    604 regions are grown by a small amount to avoid errors on rough edges --
    605 an image of the footprints is convolved with a disk of radius 3
    606 pixels.  Peaks are assigned to the footprints in which they are
    607 contained (note by definition all peaks must be located in a
    608 footprint). 
     655the smoothed significance image above the detection threshold
     656(\code{PEAKS_NSIGMA_LIMIT}).  These regions are grown by a small
     657amount to avoid errors on rough edges -- an image of the footprints is
     658convolved with a disk of radius \code{FOOTPRINT_GROW_RADIUS} (= 3
     659pixels for PS1 PV3).  Peaks are assigned to the footprints in which
     660they are contained (note by construction all peaks must be located in
     661a footprint since the peaks must be above the detection threshold).
    609662
    610663For any peak which is not the brightest peak in that footprint it is
     
    613666{\em key col} for this peak (as used in topographic descriptions of a
    614667mountain).  If the key col for a given peak is less than
    615 \code{FOOTPRINT_CULL_NSIGMA_DELTA} (4.0) sigmas below the peak of
    616 interest, the peak is considered to be {\em locally insignificant} and
    617 removed from the list of possible detections (see
     668\code{FOOTPRINT_CULL_NSIGMA_DELTA} (4.0 for PS1 PV3) sigmas below the
     669peak of interest, the peak is considered to be {\em locally
     670  insignificant} and removed from the list of possible detections (see
    618671Figure~\ref{fig:peaks}).  In the vicinity of a saturated star, the
    619 rule is somewhat more agressive as the flat-topped or structured
     672rule is somewhat more aggressive as the flat-topped or structured
    620673saturated top of a bright star may appear as multiple peaks with
    621674highly significant cols between them.  However, this is an artifact of
    622 the proximity to saturation.  In this regime, we require the col to
    623 also be a fixed fraction (5\%) of the saturation below the peak to
    624 avoid being marked as locally insignificant.
    625 
    626 \subsubsection{Centroid and higher-order Moments}
     675the proximity to saturation.  Sources for which the peak is greater
     676than 50\% of the saturation value require the col to also be a fixed
     677fraction (5\%) of the saturation below the peak to avoid being marked
     678as locally insignificant.
     679
     680\subsubsection{Centroid and Higher-Order Moments}
    627681\label{sec:moments}
    628682
     
    645699
    646700Once a collection of peaks has been identified, a number of basic
    647 properties of the objects related to the first and second moments are
    648 measured.  Below, the second moments are used to select candidate
    649 stellar sources to be used in modeling the PSF.
     701properties of the sources related to the first, second, and higher
     702moments are measured.  Below, the second moments are used to select
     703candidate stellar sources to be used in modeling the PSF.
    650704
    651705In order to measure the moments, it is necessary to define an
    652706appropriate aperture in which the moments are measured.  We also apply
    653 a ``window function'', down-weighting the pixels by a Gaussian of size
    654 $\sigma_W$ which is chosen to be large compared to the PSF size,
    655 $\sigma_{\rm PSF}$.  This
    656 window function reduces the noise of the measurement of the first and
    657 second moments by suppressing the noisy pixels at high radial distance
    658 as well as by reducing the contaminating effects of neighboring stars.
    659 The choice of the window function $\sigma_W$ and the aperture is an
    660 iterative process: for a given value of $\sigma_W$, the PSF stars will
    661 have a measured value of $\sigma_{\rm PSF}$ which is modified by the effect of
    662 the window function.  In addition, depending on the size of the window
    663 function compared to the true PSF size, the measured value of the PSF
    664 size, $\sigma_{\rm PSF}$, will be biased high or low depending on the
    665 signal-to-noise of the object. 
     707a ``window function'', down-weighting the pixels by a Gaussian,
     708centered on the object, with size $\sigma_W$ chosen to be large
     709compared to the PSF size, $\sigma_{\rm PSF}$.  This window function
     710reduces the noise of the measurement of the moments by suppressing the
     711noisy pixels at high radial distance as well as by reducing the
     712contaminating effects of neighboring stars.  The choice of $\sigma_W$
     713and the aperture is an iterative process: for a given value of
     714$\sigma_W$, the PSF stars will have a measured value of the PSF size,
     715$\sigma^{\prime}_{\rm PSF}$ which different from the true value due to
     716the effect of the window function.  The measured value of the PSF size
     717will be biased high or low depending on both the signal-to-noise of
     718the source and the size of the window function compared to the true
     719PSF size.
    666720
    667721These effects are illustrated in Figure~\ref{fig:moments.window} using
    668722simulated data.  An image was generated with a PSF model matching the
    669 radial profile of the PS1 PSF model with a FWHM of 1.4 arcseconds.  As
    670 the window function $\sigma_W$ is increased, the measured FWHM for the
    671 bright simulated stars rises to meet the truth value.  For small
    672 values of $\sigma_W$, fainter stars are biased to low measured values
    673 of the FWHM.  For large values of $\sigma_W$, the faint stars are
    674 biased to higher values and the scatter increases.
     723radial profile of the PS1 PSF model with $\sigma_{\rm PSF}$
     724corresponding to a FWHM of 1.4 arcseconds.  As the window function
     725$\sigma_W$ is increased, the measured FWHM for the bright simulated
     726stars rises to meet the truth value.  For small values of $\sigma_W$,
     727fainter stars are biased to low measured values of the FWHM.  For
     728large values of $\sigma_W$, the faint stars are biased to higher
     729values and the scatter increases.
    675730
    676731In a real image, we do not know the true value of the PSF size.  If we
     
    681736artifacts) and (2) the brighter stars are themselves subject to
    682737additional biases due to saturation and other non-linear effects
    683 (c.f., ``the Brighter-Fatter'' effect, REF).  To make a robust
    684 choice for the window function $sigma_w$, we choose a value
    685 such that the measured value of $\sigma_{\rm PSF}$ is 65\% of
    686 $\sigma_w$.  The resulting second moment values are biased somewhat
    687 low (\approx 75\% of the truth value for the PS1 PSF profile), but are
    688 relatively unbiased as a function of brightness.
    689 
    690 To choose the value of $\sigma_W$, we try values of (1, 2, 3, 4.5, 6,
    691 9, 12, 18) pixels $\approx$ (0.26, 0.51, 0.77, 1.15, 1.54, 2.3, 3.1,
    692 4.6) arcseconds.  For each of these values, we then select candidate
    693 PSF stars based on the distribution of the measured $\sigma_{x,x},
    694 \sigma_{y,y}$ values.  For each test value of $\sigma_w$, we determine
    695 the ratio $f = \frac{\sigma_{x,x} + \sigma{y,y}}{2 \sigma_w}$, i.e.,
    696 the ratio of the window size to the observed PSF size.  We interpolate
    697 to find a value of $\sigma_W$ for which $f$ is expected to be 0.65.
    698 We call this value the \code{MOMENTS_GAUSS_SIGMA}.  We use an aperture
    699 with a radius of \code{PSF_MOMENTS_RADIUS} = 4$\times$
    700 \code{MOMENTS_GAUSS_SIGMA} to select the pixels for the measurement.
    701 
    702 Once \code{PSF_MOMENTS_SIGMA} has been determined, moments are
    703 measured as defined below. 
     738(c.f., ``the Brighter-Fatter'' effect, \note{REF}).  To make a robust
     739choice for $\sigma_w$, we choose a value such that the measured value
     740of $\sigma^{\prime}_{\rm PSF}$ is 65\% of $\sigma_w$.  The resulting second
     741moment values are biased somewhat low (\approx 75\% of the truth value
     742for the PS1 PSF profile), but are relatively unbiased as a function of
     743brightness.
     744
     745To choose the value of $\sigma_W$, we try a sequence of values
     746spanning a range guaranateed to contain any reasonable seeing values.
     747The values are specified in the \code{psphot} recipe as
     748\code{PSF.SIGMA.VALUES} and have the following values for PS1 PV3: (1,
     7492, 3, 4.5, 6, 9, 12, 18) pixels $\approx$ (0.26, 0.51, 0.77, 1.15,
     7501.54, 2.3, 3.1, 4.6) arcseconds.  For each of these $\sigma_W$ values,
     751we then select candidate PSF stars based on the distribution of the
     752measured $\sigma^{\prime}_{\rm PSF}$ in the two principal directions:
     753$\sigma_{x,x}$ and $\sigma_{y,y}$ (see
     754Section~\ref{sec:psf.source.selection}, below).  For each test value
     755of $\sigma_w$, we determine the ratio $\rho_\sigma =
     756\frac{\sigma_{x} + \sigma{y}}{2 \sigma_w}$, i.e., the ratio of the
     757window size to the observed PSF size.  We interpolate to find a value
     758of $\sigma_W$ for which $\rho_\sigma$ is expected to be 0.65.  We use
     759an aperture with a radius of 4$\sigma_w$ to select the pixels for the
     760measurement of the moments.
     761
     762Once $\sigma_w$ has been determined, moments are measured as defined
     763below.
    704764
    705765\begin{eqnarray}
    706 x_0      & = & \frac{1}{S} \sum_i (f_i - s_i)x_i w_i \\
    707 y_0      & = & \frac{1}{S} \sum_i (f_i - s_i)y_i w_i \\
    708 M_{xx}   & = & \frac{1}{S} \sum_i (f_i - s_i)(x_i - x_0)^2w_i \\
    709 M_{xy}   & = & \frac{1}{S} \sum_i (f_i - s_i)(x_i - x_0)(y_i - y_0)w_i \\
    710 M_{yy}   & = & \frac{1}{S} \sum_i (f_i - s_i)(y_i - y_0)^2w_i \\
    711 M_{xxx}  & = & \frac{1}{S} \sum_i (f_i - s_i)(x_i - x_0)^3w_i / r_i \\
    712 M_{xxy}  & = & \frac{1}{S} \sum_i (f_i - s_i)(x_i - x_0)^2(y_i - y_0)w_i / r_i \\
    713 M_{xyy}  & = & \frac{1}{S} \sum_i (f_i - s_i)(x_i - x_0)(y_i - y_0)^2w_i / r_i \\
    714 M_{yyy}  & = & \frac{1}{S} \sum_i (f_i - s_i)(y_i - y_0)^3w_i / r_i \\
    715 M_{xxxx} & = & \frac{1}{S} \sum_i (f_i - s_i)(x_i - x_0)^4w_i / r^2_i \\
    716 M_{xxxy} & = & \frac{1}{S} \sum_i (f_i - s_i)(x_i - x_0)^3(y_i - y_0)w_i / r^2_i \\
    717 M_{xxyy} & = & \frac{1}{S} \sum_i (f_i - s_i)(x_i - x_0)^2(y_i - y_0)^2w_i / r^2_i \\
    718 M_{xyyy} & = & \frac{1}{S} \sum_i (f_i - s_i)(y_i - y_0)(y_i - y_0)^3w_i / r^2_i \\
    719 M_{yyyy} & = & \frac{1}{S} \sum_i (f_i - s_i)(y_i - y_0)^4w_i / r^2_i
     766x_0      & = & \frac{1}{S} \sum_i w_i (f_i - s_i)x_i \\
     767y_0      & = & \frac{1}{S} \sum_i w_i (f_i - s_i)y_i \\
     768M_{xx}   & = & \frac{1}{S} \sum_i w_i (f_i - s_i)(x_i - x_0)^2 \\
     769M_{xy}   & = & \frac{1}{S} \sum_i w_i (f_i - s_i)(x_i - x_0)(y_i - y_0) \\
     770M_{yy}   & = & \frac{1}{S} \sum_i w_i (f_i - s_i)(y_i - y_0)^2 \\
     771M_{xxx}  & = & \frac{1}{S} \sum_i \frac{w_i}{r_i} (f_i - s_i)(x_i - x_0)^3 \\
     772M_{xxy}  & = & \frac{1}{S} \sum_i \frac{w_i}{r_i} (f_i - s_i)(x_i - x_0)^2(y_i - y_0) \\
     773M_{xyy}  & = & \frac{1}{S} \sum_i \frac{w_i}{r_i} (f_i - s_i)(x_i - x_0)(y_i - y_0)^2 \\
     774M_{yyy}  & = & \frac{1}{S} \sum_i \frac{w_i}{r_i} (f_i - s_i)(y_i - y_0)^3 \\
     775M_{xxxx} & = & \frac{1}{S} \sum_i \frac{w_i}{r^2_i} (f_i - s_i)(x_i - x_0)^4 \\
     776M_{xxxy} & = & \frac{1}{S} \sum_i \frac{w_i}{r^2_i} (f_i - s_i)(x_i - x_0)^3(y_i - y_0) \\
     777M_{xxyy} & = & \frac{1}{S} \sum_i \frac{w_i}{r^2_i} (f_i - s_i)(x_i - x_0)^2(y_i - y_0)^2 \\
     778M_{xyyy} & = & \frac{1}{S} \sum_i \frac{w_i}{r^2_i} (f_i - s_i)(y_i - y_0)(y_i - y_0)^3 \\
     779M_{yyyy} & = & \frac{1}{S} \sum_i \frac{w_i}{r^2_i} (f_i - s_i)(y_i - y_0)^4
    720780\end{eqnarray}
    721781where $f_i$ is the flux in a pixel; $s_i$ is the local sky value for
     
    723783$S = \sum_i (f_i - s_i) w_i$ is the window-weighted sum of the source
    724784flux, used to re-normalize the moments; $r_i$ is the radius of a
    725 pixel, $\sqrt{(x_i - x_0)^2 + (y_i - y_0)^2}$; The sum is performed
    726 over all pixels in the aperture.  For the centroid calculation ($x_0,
     785pixel, $\sqrt{(x_i - x_0)^2 + (y_i - y_0)^2}$; The sums are performed
     786over all (unmasked) pixels in the aperture.  For the centroid calculation ($x_0,
    727787y_0$), the peak coordinate (see~\ref{sec:peaks}) is used to define the
    728788aperture and the window function; for higher order moments, the
    729789centroid is used to center the window function.
    730790
    731 If the measured centroid coordinates ($x_0, y_0$) differs from the
    732 peak coordinates be a large amount (\code{MOMENT_RADIUS}), then the
    733 peak is identified as being of poor quality and is rejected.  In
    734 both of these cases, it is likely that the `peak' was identified in a
    735 region of flat flux distribution or many saturated or edge pixels.
    736 
    737 In addition to the moments above, a preliminary Kron radius and flux
    738 are also calculated at this stage.  In this analysis, the 1st and
    739 half-radial moments are calculated:
     791If the measured centroid coordinates ($x_0, y_0$) differ from the peak
     792coordinates be a large amount (1.5$\sigma_w$), then the peak is
     793identified as being of poor quality (\code{infoFlag} bit
     794\code{MOMENTS_FAILURE}) and is skipped in further analyses.  In such
     795as case, it is likely that the `peak' was identified in a region of
     796flat flux distribution or many saturated or edge pixels.
     797
     798In addition to the moments above, the 1st and half-radial moments,
     799$M_r$ and $M_h$ as defined below, are calculated:
    740800\begin{eqnarray}
    741801M_r & = & \frac{1}{S} \sum_i (f_i - s_i)r_i \\
     
    745805these moments.
    746806
    747 The Kron radius \citep{1980ApJS...43..305K} is defined the be
    748 2.5$\times$ the first radial moment.  The Kron flux is the sum of
    749 (sky-subtracted) pixel fluxes within the Kron radius.  We also
    750 calculate the flux in two related annular apertures: the Kron inner
    751 flux is the sum of pixel values for the annulus $R_1 < r < 2.5 R_1$,
    752 while the Kron outer flux is the sum of pixel values for $2.5 R_1 < r
    753 < 4 R_1$.  The first radial moment is limited at the low and high ends
    754 by $R_{\rm min} < M_r < R_{\rm max}$ where $R_{\rm min}$ is the first
    755 radial moment of the PSF stars, or 0.75$\times$
    756 \code{MOMENTS_GAUSS_SIGMA} if that cannot be determined.  $R_{\rm
    757   max}$ is set to \code{PSF_MOMENTS_RADIUS}, the size of the moments
    758 aperture.
     807With the first radial moment, we can calculate a preliminary Kron
     808radius and magnitude.  The Kron radius \citep{1980ApJS...43..305K} is
     809defined the be 2.5$\times$ the first radial moment.  The Kron flux is
     810the sum of (sky-subtracted) pixel fluxes within the Kron radius.  We
     811also calculate the flux in two related annular apertures: the Kron
     812inner flux is the sum of pixel values for the annulus $R_1 < r < 2.5
     813R_1$, while the Kron outer flux is the sum of pixel values for $2.5
     814R_1 < r < 4 R_1$.  The first radial moment is limited at the low and
     815high ends by $R_{\rm min} < M_r < R_{\rm max}$ where $R_{\rm min}$ is
     816the first radial moment of the PSF stars, or $0.75\sigma_w$ if that
     817cannot be determined.  $R_{\rm max}$ is set to the size of the moments
     818aperture, $4\sigma_w$.  At this stage, the measurement of the Kron
     819parameters are preliminary since the aperture has been chosen as a
     820fixed size relative to the size of the PSF.  At a later stage,
     821higher-quality Kron parameters appropriate to galaxies are measured
     822with more care paid to the exact aperture used
     823(Section~\ref{sec:kron.mags}).
     824
     825% $\sigma_w$ is saved as MOMENTS_GAUSS_SIGMA
     826% the aperture radius is saved as PSF_MOMENTS_RADIUS
    759827
    760828\subsection{PSF Determination}
    761829
    762 \subsubsection{PSF Model vs Object Model}
    763 
    764 PSPhot uses an analytical model to represent the shape and flux of an
    765 object.  An important concept within the PSPhot code is the
    766 distinction between a model which describes an object on an image and
    767 a model with describes the point-spread-function (PSF) across an
    768 image.
    769 
    770 Any object in an image may be represented by some analytical model,
     830\subsubsection{PSF Model vs Source Model}
     831
     832The PSF model used by \code{psphot} consists of an analytical function
     833combined with a pixelized representation of the residual differences
     834between the analytical model and the true PSF.  Both the shape
     835parameters of the analytical model and the pixelized residual
     836differences are allowed to vary in two dimensions across the images.
     837
     838Within \code{psphot}, several analytical models may be used to
     839describe the PSF, but all share a few common characteristics.
     840
     841Any source in an image may be represented by some analytical model,
    771842for example, a 2-D elliptical Gaussian:
    772843\begin{eqnarray}
     
    776847    y  & = & y_{\rm ccd} - y_o
    777848\end{eqnarray}
    778 The object model will have a variety of model parameters, in this case
     849The source model will have a variety of model parameters, in this case
    779850the centroid coordinates ($x_o, y_o$), the elliptical shape parameters
    780851($\sigma_x, \sigma_y, \sigma_{\rm xy}$), the model normalization
    781852($I_o$) and the local value of the background ($S$).  A specific
    782 object will have a particular set of values for these different
     853source will have a particular set of values for these different
    783854parameters.
    784855
    785856The point-spread-function (PSF) of an image describes the shape of all
    786 unresolved objects in the image.  In a typical image, the shape of
     857unresolved sources in the image.  In a typical image, the shape of
    787858point sources is not well described by a single function.  Instead,
    788859the shape will vary as a function of position in the image.  The PSF
    789860model therefore must describe the parameter variation as a function of
    790 the position of the object on the image.  Note that the object model
     861the position of the source on the image.  Note that the source model
    791862consists of a certain number of parameters which are defined by the
    792863PSF model, and another set of parameters which are independent from
    793 object to object.  For the case of the elliptical Gaussian model, the
     864source to source.  For the case of the elliptical Gaussian model, the
    794865PSF parameters would be the shape terms ($\sigma_x, \sigma_y,
    795866\sigma_{\rm xy}$) while the independent parameters would be the
    796867centroid, normalization and local sky values ($x_o, y_o, I_o, S$).
    797 Thus these parameters are each a function of the object centroid
     868Thus these parameters are each a function of the source centroid
    798869coordinates:
    799870\begin{eqnarray}
     
    806877configuration.  The first option is to use a 2-D polynomial which is
    807878fitted to the measured parameter values across the image.  The second
    808 option is to use a grid of values which are measured for objects
     879option is to use a grid of values which are measured for sources
    809880within a subregion of the image.  In the latter case, the value at a
    810881specific coordinate in the image is determined by interpolation
     
    822893% XXX discuss the improvements in the astrometric modeling PV1 - PV3
    823894
    824 PSPhot uses a single structure to represent the object model and
    825 another structure to represent the PSF model.  The object model
    826 structure consists of the collection of measured object model
     895PSPhot uses a single structure to represent the source model and
     896another structure to represent the PSF model.  The source model
     897structure consists of the collection of measured source model
    827898parameters, carried as a \code{psLib} vector (\code{psVector}) along
    828899with an equal-length vector with the parameter errors.  The structure
     
    834905
    835906The PSPhot representation of the PSF consists of an array of
    836 polynomials, each representing the variation in the object model PSF
     907polynomials, each representing the variation in the source model PSF
    837908parameters (\code{psArray} of \code{psPolynomial2D}).  The PSF model
    838909structure also includes the same integer used to identify which model
    839910corresponds to particular instance of the PSF.  At the moment, the
    840911number of PSF parameters is a fixed number (4) fewer than the number
    841 of parameters of the corresponding object model.  For example, the
    842 elliptical Gaussian model uses 7 parameters to represent the object and
     912of parameters of the corresponding source model.  For example, the
     913elliptical Gaussian model uses 7 parameters to represent the source and
    8439143 for the PSF model. 
    844915
    845 PSPhot is written so that the object detection, measurement, and
     916PSPhot is written so that the source detection, measurement, and
    846917classification code does not depend on the specific form of the
    847 available object model functions.  Access to the characteristics of
     918available source model functions.  Access to the characteristics of
    848919the models is provided through a simple function abstraction method.
    849920Throughout PSPhot, there are many places where it is necessary for the
    850 code to refer to an aspect of the object or PSF model.  Often, these
     921code to refer to an aspect of the source or PSF model.  Often, these
    851922quantities are needed deep within other parts of the code.  For
    852 example, when attempting to fit the pixel flux values for an object,
     923example, when attempting to fit the pixel flux values for a source,
    853924it is necessary to generate a guess for the model parameters.  Or, in
    854925order to limit the domain of the fit, it is necessary to determine an
     
    872943
    873944When a new model is provided to PSPhot, it is not necessary to specify
    874 the intended use of the object model function (ie, PSF-like object,
     945the intended use of the source model function (ie, PSF-like source,
    875946galaxy, comet, etc).  Any model can be used for the PSF model, or to
    876 describe the flux distributions of the non-PSF objects.  The code
    877 currently uses a fixed translation between the object model parameters
     947describe the flux distributions of the non-PSF sources.  The code
     948currently uses a fixed translation between the source model parameters
    878949and the PSF model parameters.  It also defines a specific order for
    879950the 4 independent parameters. 
    880951
    881 \subsubsection{PSF Candidate Object Selection}
     952\subsubsection{Candidate PSF Source Selection}
     953\label{sec:psf.source.selection}
    882954
    883955The first stage of determining the PSF model for an image is to
    884 identify a collection of objects in the image which are {\em likely}
    885 to be PSF-like.  PSPhot uses the object moments to make the initial
    886 guess at a collection of PSF-like objects.  At this point, the program
    887 has measured the second order moments for all objects identified by
     956identify a collection of sources in the image which are {\em likely}
     957to be PSF-like.  PSPhot uses the source moments to make the initial
     958guess at a collection of PSF-like sources.  At this point, the program
     959has measured the second order moments for all sources identified by
    888960their peaks, as well as an approximate signal-to-noise ratio.  All
    889 objects with a S/N ratio greater than a user-defined parameter
     961sources with a S/N ratio greater than a user-defined parameter
    890962(\code{PSF_SHAPE_NSIGMA} = 20.0) are selected by PSPhot, though
    891 objects which have more than a certain number of saturated pixels are
     963sources which have more than a certain number of saturated pixels are
    892964excluded at this stage.  PSPhot then examines the 2-D plane of
    893 $\sigma_x, \sigma_y$ in search of a concentrated clump of objects (see
     965$\sigma_x, \sigma_y$ in search of a concentrated clump of sources (see
    894966Figure~\ref{fig:moment.class}).  To
    895967do this, it constructs an artificial image with pixels representing
     
    901973is then examined to find a peak which has a significance greater than
    902974XXX.  Unless the image is extremely sparse, such a peak will be
    903 well-defined and should represent the objects which are all very
    904 similar in shape.  Other objects in the image will tend to land in
     975well-defined and should represent the sources which are all very
     976similar in shape.  Other sources in the image will tend to land in
    905977very different locations, failing to produce a single peak.  To avoid
    906 detecting a peak from the unresolved cosmic rays, objects which have
     978detecting a peak from the unresolved cosmic rays, sources which have
    907979second-moments very close to 0 are ignored.  The only danger is if the
    908 PSF is very small and too many of these objects are rejected as cosmic
     980PSF is very small and too many of these sources are rejected as cosmic
    909981rays.
    910982
    911983Once a peak has been detected in this plane, the centroid and second
    912 moments of this peak are measured.  All objects which land within XXX
    913 $\sigma$ of this centroid are selected as likely PSF-like objects in
     984moments of this peak are measured.  All sources which land within XXX
     985$\sigma$ of this centroid are selected as likely PSF-like sources in
    914986the image. 
    915987
     
    927999\end{figure}
    9281000
    929 \subsubsection{PSF Candidate Object Model Fits}
     1001\subsubsection{Candidate PSF Source Model Fits}
    9301002
    9311003% \note{link to psLibADD}
    9321004
    933 All candidate PSF objects are then fitted with the selected object
     1005All candidate PSF sources are then fitted with the selected source
    9341006model, allowing all of the parameters (PSF and independent) to vary in
    9351007the fit.  PSPhot uses the Levenberg-Marquardt minimization technique
     
    9381010starting parameters are far from the minimization values.  PSPhot uses
    9391011the first and second moments to make a good guess for the centroid and
    940 shape parameters for the PSF models.  Any objects which fail to
     1012shape parameters for the PSF models.  Any sources which fail to
    9411013converge in the fit are flagged as invalid.
    9421014
    943 For the resulting collection of object model parameters, the
     1015For the resulting collection of source model parameters, the
    9441016PSF-dependent parameters of the models are all fitted as a function of
    9451017position to a 2-D polynomial.  The order of this polynomial is a
     
    9481020passes.  This fitting technique results in a robust measurement of the
    9491021variation of the PSF model parameters as a function of position
    950 without being excessively biased by individual objects which fail
    951 drastically.  Objects whose model parameters are rejected by this
     1022without being excessively biased by individual sources which fail
     1023drastically.  Sources whose model parameters are rejected by this
    9521024iterative fitting technique are also marked as invalid and ignored in
    9531025the later PSF model fitting stages.
    9541026
    955 All of the PSF-candidate objects are then re-fitted using the PSF
    956 model to specify the dependent model parameter values for each object.
     1027All of the PSF-candidate sources are then re-fitted using the PSF
     1028model to specify the dependent model parameter values for each source.
    9571029For example, in the case of the elliptical Gaussian model, the shape
    958 parameters ($\sigma_x, \sigma_y, \sigma_{xy}$) for each object are
    959 set by the coordinates of the object centroid and fixed (not allowed
     1030parameters ($\sigma_x, \sigma_y, \sigma_{xy}$) for each source are
     1031set by the coordinates of the source centroid and fixed (not allowed
    9601032to vary) in the fitting procedure.  The resulting fitted models are
    9611033then used to determine a metric which tests the quality of the PSF
     
    9641036The metric used by PSPhot to assess the PSF model is the scatter in
    9651037the differences between the aperture and fit magnitudes for the PSF
    966 objects.  The difference between the aperture and fit magnitudes ({\em
     1038sources.  The difference between the aperture and fit magnitudes ({\em
    9671039ApResid}) is a critical parameter for any PSF modeling software which
    9681040uses an analytical model to represent the flux distribution of the
    969 objects in an image.  An approximate correction is measured here, with
    970 a more detailed correction measured after all object analysis is
     1041sources in an image.  An approximate correction is measured here, with
     1042a more detailed correction measured after all source analysis is
    9711043performed.  The PSF model with the best consistency of the aperture
    9721044correction is judged to be the best model.
     
    9741046\subsection{Bright Source Analysis}
    9751047
    976 %% \subsubsection{Very Bright Stars}
    977 %%
    978 %% The PSF modeling code fails to fit the wings of highly saturated stars
    979 %% if the core of the star is too contaminated by saturated pixels. For
    980 %% stars with estimated instrumental magnitudes brighter than XXX, we fit
    981 %% and subtract a radial profile modeled with a spline (?).
     1048Once a PSF model has been determined, the brighter sources in the
     1049image may be analysed in detail.  The goals in this stage are (1) to
     1050determine the fluxes and positions of the bright stellar sources with
     1051high precision appropriate to their high signal-to-noise and (2) to
     1052characterize the bright source flux profiles sufficiently well that
     1053they may be subtracted from the image to allow for the clean detection
     1054of the fainter sources.  Note that as the analysis proceeds, there are
     1055several stages in which the 2D flux models for all sources are
     1056subtracted from the image, and individual sources are replaced in the
     1057image for a particular analysis step and then removed again. 
     1058
     1059In order to allow for multiple threads to process a single image, the
     1060pixels in an image are divided into a grid of superpixels (see
     1061Figure~\ref{fig:threadgrid}).  The superpixels are assigned to one of
     1062four groups, as illustrated, so that each superpixel in a group is
     1063well separated from the other superpixels of that group.  The analysis
     1064of the image proceeds in 4 steps, one for each of these groups.  Each
     1065of the superpixels in the first group is assigned to a single thread
     1066until all threads are assigned.  A single thread is responsible for
     1067the analysis of sources which land within their current superpixel, as
     1068determined by the centroid coordinates.  As the threads complete their
     1069analysis, they are assigned the next unfinished superpixel in the
     1070active group.  When all superpixels in one group have been processed,
     1071then the superpixels in the next group can start.  This strategy
     1072allows the threading to process sources which may be extended without
     1073the danger that two threads are actively touching the same pixels.
     1074For the PV3 analysis, 4 threads were used for most processing tasks.
     1075
     1076\subsubsection{Very Bright Stars}
     1077
     1078The PSF modeling code fails to fit the wings of highly saturated stars
     1079if the core of the star is too contaminated by saturated pixels. For
     1080stars with estimated instrumental magnitudes brighter than XXX, we fit
     1081and subtract a radial profile modeled with a spline (?).
     1082
     1083\note{more here}
    9821084
    9831085\subsubsection{Fast Ensemble PSF Fitting}
    9841086
    985 Before the detailed analysis of the objects is performed, it is
     1087Before the detailed analysis of the sources is performed, it is
    9861088convenient to subtract off all of the sources, at least as well as
    9871089possible at this stage.  We make the assumption that all sources are
     
    10191121achieve a good convergence.
    10201122
    1021 Once a solution set for $A_i$ is found, all of the objects are
     1123Once a solution set for $A_i$ is found, all of the sources are
    10221124subtracted from the by applying these values to the unit-flux PSF.
    10231125
    1024 \subsubsection{PSF Model applied to detected objects}
     1126\subsubsection{Full PSF Model Fitting}
    10251127
    10261128% \note{review the discussion below}
    10271129
    10281130Once a PSF model has been selected for an image, PSPhot attempts to
    1029 fit all of the detected objects, above a user-defined signal-to-noise
     1131fit all of the detected sources, above a user-defined signal-to-noise
    10301132ratio with the PSF model.  For these fits, the dependent parameters
    1031 are fixed by the PSF model and only the 4 independent object model
     1133are fixed by the PSF model and only the 4 independent source model
    10321134parameters are allowed to vary in the fit.  PSPhot again uses
    10331135Levenberg-Marquardt minimization for the non-linear fitting.  The
    1034 objects are fitted in their S/N order, starting with the brightest and
     1136sources are fitted in their S/N order, starting with the brightest and
    10351137working down to the user-specified limit.
    10361138
    1037 Once a solution has been achieved for an object, PSPhot attempts to
    1038 judge the quality of the PSF model as a representation of the object
     1139Once a solution has been achieved for a source, PSPhot attempts to
     1140judge the quality of the PSF model as a representation of the source
    10391141shape.  To do this, it calculates the next step of the minimization
    10401142{\em allowing the shape parameters to vary}.  This step, essentially
    10411143the Gauss-Newton minimization distance from the current local minimum,
    1042 should be very small if the object is well represented by the PSF, but
    1043 large if the PSF is not a good representation of the object flux.  The
     1144should be very small if the source is well represented by the PSF, but
     1145large if the PSF is not a good representation of the source flux.  The
    10441146model quality is judged by the change in the two shape parameters
    1045 which represent the 2D size of the object.  For the case of the
     1147which represent the 2D size of the source.  For the case of the
    10461148elliptical Gaussian, these two parameters are $\sigma_x$ and
    10471149$\sigma_y$.  For a generic model, the shape parameters may be defined
    10481150differently, but there should always be two parameters which scale the
    1049 object size in two dimensions.  Currently, PSPhot requires the two
     1151source size in two dimensions.  Currently, PSPhot requires the two
    10501152relevant shape parameters to be the first two dependent parameters in
    10511153the list of model parameters (ie, parameters 4 \& 5).
    10521154
    10531155The expected distribution of the variation of the two shape parameters
    1054 will be a function of the signal-to-noise of the object in question
     1156will be a function of the signal-to-noise of the source in question
    10551157and the value of the shape parameter itself.  The expected standard
    10561158deviation on the shape parameter is, eg, $\sigma_x / {\rm S/N}$.  If
    1057 the object is well-represented by the PSF, then the shape parameter
     1159the source is well-represented by the PSF, then the shape parameter
    10581160values should be close to their minimization value.  We can thus ask,
    1059 for each object, given the measured amplitude of the Gauss-Newton
     1161for each source, given the measured amplitude of the Gauss-Newton
    10601162step, how many standard deviations from the expected value (of 0.0) is
    1061 this particular value?  Objects for which the variation in the shape
     1163this particular value?  Sources for which the variation in the shape
    10621164parameters is a large positive number of standard deviations are
    10631165likely to be better represented by a larger flux distribution than the
    1064 PSF (eg, a Galaxy or Comet, etc).  Objects for which the variation in
     1166PSF (eg, a Galaxy or Comet, etc).  Sources for which the variation in
    10651167the shape parameters is a large negative number of standard deviations
    10661168are likely to be better represented by a smaller flux distribution
    10671169than the PSF (ie, a cosmic ray or other defect).  A user-defined
    10681170number of standard deviations is used to select these two cases, and
    1069 to flag the object as a likely galaxy (really meaning 'extended') or
     1171to flag the source as a likely galaxy (really meaning 'extended') or
    10701172as a likely defect. 
    10711173
     
    10821184converge on a fit with very low or negative peak flux / flux
    10831185normalization.  PSPhot will flag any non-convergent PSF fit and any
    1084 object with PSF S/N ratio lower than a user-defined cutoff.  It is
     1186source with PSF S/N ratio lower than a user-defined cutoff.  It is
    10851187also useful to identify very poor fits by setting a maximum Chi-Square
    1086 cutoff for objects. 
    1087 
    1088 As the objects are fitted to the PSF model, those which survive the
     1188cutoff for sources. 
     1189
     1190As the sources are fitted to the PSF model, those which survive the
    10891191exclusion stage are subtracted from the image.  The subtraction
    10901192process modifies the image pixels (removing the fitted flux, though
     
    11001202
    11011203Sources which are blended with other sources are fitted together as a set of
    1102 PSFs.  A single multi-object fit is performed on all blended peaks.
     1204PSFs.  A single multi-source fit is performed on all blended peaks.
    11031205The resulting fits are evaluated independently and any which are
    11041206determined to be PSFs are subtracted from the image.
     
    11071209
    11081210Sources which are judged to be non-PSF-like are confronted with two
    1109 possible alternative choices.  First, the object is fitted with a
     1211possible alternative choices.  First, the source is fitted with a
    11101212double-source model.  In this pass, the assumption is made that there
    11111213are two neighboring sources, but the peaks are blended together, or
     
    11251227has been measured for all sources, PSPhot uses these two measurements,
    11261228along with some additional pixel-level analysis, to determine the size class
    1127 of the object.  If the object is large compared to a PSF, it is
     1229of the source.  If the source is large compared to a PSF, it is
    11281230considered to be {\em extended} and will be
    11291231fitted with a galaxy model (or possibly another type of extended
    1130 source model in special cases).  If the object is small compared to a
     1232source model in special cases).  If the source is small compared to a
    11311233PSF, it is considered to be a {\em cosmic ray} and masked.
    11321234
     
    11341236significantly brighter than the PSF magnitude when compared to a PSF
    11351237star.  The value $dMagKP = m_{\rm Kron} - m_{\rm PSF}$, the difference between the PSF
    1136 and Kron magnitudes, is calculated for each object.  The median of
     1238and Kron magnitudes, is calculated for each source.  The median of
    11371239$dMagKP$ is calculated for the PSF stars.  This median is subtracted
    11381240from $dMagKP$ for each star.  The result is divided by the quadrature
    11391241error of the PSF and Kron magnitudes and called \code{extNsigma}.  If
    11401242\code{extNsigma} is larger than \code{PSPHOT.EXT.NSIGMA.LIMIT} (3.0),
    1141 the object is considered to be extended.
     1243the source is considered to be extended.
    11421244
    11431245Cosmic Rays are identified by a combination of the Kron magnitude and
    1144 the second-moment width of the object in the minor axis direction.
     1246the second-moment width of the source in the minor axis direction.
    11451247The second-moment in the minor axis direction is calculated from
    11461248$M_{xx}, M_{xy}, M_{yy}$ as follows:
     
    11491251\]
    11501252If $M_{\rm minor} < 1.2$ pixels$^2$ and the instrumental Kron
    1151 magnitude is $< -5.5$, then the object is identified as a cosmic ray
     1253magnitude is $< -5.5$, then the source is identified as a cosmic ray
    11521254and the associated pixels are masked.
    11531255
    1154 \subsubsection{Non-PSF Objects}
    1155 
    1156 Once every object (above the S/N cutoff) has been confronted with the
    1157 PSF model, the objects which are thought to be galaxies (extended) can
     1256\subsubsection{Non-PSF Sources}
     1257
     1258Once every source (above the S/N cutoff) has been confronted with the
     1259PSF model, the sources which are thought to be galaxies (extended) can
    11581260now be fit with appropriate models for the galaxies (or other likely
    11591261extended shapes).  Again, the fitting stage starts with the brightest
     
    11631265PSPhot will use the user-selected galaxy model to attempt the galaxy
    11641266model fits.  In the configuration system, the keyword \code{GAL_MODEL}
    1165 is set to the model of interest.  All suspected extended objects are
     1267is set to the model of interest.  All suspected extended sources are
    11661268fitted with the model, allowing all of the parameters to float.  The
    11671269initial parameter guesses are critical here to achieving convergence
    11681270on the model fits in a reasonable time.  The moments and the pixel
    11691271flux distribution are used to make the initial parameter guess.  Many
    1170 of the object parameters can be accurately guessed from the first and
     1272of the source parameters can be accurately guessed from the first and
    11711273second moments.  The power-law slope can be guessed by measuring the
    11721274isophotal level at two elliptical radii and comparing the ratio to
    11731275that expected.
    11741276
    1175 For each of the galaxy models (in fact for all object models), a
     1277For each of the galaxy models (in fact for all source models), a
    11761278function is defined which examines the fit results and determines if
    11771279the fit can be consider as a success or a failure.  The exact criteria
     
    11841286All galaxy model fits which are successful are then subtracted from
    11851287the image as is done for the successful PSF model fits.  Of course,
    1186 the background flux is retained, with the result that only the object
     1288the background flux is retained, with the result that only the source
    11871289is subtracted from the image.  Again, the variance image is (currently)
    11881290not modified. 
    11891291
    1190 \subsection{Faint Sources}
     1292\subsection{Faint Source Analysis}
    11911293
    11921294After a first pass through the image, in which the brighter sources
     
    11941296subtracted, PSPhot optionally begins a second pass at the image.  In
    11951297this stage, the new peaks are detected on the image with the bright
    1196 objects subtracted.  In this pass, the peak detection process uses the
     1298sources subtracted.  In this pass, the peak detection process uses the
    11971299variance image to test the validity of the individual peaks.  All peaks
    11981300with a significance greater than a user-defined minimum threshold are
    1199 accepted as objects of potential interest. 
    1200 
    1201 The objects which are measured in this faint-object stage are clearly
    1202 low significance detections.  The PV3 threshold for the bright object
     1301accepted as sources of potential interest. 
     1302
     1303The sources which are measured in this faint-source stage are clearly
     1304low significance detections.  The PV3 threshold for the bright source
    12031305analysis is a signal-to-noise of 20.  The lower limit cutoff for the
    1204 faint object analysis in PV3 is a signal-to-noise of 5.0.  Objects
    1205 detected in the faint object stage are fitted with the PSF model using
     1306faint source analysis in PV3 is a signal-to-noise of 5.0.  Sources
     1307detected in the faint source stage are fitted with the PSF model using
    12061308the linear, ensemble fitting process.
    12071309
    1208 \subsection{Aperture Correction Measurement}
    1209 
    1210 The important concept here is that an analytical model will always
    1211 fail to describe the flux of the objects at some level.  In the end,
    1212 all astronomical photometry is in some sense a relative measurement
    1213 between two images.  Whether the goal is calibration of a science
    1214 image taken at one location to a standard star image at another
    1215 location, or the goal is simply the repetitive photometry of the same
    1216 star at the same location in the image, it is always necessary to
    1217 compare the photometry between two images.  If this measurement is to
    1218 be consistent, then the measurement must represent the flux of the
    1219 stars in the same way regardless of the conditions under which the
    1220 images were taken, at least within some range of normal image
    1221 conditions.  So, for example, two images with different image quality,
    1222 or with different tracking and focus errors, will have different PSF
    1223 models.  Since an analytical model will always fail to represent the
    1224 flux of the star at some level, the measured flux of the same object
    1225 in the two images will be different (even assuming all other
    1226 atmospheric and instrumental effects have been corrected).  The
    1227 amplitude of the error will by determined by how inconsistently the
    1228 models represent the actual object flux.  For example, if the first
    1229 image PSF model flux is consistently 10\% too low and the second is 5\%
    1230 too high, then the comparison between the two images will be in error
    1231 by 15\%. 
    1232 
    1233 Aperture photometry avoids these problems, by trading for other
    1234 difficulties.  In aperture photometry, if a large enough aperture is
    1235 chosen, the amount of flux which is lost will be a small fraction of
    1236 the total object flux.  Even more importantly, as the image conditions
    1237 change, the amount lost will change by an even smaller fraction, at
    1238 least for a large aperture.  This can be seen by the fact that the
    1239 dominant variations in the image quality are in the focus, tracking
    1240 and seeing.  All of these errors initially affect the cores of the
    1241 stellar images, rather than the wide wings.  The wide wings are
    1242 largely dominated by scattering in the optics and scattering in the
    1243 atmosphere.  The amplitude and distribution of these two scattering
    1244 functions do not change significantly or quickly for a single
    1245 telescope and site. 
    1246 
    1247 The difficulty for aperture photometry is the need to make an accurate
    1248 measurement of the local background for each object.  As the aperture
    1249 grows, errors in the measurement of the sky flux start to become
    1250 dominant.  If the aperture is too small, then variation in the image
    1251 quality are dominant.  The brighter is the object, the smaller is the
    1252 error introduced by the large size of the aperture.  However, the
    1253 number of very bright stars is limited in any image, and of course the
    1254 brighter stars are more likely to suffer from non-linearity or
    1255 saturation.  PSPhot measures the aperture correction ({\em ApResid})
    1256 for every PSF candidate object and applies this correction to the PSF
    1257 model photometry.
    1258 
    1259 % How important is this effect?  Consider a typical bright object with a
    1260 % flux of (say) 40,000 counts in an image of background 1000 counts per
    1261 % pixel, with FWHM of 4 pixels.  In principle, the flux of this object
    1262 % should be measurable with an accuracy of roughly 0.57\%
    1263 % ($\frac{\sqrt{40000 + 1000 \times 12}}{40000}$).  However, the
    1264 % measurement of the sky is limited at some finite level by Poisson
    1265 % statistics.  If we are required to use an aperture of (say) 25 pixels
    1266 % in radius (eg, 5 arcseconds for an 0.2 arcsec / pixel detector), and
    1267 % we have an annulus of twice this radius to measure the local sky, then
    1268 % we will have an error of XXX.
    1269 %
    1270 % \note{outline the variation of {\em ApResid} as a function of
    1271 % magnitude}.
    1272 
    1273 %%% PSPhot measures the aperture correction ({\em ApResid}) for every PSF
    1274 %%% candidate object, then calculates the trend of this correction as a
    1275 %%% function of the magnitude.  This trend is fitted with a line.  The
    1276 %%% resulting function can be used to determine the effective aperture
    1277 %%% correction for an infinite flux object and the average bias inherent
    1278 %%% in the sky measurement for the image.  The scatter of the
    1279 %%% PSF-candidate object measurements about this trend is a measure of how
    1280 %%% well we can measure photometry from the image by applying the specific
    1281 %%% PSF model.  The slope of this trend is a measure of the bias in the
    1282 %%% local sky measurment for each object.  In principal, the measured sky
    1283 %%% levels could be modified by this bias.  More generally, the measured
    1284 %%% bias in a collection of images could be used to improve the model
    1285 %%% fitting or sky fitting portion of the software the remove the bias
    1286 %%% term.
    1287 
    1288 PSPhot allows a collection of PSF model functions to be tried on all
    1289 PSF candidate objects.  For each model test, the above corrected
    1290 ApResid scatter is measured.  The PSF model function with the smallest
    1291 value for the ApResid scatter is then used by PSPhot as the best PSF
    1292 model for this image.  The number of models to be tested is specified
    1293 by the configuration keyword \code{PSF_MODEL_N}.  The configuration
    1294 variables \code{PSF_MODEL_0}, \code{PSF_MODEL_1}, through
    1295 \code{PSF_MODEL_N - 1} specify the names of the models which should be
    1296 tested.
    1297 
    1298 Several likely PSF model classes are available within \code{psphot}:
    1299 \begin{itemize}
    1300 \item Gaussian : $f = I_0 e^{-z}$
    1301 \item Pseudo-Gaussian : $f = I_0 (1 + z + \frac{1}{2} z^2 + \frac{1}{6} z^3)^{-1}$ \code{[PGAUSS]}
    1302 \item Variable Power-Law : $f = I_0 (1 + z + z^{\alpha})^{-1}$ \code{[RGAUSS]}
    1303 \item Steep Power-Law : $f = I_0 (1 + \kappa z + z^{2.25})^{-1}$ \code{[QGAUSS]}
    1304 \item PS1 Power-Law : $f = I_0 (1 + \kappa z + z^{1.67})^{-1}$ \code{[PS1_V1]}
    1305 \end{itemize}
    1306 where $z \propto r^2$ ($z = \frac{x^2}{2\sigma_x^2} +
    1307 \frac{y^2}{2\sigma_y^2} + \sigma_{\rm xy} x y $).  The Pseudo-Gaussian
    1308 is a Taylor expansion of the Gaussian and is used by Dophot
    1309 \citep{1993PASP..105.1342S}.  The latter profiles are similar to the
    1310 Moffat profile form \citep{1969AA.....3..455M,1983AA...126..278B},
    1311 with small differences.  For the PS1 GPC1 analysis, we used the
    1312 \code{PS1_V1} model, which we found by experimentation to match well
    1313 to the observed profiles generated by PS1.
    1314 Figure~\ref{fig:radial.profiles} shows example radial profiles for
    1315 moderately bright stars in fairly good (0.9 arcsec) and poor (2.2
    1316 arcsec) seeing.  Using a fixed power-law exponent results in somewhat
    1317 faster profile fitting compared to the variable power-law exponent
    1318 model.
    1319 
    1320 % moffat : 1969A&A.....3..455M
    1321 % buonanno : 1983A&AS...51...83B
    1322 
    1323 \begin{figure}[htbp]
    1324   \begin{center}
    1325   \includegraphics[width=\hsize]{{pics/radial.profiles}.\plotext}
    1326   \caption{\label{fig:radial.profiles} Radial profiles of stellar images from PS1.  These two
    1327     profiles illustrate the radial trend of the PS1 PSFs for a star
    1328     with FWHM 0.9 arcsec (red) and 2.2 arcsec (blue).  The black line
    1329     shows the PSF model with radial trend of the form $(1 + \kappa r^2 + r^{3.33})^{-1}$.}
    1330   \end{center}
    1331 \end{figure}
    1332 
    1333 \subsection{Radial Profiles}
     1310\subsection{Extended Source Analysis}
     1311
     1312\note{intro paragraph: After the initial, fast analysis of the image
     1313  relying primarily on the PSF model, a complete analysis of the
     1314  extended source properties may be performed.  For PS1 processing,
     1315  this step is the nightly (PV0) analysis of individual exposures and
     1316  only performed for the stacks. }
     1317
     1318\subsubsection{Radial Profiles}
    13341319
    13351320Galaxies with regular profiles, such as elliptical galaxies and
     
    13911376% \note{these profiles are not saved in PSPS}
    13921377
    1393 \subsection{Petrosian Radii and Magnitudes}
     1378\subsubsection{Petrosian Radii and Magnitudes}
    13941379
    13951380\cite{1976ApJ...209L...1P} defined an adaptive aperture based on a
     
    13971382aperture which can be determined for galaxies without significant
    13981383biases as a function of distance.  Since surface brightness in a
    1399 resolved object is conserved, using a ratio of surface brightness to
     1384resolved source is conserved, using a ratio of surface brightness to
    14001385define a spatial scale results in a spatial scale which is constant
    14011386regardless of galaxy distance.
     
    14361421Petrosian flux is contained. 
    14371422
    1438 \subsection{Radial Profile Wings}
     1423\subsubsection{Radial Profile Wings}
    14391424
    14401425We attempt to measure the radial profile of sources in order to find
    1441 the radius at which the flux of the object is matches the sky.  In
     1426the radius at which the flux of the source is matches the sky.  In
    14421427this analysis, a series of up to 25 radial bins with power-law spacing
    1443 are defined and the flux of the object in each annulus is measured.
     1428are defined and the flux of the source in each annulus is measured.
    14441429The ``sky radius'' is defined to be the radius at which the (robust
    14451430median) flux in the annulus is within 1 $\sigma$ of the local sky
     
    14511436calculation of the kron magnitude.
    14521437
    1453 \subsection{Kron Magnitudes}
     1438\subsubsection{Kron Magnitudes}
     1439\label{sec:kron.mags}
    14541440
    14551441Preliminary Kron radius and flux values \citep{1980ApJS...43..305K}
     
    14881474opposites sides of the central pixel are considered together.  The
    14891475geometric mean of the two fluxes is used to replace the flux values.
    1490 If the object has 180\degree\ symmetry, this operation has no impact.
     1476If the source has 180\degree\ symmetry, this operation has no impact.
    14911477However, if one of the two pixels is unusually high, the value will be
    14921478surpressed by the matched pixel on the other side.  This trick has the
     
    14941480neighbors.
    14951481
    1496 \subsection{Convolved Galaxy Model Fits}
     1482\subsubsection{Convolved Galaxy Model Fits}
    14971483
    14981484In the galaxy model fittting stage, sources which meet certain
     
    15261512in the analysis.  This restriction limited the total time spent on the
    15271513galaxy modeling analysis at the expense of galaxy photometry in the
    1528 plane (though Kron photometry is available for those objects).  The
     1514plane (though Kron photometry is available for those sources).  The
    15291515Galactic Plane region was defined by $|b| > b_{\rm min}$ where $b_{\rm
    15301516  min} = b_0 + r_b e^{\frac{-l^2}{2 \sigma_b^2}}$.  For the PV3
     
    16621648% DOI: https://doi.org/10.1071/AS05001
    16631649
    1664 \subsection{Convolved Radial Aperture Photometry}
     1650\subsubsection{Convolved Radial Aperture Photometry}
    16651651
    16661652For some science goals, a well-measured color of a galaxy is more
     
    16761662radial apertures are measured.  In the first set, the fluxes in the
    16771663radial apertures are measured using the raw stack images.  The centers
    1678 of the apertures for each object across the 5 filters are fixed so
     1664of the apertures for each source across the 5 filters are fixed so
    16791665that the pixels represent the equivalent portions of the same galaxy
    1680 for all 5 filters.  In this analysis, the best model for each object
    1681 is subtracted from the image pixels for all objects excluding the
    1682 object in consideration.  The 'best model' is determined based on the
     1666for all 5 filters.  In this analysis, the best model for each source
     1667is subtracted from the image pixels for all sources excluding the
     1668source in consideration.  The 'best model' is determined based on the
    16831669minimum $\chi^2$ value for the model fits.
    16841670
     
    16891675image with a typical FWHM of 6\arcsec.  The full set of radial
    16901676apertures are again measured on these convolved images.  Again, the
    1691 best object models are subtracted from the image for objects not being
     1677best source models are subtracted from the image for sources not being
    16921678measured.  This subtraction includes the convolution to smooth the
    16931679model to the effective FWHM of the convolved image.  The entire
     
    16951681
    16961682% \note{is the first convolution done with the Alard-Lupton technique?}
     1683
     1684\subsection{Aperture Correction}
     1685
     1686The important concept here is that an analytical model will always
     1687fail to describe the flux of the sources at some level.  In the end,
     1688all astronomical photometry is in some sense a relative measurement
     1689between two images.  Whether the goal is calibration of a science
     1690image taken at one location to a standard star image at another
     1691location, or the goal is simply the repetitive photometry of the same
     1692star at the same location in the image, it is always necessary to
     1693compare the photometry between two images.  If this measurement is to
     1694be consistent, then the measurement must represent the flux of the
     1695stars in the same way regardless of the conditions under which the
     1696images were taken, at least within some range of normal image
     1697conditions.  So, for example, two images with different image quality,
     1698or with different tracking and focus errors, will have different PSF
     1699models.  Since an analytical model will always fail to represent the
     1700flux of the star at some level, the measured flux of the same source
     1701in the two images will be different (even assuming all other
     1702atmospheric and instrumental effects have been corrected).  The
     1703amplitude of the error will by determined by how inconsistently the
     1704models represent the actual source flux.  For example, if the first
     1705image PSF model flux is consistently 10\% too low and the second is 5\%
     1706too high, then the comparison between the two images will be in error
     1707by 15\%. 
     1708
     1709Aperture photometry avoids these problems, by trading for other
     1710difficulties.  In aperture photometry, if a large enough aperture is
     1711chosen, the amount of flux which is lost will be a small fraction of
     1712the total source flux.  Even more importantly, as the image conditions
     1713change, the amount lost will change by an even smaller fraction, at
     1714least for a large aperture.  This can be seen by the fact that the
     1715dominant variations in the image quality are in the focus, tracking
     1716and seeing.  All of these errors initially affect the cores of the
     1717stellar images, rather than the wide wings.  The wide wings are
     1718largely dominated by scattering in the optics and scattering in the
     1719atmosphere.  The amplitude and distribution of these two scattering
     1720functions do not change significantly or quickly for a single
     1721telescope and site. 
     1722
     1723The difficulty for aperture photometry is the need to make an accurate
     1724measurement of the local background for each source.  As the aperture
     1725grows, errors in the measurement of the sky flux start to become
     1726dominant.  If the aperture is too small, then variation in the image
     1727quality are dominant.  The brighter is the source, the smaller is the
     1728error introduced by the large size of the aperture.  However, the
     1729number of very bright stars is limited in any image, and of course the
     1730brighter stars are more likely to suffer from non-linearity or
     1731saturation.  PSPhot measures the aperture correction ({\em ApResid})
     1732for every PSF candidate source and applies this correction to the PSF
     1733model photometry.
     1734
     1735% How important is this effect?  Consider a typical bright source with a
     1736% flux of (say) 40,000 counts in an image of background 1000 counts per
     1737% pixel, with FWHM of 4 pixels.  In principle, the flux of this source
     1738% should be measurable with an accuracy of roughly 0.57\%
     1739% ($\frac{\sqrt{40000 + 1000 \times 12}}{40000}$).  However, the
     1740% measurement of the sky is limited at some finite level by Poisson
     1741% statistics.  If we are required to use an aperture of (say) 25 pixels
     1742% in radius (eg, 5 arcseconds for an 0.2 arcsec / pixel detector), and
     1743% we have an annulus of twice this radius to measure the local sky, then
     1744% we will have an error of XXX.
     1745%
     1746% \note{outline the variation of {\em ApResid} as a function of
     1747% magnitude}.
     1748
     1749%%% PSPhot measures the aperture correction ({\em ApResid}) for every PSF
     1750%%% candidate source, then calculates the trend of this correction as a
     1751%%% function of the magnitude.  This trend is fitted with a line.  The
     1752%%% resulting function can be used to determine the effective aperture
     1753%%% correction for an infinite flux source and the average bias inherent
     1754%%% in the sky measurement for the image.  The scatter of the
     1755%%% PSF-candidate source measurements about this trend is a measure of how
     1756%%% well we can measure photometry from the image by applying the specific
     1757%%% PSF model.  The slope of this trend is a measure of the bias in the
     1758%%% local sky measurment for each source.  In principal, the measured sky
     1759%%% levels could be modified by this bias.  More generally, the measured
     1760%%% bias in a collection of images could be used to improve the model
     1761%%% fitting or sky fitting portion of the software the remove the bias
     1762%%% term.
     1763
     1764PSPhot allows a collection of PSF model functions to be tried on all
     1765PSF candidate sources.  For each model test, the above corrected
     1766ApResid scatter is measured.  The PSF model function with the smallest
     1767value for the ApResid scatter is then used by PSPhot as the best PSF
     1768model for this image.  The number of models to be tested is specified
     1769by the configuration keyword \code{PSF_MODEL_N}.  The configuration
     1770variables \code{PSF_MODEL_0}, \code{PSF_MODEL_1}, through
     1771\code{PSF_MODEL_N - 1} specify the names of the models which should be
     1772tested.
     1773
     1774Several likely PSF model classes are available within \code{psphot}:
     1775\begin{itemize}
     1776\item Gaussian : $f = I_0 e^{-z}$
     1777\item Pseudo-Gaussian : $f = I_0 (1 + z + \frac{1}{2} z^2 + \frac{1}{6} z^3)^{-1}$ \code{[PGAUSS]}
     1778\item Variable Power-Law : $f = I_0 (1 + z + z^{\alpha})^{-1}$ \code{[RGAUSS]}
     1779\item Steep Power-Law : $f = I_0 (1 + \kappa z + z^{2.25})^{-1}$ \code{[QGAUSS]}
     1780\item PS1 Power-Law : $f = I_0 (1 + \kappa z + z^{1.67})^{-1}$ \code{[PS1_V1]}
     1781\end{itemize}
     1782where $z \propto r^2$ ($z = \frac{x^2}{2\sigma_x^2} +
     1783\frac{y^2}{2\sigma_y^2} + \sigma_{\rm xy} x y $).  The Pseudo-Gaussian
     1784is a Taylor expansion of the Gaussian and is used by Dophot
     1785\citep{1993PASP..105.1342S}.  The latter profiles are similar to the
     1786Moffat profile form \citep{1969AA.....3..455M,1983AA...126..278B},
     1787with small differences.  For the PS1 GPC1 analysis, we used the
     1788\code{PS1_V1} model, which we found by experimentation to match well
     1789to the observed profiles generated by PS1.
     1790Figure~\ref{fig:radial.profiles} shows example radial profiles for
     1791moderately bright stars in fairly good (0.9 arcsec) and poor (2.2
     1792arcsec) seeing.  Using a fixed power-law exponent results in somewhat
     1793faster profile fitting compared to the variable power-law exponent
     1794model.
     1795
     1796% moffat : 1969A&A.....3..455M
     1797% buonanno : 1983A&AS...51...83B
     1798
     1799\begin{figure}[htbp]
     1800  \begin{center}
     1801  \includegraphics[width=\hsize]{{pics/radial.profiles}.\plotext}
     1802  \caption{\label{fig:radial.profiles} Radial profiles of stellar images from PS1.  These two
     1803    profiles illustrate the radial trend of the PS1 PSFs for a star
     1804    with FWHM 0.9 arcsec (red) and 2.2 arcsec (blue).  The black line
     1805    shows the PSF model with radial trend of the form $(1 + \kappa r^2 + r^{3.33})^{-1}$.}
     1806  \end{center}
     1807\end{figure}
     1808
     1809\subsection{Output Formats}
     1810
     1811\section{Forced Photometry Modes}
     1812
     1813\subsection{Forced Photometry : PSFs}
     1814
     1815\subsection{Forced Photometry : galaxies}
     1816
     1817\section{Difference Image Photometry}
     1818
     1819The variance map for a difference image must be generated from the two
     1820images used to construct the difference.  Otherwise, the low sky level
     1821will automatically result in inconsistent interpretation of the variance.
     1822
     1823For a difference image, both positive and negative sources will be
     1824present.  The basic peak detection algorithm will only trigger for the
     1825positive sources.  One solution is to simply apply PSPhot to both the
     1826difference image and its negative value.  \note{do we want to code in
     1827an automatic switch to get both positive and negative excursions in
     1828the single pass?}.
     1829
     1830In the case of a difference image, the PSF model construction stage
     1831will probably fail for lack of valid sources.  It is better in these
     1832cases to provide PSF model from some other source.  For example, the
     1833two images which are combined to generate the difference image
     1834represent the PSF.  Presumably, one or both have been convolved with a
     1835PSF-matching kernel.  The images which result from the convolution
     1836should be used to measure the PSF model. 
     1837
     1838The source classification scheme defaults to the galaxy models for
     1839sources which are not well represented by the PSF model.  In a
     1840properly-constructed difference image, galaxies are unlikely to remain
     1841behind as significant sources.  Most real sources in the difference
     1842image will be PSF-like and will consist of photometrically variable
     1843sources (flare stars, supernovae, etc) or astrometrically variable
     1844sources (high-proper motion stars or solar-system bodies).  There are
     1845three likely classes of sources which will not be well represented by
     1846the PSF model.  1) Fast-moving solar-system objects will appear as
     1847short streaks.  For example, a fast solar system object would have an
     1848apparent rate of 0.5 degrees per hour, translating to 15 arcseconds in
     1849a 30 second exposure.  Even a main belt asteroid at roughly 1 AU would
     1850have reflect motion of approximately 1 degree per day, equivalent to
     18511.25 arcsec in a 30 second exposure, and could be noticeably smeared
     1852and non-PSF-like.  A trailed-star model can be used to characterize
     1853these types of sourcess.  2) Small offset stars, either due to
     1854atmospheric / color effects or modest proper motion will appear as PSF
     1855dipoles in the difference images.  The positive and the negative
     1856images will have stellar profiles, but they will be significantly
     1857offset and will not subtract well.  The two components may not have
     1858the same amplitude.  A PSF-dipole model can be used to fit these types
     1859of sources, with free parameters of the two centroids and the two
     1860fluxes.  3) Comets will appear in the difference images as a non-PSF
     1861sources.  Their 2-D structure includes both the flux from the coma
     1862(with a typical power-law profile) and flux from the tail (with a more
     1863complex flux distribution).  A comet flux model can be used to
     1864characterize these sources in difference images.  A major difficulty
     1865in applying these three types of models is in making a robust test of
     1866which model should be used.  This problem is akin to the issue of
     1867selecting and distinguishing between multiple galaxy models, as
     1868discussed in the section on Galaxy models.
     1869
     1870\section{Examples and Tests}
    16971871
    16981872\acknowledgments
     
    17201894\end{document}
    17211895
    1722 \subsection{Forced Photometry : PSFs}
    1723 
    1724 \subsection{Forced Photometry : galaxies}
    1725 
    17261896\subsection{Output Options}
    17271897
     
    17291899
    17301900% \note{need to discuss failings and holes}
    1731 
    1732 \section{Alternative Scenarios}
    1733 
    1734 \subsection{Trailed Sources}
    1735 
    1736 \subsection{Difference Images}
    1737 
    1738 The variance map for a difference image must be generated from the two
    1739 images used to construct the difference.  Otherwise, the low sky level
    1740 will automatically result in inconsistent interpretation of the variance.
    1741 
    1742 For a difference image, both positive and negative objects will be
    1743 present.  The basic peak detection algorithm will only trigger for the
    1744 positive sources.  One solution is to simply apply PSPhot to both the
    1745 difference image and its negative value.  \note{do we want to code in
    1746 an automatic switch to get both positive and negative excursions in
    1747 the single pass?}.
    1748 
    1749 In the case of a difference image, the PSF model construction stage
    1750 will probably fail for lack of valid sources.  It is better in these
    1751 cases to provide PSF model from some other source.  For example, the
    1752 two images which are combined to generate the difference image
    1753 represent the PSF.  Presumably, one or both have been convolved with a
    1754 PSF-matching kernel.  The images which result from the convolution
    1755 should be used to measure the PSF model. 
    1756 
    1757 The object classification scheme defaults to the galaxy models for
    1758 objects which are not well represented by the PSF model.  In a
    1759 properly-constructed difference image, galaxies are unlikely to remain
    1760 behind as significant sources.  Most real objects in the difference
    1761 image will be PSF-like and will consist of photometrically variable
    1762 objects (flare stars, supernovae, etc) or astrometrically variable
    1763 objects (high-proper motion stars or solar-system objects).  There are
    1764 three likely classes of objects which will not be well represented by
    1765 the PSF model.  1) Fast-moving solar-system objects will appear as
    1766 short streaks.  For example, a fast solar system object would have an
    1767 apparent rate of 0.5 degrees per hour, translating to 15 arcseconds in
    1768 a 30 second exposure.  Even a main belt asteroid at roughly 1 AU would
    1769 have reflect motion of approximately 1 degree per day, equivalent to
    1770 1.25 arcsec in a 30 second exposure, and could be noticeably smeared
    1771 and non-PSF-like.  A trailed-star model can be used to characterize
    1772 these types of objects.  2) Small offset stars, either due to
    1773 atmospheric / color effects or modest proper motion will appear as PSF
    1774 dipoles in the difference images.  The positive and the negative
    1775 images will have stellar profiles, but they will be significantly
    1776 offset and will not subtract well.  The two components may not have
    1777 the same amplitude.  A PSF-dipole model can be used to fit these types
    1778 of objects, with free parameters of the two centroids and the two
    1779 fluxes.  3) Comets will appear in the difference images as a non-PSF
    1780 objects.  Their 2-D structure includes both the flux from the coma
    1781 (with a typical power-law profile) and flux from the tail (with a more
    1782 complex flux distribution).  A comet flux model can be used to
    1783 characterize these objects in difference images.  A major difficulty
    1784 in applying these three types of models is in making a robust test of
    1785 which model should be used.  This problem is akin to the issue of
    1786 selecting and distinguishing between multiple galaxy models, as
    1787 discussed in the section on Galaxy models.
    1788 
    1789 \subsection{Input \& Output Data Formats}
    1790 
    1791 \section{Sample Tests}
    17921901
    17931902\begin{verbatim}
     
    18271936* authors
    18281937* PSF residual map
    1829 * section 3.5.3 Model applied to detected objects needs to be reviewed
     1938* section 3.5.3 Model applied to detected sources needs to be reviewed
    18301939
    18311940* read for english & phrasing
Note: See TracChangeset for help on using the changeset viewer.