stdpipe.photometry_quality module¶
PSF-based per-source quality metrics borrowed from the crowdsource
photometry pipeline (Schlafly et al., MIT-licensed).
The metrics operate on stacks of postage stamps:
impsf — neighbour-subtracted data stamps (data minus the model of every
other source). For an isolated source this is just the data stamp.
im — raw data stamps (no neighbour subtraction).
psf — model PSF stamps for each source, normalized to integrate to one.
weight — inverse-sigma stamps; pixels with weight == 0 are treated as
masked.
All inputs are (N, S, S) arrays. Outputs are length-N 1D arrays.
The functions are deliberately decoupled from any particular photometry
backend so they can be reused from stdpipe.photometry_psf.measure_objects_psf(),
stdpipe.photometry_measure.measure_objects_sep(), or external code.
- stdpipe.photometry_quality.neff_fwhm(stamp)[source]¶
FWHM-like quantity of a 2D PSF stamp, equivalent to
crowdsource.psf.neff_fwhm.Returns
1.18 / sqrt(pi * sum((p/norm)^2)). The1.18calibrates the n_eff-derived width to the actual FWHM of a Gaussian PSF.
- stdpipe.photometry_quality.convolve_with_exp_galaxy(psf_stack, re)[source]¶
Convolve each
(S, S)PSF inpsf_stackwith a circular exponential galaxy of effective radiusre(in pixels).Uses an FFT-based 6-Gaussian mixture approximation of the exponential, so the result is the same shape as the input.
remay be a scalar or a length-N array (one per source).
- stdpipe.photometry_quality.compute_qf(psf_stack, weight_stack)[source]¶
Per-source PSF quality factor.
qf = sum(P_normed * (W > 0))— the fraction of the PSF footprint that overlaps unmasked pixels.1.0for a fully unmasked source,< 1if pixels are masked or off-image.
- stdpipe.photometry_quality.compute_fracflux(impsf_stack, im_stack, psf_stack, weight_stack)[source]¶
Per-source fraction-of-flux metric.
fracflux = sum(impsf * (W > 0) * P_normed) / sum(im * (W > 0) * P_normed)Approaches 1 for an isolated source whose neighbours have been cleanly subtracted, and drops below 1 when nearby sources contribute flux at the target’s PSF footprint. Useful as a crowding / blendiness indicator.
- stdpipe.photometry_quality.compute_spread_model(impsf_stack, psf_stack, weight_stack, fwhm=None)[source]¶
Per-source
spread_modelstar/galaxy classifier (and its uncertainty).Equivalent to SExtractor’s spread_model and to
crowdsource_base.spread_model. Convolves each PSF with a tiny exponential galaxy (re = fwhm / 16 * 1.6783) and compares the data’s similarity to PSF vs PSF-convolved-galaxy. Returns(spread, dspread): a star yieldsspread ~ 0, an extended sourcespread > 0.If
fwhmis None it is estimated per-source from the PSF stamp vianeff_fwhm().