DonutDetectDiameterTask#

class lsst.ts.wep.task.DonutDetectDiameterTask(*args, **kwargs)#

Bases: Task

Detect donuts and estimate their diameters via disk cross-correlation.

Bins the post-ISR exposure and correlates it against a geometric ladder of filled-disk templates (whose differences form annuli). For each diameter, a NORMALIZED cross-correlation (cosine-similarity) score is formed:

rho = <image, t> / (||t|| * ||image_patch||)

where t is the zero-mean annulus template and ||image_patch|| is the local mean-removed image energy under the template’s support (obtained from the image-squared correlation). This makes the score a pure shape-agreement measure in ~[-1, 1], independent of BOTH donut size and brightness – so a small crisp donut is not out-scored by a large or merely-bright feature.

Bad pixels (config.badPixelTypes) are zeroed before binning (_prepImage). Peaks are declustered by a per-peak separation scaled to the winning diameter, then quality-cut, in _selectPeaks. Finally the pooled per-detection likeness sizing curve yields a single exposure diameter.

Quality-control cuts and diagnostics#

Up to config.nPeaks peaks are returned; a peak must pass BOTH a likeness and a matched-filter SNR threshold (config.likenessThreshold, config.snrThreshold) to survive. The cuts are applied inside peak selection (_selectPeaks), so pruning a failing candidate lets the descent through the sorted maxima continue – the nPeaks slots fill with genuine survivors rather than being spent on rejects. Each peak carries two complementary scores:

likeness – the cosine score above. Measures SHAPE agreement only; being

scale- and brightness-invariant, it discards the amplitude, which is why pure-noise local maxima can still reach ~0.5-0.6 (hence the default likeness threshold sits just above that noise floor).

snr – the matched-filter SNR, dot / (||t|| * pixelNoise). Restores

the amplitude information the cosine normalization throws away.

They fail differently – and so are required jointly: the cosine rejects wrong-shape features at any brightness, the SNR rejects noise at any shape. On a measured failure (2026070900182 det 203, 2 real donuts and 3 noise peaks) the two real peaks separated from the three spurious ones by ~1.7x in likeness but ~15x in SNR.

Also reported per peak (diagnostic only, no cut applied) is curve_argmax_edge, true when the sizing curve’s maximum lands on a ladder endpoint – a monotonic curve carrying no interior scale, which is how a spurious result ends up pinned to an endpoint rung.

param args:

type args:

Any

param kwargs:

type kwargs:

Any

Methods Summary

run(exposure)

Detect donuts and estimate the exposure's donut diameter.

Methods Documentation

run(exposure)#

Detect donuts and estimate the exposure’s donut diameter.

Bins and cleans the exposure, correlates it against the disk-template bank, builds the likeness and SNR maps, selects and quality-cuts peaks, and pools their sizing curves into one exposure diameter.

Parameters:

exposure (lsst.afw.image.Exposure) – Post-ISR exposure to detect donuts in.

Returns:

detectionsastropy.table.QTable

One row per surviving peak, with id, centroid_x and centroid_y (full-res px), per-detection diameter, likeness, snr, peak_diameter and the diagnostic curve_argmax_edge flag.

diameterfloat

The combined exposure donut diameter in full-res px, NaN if unmeasurable.

diameterScatterfloat

Per-detection fractional scatter, NaN with fewer than 2 detections.

sizingCurvesdict

The per-detection and combined sizing curves (see _exposureDiameter).

binnedImagenp.ndarray

The binned, bad-pixel-filled image correlated.

likeness, snr, argDiameternp.ndarray

The likeness map, the matched-filter SNR at the winning diameter, and the per-pixel winning diameter (binned px).

pixelNoisefloat

The robust per-binned-pixel noise sigma.

diskCorr, diskCorrSqlist [np.ndarray]

The raw image and image-squared correlation maps.

diametersBinned, diametersFullnp.ndarray

The diameter ladder in binned and full-res px.

bboxlsst.geom.Box2I

The edge-eroded bounding box the binned frame maps into.

binningint

The detection binning factor applied.

Return type:

lsst.pipe.base.Struct