WPHOT is designed to perform the source position and flux characterization step associated with each of the three stages of source extraction during pipeline processing (singleframe, singleepoch 4band frameset, and final multiframe coadd stage). The characterization is based on an input list of source candidate positions produced by the source detection module, MDET, using a detection algorithm which makes use of the data at all bands simultaneously.
Since the majority of sources detected by WISE are expected to be spatially unresolved, the optimal approach for source characterization involves profilefitting photometry (WPRO). Profilefitting is our primary method of flux estimation  it gives the best results for the majority (i.e., the fainter) sources, handles PSF variations and masked pixels in an optimal fashion, and extends the dynamic range for bright sources well into the saturated regime.
Just as with the detection step, profilefitting is carried out using the data from all bands simultaneously. The advantages of simultaneous multiband extraction are:
The multiband estimation process represents a departure from the traditional procedure, employed in such software packages as DAOPHOT (Stetson 1987) and SExtractor (Bertin & Arnouts 1996), in which detection and characterization are carried out one band at a time. Another motivation for developing new source extraction algorithms is that currently available packages operate on a single regularlysampled image rather than a set of dithered images. The procedures employed in MDET and WPHOT are optimized for the latter case.
Since the majority of sources are unresolved, the profilefitted flux represents our best estimate in most cases. For extended sources (one indicator of which is an elevated chi squared value), an aperture flux should be used instead. Therefore, in addition to profilefitting photometry, WPHOT includes an system (WAPPco) that employs circular apertures to characterize the integrated flux and `curveofgrowth' of point sources as measured in the coadded images. Those sources that are within close proximity to a 2MASS XSC (galaxy) are further characterized using an elliptical aperture derived from the 2MASS XSC.
Figure 1  WPHOT overview flowchart 
The compromise solution is to break the large coadd 'footprint' into a smaller pieces, processing each piece separately. The cost is i/o overhead from reading in the frames multiple times, once for each grid piece. An example of a 3x3 divided footprint is shown in the diagram; a savings in memory load of nearly 50% is possible with such a gridding. The optical grid configuration, balancing runtime and memory usage is found to be 5x5.
The basic algorithm steps follow from the Coadd 'footprint' divided into NxM pieces with enough overlap to take into account spacecraft rotation (w/ respect to equatorial north) and minimum border tolerance for background and source flux estimage; each piece is processed separately as follows:
The local background is determined from the pixel value distribution within a circular annulus centered on the source MDETposition. The source background, b_λ and σ^2_bann, representing the local ``sky'' background level and its uncertainty, are estimated from the trimmed average of the pixel value distribution, where the trimming is driven by the 50% (median) and 16% (lower 1σ) histogram shape and thus robust to contamining sources in the annulus (whose pixel values reside on the positive side of histogram median); see Figure 3 for illustration.
The formal background error, or sigma in the mean, is derived from the the error propagation that follows the instrument characteristics and the noise model that is tracked by AWAIC and passed to on to WPHOT. With this noise model, the formal uncertainty in the background sky level is
(Eq. 1) 
where N_b is the number of pixels in the annulus and
σ_i
is the measurement uncertainty for detector/frame pixel i,
and F_b is the correlation factor that is appropriate to the images
being measured (for WISE frames, the factor is unity, and for coadds it
ranges between 30 and 225, W1 to W4, respectively).
Figure 3  parameters: standard aperture (red) and local background annulus (green). 
The formal background uncertainty is not sensitive to confusion noise that may be present in the aperture or annulus. It therefore requires a correction to account for any stellar crowding or confusion noise. A reasonable proxy to the total noise comes from the annulus background uncertainty, σ^2_bann. We therefore make the assumption that the confusion noise is the difference between the total noise in the annulus and the formal (Poisson) noise in the aperture:
(Eq. 2) 
For most of the sky, the confusion noise term is zero or negligible in value, but for the Galactic Plane where stellar crowding is an important concern, the confusion noise term may be appreciable.
Choosing the optimal size for the annulus is an important consideration toward accurate photometry. The annulus must be large enough to avoid the influence of the point spread function and to minimize the Poisson component of the sky pixels (see equation below). On the other, it must also be small enough to represent the ``local'' sky value (that is to say, the fluctuations that are present in the aperture should be of similar amplitude in the annulus). Moreover, in order to accommodate the possibility of the source being fuzzy galaxy, the annulus should extend beyond the size expected for most galaxies in the sky.
Consider what was done with 2MASS background estimation. For standard 2MASS point source photometry, the annulus that was used: R_inner = 14 arcsec, R_outer = 20 arcsec, with 2 arcsec pixels that translates to 160 pixels in the annulus. The 2MASS beam is about 2.5 arcsec, so R_inner is ~6x the FWHM. For the combined calibration fields, 2MASS used a larger annulus, 24  30 arcsec in size, or roughly ~10x the FWHM. The standard calibration aperture for IRAC is 12 arcsec, and the annulus is 14.4  20 arcsec, which compared to the 2 arcsec beam is ~7  10x the FWHM.
For WISE, the FWHM=6 arcsec for the short channels, and so using 2MASS/IRAC as a guide, the inner radius would be ~40  50 arcsec (80  100 arcsec for WISE4); with 2.75 arcsec pixels, that translates to R_inner ~ 15  18 pixels. For the width, using a similar area as the 2MASS/IRAC annulus, then R_outer ~ 19 pixels. Since that is a relatively thin aperture, subject to pixelization effects, it would be better to extend it to a width of 4  5 pixels, or R_outer = 20  22. Consequently, the adopted annulus for WISE point sources is: 50  70 arcsec (for all four bands), corresponding to 1825 pixel radius in W1, W2, W3, and 9 to 13 pixels for W4. This setting is constrained by the W4 beam.
Local Background Output ParametersThe purpose of this step is to make a maximum likelihood estimate of the source position and the set of fluxes at the four wavelengths for each source candidate identified by the detection module MDET. The candidate source and its neighbors (i.e., adjacent candidates whose PSF responses overlap significantly with the primary candidate) are grouped into blends, and their parameters estimated simultaneously; this process is referred to as passive deblending, and is incorporated explicitly into the photometric measurement model. The critical distance for blend grouping is driven by the size of the PSF at the longest wavelength; neighbors separated from the source in question by less than twice the nominal FWHM at W4 (i.e., 24 arcsec) are included in the initial blend group.
For a blend consisting of N_{B} components, the measurement model used in profile fitting is:
(Eq. 3) 
where ρ_{λi} is the observed value of the ith pixel at 2d sky location r_{λi} in the waveband denoted by subscript λ, s_{n} is a 2d vector representing the location of the nth blend component, f_{λn} is the flux in the λth waveband, H_{λ}(r) is the PSF, b_{λ} is the local background, estimated in an annulus surrounding the candidate position, and ν_{λi} is the noise, assumed to be a spatially and spectrally uncorrelated zeromean Gaussian random process with variance σ_{λi}^{2}.
The latter quantity includes the various noise components in the error model and may be expressed as:
(Eq. 4) 
where (σ_{pix})_{λi} represents the uncertainty in the pixel value due to instrumental effects; it is calculated by module ICAL, and includes the effects of Poisson noise, read noise, and flatfielding error. Also, (σ_{conf})_{λi} represents the confusion noise, as defined by Eq. (2) above, and δH_{λ}(r) represents the PSF uncertainty which must be scaled by the source flux, f^{^}_{λ}. The "hat" symbol (^) over the latter quantity denotes an estimated value. Our best estimate prior to the profile fitting is the aperture flux; we follow this with a second iteration based on the profilefitted flux from the first iteration.
The set of unknowns in the estimation process can be represented by an n_{p}dimensional parameter vector, z, defined as:
(Eq. 5) 
where N_{λ} represents the number of wavebands, and the number of unknowns is given by n_{p} = N_{B}(N_{λ} + 2).
The solution procedure is to maximize the conditional probability P(ρz,N_{B}) with respect to z, where:
(Eq. 6) 
in which the summation over i is for all pixels within a predefined "fitting radius", r_{fit}, of the candidate source location. Pixels which are flagged as "bad," due to effects such as saturation and cosmic ray hits, are excluded from the solution. We normally set r_{fit} = 1.25 x FWHM, where the latter quantity represents the nominal FWHM of the PSF at the particular band, equal to 6, 6, 6, and 12 arcsec in bands W1 through W4, respectively. However, in the case of saturated stars, we set r_{fit} = max(2r_{sat}, 1.25xFWHM), where r_{sat} is the effective radius of the saturated core of the bright star, calculated by the MDET module.
The quality of the fit is then evaluated using the reduced chi squared, given by:
(Eq. 7) 
where N_{obs} represents the total number of pixel values used in the solution.
Before proceeding further, the blend group is first examined to check for redundant components, i.e., those components which can be removed without an increase in χ_{ν}^{2}. Thus the final value of N_{B} can, in some cases, be less than the initial value defined above.
If χ_{ν}^{2} ~ 1, the fit is regarded as satisfactory.
However, if χ_{ν}^{2}
is larger than a critical value,
(χ_{ν}^{2})_{crit},
or if the reduced chi squared for an
individual band (denoted
(χ_{ν}^{2})_{λ})
exceeds a related threshold,
(where
phi is the relative number of degrees of freedom of the singleband fit
with respect to the multiband fit),
then we consider that the source model has not satisfactorily reproduced the
observed data. We then examine the hypothesis that the true intensity
distribution involves additional point source components. In this procedure,
referred to as active deblending, we successively add more source
components (thereby increasing N_{B}) until either
χ_{ν}^{2} <
(χ_{ν}^{2})_{crit}
or else the blend number
reaches a predefined limit, (N_{B})_{max}, at which
point we conclude that a model consisting of a few point sources
is not consistent with the observations. For reasons of computational speed,
we allow at most 1 extra component to be added via active deblending.
At each iteration of the active deblending procedure, the mechanism for adding a new source component is as follows:
The overall profilefitting photometry procedure is illustrated by the flow chart in Figure 6; the active deblending procedure is contained within the blue dashed rectangular box. Active deblending is required for sources whose separation is less than 1.3 times the FWHM of the PSF at a given band, since this is the critical distance at which the detector can resolve neighboring sources.
Figure 6  WPRO Flow Chart 
When a satisfactory solution has been obtained, the uncertainties in the estimated parameters (position and fluxes) are obtained using:
(Eq. 8)

in which E is the expectation operator and T denotes transpose.
The way in which the above estimation procedure is implemented is that we start with the brightest source in the candidate list and estimate its parameters as above. We then proceed as follows:
We then repeat the procedure for the next brightest candidate, and so on until the MDET candidate list is exhausted.
Each PSF in the library represents an average over a focalplane segment of width W_{P}, over which we approximate the PSF as locally isoplanatic. The driver for W_{P} is the Functional Requirement of at least 7% flux accuracy for an unsaturated source with SNR > 100. Our 9x9 subdivision of the focal plane exceeds this requirement by typically better than a factor of 4. We now discuss in detail the procedure used for PSF estimation in each focalplane segment.
The measurement model for the PSF is then:
(Eq. 10) 
where s_{n} is the location of the nth star in the segment. The origin of the coordinate system for the PSF image is defined to be at the star location.
The noise, ν_{nj}, is assumed to be an uncorrelated Gaussian random process for which
(Eq. 11) 
From the set of star images, we can make a maximum likelihood estimate of the PSF using:
(Eq. 12) 
where f^{^}_{n} and s^{^}_{n} represent the estimated flux and position, respectively, of the nth star. For bright stars, an accurate flux estimate can be obtained via .
The source position s_{n} is estimated by adjusting the positional offset of the star image for maximum correlation with respect to a nominal starting PSF, H_{0}(r'), for which we used a theoretical form based on optical simulations. The estimation is accomplished by numerical minimization, with respect to s_{n}, of:
(Eq. 13) 
(Eq. 14) 
We model Δ_{ni} as a zeromean Gaussian random process with variance
(Eq. 15) 
where δH(r) represents the PSF uncertainty at offset r from the PSF origin; g and N_{R} represent the gain and read noise, respectively.
Suppose that the position (r_{i}  s_{n}) falls within the jth pixel on the grid used to represent the PSF, i.e.,
(Eq. 16) 
(Eq. 17) 
where (x'_{j}, y'_{j}) represent the components of r'_{j}, (ξ_{n}, η_{n}) represent the components of s_{n}, and δx, δy represent the sampling intervals of the PSF grid in the x and y directions, respectively.
Then:
(Eq. 18) 
Thus the probability density of the set of local data residuals, Δ, conditioned on δH_{j}, is given by:
(Eq. 20) 
where the summations are over all n, i which satisfy Equations 16 and 17 for a given j.
This expression is maximized when:
(Eq. 21)

Since δH_{j} is present on both sides of Equation 2), iterative solution is required. Convergence is rapid, however, and a single iteration suffices.
For each focal plane segment:
1. Locate all stars above a given flux threshold for the particular band.
2. Estimate PSF and its uncertainty using Equations 12 and 21.
3. For each individual star, examine the quality of its profile fit by evaluating χ_{ν}^{2} using Equation 7.
4. List any stars for which χ_{ν}^{2} exceeds a predefined threshold (~ 2); discard the star with the highest χ_{ν}^{2}
5. Iterate from step 2 until all all remaining stars used in the PSF estimation have acceptable profile fits.
The PSFs and their corresponding uncertainty images, as used for the Preliminary Release, were generated one band at a time using the procedure described above. Candidate frames were selected from all scans between 01601a (by which time improved astrometry had been implemented) and 01751a. Initial frame selection was made by searching source detection tables for bright unsaturated stars, requiring SNR of at least 30 in the case of W4. This yielded 1028 candidate framesets. The W1 images were then visually examined to remove those images with obvious tracking problems (elongated images), high cosmic ray fluxes, highly crowded fields in the Galactic plane, structured backgrounds (e.g. nebulae), very bright stars saturating large areas of the array, and scattered moonlight. This selection process left 888 candidate framesets. The practical limit on the number frames that WPSFGEN can process at once is ~500, so another 300 framesets were removed by randomly rejecting framesets which had only one band four detection with W4SNR > 30. The final list of 484 frames provided 68749 unique sources with SNR > 100.
For bands W1W3, PSFs were generated in 9x9 grids over the focal plane. Because of the relative scacity of bright stars in W4, a 5x5 grid was generated, and interpolated between adjacent PSFs to form a 9x9 grid. The following is aset of pseudocolor representations of the PSFs using a linear intensity scale, clipped at 60% of peak; the width of the field of view is 43.5 arcsec for W1W3 and 87 arcsec for W4:
Figure 7  WISE PSFs 
Profiles through the central PSF in the 9x9 array in each band are shown in Figure 8. The major axis has been defined as that for which the FWHM is maximized, and the minor axis is perpendicular to that.
Figure 8  PSF profiles through major axes (solid lines) and minor axes (dashed lines). 
The major and minor axes and position angles of major axes of the central PSFs are then as follows:
Band  Major Axis FWHM [arcsec] 
Minor Axis FWHM [arcsec] 
Major Axis PA [deg] 

W1  6.08  5.60  3 
W2  6.84  6.12  15 
W3  7.36  6.08  6 
W4  11.99  11.65  0 
Noise pixel estimates can be found in IV.6.d.i.
w?sat: The number of saturated pixels located within the photometric "fitting" region in the vicinity of the source, expressed as a fraction of the total number of pixels within that region. The saturated pixels themselves were excluded from the solution, as explained above.
w?frl: The fractional number of pixels within the fitting region which were flagged as begin contaminated by latents. These pixels were also excluded from the solution.
N of M refers to the number of S/N > 3Ïƒ extractions relative to the total number of measurements for a source. Sources that are low S/N will have a low N/M fraction, and conversely high S/N sources should have a fraction that is unity. Those sources that are high S/N but exhibit a low N/M fraction may indicate measurement failures or source instability.
The distribution in individual measurements has a mean and standard deviation of the mean and population. Sources that are high S/N but exhibit a large standard deviation may indicate shorttime scale variability or measurement failure.
(Eq. 23)

The weighted mean, the unbiased weighted sample variance (re: population variance) and the standard error of the mean are reported. Comparison of population variance with composite WPRO flux variance may be used to assess time variability; see next section.
Repeatability Output Parameters
It should be understood that the profile fitting system (WPRO) represents the most accurate flux estimation for point sources under most circumstances  the exceptions are when the source is high S/N (>> 50) but not saturated or when it is resolved and extended. Circular aperture photometry provides a better flux estimation for both of these cases. If the source is associated with a 2MASS extended source, then WAPPco provides an elliptical aperture measurement designed to capture a larger fraction of the source flux as described below.
The basic flow of the WPHOT coadd photometry system WAPPco is illustrated in Figure 9. Fixed serves several purposes, including:
Figure 9  system flowchart 
The primary functions of WAPPco is to carry out circular and local background estimation. It performs the initial (preliminary) flux measurements for source characterization by WPRO, and applies a full suite of circular apertures on the coadded mosaics. The aperture MASK is scanned for bad, saturated or fatalflagged pixels, and the aperture flux is flagged accordingly. If nearby stars are detected within the aperture, the flag is set to indicate "contamination." If the source is associated (in position) with a 2MASS XSC source, elliptical is carried out using an aperture based on the 2MASS extraction. Finally, if the source is suspected to be extended (e.g., poor χ^{2} value ), then it is flagged as such.
bands  1  2  3  4  5  6  7  8  units 
W1, W2, W3  5.50  8.25  11.00  13.75  16.50  19.25  22.00  24.75  arcsec 
W4  11.00  16.50  22.00  27.50  33.00  38.50  44.00  49.50  arcsec 
W1  W2  W3  W4 
[mag]  [mag]  [mag]  [mag] 
0.222  0.280  0.665  0.616 
Multiple is the primary function of the WAPPco system. The standard aperture is used to measure the source brightness in a small aperture, which is then corrected so that it recovers the "total" flux of the source, thus matching the PSFmeasured flux of the source. A set of nested circular apertures centered on the source (as determined by WPRO) provides the "curve of growth" for a source. The aperture sizes range from the smallest APMIN (5.5 arcsec, or 4 coadded pixels) to the largest APMAX (24.75 arcsec, or 18 coadded pixels), which is constrained by the background annulus. The photometry is carried out using code, developed by 2MASS, that is adapted for WISE images. It includes fractional pixel computations and the ability to use noncircular (elliptical) apertures that are deployed for measurements of 2MASS XSC galaxies.
Figure 10  Set of nested circular apertures (red) and background annulus (green). 
Formal aperture and error model measurements
(see also II.3.f):
(Eq. 31)

where G is the gain (electrons per DN), N_ap is the number of pixels in the circular aperture of radius R_ap, N_b is the number of pixels in the background annulus, b_λ and σ_bann_λ are the sky background level and uncertainty in the annulus pixel distribution, respectively, σ_ann_λ is the uncertainty due to the finite annulus, and σ_b_λ is the measurement uncertainty detector/frame pixel based on the error model (see Eq. 1) and the estimated confusion noise, F_{a} and F_{b} are the pixel correlation factors, where they are roughly equal to each other. For WISE coadded images, the F values appropriate to the standard circular apertures (8.25 arcsec radius) are set to 32, 37, 58 and 221 respectively for W1, W2, W3 and W4.
flag values:
value Condition   0 nominal  no contamination 1 source confusion  another source falls within the measurement aperture 2 bad or fatal pixels: presence of bad pixels in the measurement aperture (bit 2 or 18 set) 4 nonzero bit flag tripped (other than 2 or 18) 8 corruption  all pixels are flagged as unusable, or the aperture flux is negative; in the former case, the aperture magnitude is NULL; in the latter case, the aperture magnitude is a 95% confidence upper limit 16 saturation  here are one or more saturated pixels in the measurement aperture 32 upper limit  the magnitude is a 95% confidence upper limit combinations: 3 source confusion + bad pixels 5 source confusion + nonzero bit flag 6 bad pixels + nonzero bit flag 7 source confusion + bad pixels + nonzero bit flag 9 source confusion + corruption 10 bad pixels + corruption 11 source confusion + bad pixels + corruption 12 nonzero bit flag + corruption 13 source confusion + nonzero bit flag + corruption 14 bad pixels + nonzero bit flag + corruption 15 source confusion + bad pixels + nonzero bit flag + corruption 17 source confusion + saturation 18 bad pixels + saturation 19 source confusion + bad pixels + saturation 20 nonzero bit flag + saturation 21 source confusion + nonzero bit flag + saturation 22 bad pixels + nonzero bit flag + saturation 23 source confusion + bad pixels + nonzero bit flag + saturation 24 corruption + saturation 25 source confusion + corruption + saturation 26 bad pixels + corruption + saturation 27 source confusion + bad pixels + corruption + saturation 28 nonzero bit flag + corruption + saturation 29 source confusion + nonzero bit flag + corruption + saturation 30 bad pixels + nonzero bit flag + corruption + saturation 31 source confusion + bad pixels + nonzero bit flag + corruption + saturation
When the WPRO or WAPP flux measurement has a signaltonoise ratio less than 2, the respective WPRO or WAPP calibrated magnitude in the Working Database is replaced with the 2σ brightness upper limit in magnitude units. In these cases, the magnitude uncertainty values are set to NULL.
The magnitude upper limit is computed by replacing the integrated flux measurement with the flux measurement plus two times the measurement uncertainty, as shown below. If the integrated flux measurement is negative, then the flux is replaced with two times the flux uncertainty.
(Eq. 36)  
(Eq. 37)  
(Eq. 38)  
(Eq. 39) 
where mzero_{λ} is the instrumental zero point magnitude (IV.3.g.iv), m_{λ} is the reported upper limit in mag units, and its uncertainty δm_{λ} is set to NULL.
Sources that are in close proximity (xscprox <= 2 arcsec) to 2MASS XSC sources are assumed to be associated (i.e., the same source), and special is triggered for the source. The aperture is based on the elliptical shape that the 2MASS XSC reports. Due to the larger WISE beam, however, the aperture is adjusted (scaled) accordingly. Fig. 12 illustrates the difference in beam between 2MASS, IRAC and WISE, and the plots (Fig. 1314) that follow show the quantitative difference which WAPPco uses to adjust the elliptical aperture for a particular case (XSC size and inclination). For a full suite of sizes and shapes, a lookup table is created to adjust the WISE aperture in accordance with the 2MASS XSC aperture shape.
Figure 11  WISE W1+W2+W3 composite image showing the elliptical aperture (blue) used to extract the flux from 2MASS galaxies in the field. 
There are two simple ways to assess whether a source is extended. Although they are not foolproof, they are reliable, at least in the sense that they are a good warning signal. The two methods are WPRO rchi^2 thresholding and XSC proximity. For each band, the reduced chi^2 is a measure of the goodness of fit between the source and the PSF. The nominal value for this parameter is unity. For sources that are poorly fit, the value exceeds 2, and is often much larger. Resolved 2MASS galaxies exhibit large rchi^2 values, with typical values near 4 to 6 for the W1 measurements. Placing a threshold on the rchi^2, in any band, separates pointlike from extended sources. This threshold should be some value between 2 and 4, where 2 is a stringent threshold and 4 is more relaxed.
Last update: 2011 November 28