# PS1-assisted astrometric and chromatic ePSF calibration of TESS full-frame images

- Working outline, 2026-10-01; concise bullets, not manuscript prose.
- Adopted example: S24 C2K2, `tess2020120182919-s0024-2-2`; science crop origin (44, 0), shape 2048 × 2048 pixels.
- Replication: S20 C3K3, S22 C3K3, S24 C1K2, S23 C4K2; five independent FFIs, all four cameras.
- Recipe: A3 + Gaia-XP colour; lp7s prior; no brightness-width term, fitted background, or in-loop rejection.
- Final accuracy claims require five-fold held-out evaluation; all-star fits supply delivered calibrations.
- Development figures illustrate methods; they do not replace the unfinished five-FFI dataset.
- [Historical outline](archive/OUTLINE_20260930.md); [evidence and unresolved checks](EDITORIAL_AUDIT.md).

## 1. Introduction

- Jointly constrain positions, effective response, and flux in crowded, undersampled images.
- PS1 supplies a resolved contaminating scene; Gaia supplies astrometry and colour information.
- Distinguish single-image calibration from time-series performance; no light-curve gains claimed.
- Acknowledge established ePSF/PRF and TESS crowded-field work; colour dependence itself is not new.
- Test a reproducible scene-assisted calibration and de-crowding chain across cameras.

## 2. PS1 reference scene

### 2.1 Inputs, coverage, and units

- Record exposure IDs, epochs, checksums, crop, WCS, catalog selections, and per-band usable coverage.
- Mapping uses the custom MOCPy polygon-point query to identify candidate PS1 skycells for each TESS grid centre.
- Resolve overlapping candidates by the nearest PS1 projection centre in TESS coordinates; leave unmatched centres unassigned.
- Transform each owned TESS pixel's corners through both WCS solutions; assign enclosed PS1 pixel centres its grid index.
- Store the inverse PS1-to-TESS index map; F = 4 assigns quarter-pixel template cells, not native TESS pixels.
- A PS1 map value of −1 means no assignment in that skycell map, not necessarily a gap in TESS coverage.
- Distinguish nominal survey footprint from observed valid pixels; retain overlap/edge masks.
- Convert PS1 values to common linear flux units; track flux-per-pixel and pixel-area conventions.
- F1 labels a field; F = 1 and F = 4 label template sampling.
- Figure 1: (a) footprint, (b) skycell ownership, (c) one skycell's PS1-to-TESS pixel assignment; distinguish stored historical geometry from final mapping.

### 2.2 Band synthesis

- Retain separate r/i/z/y templates; combine only where required by the matching method.
- D13 synthesis weights ≈ (0.254, 0.437, 0.165, 0.144); calculate with stored full precision.
- Use TESS POC v2.0 response; distinguish synthesis weights from fixed D18 colour-label weights.
- Specify spectral selection, response, and zero points; validate on held-out spectra.
- Figure 2: bandpasses; Appendix C: colour-dependent synthesis residuals and spectral outliers.
- No universal sub-percent claim; quantify very-red and emission-line limitations separately.

### 2.3 Source removal and decomposition

- Remove residual PS1 sky/background structure before smoothing; it is not the TESS exposure's background.
- Without removal, PS1 background structure would spread under convolution and rebinning; excluded pixels do not enter the retained template.
- Treat invalid chip-gap coverage separately, not as measured sky.
- Omit selected bright-source segments from the subtraction scene; their TESS signals remain measurable.
- On valid pixels: original = removed sources + excluded PS1 background + retained scene.
- Bright selection is not a saturation diagnosis; merged segments and wings may remove neighbours.
- Quantify neighbour preservation and excluded background in TESS-equivalent units.
- Figure 3: full-skycell decomposition; supporting zoom: segmentation and nearby sources.

### 2.4 Smoothing, seams, and mapping

- Distinguish PS1 response, preprocessing Gaussian, matching kernel, and TESS ePSF.
- Record smoothing/support, overlap ownership, padding, and pixel-area treatment; test seams and flux accounting.
- Initial F = 4 mapping uses header WCS; geometry does not depend on TESS pixel values.
- Rebuild F = 4 templates on calibrated WCS before the final image; archive both mapping hashes.
- Figure 4: template sampling illustration only; no differing-WCS image comparison.
- Appendix A: require identical WCS, scene, masks, and matching recipe before claiming a sampling gain.

## 3. Preliminary de-crowded image

### 3.1 Empirical template match

- Match the band-combined F = 4 scene with oversampling-aware Hotpants.
- Subtract contaminating light while retaining deliberately omitted calibration stars.
- Specify kernel basis, spatial variation, photometric scale, masks, and native-pixel integration.
- Figure 5: data flow, including initial and calibrated-WCS template construction.

### 3.2 Image-level background

- Estimate the TESS background outside stellar masks; harmonically fill excluded regions before subtraction.
- An exposed stellar wing raises the inferred background and causes over-subtraction beneath the star.
- Method A: magnitude-dependent centred disks, 6–30 native pixels for T < 13; replace fixed pad 2 with pad 0.
- Radii target a fitted wing level of 0.1 electrons/s; this is not a zero-leakage guarantee.
- Apply extra disks to background-fit pixels only, in both background stages; shared masks and Hotpants masks stay unchanged.
- Preserve separate invalid, saturation, strap, and coverage exclusions; no free background in the scene fit.
- Figure 6a: wing-mask footprint and insufficient-mask comparison; Appendix A: detailed background checks.
- Validate on withheld blank regions; retain signed residuals.
- F1 masking tests are developmental; new cross-field background products remain provisional, not accepted final results.

### 3.3 Preliminary image comparison

- Compare the background-subtracted FFI with its preliminary de-crowded image at identical coordinates and display limits.
- Show adjacent zooms with shared axes; white at zero, linear within ±10 electrons/s and logarithmic outside.
- Historical example only: record exposure, background treatment, template, masks, and empirical matching recipe.
- Reduced crowding motivates the scene fit; visual cleaning alone does not establish unbiased flux or astrometry.

### 3.4 Why calibrate for time-series photometry?

- Aim: recover real flux changes across epochs without confusing pointing or response changes with variability.
- A clean single image is insufficient; residual neighbour light can change as stars move across detector pixels.
- Jointly calibrate positions, spatial/chromatic response, and flux to support consistent subsequent light-curve extraction.
- Paper 1 establishes single-image ingredients; temporal accuracy requires separate multi-epoch validation.
- No standalone figure here: §3.3 shows de-crowding; §4 shows the calibrated response and remaining residuals.

## 4. Joint scene, WCS, and chromatic ePSF model

- Current figure source: completed F1/F2 A3 + lp7s fits; saved full fits and five-fold checks.
- These fits use the intended penalty but older background/mask preparation; replace inputs when final products are accepted.

### 4.1 Scene likelihood

- Native pixel model: m_p = Σ_i f_i R_ip; define fitted flux f_i and its finite-support convention.
- Account for neighbours, contributor/anchor/nuisance roles, duplicate pixels, uncertainties, masks, and robust loss.
- Record provisional pre-fit exclusion v1min lists and hashes; distinguish from rejected v0/v1 lists.
- Mask F2 straps; no data-dependent in-loop rejection in the adopted recipe.

### 4.2 Astrometry and gauge

- Propagate Gaia positions to the observation epoch; verify observer/parallax handling before claiming it is applied.
- Define the implemented WCS correction and crop-local coordinates.
- Constrain the ePSF core-centroid gauge; distinguish WCS shift from effective image-centroid shift.
- Figure 9: fitted WCS correction fields from available lp7s fits; not an astrometric-accuracy measurement.
- Add independently measured held-out positional residuals when available across all five FFIs.

### 4.3 Spatial ePSF and rendering

- Interpolate spatial nodes and apply the adopted chromatic/gauge transformations.
- Stored E is already pixel-integrated (`pixel_integrated_v1`), sampled on an O = 4 grid.
- At native pixel centre (x_p, y_p), sample g = c_E + O[(x_p, y_p) − (x_i, y_i)].
- Response R_ip = O² interp(E_i, g): one bilinear sample; zero outside support; no second sixteen-subpixel sum.
- Keep stellar centres continuous; do not round to quarter-pixel phases.
- Separate ePSF grid factor O from template sampling F, even when both equal four.
- Figure 5 inset: correct sampling operator; schematic, not a measured response.
- Figure 14: fitted spatial-response nodes from the available lp7s model; record support and normalization.

### 4.4 Chromatic structure and regularization

- A3: fixed Gaia-XP colour, quadratic colour shifts, and CCD-frame elongation terms.
- Define colour reference, spatial normalization, 17-coefficient ordering, and non-XP fallback from metadata.
- lp7s: local-polynomial weight 3 × 10⁸, 7 × 7 window; fine-neighbour weight zero.
- Penalty: penalize mean-squared ePSF departures from a local-polynomial smooth model to suppress small-scale noise; validate the strength on held-out stars.
- Specify prior definition and normalization; the older moment-blind recipe is superseded.
- No brightness-width term in the adopted five-FFI fit.
- Figure 12: A3 model responses across colour; distinguish predicted shape/shift from empirical residuals.
- Figures 10/15: retain labelled older empirical colour diagnostics until their A3 replacements exist.

### 4.5 Validation

- Run to stated convergence criteria; retain learning curves and parameter-drift checks.
- Five fixed folds: held-out stars/scoring pixels must not train the shared calibration.
- Document leakage controls for blends, colour mapping, preprocessing, and hyperparameter selection.
- Compare baselines on identical samples; show N, bin edges, scatter, units, and uncertainty definitions.
- Figure 11: held-out data/model/residual stamps; common signed scales; selection independent of residual quality.
- Pixel-validation plate: current lp7s five-fold scores and learning curves; show remaining overfitting, not just gains.
- Photometric consistency: retain the older held-out flux plot; replace with matched lp7s/XP measurements when available.
- Gaia-XP predicts comparison flux, not exact truth; separate response, variability, and flux-support effects.

## 5. Final de-crowded image and measurements

### 5.1 Calibrated remapping

- Export fitted WCS; rebuild F = 4 per-band templates; verify seams, weights, coverage, and scaling.
- Preliminary/final differences include remapping and scale changes, not only kernels.
- Isolate kernel effects using Hotpants, achromatic, and chromatic controls on identical remapped templates.

### 5.2 Band-resolved kernels

- Fit a least-squares line through nonlinear A3 responses at 25 training-colour quantiles (2–98%).
- E_b = P₀ + δ_b P₁; normalize ΣP₀ = 1 and ΣP₁ = 0.
- P₁ is a fitted colour slope, not necessarily a derivative; P₀ is a fitted intercept.
- Derive matching K_b from E_b and the pre-smoothed PS1 response; K_b ≠ E_b.
- Apply spatial weights at source positions before convolution; integrate the F = 4 template onto native pixels.
- Verify reconstruction, normalization, ringing, colour extrapolation, and boundaries.
- Figure 20: response/kernel bases at a recorded node; signed colour components and calibrated axes.

### 5.3 Image-level evidence

- Figure 18: preselected real-image region; identical coordinates, shared masks, signed scales.
- Figure 16: controlled residual scores versus colour/position; consistent noise propagation.
- Separate full-chain and kernel-only gains; show failure regions alongside improvements.
- Compare cameras only with identical recipes, not mixed development runs.

### 5.4 Refit stability

- Refit with identical initialization and warm continuation; compare effective position, flux, and shape.
- Report every gate separately; small WCS drift does not establish complete stability.
- Development G6: position/flux stable, effective-width tolerance fails; brightness/background terms differ from the adopted recipe.
- Supplement G6: signed changes and tolerance bands; repeat with adopted recipe before claiming stability.

### 5.5 Photometry and targeted de-crowding

- Specify fitted parameters, neighbour handling, flux support, and uncertainty propagation.
- Omit a chosen target from the subtraction scene while retaining neighbours; verify segment accounting.
- Figure 19: target retained/subtracted, marked neighbours, catalog identifiers.
- Figure 21: extraction residuals and flux/uncertainty checks on independently selected targets.
- Validate uncertainties with injection/recovery or scoped repeat observations; a single frame is insufficient.

## 6. Discussion and conclusions

- State measured calibration/de-crowding results only; distinguish method scope from performance evidence.
- Discuss colour extrapolation, missing XP, variability, epoch mismatch, saturation, seams, blends, and finite support.
- Colour slopes alone cannot identify response-curve errors; label interpretations as hypotheses.
- Release pinned code/configuration, input/output hashes, exclusions, folds, figure tables, and build commands.
- Future work: temporal calibration and light curves, not demonstrated here.

## Appendix A. Sampling and background masks

- Controlled F = 1/F = 4 test with fixed WCS, scene, masks, noise, and matching.
- Synthetic illustration is not an observed sampling gain.
- Compare insufficient versus magnitude-sized masks on identical data; show background lift beneath masked stars.
- Separate isolated-star improvement from residual neighbour-wing contamination; no blanket background-fix claim.
- Retain the older full-frame background decomposition as labelled historical context.

## Appendix B. Model selection and numerical checks

- Compare A3 and simpler colour models using held-out evidence; label exploratory history.
- Historical spatial/colour flux trends are supporting single-image diagnostics, not demonstrated light-curve performance.
- Include convergence/prior, centroid gauge, pixel phase, support, and kernel reconstruction tests.
- Report measured computational cost and environment, not extrapolated performance.

## Appendix C. Band-synthesis verification

- Publish exact synthesis/colour-label weights separately; record responses, zero points, spectra, and holdout selection.
- Show errors versus colour/type, including very-red and emission-line limitations.
- Separate response/catalog uncertainty from measured camera-dependent trends.
