IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40588


Ignore:
Timestamp:
Dec 23, 2018, 7:41:43 AM (8 years ago)
Author:
eugene
Message:

update the aperture discussion; warp photometry

File:
1 edited

Legend:

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

    r40586 r40588  
    112112%   * add example for sky model
    113113%   * Kaiser optimal detection reference
    114 %   * find a brighter-fatter reference
    115114% * define more tests and generate examples
    116115%   * simulation example of background subtraction
     
    119118% * check all references
    120119% \end{verbatim}
     120
     121\note{the beginning section needs to be updated to mention the DR1 and
     122  DR2 releases, the PV0-PV3 analysis versions, and the basic idea of
     123  the IPP stages).
    121124
    122125This is the fourth in a series of seven papers describing the
     
    258261stand-alone C program, or as a set of library functions which may be
    259262integrated into other programs
     263
     264\note{quick discussion of the IPP analysis stages; PV0-PV3; DR1 \& DR2}
    260265
    261266Several variants of \code{psphot} have been used in the PS1 PV3
     
    764769artifacts) and (2) the brighter stars are themselves subject to
    765770additional biases due to saturation and other non-linear effects
    766 (c.f., ``the Brighter-Fatter'' effect, \note{REF}).  To make a robust
    767 choice for $\sigma_w$, we choose a value such that the measured value
    768 of $\sigma^{\prime}_{\rm PSF}$ is 65\% of $\sigma_w$.  The resulting second
    769 moment values are biased somewhat low (\approx 75\% of the truth value
    770 for the PS1 PSF profile), but are relatively unbiased as a function of
    771 brightness.
     771\citep[c.f., ``the Brighter-Fatter''
     772  effect,][]{2014JInst...9C3048A,2015JInst..10C5032G}.  To make a
     773robust choice for $\sigma_w$, we choose a value such that the measured
     774value of $\sigma^{\prime}_{\rm PSF}$ is 65\% of $\sigma_w$.  The
     775resulting second moment values are biased somewhat low (\approx 75\%
     776of the truth value for the PS1 PSF profile), but are relatively
     777unbiased as a function of brightness.
    772778
    773779To choose the value of $\sigma_w$, we try a sequence of values
     
    787793an aperture with a radius of 4$\sigma_w$ to select the pixels for the
    788794measurement of the moments.
     795
     796%% comfirmed: PSF_MOMENTS_RADIUS = 4 * MOMENTS_GAUSS_SIGMA (\sigma_w)
     797%% factor of 4 is hard-wired in psphotSourceStats.c where MOMENTS_GAUSS_SIGMA is set.
     798%% PSF_MOMENTS_RADIUS used for: moments analysis, Kron analysis (starting radius),
     799%% radial profile wings (starting radius)
    789800
    790801Once $\sigma_w$ has been determined, moments are measured as defined
     
    917928some of the observed PSF variations in the images
    918929
    919 \note{write up the fitting process to define the grid?}
     930% \note{write up the fitting process to define the grid?}
    920931
    921932Several analytical functions which are likely candidates to describe
     
    980991interpolated to the center of the model pixel.
    981992
    982 Pixels for a given star which are more than XX sigma
     993Pixels for a given star which are more than a number of sigmas
    983994(PSF.RESIDUALS.NSIGMA = 3.0) deviant from the median value of the
    984995pixels from all stars are rejected. 
     
    10301041ignored.
    10311042
    1032 % \note{is the pixel scale $0.1 \sigma_w$ or PSF_CLUMP_GRID_SCALE = 0.2?}
    1033 % psphotSourceStats sets PSF_CLUMP_GRID_SCALE to 0.1 \sigma_w^2, set
    1034 % to 0.2 by default (before \sigma_w is known).
    1035 % pmSource uses PSF_CLUMP_GRID_SCALE.  note that the image is in Mxx
    1036 % (\sigma_x^2) not \sigma_x,\sigma_y)
    1037 
    10381043Once a peak has been detected in this plane, the centroid and second
    10391044moments of this peak are measured.  All sources which land within 2
     
    11121117\end{table}
    11131118
    1114 
    11151119All of the PSF-candidate sources are then re-fitted using the PSF
    11161120model to specify the PSF-dependent model parameter values for each
     
    11221126the PSF model for this particular image.
    11231127
    1124 The metric used by \code{psphot} to assess the PSF model is the scatter in
    1125 the differences between the aperture and fit magnitudes for the PSF
    1126 sources.  This difference is a critical parameter for any PSF modeling
    1127 software as it is a measurement of how well the PSF model captures the
    1128 flux of the star.  An approximate correction is measured here, with a
    1129 more detailed correction measured after all source analysis is
    1130 performed (see Section~\ref{sec:aperture.correction}).  The PSF model
    1131 with the best consistency of the aperture correction is judged to be
    1132 the best model.  \note{are we making a decision on the order or
    1133   anything based on apresid?}
     1128The metric used by \code{psphot} to assess the PSF model is the
     1129scatter in the differences between the aperture and fit magnitudes for
     1130the PSF sources.  This difference is a critical parameter for any PSF
     1131modeling software as it is a measurement of how well the PSF model
     1132captures the flux of the star.  Aperture photometry is measured for a
     1133circular aperture with a radius of \code{PSF_APERTURE_SCALE} (= 4.5
     1134for the PV3 $3\pi$ analysis) times $\sigma_w$
     1135(Section~\ref{sec:moments}).  The average aperture correction ($m_{\rm
     1136  AP} - m_{\rm PSF}$) is measured and, if multiple PSF model types are
     1137selected, the PSF model with the minimum clipped scatter in this
     1138statistic is chosen for the image.  An approximate aperture correction
     1139is measured here, with a more detailed correction measured after all
     1140source analysis is performed (see
     1141Section~\ref{sec:aperture.correction}).
    11341142
    11351143\subsection{Bright Source Analysis}
     
    13141322M_{\rm minor} = \frac{1}{2}(M_{xx} + M_{yy}) - \frac{1}{2}\sqrt{(M_{xx} - M_{yy})^2 + 4 M_{xy}^2}
    13151323\]
    1316 If $M_{\rm minor} < 1.2$ pixels$^2$ and the instrumental Kron
    1317 magnitude is $< -5.5$, then the source is identified as a cosmic ray
    1318 and the associated pixels are masked.
    1319 
    1320 \note{how are / were these parameters set?}
     1324If $M_{\rm minor} < 0.8$ pixels$^2$ and the signal-to-noise of the
     1325flux measured in the moments analysis $> 7$, then the source is
     1326identified as a cosmic ray and the associated pixels are masked.
     1327These values are tuned empirically for the PV3 analysis based on
     1328cosmic rays identified in the GPC1 images.
     1329
     1330% Mminor < 0.8 && SN > 7
     1331
     1332% for dynamic CR parameters, use object with Mminor < 1.2 and Mkron <
     1333% -5.5 to assess the distribution
    13211334
    13221335\subsubsection{Full PSF Model Fitting}
     
    13451358For the PSF model fitting, only pixels within a circular aperture
    13461359scaled based on the seeing are used.  The radius of the circular
    1347 aperture is set to be a fixed multiple of $\sigma_w$, the width of the
    1348 Gaussian window function determined based on the analysis of the
    1349 second moments (see Section~\ref{sec:moments}).  For the PV3 $3\pi$
    1350 analysis, the PSF fit window radius is $7 \times \sigma_w$. 
     1360aperture is set to be a fixed multiple (\code{PSF_FIT_RADIUS_SCALE})
     1361of $\sigma_w$, the width of the Gaussian window function determined
     1362based on the analysis of the second moments (see
     1363Section~\ref{sec:moments}).  For the PV3 $3\pi$ analysis, the PSF fit
     1364window radius is $7 \times \sigma_w$.
    13511365
    13521366Sources which are blended with other sources are fitted together as a
     
    18541868% \note{is the first convolution done with the Alard-Lupton technique?}
    18551869
    1856 \subsection{Aperture Correction}
     1870\subsection{Aperture Correction and Total Aperture Fluxes}
    18571871\label{sec:aperture.correction}
    18581872
     
    18711885least within some range of normal image conditions.  So, for example,
    18721886two images with different image quality, or with different tracking
    1873 and focus errors, will have different PSF models.  Since an analytical
    1874 model will always fail to represent the flux of the star at some
    1875 level, the measured flux of the same source in the two images will be
    1876 different (even assuming all other atmospheric and instrumental
    1877 effects have been corrected).  The amplitude of the error will by
    1878 determined by how inconsistently the models represent the actual
    1879 source flux. 
     1887and focus errors, will have different PSF models.  To the extent the
     1888PSF model is inaccurate, the measured flux of the same source in the
     1889two images will be different (even assuming all other atmospheric and
     1890instrumental effects have been corrected).  The amplitude of the error
     1891will by determined by how inconsistently the models represent the
     1892actual source flux.
    18801893
    18811894Aperture photometry attempts to avoid these problems, but introduces
     
    18911904in the atmosphere.  The amplitude and distribution of these two
    18921905scattering functions do not change significantly or quickly for a
    1893 single telescope and site.
     1906single telescope and site.  Aperture photometry can then be used to
     1907correct the PSF photometry.
    18941908
    18951909The difficulty for aperture photometry is the need to make an accurate
     
    19011915number of very bright stars is limited in any image, and of course the
    19021916brighter stars are more likely to suffer from non-linearity or
    1903 saturation.  \code{psphot} measures the aperture correction ({\em ApResid})
    1904 for every PSF candidate source and applies this correction to the PSF
    1905 model photometry.
     1917saturation. 
     1918
     1919In order to thread the needle between these effects, \code{psphot}
     1920measures the aperture photometry on a modest-sized aperture, and then
     1921uses the PSF model to extrapolate to a large aperture.  When the PSF
     1922fluxes are calculated, the aperture flux for the modest-sized aperture
     1923is also determined.  The aperture is a circular aperture with radius
     1924set to a fixed multiple (\code{PSF_APERTURE_SCALE}) of $\sigma_w$, the
     1925width of the Gaussian window function determined based on the analysis
     1926of the second moments (see Section~\ref{sec:moments}).  For the PV3
     1927$3\pi$ analysis, the aperture window radius is $4.5 \times \sigma_w$,
     1928while the large reference aperture radius is set to 25 pixels
     1929(\code{PSF_REF_RADIUS} = 6\farcs4).  These corrected aperture
     1930magnitudes are saved in the output catalogs as \code{AP_MAG}, the
     1931uncorrected aperture magnitudes are saved as \code{AP_MAG_RAW}, and
     1932the radius used to measure the raw aperture flux is saved as
     1933\code{AP_MAG_RADIUS}.  The corresponding flux and the flux error are
     1934saved as \code{AP_FLUX} and \code{AP_FLUX_SIG}.
     1935
     1936With these aperture magnitudes in hand, it is now possible to make an
     1937average correction to the PSF magnitudes to bring the PSF and aperture
     1938magnitudes to the same system.  This correction is measured using the
     1939same stars from which the PSF model is measured, as long as the PSF
     1940magnitude error for the star is less than 0.03 mag.  The correction is
     1941calculated using the weighted average of the values $m_{\rm AP} -
     1942m_{\rm PSF}$.  Since the PSF may vary across the image, the correction
     1943is determined as a function of position in the image.  Like the PSF
     1944model, the 2D variations of the aperture correction may be modeled as
     1945a polynomial or via interpolation in a grid.  For the $3\pi$ PV3
     1946analysis, a grid with a maximum of $6\times 6$ samples per GPC1 chip
     1947image was used.  The reported PSF magnitudes for all objects have this
     1948aperture correction applied.
     1949
     1950% growth curve analysis in psphot:
     1951% in psphotChoosePSF : call psphotMakeGrowthCurve
     1952% in psphotMakeGrowthCurve : boolean GROWTH_FROM_SOURCES, use
     1953%% pmGrowthCurveGenerateFromSources or
     1954%% pmGrowthCurveGenerate (uses PSF model only)
     1955%% GROWTH_FROM_SOURCES is set to TRUE for default recipe
     1956
     1957%% ApTrend:
     1958%% in psphotApResid, called by psphotReadout near the end of the
     1959%% analysis
     1960%% ApTrend = f(x,y) for (apMag - psfMag) for psfMagErr <= 0.03
     1961%% apMag is growth curve corrected
     1962%% psfMag is raw
     1963
     1964%% raw psfMag and raw apMag are measured
     1965%% apMag = apMagRaw + growth curve correction (from apRadius to 25 pix
     1966%% = PSF_REF_RADIUS)
     1967%% psfMag = psfMagRaw + aperture trend (<ap - psf> + growth curve)
    19061968
    19071969% How important is this effect?  Consider a typical bright source with a
     
    20122074Any measurement which relies on a good knowledge of the PSF at the
    20132075location of an object either needs to determine the PSF variations
    2014 present in the \ippstage{stack} image, or the measurement will be
     2076present in the \ippstage{stack} image or the measurement will be
    20152077somewhat degraded.  The highly textured PSF variations make this a
    20162078very challenging problem: not only would such a PSF model require an
     
    20322094%% images for a given stack. 
    20332095
    2034 The PV3 $3\pi$ analysis solves this problem by using the sources
     2096The IPP analysis solves this problem by starting with the sources
    20352097detected in the stack images and performing forced photometry on the
    20362098individual warp images used to generate the stack.  This
    2037 \ippstage{fullforce} analysis is performed on all warps for a single
    2038 skycell and filter as a single unit, as this matches the arrangement
    2039 of the input source catalog from the \ippstage{skycal} stage.  When
    2040 processing is queued for this stage, an entry is added to the
    2041 \ippdbtable{fullForceRun} primary database table linking to the
    2042 specific \ippdbcolumn{skycal_id} entry that will be used as the
    2043 catalog for the photometry.  The \ippdbcolumn{warp_id} values for the
    2044 input \ippstage{warp} stage images that contributed to the
    2045 \ippstage{stack} associated with that \ippdbcolumn{skycal_id} are
    2046 then added to the \ippdbtable{fullForceInput} table, linked to the
    2047 primary table by the \ippdbcolumn{ff_id} identifier.  The individual
    2048 jobs for each warp are then run, which passes the \ippstage{warp}
    2049 stage image products along with the \ippstage{skycal} catalog to the
    2050 \ippprog{psphotFullForce} program.
    2051 
    2052 In this program, the positions of sources are loaded from the input
    2053 catalog.  PSF stars are pre-identified \note{how?} and a PSF model
    2054 generated for each \ippstage{warp} image based on those stars, using
    2055 the same stars for all warps to the extent possible (PSF stars which
    2056 are excessively masked on a particular image are not used to model the
    2057 PSF).  The PSF model is fitted to all of the known source positions in
    2058 the warp images.  Aperture magnitudes, Kron magnitudes, and moments
    2059 are also measured at this stage for each warp.  Note that the flux
    2060 measurement for a faint, but significant, source from the stack image
    2061 may be at a low significance (less than the $5\sigma$ criterion used
    2062 when the photometry is not run in this forced mode) in any individual
    2063 warp image; the flux may even be negative for specific warps.  When
    2064 combined together, these low-significance measurements will result in
    2065 a signficant measurement as the signal-to-noise increases by the
    2066 square root of the number of measurements.
    2067 
    2068 Upon completion of the forced photometry (for point sources as well as
    2069 galaxies, discussed below), an entry is added to the
    2070 \ippdbtable{fullForceResult} table with the processing statistics for
    2071 that combination of \ippdbcolumn{ff_id} and \ippdbcolumn{warp_id}.
    2072 Once all of the entries in the \ippdbtable{fullForceInput} table have
    2073 finished, a summary operation is run to generate an appropriate
    2074 average value for each measurement, by combining the measurements from
    2075 each of the inputs.  The output catalogs listed in the
    2076 \ippdbtable{fullForceResult} table are passed to the
    2077 \ippprog{psphotFullForceSummary} to do this averaging.  \note{describe
    2078   what is done} When this completes, an entry is added to the
    2079 \ippdbtable{fullForceSummary}, and the \ippdbtable{fullForceRun} entry
    2080 is marked as completed.
     2099forced-photometry analysis is performed using the
     2100\ippprog{psphotFullForce} variant of \ippprog{psphot}.
     2101
     2102In this program, the positions of sources are loaded from the output
     2103catalog of the stack photometry.  Candidates PSF stars are
     2104pre-identified as those stars used to generate the PSF model in the
     2105stack photometry analysis.  A PSF model is generated for each input
     2106warp image based on those stars; PSF stars which are excessively
     2107masked on a particular image are not used to model the PSF.  The PSF
     2108model is fitted to all of the known source positions in the warp
     2109images.  Aperture magnitudes, Kron magnitudes, and moments are also
     2110measured at this stage for each warp.  Note that the flux measurement
     2111for a faint, but significant, source from the stack image may be at a
     2112low significance (less than the $5\sigma$ criterion used when the
     2113photometry is not run in this forced mode) in any individual warp
     2114image; the measured flux may even be negative due to statistical
     2115fluctuations.  When combined together, these low-significance
     2116measurements will result in a signficant measurement as the
     2117signal-to-noise increases with the combination of more data.
     2118
     2119Individual warp images are processed independently with separate
     2120executions of the \ippprog{psphotFullForce} program.  Once all of the
     2121forced photometry measurements (for point sources as well as galaxies,
     2122discussed below) are completed for all of the warps which contributed
     2123to a stack image, the measurements are combined together by other
     2124portions of the IPP system.   The PSF photometry measurements are
     2125combined in the context of the DVO database system
     2126\citep{magnier2017.datasystem}, including recalibration of the zero
     2127points for the individual warp. 
    20812128
    20822129\subsection{Forced Galaxy Models}
     
    20872134this analysis, the galaxy models determined by the
    20882135\ippstage{staticsky} photometry analysis are used to seed the analysis
    2089 in the individual \ippstage{warp} images.  The purpose of this
     2136in the individual \ippstage{warp} images.  The motivation of this
    20902137analysis is the same as the \ippstage{fullforce} PSF photometry: the
    20912138PSF of the \ippstage{stack} image is poorly determined due to the
     
    21012148elliptical shape, and thus the best galaxy magnitude value.
    21022149
    2103 For each \ippstage{warp} image, the \ippstage{staticsky} value for the
    2104 major and minor axis are used as the center of a $7\times{} 7$ grid
     2150For each \ippstage{warp} image, the \ippstage{staticsky} values for
     2151the major and minor axis are used as the center of a $5 \times 5$ grid
    21052152search of the major and minor axis parameter values.  The grid spacing
    21062153is defined as a function of the signal-to-noise of the galaxy in the
    21072154stack image so that bright galaxies are measured with a much finer
    2108 grid spacing that faint galaxies \note{need to quantify this}.  For
    2109 each grid point, the major and minor axis values at that point are
    2110 determined for the model.  The model is then generated and convolved
    2111 with the PSF model for the \ippstage{warp} image at that point.  The
    2112 resulting model is then compared to the \ippstage{warp} pixel data
    2113 values and the best fit normalization value is defined.  The
    2114 normalization and the $\chi^2$ value for each grid point is recorded.
    2115 
    2116 For a given galaxy, the result is a collection of $\chi^2$ values for
    2117 each of the grid points spanning all \ippstage{warp} images.  A single
    2118 $\chi^2$ grid can then be made by combining each grid point across the
    2119 inputs.  The combined $\chi^2$ for a single grid point is simply the
    2120 sum of all $\chi^2$ values at that point.  If, for a single \ippstage{warp}
    2121 image, the galaxy model is excessively masked, then that image will be
    2122 dropped for all grid points for that galaxy.  The reduced $\chi^2$
    2123 values can be determined by tracking the total number of pixels
    2124 used across all inputs to generate the combined $\chi^2$ values.  From
    2125 the combined grid of $\chi^2$ values, the point in the grid with the
    2126 minimum $\chi^2$ is found.  Quadratic interpolation is used to
    2127 determine the major, minor axis values for the interpolated minimum
    2128 $\chi^2$ value.  The errors on these two parameters is then found by
    2129 determining the contour at which the \note{reduced?} $\chi^2$
    2130 increases by 1.
    2131 
    2132 Thus the \ippstage{fullforce} galaxy analysis uses the PSF information
    2133 from each \ippstage{warp} to determine a best set of convovled galaxy
    2134 models for each object in the \ippstage{skycal} catalog.
    2135 \note{discuss the subset of galaxy models and objects}.
     2155grid spacing than faint galaxies.  For both the major and minor axis
     2156directions, values of ($1 - \frac{3.0}{S/N}$, $1 - \frac{1.5}{S/N}$,
     21571.0, $1 + \frac{1.5}{S/N}$, $1 + \frac{3.0}{S/N}$) times the dimension
     2158are tested.  For each grid point, the major and minor axis values at
     2159that point are used to generate the model.  The model is then
     2160convolved with the PSF model for the \ippstage{warp} image at that
     2161point.  The resulting convolved model is then compared to the
     2162\ippstage{warp} pixel data values and the best fit normalization value
     2163is determined.  The integrated flux, flux error, and the $\chi^2$
     2164value for each grid point are recorded.
     2165
     2166For a given galaxy, the result is a collection of $\chi^2$ values,
     2167fluxes, and flux errors for each of the grid points spanning all
     2168\ippstage{warp} images.  A single $\chi^2$ grid can then be made by
     2169combining each grid point across the inputs.  The combined $\chi^2$
     2170for a single grid point is simply the sum of all $\chi^2$ values at
     2171that point.  If, for a single \ippstage{warp} image, the galaxy model
     2172is excessively masked, then that image will be dropped for all grid
     2173points for that galaxy.  The reduced $\chi^2$ values can be determined
     2174by tracking the total number of pixels used across all inputs to
     2175generate the combined $\chi^2$ values.  From the combined grid of
     2176$\chi^2$ values, the point in the grid with the minimum $\chi^2$ is
     2177found.  Quadratic interpolation is used to determine the major, minor
     2178axis values for the interpolated minimum $\chi^2$ value.  The errors
     2179on these two parameters is then found by determining the contour at
     2180which the \note{reduced?} $\chi^2$ increases by 1.
     2181
     2182In this way, the \ippstage{fullforce} galaxy analysis uses the PSF
     2183information from each \ippstage{warp} to determine a best set of
     2184convolved galaxy models for each object in the \ippstage{skycal}
     2185catalog.
     2186
     2187% galaxy model fits performed based on limits set in psphotChooseAnalysisOptions.c
     2188
     2189% petrosian analysis performed on same objects as galaxy model fits
     2190% if EXTENDED_SOURCE_PETROSIAN == TRUE (TRUE for PV3 stack - STACKPHOT)
     2191
     2192% galaxy model fits are performed on :
     2193% all if (PSPHOT.EXT.FIT.ALL.SOURCES == TRUE) (FALSE for PV3 stack)
     2194%   (even so, if density is higher than PSPHOT.EXT.FIT.ALL.THRESH, skip)
     2195
     2196% only extended sources (based on EXT.NSIGMA) if EXT.NSIGMA.LIMIT.USE
     2197% == TRUE (FALSE for PV3 stacks)
     2198
     2199% fit sources / measure petrosian to fixed flux limit if limits are
     2200% defined (they are for PV3)
     2201
     2202% mag limits by filter, e.g., : petro 25, extfit 21.5
     2203% are translated to flux in counts and compared to Kron flux
     2204
     2205% SN limit is used only if fixed flux limits are not set
     2206% SN limit set to EXTENDED_SOURCE_SN_LIM (10.0 for PV3)
     2207% S/N limit for Kron flux,
     2208
     2209% galaxy coordinate limits:
     2210% if |b| > 20.0 + 15.0 exp(-long^2 / (2 * 50^2))
    21362211
    21372212\section{Difference Image Photometry}
Note: See TracChangeset for help on using the changeset viewer.