IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 17, 2018, 10:41:29 AM (8 years ago)
Author:
eugene
Message:

updates

File:
1 edited

Legend:

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

    r40559 r40584  
    184184
    185185The photometric and astrometric precision goals for the Pan-STARRS\,1
    186 surveys were quite stringent: photmetric accuracy of 10
     186surveys were quite stringent: photometric accuracy of 10
    187187millimagnitudes, relative astrometric accuracy of 10 milliarcseconds
    188188and absolute astrometric accuracy of 100 milliarcseconds with respect
     
    252252In the process, the source analysis software was written using the
    253253data analysis C-code library written for the IPP, \code{psLib}
    254 \citep{psLib}.  Components of the photometry code were integrated into
    255 the IPP's mid-level astronomy data analysis toolkit called
    256 \code{psModules} \citep{psModules}.  The resulting software,
    257 `\code{psphot}', can be used either as a stand-alone C program, or as
    258 a set of library functions which may be integrated into other programs
    259 
    260 % \note{add refs to the psLib and psModules ADDs} : ref to online docs?
     254\citep{magnier2017.datasystem}.  Components of the photometry code
     255were integrated into the IPP's mid-level astronomy data analysis
     256toolkit called \code{psModules} \citep{magnier2017.datasystem}.  The
     257resulting software, `\code{psphot}', can be used either as a
     258stand-alone C program, or as a set of library functions which may be
     259integrated into other programs
    261260
    262261Several variants of \code{psphot} have been used in the PS1 PV3
     
    703702\begin{figure}[htbp]
    704703  \begin{center}
    705   \includegraphics[width=\hsize]{{pics/FWHM.smooth.trend.ps1}.\plotext}
    706   \caption{\label{fig:moments.window} Example of the biases encountered when measuring the second
    707     moments.  A simulated image was generated using the PS1 PSF
    708     profile.  Each panel corresponds to a different value of
    709     $\sigma_w$, as marked.  The solid red line is the true FWHM of the
    710     PSF used to generate the stars.  The blue solid line is the FWHM
    711     of the window function ($2.35\sigma_w$).  The gray dots are the
    712     FWHM derived from the measured second moments for stars in the
    713     image.  The dotted blue line is the target (65\% of the window
    714     function).  In this example, we would choose $\sigma_w$ between
    715     0.5 and 0.8 arcseconds so the dotted blue line would match the
    716     bright end of the gray dots.}
     704% \includegraphics[width=0.6\hsize]{{pics/FWHM.smooth.trend.ps1}.\plotext}
     705  \includegraphics[width=0.95\hsize]{{pics/FWHM.smooth.trend.ps1}.png}
     706  \caption{\label{fig:moments.window} Example of the biases
     707    encountered when measuring the second moments.  A simulated image
     708    was generated using the PS1 PSF profile.  Each panel corresponds
     709    to a different value of $\sigma_w$, corresponding to the window
     710    FWHM values as marked.  The solid red line is the true FWHM of the
     711    PSF used to generate the stars (1.4 arcsec in all cases).  The
     712    blue solid line is the FWHM of the window function.  The gray dots
     713    are the FWHM derived from the measured second moments for stars in
     714    the image.  The median of this distribution (mag $< -10$) is
     715    listed as ``obs''.  The ratio of the median FWHM to the FWHM of
     716    the window function is listed as ``ratio'', while the ratio of the
     717    median FWHM to the true stellar FWHM is listed as ``bias''.  The
     718    dotted blue line is the target (65\% of the window function).  In
     719    this example, we would choose $\sigma_w$ between 0.5 and 0.8
     720    arcseconds so the dotted blue line would match the bright end of
     721    the gray dots.   See discussion in the text for the choice of
     722    target window.
     723}
    717724  \end{center}
    718725\end{figure}
     
    726733appropriate aperture in which the moments are measured.  We also apply
    727734a ``window function'', down-weighting the pixels by a Gaussian,
    728 centered on the object, with size $\sigma_W$ chosen to be large
     735centered on the object, with size $\sigma_w$ chosen to be large
    729736compared to the PSF size, $\sigma_{\rm PSF}$.  This window function
    730737reduces the noise of the measurement of the moments by suppressing the
    731738noisy pixels at high radial distance as well as by reducing the
    732 contaminating effects of neighboring stars.  The choice of $\sigma_W$
     739contaminating effects of neighboring stars.  The choice of $\sigma_w$
    733740and the aperture is an iterative process: for a given value of
    734 $\sigma_W$, the PSF stars will have a measured value of the PSF size,
     741$\sigma_w$, the PSF stars will have a measured value of the PSF size,
    735742$\sigma^{\prime}_{\rm PSF}$ which different from the true value due to
    736743the effect of the window function.  The measured value of the PSF size
     
    743750radial profile of the PS1 PSF model with $\sigma_{\rm PSF}$
    744751corresponding to a FWHM of 1.4 arcseconds.  As the window function
    745 $\sigma_W$ is increased, the measured FWHM for the bright simulated
    746 stars rises to meet the truth value.  For small values of $\sigma_W$,
     752$\sigma_w$ is increased, the measured FWHM for the bright simulated
     753stars rises to meet the truth value.  For small values of $\sigma_w$,
    747754fainter stars are biased to low measured values of the FWHM.  For
    748 large values of $\sigma_W$, the faint stars are biased to higher
    749 values and the scatter increases.
     755large values of $\sigma_w$, the faint stars are biased to higher
     756values and the scatter increases.  We attempt to minimize the scatter
     757and trends with magnitude at the cost of overall bias.
    750758
    751759In a real image, we do not know the true value of the PSF size.  If we
     
    763771brightness.
    764772
    765 To choose the value of $\sigma_W$, we try a sequence of values
     773To choose the value of $\sigma_w$, we try a sequence of values
    766774spanning a range guaranateed to contain any reasonable seeing values.
    767775The values are specified in the \code{psphot} recipe as
    768776\code{PSF.SIGMA.VALUES} and have the following values for PS1 PV3: (1,
    7697772, 3, 4.5, 6, 9, 12, 18) pixels $\approx$ (0.26, 0.51, 0.77, 1.15,
    770 1.54, 2.3, 3.1, 4.6) arcseconds.  For each of these $\sigma_W$ values,
     7781.54, 2.3, 3.1, 4.6) arcseconds.  For each of these $\sigma_w$ values,
    771779we then select candidate PSF stars based on the distribution of the
    772780measured $\sigma^{\prime}_{\rm PSF}$ in the two principal directions:
     
    776784\frac{\sigma_{x} + \sigma{y}}{2 \sigma_w}$, i.e., the ratio of the
    777785window size to the observed PSF size.  We interpolate to find a value
    778 of $\sigma_W$ for which $\rho_\sigma$ is expected to be 0.65.  We use
     786of $\sigma_w$ for which $\rho_\sigma$ is expected to be 0.65.  We use
    779787an aperture with a radius of 4$\sigma_w$ to select the pixels for the
    780788measurement of the moments.
     
    849857
    850858\subsubsection{PSF Model vs Source Model}
     859\label{sec:Source.Model}
    851860
    852861The point-spread-function (PSF) of an image describes the shape of all
     
    10071016selected by \code{psphot}, though sources which have more than a
    10081017certain number of saturated pixels are excluded at this stage.  The
    1009 program then examines the 2-D plane of $\sigma_x, \sigma_y$ in search
     1018program then examines the 2-D plane of $M_{x,x}, M_{y,y}$ in search
    10101019of a concentrated clump of sources (see
    10111020Figure~\ref{fig:moment.class}).  To do this, it constructs an
    1012 artificial image with pixels representing the value of $\sigma_x,
    1013 \sigma_y$, using $0.1 \sigma_w$ as the size of a pixel in this
    1014 artificial image.  The binned $\sigma_x, \sigma_y$ plane is then
     1021artificial image with pixels representing the value of $M_{x,x},
     1022M_{y,y}$, using $0.1 \sigma^2_w$ as the size of a pixel in this
     1023artificial image.  The binned $M_{x,x}, M_{y,y}$ plane is then
    10151024examined to find a significant peak.  Unless the image is extremely
    10161025sparse, such a peak will be well-defined and should represent the
     
    10271036% (\sigma_x^2) not \sigma_x,\sigma_y)
    10281037
    1029 \note{re-work wording above reflecting comment above}
    1030 
    10311038Once a peak has been detected in this plane, the centroid and second
    10321039moments of this peak are measured.  All sources which land within 2
     
    10371044  \begin{center}
    10381045  \includegraphics[width=\hsize]{{pics/moment.class}.\plotext}
    1039   \caption{\label{fig:moment.class} Illustration of PSF star selection using the FWHM derived
    1040     from the second moments in $X_{\rm ccd}$ and $Y_{\rm ccd}$
     1046  \caption{\label{fig:moment.class} Illustration of PSF star selection
     1047    using the second moments in $X_{\rm ccd}$ and $Y_{\rm ccd}$
    10411048    directions.  The dominant clump is located in this diagram.
    10421049    Galaxies tend to have a range of sizes and thus spread out above
     
    10881095\begin{table}
    10891096\caption{\label{tab:psf.order.nstars} Minimum number of stars required
    1090   for a given order of the PSF 2D variations.}\vspace{-0.5cm}
     1097  for a given order of the PSF 2D variations.} % \vspace{-0.5cm}
    10911098\begin{center}
    10921099\begin{tabular}{llll}
     
    12151222PSF.
    12161223
    1217 \subsubsection{Full PSF Model Fitting}
    1218 
    1219 % \note{review the discussion below}
    1220 
    1221 Once a PSF model has been selected for an image, \code{psphot} attempts to
    1222 fit all of the detected sources, above a user-defined signal-to-noise
    1223 ratio with the PSF model.  For these fits, the dependent parameters
    1224 are fixed by the PSF model and only the 4 independent source model
    1225 parameters are allowed to vary in the fit.  \code{psphot} again uses
    1226 Levenberg-Marquardt minimization for the non-linear fitting.  The
    1227 sources are fitted in their S/N order, starting with the brightest and
    1228 working down to the user-specified limit, with the other sources
    1229 subtracted as discussed above.
    1230 
    1231 \note{code review for the next bit}
    1232 
    1233 Once a solution has been achieved for a source, \code{psphot} attempts to
    1234 judge the quality of the PSF model as a representation of the source
    1235 shape.  To do this, it calculates the next step of the minimization
    1236 {\em allowing the shape parameters to vary}.  This step, essentially
    1237 the Gauss-Newton minimization distance from the current local minimum,
    1238 should be very small if the source is well represented by the PSF, but
    1239 large if the PSF is not a good representation of the source flux.  The
    1240 model quality is judged by the change in the two shape parameters
    1241 which represent the 2D size of the source.  For the case of the
    1242 elliptical Gaussian, these two parameters are $\sigma_x$ and
    1243 $\sigma_y$.  For a generic model, the shape parameters may be defined
    1244 differently, but there should always be two parameters which scale the
    1245 source size in two dimensions.  Currently, \code{psphot} requires the two
    1246 relevant shape parameters to be the first two dependent parameters in
    1247 the list of model parameters (ie, parameters 4 \& 5).
    1248 
    1249 The expected distribution of the variation of the two shape parameters
    1250 will be a function of the signal-to-noise of the source in question
    1251 and the value of the shape parameter itself.  The expected standard
    1252 deviation on the shape parameter is, eg, $\sigma_x / {\rm S/N}$.  If
    1253 the source is well-represented by the PSF, then the shape parameter
    1254 values should be close to their minimization value.  We can thus ask,
    1255 for each source, given the measured amplitude of the Gauss-Newton
    1256 step, how many standard deviations from the expected value (of 0.0) is
    1257 this particular value?  Sources for which the variation in the shape
    1258 parameters is a large positive number of standard deviations are
    1259 likely to be better represented by a larger flux distribution than the
    1260 PSF (eg, a Galaxy or Comet, etc).  Sources for which the variation in
    1261 the shape parameters is a large negative number of standard deviations
    1262 are likely to be better represented by a smaller flux distribution
    1263 than the PSF (ie, a cosmic ray or other defect).  A user-defined
    1264 number of standard deviations is used to select these two cases, and
    1265 to flag the source as a likely galaxy (really meaning 'extended') or
    1266 as a likely defect. 
    1267 
    1268 At this stage of the analysis, \code{psphot} uses two additional indicators
    1269 to identify good and poor PSF fits.  The first of these is the
    1270 signal-to-noise ratio.  It is possible for the peak finding algorithm
    1271 to identify peaks in locations which are not actually a normal peak.
    1272 Some of these cases are in the edges of saturated, bleeding columns
    1273 from bright stars, in the nearly flat halos of very bright stars, and
    1274 so on.  In these cases, a local peak exists, with a lower nearby sky
    1275 region.  However, the fitted PSF model cannot converge on the peak
    1276 because it is very poorly defined (perhaps only existing in the
    1277 smoothed image).  The fit can either fail to converge or it can
    1278 converge on a fit with very low or negative peak flux / flux
    1279 normalization.  \code{psphot} will flag any non-convergent PSF fit and any
    1280 source with PSF S/N ratio lower than a user-defined cutoff.  It is
    1281 also useful to identify very poor fits by setting a maximum Chi-Square
    1282 cutoff for sources. 
    1283 
    1284 As the sources are fitted to the PSF model, those which survive the
    1285 exclusion stage are subtracted from the image.  The subtraction
    1286 process modifies the image pixels (removing the fitted flux, though
    1287 not the locally fitted background) but does not modify the mask or the
    1288 variance images.  The signal-to-noise ratio in the image after
    1289 subtraction represents the significance of the remaining flux.  If the
    1290 subtractions are sufficiently accurate models of the PSF flux
    1291 distribution, the remaining flux should be below 1 $\sigma$
    1292 significance.  In practice the cores of bright stars are poorly
    1293 represented and may have larger residual significance.
    1294 
    1295 \subsubsection{Blended Sources}
    1296 
    1297 Sources which are blended with other sources are fitted together as a set of
    1298 PSFs.  A single multi-source fit is performed on all blended peaks.
    1299 The resulting fits are evaluated independently and any which are
    1300 determined to be PSFs are subtracted from the image.
    1301 
    1302 \subsubsection{Double Sources}
    1303 
    1304 Sources which are judged to be non-PSF-like are confronted with two
    1305 possible alternative choices.  First, the source is fitted with a
    1306 double-source model.  In this pass, the assumption is made that there
    1307 are two neighboring sources, but the peaks are blended together, or
    1308 otherwise not distinguished.  The initial guess for the two peaks is
    1309 made by splitting the flux of the single source in half and locating
    1310 the two starting peaks at +/- 2 pixels from the original peak along
    1311 the direction of the semi-major axis of the sources, as measured from
    1312 the second moments.  In order for the two-source model to be accepted,
    1313 both sources must be judged as a valid PSF source.  Otherwise, the
    1314 double-PSF model is rejected and the source is fitted with the
    1315 available non-PSF model or models.
     1224\subsubsection{Radial Profile Wings}
     1225
     1226We attempt to measure the radial profile of sources in order to find
     1227the radius at which the flux of the source is matches the sky.  In
     1228this analysis, a series of up to 25 radial bins with power-law spacing
     1229are defined and the flux of the source in each annulus is measured.
     1230The ``sky radius'' is defined to be the radius at which the (robust
     1231median) flux in the annulus is within 1 $\sigma$ of the local sky
     1232level.  If this limit is not reached before the slope of the flux from
     1233one annulus to the next is less than a user-defined limit, then the
     1234annulus at which the slope reaches this limit is used to define the
     1235sky radius.  These values are saved in the output smf / cmf files, but
     1236not sent to the PSPS.  The sky radius value is used below in the
     1237calculation of the Kron magnitude.
     1238
     1239\subsubsection{Kron Magnitudes}
     1240\label{sec:kron.mags}
     1241
     1242Preliminary Kron radius and flux values \citep{1980ApJS...43..305K}
     1243are calculated soon after sources are detected
     1244(Section~\ref{sec:moments}).  However, these preliminary values are
     1245not accurate due to the window-functions applied.  After sources have
     1246been characterized and the PSF model is well-determined, the Kron
     1247parameters are re-calculated more carefully.  In this version of the
     1248calculation, following the algorithm described by \cite{sextractor},
     1249the image is first smoothed by Gaussian kernel with $\sigma = 1.7$
     1250pixels, corresponding to a FWHM of 1.0\arcsec\ in the PS1 stack
     1251images.  Next, the Kron radius is determined in an iterative process:
     1252the first radial moment is measured using the pixels in an aperture
     12536$\times$ the first radial moment from the previous iteration.  On the
     1254first iteration, the sky radius is used in place of the first radial
     1255moment.  By default, 2 iterations are performed.  The Kron radius is
     1256defined to be 2.5$\times$ the first radial moment.  The Kron flux is
     1257the sum of pixel fluxes within the Kron radius.  We also calculate the
     1258flux in two related annular apertures: the Kron inner flux is the sum
     1259of pixel values for the annulus $R_1 < r < 2.5 R_1$, while the Kron
     1260outer flux is the sum of pixel values for $2.5 R_1 < r < 4 R_1$.
     1261
     1262Two details in the calculation above should be noted.  First, for
     1263faint sources, noise in the measurement of the 1st radial moment may
     1264result in an excessively small aperture for the successive
     1265calculations.  The window used for the calculations is constrained to
     1266be at least the size of the aperture based on the PSF stars
     1267(Section~\ref{sec:moments}).  At the other extreme, noise may make the radius
     1268grow excessively, resulting in an unrealistically low effective
     1269surface brightness.  The aperture is constrained to be less than a
     1270maximum value defined such that the minimum surface brightness is
     12711/2$times$ the effective surface brightness of a point source detected at the
     1272$5\sigma$ limit.
     1273
     1274Second, the measurement of the 1st radial moment includes a filter to
     1275reduce contamination from outlier pixels.  Pairs of pixels on
     1276opposites sides of the central pixel are considered together.  The
     1277geometric mean of the two fluxes is used to replace the flux values.
     1278If the source has 180\degree\ symmetry, this operation has no impact.
     1279However, if one of the two pixels is unusually high, the value will be
     1280surpressed by the matched pixel on the other side.  This trick has the
     1281effect of reducing the impact of pixels which include flux from near
     1282neighbors.
     1283
     1284\note{give a test example}
    13161285
    13171286\subsubsection{Source Size Assessment}
    13181287\label{sec:source.size}
    1319 
    1320 \note{is this in the right place?}
    13211288
    13221289After the PSF model has been fitted to all sources, and the Kron flux
     
    13531320\note{how are / were these parameters set?}
    13541321
     1322\subsubsection{Full PSF Model Fitting}
     1323
     1324% \note{review the discussion below}
     1325
     1326% gaussSigma = MOMENTS_GAUSS_SIGMA from recipe (initially)
     1327% gaussSigma = Sigma used for window function, $\sigma_w$
     1328
     1329% fitRadius, apRadius = (fitScale, apScale) * gaussSigma
     1330% fitScale = 7.0
     1331% apScale = 4.5
     1332
     1333Once a PSF model has been selected for an image, \code{psphot}
     1334attempts to fit all of the detected sources, with signal-to-noise
     1335ratio greater than a user-defined limit, with the PSF model.  In the
     1336PV3 analysis of the $3\pi$ survey data, this limit was set to a
     1337signal-to-noise ratio of 20.0 for all analysis stages.  In these fits,
     1338the dependent parameters are fixed by the PSF model and only the 4
     1339independent source model parameters are allowed to vary in the fit.
     1340\code{psphot} again uses Levenberg-Marquardt minimization for the
     1341non-linear fitting.  The sources are fitted in their S/N order,
     1342starting with the brightest and working down to the user-specified
     1343limit, with the other sources subtracted as discussed above.
     1344
     1345For the PSF model fitting, only pixels within a circular aperture
     1346scaled based on the seeing are used.  The radius of the circular
     1347aperture is set to be a fixed multiple of $\sigma_w$, the width of the
     1348Gaussian window function determined based on the analysis of the
     1349second moments (see Section~\ref{sec:moments}).  For the PV3 $3\pi$
     1350analysis, the PSF fit window radius is $7 \times \sigma_w$. 
     1351
     1352Sources which are blended with other sources are fitted together as a
     1353set of PSFs.  Blended objects are identified by first searching for
     1354objects for which the PSF fit windows overlap.  For a group of such
     1355neighboring objects, a contour is determined in the flux image at
     1356$25\%$ of the peak of the brightest source in the group.  All objects
     1357lying within this contour are treated as blends of this brightest
     1358source.  If other objects in this group exist, the brightest object
     1359not already assigned to a blend is used to define the contour for
     1360blends of this next object.  All objects in the image are tested as
     1361possible blends.  A single multi-source fit is performed on each group
     1362of blended peaks.
     1363
     1364%% Once a solution has been achieved for a source, \code{psphot} attempts to
     1365%% judge the quality of the PSF model as a representation of the source
     1366%% shape.  To do this, it calculates the next step of the minimization
     1367%% {\em allowing the shape parameters to vary}.  This step, essentially
     1368%% the Gauss-Newton minimization distance from the current local minimum,
     1369%% should be very small if the source is well represented by the PSF, but
     1370%% large if the PSF is not a good representation of the source flux.  The
     1371%% model quality is judged by the change in the two shape parameters
     1372%% which represent the 2D size of the source.  For the case of the
     1373%% elliptical Gaussian, these two parameters are $\sigma_x$ and
     1374%% $\sigma_y$.  For a generic model, the shape parameters may be defined
     1375%% differently, but there should always be two parameters which scale the
     1376%% source size in two dimensions.  Currently, \code{psphot} requires the two
     1377%% relevant shape parameters to be the first two dependent parameters in
     1378%% the list of model parameters (ie, parameters 4 \& 5).
     1379%%
     1380%% The expected distribution of the variation of the two shape parameters
     1381%% will be a function of the signal-to-noise of the source in question
     1382%% and the value of the shape parameter itself.  The expected standard
     1383%% deviation on the shape parameter is, eg, $\sigma_x / {\rm S/N}$.  If
     1384%% the source is well-represented by the PSF, then the shape parameter
     1385%% values should be close to their minimization value.  We can thus ask,
     1386%% for each source, given the measured amplitude of the Gauss-Newton
     1387%% step, how many standard deviations from the expected value (of 0.0) is
     1388%% this particular value?  Sources for which the variation in the shape
     1389%% parameters is a large positive number of standard deviations are
     1390%% likely to be better represented by a larger flux distribution than the
     1391%% PSF (eg, a Galaxy or Comet, etc).  Sources for which the variation in
     1392%% the shape parameters is a large negative number of standard deviations
     1393%% are likely to be better represented by a smaller flux distribution
     1394%% than the PSF (ie, a cosmic ray or other defect).  A user-defined
     1395%% number of standard deviations is used to select these two cases, and
     1396%% to flag the source as a likely galaxy (really meaning 'extended') or
     1397%% as a likely defect. 
     1398
     1399After the PSF model is fitted to each object, \code{psphot} makes an
     1400assessment of the quality of the PSF fits.  First, it checks that the
     1401non-linear fitting process has converged with a valid fit.  The fit
     1402for an object can fail if there are too few valid pixels, due to
     1403masking or proximity to an edge, or if the parameters are driven to
     1404extreme values which are not permitted.  In addition, it is possible
     1405for the peak finding algorithm to identify peaks in locations which
     1406are not actually a normal peak.  Some of these cases are in the edges
     1407of saturated, bleeding columns from bright stars, in the nearly flat
     1408halos of very bright stars, and so on.  In these cases, a local peak
     1409exists, with a lower nearby sky region.  However, the fitted PSF model
     1410cannot converge on the peak because it is very poorly defined (perhaps
     1411only existing in the smoothed image).  In these cases, \code{psphot}
     1412flags the object with the bad bit \code{PM_SOURCE_MODE_FAIL}.  It is
     1413also possible in this type of case for the fit to result in a very low
     1414or negative value for the flux normalization parameter.  Source for
     1415which the peak is less than 0.02 are also marked as failing the
     1416non-linear PSF fit (\code{PM_SOURCE_MODE_FAIL}).
     1417
     1418Poor fits are also identified by the signal-to-noise and the $\chi^2$
     1419value of the resulting fit.  If a source has a PSF S/N ratio lower
     1420than a user-defined cutoff (set to 2.0 for the PV3 analysis of the
     1421$3\pi$ survey), the non-linear PSF fit will be rejected.  If the
     1422Chi-Square per degree of freedom is greater than a user-defined limit
     1423(set to 50.0 for the PV3 analysis of the $3\pi$ survey), the
     1424non-linear PSF fit will be rejected.  These sources are marked with
     1425the flag bit (\code{PM_SOURCE_MODE_POOR}).
     1426
     1427Sources which are pass the above tests are marked as having a valid
     1428non-linear PSF model fit (\code{PM_SOURCE_MODE_SATSTAR}).  Among these
     1429sources, those for which the peak flux is greater than the saturation
     1430limit are marked as saturated stars (\code{PM_SOURCE_MODE_SATSTAR}).
     1431These model fits should be consisdered with caution, but the fluxes
     1432and positions may have some validity (see Section~\ref{Saturation}).
     1433
     1434As the sources are fitted to the PSF model, those which survive the
     1435exclusion stage are subtracted from the image.  The subtraction
     1436process modifies the image pixels (removing the fitted flux, though
     1437not the locally fitted background) but does not modify the mask or the
     1438variance images.  The signal-to-noise ratio in the image after
     1439subtraction represents the significance of the remaining flux.  If the
     1440subtractions are sufficiently accurate models of the PSF flux
     1441distribution, the remaining flux should be below 1 $\sigma$
     1442significance.  In practice the cores of bright stars are poorly
     1443represented and may have larger residual significance.
     1444
     1445For sources in groups of blended stars, the resulting fits are
     1446evaluated independently.  Any which are determined to be valid PSF
     1447fits are subtracted from the image and kept for future analysis.
     1448
     1449\subsubsection{Double and Extended Sources}
     1450
     1451Sources which are judged to be non-PSF-like are confronted with two
     1452possible alternative choices.  First, the source is fitted with a
     1453double-source model.  In this pass, the assumption is made that there
     1454are two neighboring sources, but the peaks are not resolved.  The
     1455initial guess for the two peaks is made by splitting the flux of the
     1456single source in half and locating the two starting peaks at +/- 2
     1457pixels from the original peak along the direction of the semi-major
     1458axis of the sources, as measured from the second moments.  In order
     1459for the two-source model to be accepted, both sources must be judged
     1460as a valid PSF source.  Otherwise, the double-PSF model is rejected
     1461and the source is fitted with the available non-PSF model or models.
     1462
    13551463\subsubsection{Non-PSF Sources}
    13561464
    13571465Once every source (above the S/N cutoff) has been confronted with the
    1358 PSF model, the sources which are thought to be galaxies (extended) can
    1359 now be fit with appropriate models for the galaxies (or other likely
    1360 extended shapes).  Again, the fitting stage starts with the brightest
    1361 sources (as judged by the rough S/N measured from the moments
    1362 aperture) and working to a user defined S/N limit. 
    1363 
    1364 \code{psphot} will use the user-selected galaxy model to attempt the galaxy
    1365 model fits.  In the configuration system, the keyword \code{GAL_MODEL}
    1366 is set to the model of interest.  All suspected extended sources are
    1367 fitted with the model, allowing all of the parameters to float.  The
    1368 initial parameter guesses are critical here to achieving convergence
    1369 on the model fits in a reasonable time.  The moments and the pixel
    1370 flux distribution are used to make the initial parameter guess.  Many
    1371 of the source parameters can be accurately guessed from the first and
    1372 second moments.  The power-law slope can be guessed by measuring the
    1373 isophotal level at two elliptical radii and comparing the ratio to
    1374 that expected.
    1375 
    1376 For each of the galaxy models (in fact for all source models), a
    1377 function is defined which examines the fit results and determines if
    1378 the fit can be consider as a success or a failure.  The exact criteria
    1379 for this decision will depend on the details of the model, and so this
    1380 level of abstraction is needed.  For example, in some case, the range
    1381 of valid values for each of the parameters must be considered in the
    1382 fit assessment.  In other cases, we may choose to use only the
    1383 parameter errors and the fit Chi-Square value.
    1384 
    1385 All galaxy model fits which are successful are then subtracted from
    1386 the image as is done for the successful PSF model fits.  Of course,
    1387 the background flux is retained, with the result that only the source
    1388 is subtracted from the image.  Again, the variance image is (currently)
    1389 not modified. 
     1466PSF model, the sources which are thought to be extended (resolved) can
     1467now be fit with an appropriate model (e.g., galaxy profile or other
     1468likely extended shapes).  Again, the fitting stage starts with the
     1469brightest sources (as judged by the rough S/N measured from the
     1470moments aperture) and working to a user defined S/N limit.
     1471
     1472\code{psphot} will use the user-selected extended source model to
     1473attempt these fits.  In the configuration system, the keyword
     1474\code{EXT_MODEL} is set to the model of interest.  All suspected
     1475extended sources are fitted with the model, allowing all of the
     1476parameters to float.  The initial parameter guesses are critical here
     1477to achieving convergence on the model fits in a reasonable time.  The
     1478moments and the pixel flux distribution are used to make the initial
     1479parameter guess.  Many of the source parameters can be accurately
     1480guessed from the first and second moments.  The power-law slope can be
     1481guessed by measuring the isophotal level at two elliptical radii and
     1482comparing the ratio to that expected.
     1483
     1484For each type of extended source model (in fact for all source
     1485models), a function is defined which examines the fit results and
     1486determines if the fit can be consider as a success or a failure.  The
     1487exact criteria for this decision depends on the details of the model,
     1488and so this level of abstraction is needed.  For example, in some
     1489case, the range of valid values for each of the parameters must be
     1490considered in the fit assessment.  In other cases, we may choose to
     1491use only the parameter errors and the fit Chi-Square value.
     1492
     1493All extended source model fits which are successful are then
     1494subtracted from the image as is done for the successful PSF model
     1495fits.  The background flux is retained, with the result that only the
     1496source is subtracted from the image.  At this stage, the variance
     1497image is not modified. 
     1498
     1499For the single exposure (\ippstage{camera}) and \ippstage{stack} image
     1500analysis, these galaxy model fits are only used internally to generate
     1501a clean object-subtracted residual image.  For the PV3 analysis of the
     1502$3\pi$ survey, these model fits were saved in the output catalog
     1503files, but not loaded to the public database.  The \code{QGAUSS}
     1504extended source model was used for the PV3 analysis (see
     1505Section~\ref{sec:Source.Model}).  The convolved galaxy model fits (see
     1506Section~\ref{sec:galaxy.conv.fit}) and the forced galaxy model fits
     1507(see Section~\ref{sec:galaxy.forced.fit}) provide more reliable and
     1508physically-motivated galaxy models.
     1509
     1510For the difference image analysis, a trailed object model is used for
     1511the extended sources; these model fit parameters are passed to the
     1512Moving Object Processing System \citep[MOPS][]{2013PASP..125..357D}.
    13901513
    13911514\subsection{Faint Source Analysis}
     
    15181641Petrosian flux is contained. 
    15191642
    1520 \subsubsection{Radial Profile Wings}
    1521 
    1522 We attempt to measure the radial profile of sources in order to find
    1523 the radius at which the flux of the source is matches the sky.  In
    1524 this analysis, a series of up to 25 radial bins with power-law spacing
    1525 are defined and the flux of the source in each annulus is measured.
    1526 The ``sky radius'' is defined to be the radius at which the (robust
    1527 median) flux in the annulus is within 1 $\sigma$ of the local sky
    1528 level.  If this limit is not reached before the slope of the flux from
    1529 one annulus to the next is less than a user-defined limit, then the
    1530 annulus at which the slope reaches this limit is used to define the
    1531 sky radius.  These values are saved in the output smf / cmf files, but
    1532 not sent to the PSPS.  The sky radius value is used below in the
    1533 calculation of the kron magnitude.
    1534 
    1535 \subsubsection{Kron Magnitudes}
    1536 \label{sec:kron.mags}
    1537 
    1538 Preliminary Kron radius and flux values \citep{1980ApJS...43..305K}
    1539 are calculated soon after sources are detected
    1540 (Section~\ref{sec:moments}).  However, these preliminary values are
    1541 not accurate due to the window-functions applied.  After sources have
    1542 been characterized and the PSF model is well-determined, the Kron
    1543 parameters are re-calculated more carefully.  In this version of the
    1544 calculation, following the algorithm described by \cite{sextractor},
    1545 the image is first smoothed by Gaussian kernel with $\sigma = 1.7$
    1546 pixels, corresponding to a FWHM of 1.0\arcsec\ in the PS1 stack
    1547 images.  Next, the Kron radius is determined in an iterative process:
    1548 the first radial moment is measured using the pixels in an aperture
    1549 6$\times$ the first radial moment from the previous iteration.  On the
    1550 first iteration, the sky radius is used in place of the first radial
    1551 moment.  By default, 2 iterations are performed.  The Kron radius is
    1552 defined the be 2.5$\times$ the first radial moment.  The Kron flux is
    1553 the sum of pixel fluxes within the Kron radius.  We also calculate the
    1554 flux in two related annular apertures: the Kron inner flux is the sum
    1555 of pixel values for the annulus $R_1 < r < 2.5 R_1$, while the Kron
    1556 outer flux is the sum of pixel values for $2.5 R_1 < r < 4 R_1$.
    1557 
    1558 Two details in the calculation above should be noted.  First, for
    1559 faint sources, noise in the measurement of the 1st radial moment may
    1560 result in an excessively small aperture for the successive
    1561 calculations.  The window used for the calculations is constrained to
    1562 be at least the size of the aperture based on the PSF stars
    1563 (Section~\ref{sec:moments}).  At the other extreme, noise may make the radius
    1564 grow excessively, resulting in an unrealistically low effective
    1565 surface brightness.  The aperture is constrained to be less than a
    1566 maximum value defined such that the minimum surface brightness is
    1567 1/2$times$ the effective surface brightness of a source detected at the
    1568 $5\sigma$ limit.
    1569 
    1570 Second, the measurement of the 1st radial moment includes a filter to
    1571 reduce contamination from outlier pixels.  Pairs of pixels on
    1572 opposites sides of the central pixel are considered together.  The
    1573 geometric mean of the two fluxes is used to replace the flux values.
    1574 If the source has 180\degree\ symmetry, this operation has no impact.
    1575 However, if one of the two pixels is unusually high, the value will be
    1576 surpressed by the matched pixel on the other side.  This trick has the
    1577 effect of reducing the impact of pixels which include flux from near
    1578 neighbors.
    1579 
    1580 \note{give a test example}
    1581 
    15821643\subsubsection{Convolved Galaxy Model Fits}
     1644\label{sec:galaxy.conv.fit}
    15831645
    15841646In the galaxy model fittting stage, sources which meet certain
     
    18741936tested.
    18751937
     1938\begin{table*}
     1939\begin{center}
     1940\caption{\label{tab:measurements} \nocode{psphot} measurements performed} % \vspace{-0.5cm}
     1941\begin{tabular}{lcccc}
     1942\hline
     1943\hline
     1944{\bf Measurement} & {\bf Camera} & {\bf Stack} & {\bf Forced Warp} & {\bf Diff} \\
     1945\hline
     1946  Background                 & Y & Y & Y & N$^1$ \\
     1947  Peaks                      & Y & Y & N & Y \\
     1948  Footprints                 & Y & Y & N & Y \\
     1949  Moments                    & Y & Y & Y & Y \\
     1950  PSF Model                  & Y & Y & Y & N$^2$ \\
     1951  Bright Star Profile        & Y & Y & N & Y \\
     1952  Non-Linear PSF Fits        & Y & Y & N & N \\
     1953  Source-Size Tests          & Y & Y & N & Y \\
     1954  Unconvolved Galaxy Model   & Y & Y & N & N \\
     1955  Unconvolved Streak Model   & N & N & N & Y \\
     1956  Linear PSF Fits            & Y & Y & Y & Y \\
     1957  Radial Profiles            & Y & Y & N & Y \\
     1958  Petrosian Fluxes           & N & Y & Y & N \\
     1959  Kron Fluxes                & Y & Y & Y & Y \\
     1960  Convolved Galaxy Models    & N & Y & N & N \\
     1961  Fixed Aperture Photometry  & N & Y & Y & N \\
     1962  Convolved, Fixed Apertures & N & Y & N & N \\
     1963  Aperture Corrections       & Y & Y & Y & N \\
     1964  Forced PSF Fluxes          & N & N & Y & N \\
     1965  Forced Galaxy Models       & N & N & Y & N \\
     1966  Lensing Parameters         & N & Y & Y & N \\
     1967\hline
     1968\hline
     1969\multicolumn{5}{l}{$^1$ Background subtraction is performed by {\tt ppSub} before calling {\tt psphot}} \\
     1970\multicolumn{5}{l}{$^2$ PSF modeling is perfom by {\tt ppSub} on the input warps before calling {\tt psphot}} \\
     1971\end{tabular}
     1972\end{center}
     1973\end{table*}
     1974
    18761975\subsection{Output Formats}
    18771976
     
    19732072is marked as completed.
    19742073
    1975 \subsection{Forced Photometry : PSFs}
    1976 
    1977 \subsection{Forced Photometry : galaxies}
     2074\subsection{Forced Galaxy Models}
     2075\label{sec:galaxy.forced.fit}
    19782076
    19792077The convolved galaxy models are also re-measured on the
     
    21492247
    21502248* background model description (see waters)
     2249
Note: See TracChangeset for help on using the changeset viewer.