PSF kernel calibration
Per-iteration PSF kernel fit (gaussian/moffat/drizzle), DAO matched-filter FWHM scan / empirical-FWHM shortcut, and centre-mask helpers.
Per-iteration PSF calibration: sphot’s mainloop hook.
calibrate_psf_step is called per Sersic+iPSF mainloop iteration via sphot.core._maybe_recalibrate_psf when [psf-calib] in_mainloop = true. Each call:
Pulls quality-passing anchors from cutoutdata.psf_table. With no usable photometry the bootstrap blur grid picks a starting PSF from source counts.
Fits a kernel K (Gaussian / Moffat / drizzle) against the anchors via the multi-source NNLS objective.
Replaces cutoutdata.psf with library_psf * K.
Scans dao_fwhm_factor on a 3-point bracket and picks the factor that maximises quality-passing source count under the new PSF.
- sphot.calibrate_psf.effective_fwhm_data_px(cutoutdata)[source]
FWHM of cd.psf in data pixels (post-kernel calibration).
Used for sizing the centre-mask radius and any other “where is the PSF actually wide” calculation. Falls back to the library Gaussian equivalent (2.355 × psf_sigma) if photutils.psf.fit_fwhm fails so the caller always gets a finite, sane number.
- sphot.calibrate_psf.calibrate_psf_step(cutoutdata, *, family: str = 'gaussian', K: int = 30, fwhm_default_grid: Sequence[float] = (1.0, 1.5, 2.355), bracket_lo: float = 0.5, bracket_hi: float = 3.5, skip_stable_threshold: float = 0.001, progress=None, log=<built-in function print>)[source]
One PSF calibration step. Reuses the just-completed photometry and cd.sersic_residual to fit a kernel and update cd.psf.
- Steps:
Pull (x, y, flux) of the K brightest quality-passing sources from cd.psf_table (or run bootstrap blur if none).
Fit kernel parameters via the multi-source NNLS objective.
cd.psf <- library * K.
Bracket-scan dao_fwhm_factor, or reuse the previous one if the kernel L2 distance is below skip_stable_threshold.
Persist cd.kernel_params, cd.dao_fwhm_factor, cd._calibrate_psf_prev_kernel.
family: ‘gaussian’ (default) | ‘moffat’ | ‘drizzle’.