# Five-FFI PS1-to-template verification — 2026-10-02

> **Causal follow-up completed:** [paired injection and scene-list audit](/home/kshukawa/syndiff_pipeline/doc/ps1_injection_cause_20261002.md) locate near-star photon loss in footprint removal and show that the five saved fitting scenes omit recorded faint neighbours. Complete one-source tests recover the induced bright-flux error when the neighbour is included. The population contrasts below remain valid descriptive measurements, not a direct causal missing-flux budget.

Status: complete for the requested common-bootstrap comparison. No production products or fitting parameters changed.

## Headline / Conclusion

All five selected FFIs reproduce the C4 operator result: the tested source-removal, Gaussian convolution, binning, template assembly and saved Hotpants application agree with their frozen inputs at exact or float-rounding precision. The same apparent depression is already present in source-removed PS1 images and is propagated by the later operators. No additional unexplained loss was found in the tested interiors.

The control-selection effect also appears across fields. More comparable Gaia environments reduce the aperture contrasts but leave field- and magnitude-dependent residuals. Some are statistically significant, others are consistent with zero. This is not a demonstration of unbiased stellar photometry and does not establish a universal additive correction.

## The five selected frames

| Field | Sector / camera / CCD | FFI stem | Input note |
|---|---|---|---|
| F1 | 24 / 2 / 2 | tess2020120182919-s0024-2-2 | Original dataset bootstrap |
| F2 | 20 / 3 / 3 | tess2020013215923-s0020-3-3 | Glint rectangle excluded from control analysis |
| S22 | 22 / 3 / 3 | tess2020071012921-s0022-3-3 | Original dataset bootstrap |
| C1 | 24 / 1 / 2 | tess2020118235919-s0024-1-2 | Corrected-WCS FFI and rebuilt bootstrap; WCSREFIT asserted |
| C4 | 23 / 4 / 2 | tess2020087042920-s0023-4-2 | Rerun with the same distributed-cell protocol |

## Scope and reproducibility

Outputs: `/astro/armin/koji/syndiff/dev_runs/epsf_stage_trace_20261002/multifield/`.

Code: nested dev repository, branch `codex/ps1-stage-trace`, checkpoint `96aa7e2` plus the final report/plot-label commit. Worktree: `/home/kshukawa/syndiff_pipeline/dev/.claude/worktrees/codex-ps1-stage-trace`.

The diagnostic source files are `ps1_multifield.py`, `ps1_multifield_report.py`, and the generalized `ps1_stage_trace.py`, `ps1_hpc_replay.py`, `ps1_control_null.py`, all under `forward_epsf_wcs/diagnostics/`. Copies are in the run's `code/` directory.

Each field has an `inputs.json` with SHA256 hashes for its FFI, template, hp_c and kernel; the hashes were unchanged at completion. Each also has `tables/cell_inventory.json` recording the recipe-matched combined fingerprint and removal-record hash of every contributing skycell. The input recipe is `e17a198a4942aa2d` (footprint_v1), with pinned processing code `648c0bcf4b559691177f7b4764f721ac54aebdc8`. Frozen r/i/z/y weights are 0.254/0.4368/0.1654/0.1438.

Nine skycells per field were selected **before looking at measurements**, as owners of the 3×3 detector grid at crop-local x,y = 384, 1024, 1664 pixels. The central cell's original PS1 r/i/z/y images, masks and uncertainties were freshly retrieved and the complete removal replayed. The other eight cells use recipe-matched published combined inputs. This extends the earlier C4 sample's spatial coverage.

Run from `/home/kshukawa/syndiff_pipeline`:

```bash
source /home/kshukawa/miniforge3/etc/profile.d/mamba.sh
mamba activate syndiff
export OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 NUMBA_NUM_THREADS=1 PYTHONUNBUFFERED=1
python dev/.claude/worktrees/codex-ps1-stage-trace/forward_epsf_wcs/diagnostics/ps1_multifield.py --field F1
# Repeat the same command with --field F2, S22, C1, C4.
python dev/.claude/worktrees/codex-ps1-stage-trace/forward_epsf_wcs/diagnostics/ps1_multifield_report.py
```

Each process limits Dask to two workers. `--resume` verifies the input hashes and reuses completed cell checks. Logs are `<field>.log` plus `<field>/logs/`; all five `DONE.json` records are present. No Colab, training or production submission was used.

## Method

$$I_1=Z(I_0),\qquad C=G*I_1,\qquad T=B[(1-M)C_{\rm pad}],\qquad H=K_\theta(T)+b.$$

- $I_0$: fresh band-combined PS1 image, in linear PS1 flux units per PS1 pixel; $Z$: pinned segmentation and footprint-removal rule; $I_1$: its published output in the same units.
- $G$: configured unit-sum Gaussian, standard deviation 40 PS1 pixels and radius 470 PS1 pixels; $*$: convolution; $C$: canonical convolved cell. $C_{\rm pad}$ is the saved padding-aware input read by downsampling.
- $M$: saved bit-12 mask indicator; $B$: the frozen sum of PS1-pixel contributions onto OS4 pixels; $T$: published OS4 template, in PS1 flux units per OS4 pixel.
- $K_\theta$: Hotpants convolution/downsampling with saved coefficients $\theta$, including its flux-unit conversion; $b$: that field's saved constant background; $H$: hp_c, in electron/s per native TESS pixel. No coefficients or flux scales were refitted.

Closure compares the right-hand calculation with the saved output. Gaussian checks exclude the adjacent-cell overlap plus kernel support; binning checks use eroded pure-cell interiors. This is not a seam test.

The population statistic is separate:

$$D=\langle A(H,\boldsymbol{x}_{s})-A(H,\boldsymbol{x}_{c})\rangle.$$

- $D$: mean aperture contrast in electron/s; $A$: sum inside 3 native pixels after subtracting the mean 20–30-pixel annulus, reproducing the old atlas estimator.
- $\boldsymbol{x}_{s}$ and $\boldsymbol{x}_{c}$: selected and control positions, in crop-local native TESS pixels. Original controls are 25 pixels east. Matched controls share the 128-pixel detector cell and a 0.2-pixel bin in distance to the nearest retained Gaia source with $13\le T_{\rm mag}<18$; $T_{\rm mag}$ is catalogue TESS magnitude.
- Four matched controls are averaged per real star. Real and control positions are farther than 5 pixels from other bright stars. The reported subset has zero recorded deleted neighbours. Errors bootstrap 128-pixel detector cells, 500 draws.

Catalogue positions consistently use the dataset-private FFI WCS and the same epoch-2016 coordinates used for removal. This differs slightly from the earlier C4-only atlas-refit/proper-motion positions. The common-protocol C4 numbers below are the correct reference for cross-field comparisons. No C4-derived conversion factor is applied to the other fields' PS1 sums.

## Direct stage results

The raw-removal replay matches **199,540,467 pixels exactly**, across one fully refetched cell per field. There are **45** sampled skycells, **135** strict-interior Gaussian cutout checks, **3,124,925** interior OS4 output-pixel checks and **2,145** hp_c patches including **526** removed-star centres.

| Field | Interior OS4 pixels | Binning RMS (PS1 units/OS4 pixel) | hp_c replay RMS (electron/s/native pixel) |
|---|---:|---:|---:|
| F1 | 625,191 | 2.03e-6 | 7.97e-7 |
| F2 | 642,696 | 2.02e-6 | 8.01e-7 |
| S22 | 593,454 | 1.92e-6 | 7.69e-7 |
| C1 | 622,684 | 1.77e-6 | 7.23e-7 |
| C4 | 640,900 | 2.30e-6 | 9.37e-7 |

For every field, the saved contribution sums equal the published template exactly on the tested interior pixels. Worst Gaussian RMS is 1.66e-8 PS1 units/pixel. The maximum hp_c replay difference is 3.05e-5 electron/s/pixel. These levels are float-rounding residuals, not fitted residuals to the science data.

![Fresh raw PS1 examples for all fields](/astro/armin/koji/syndiff/dev_runs/epsf_stage_trace_20261002/multifield/figs/raw_five_fields.png)

![Measured hp_c, saved-kernel replay, numerical differences, and separate population contrasts](/astro/armin/koji/syndiff/dev_runs/epsf_stage_trace_20261002/multifield/figs/five_field_images.png)

The full nine-cell absolute/prediction/residual maps are in each field's `figs/operator_maps.png`, and the five-stage absolute and difference stacks in `figs/stage_stacks.png`. All these maps and stage stacks were viewed. The residual maps have a common narrow scale; they show no coherent loss feature.

## Control results

The unchanged-sky null again develops a negative central feature when positions are selected to lack nearby retained sources. F2 is substantially noisier: its unrestricted control stacks contain strong off-centre features, visible in `F2/figs/control_null_stamps.png`, and its bootstrap errors are correspondingly large. Do not infer a clean common amplitude from the five null curves.

For a fixed magnitude range, TESS magnitude 11–12:

| Field | Stars | Original control (electron/s) | Matched control (electron/s) |
|---|---:|---:|---:|
| F1 | 1,292 | −42.6 ± 6.7 | −16.9 ± 4.7 |
| F2 | 1,256 | −22.2 ± 7.0 | −4.3 ± 7.8 |
| S22 | 1,243 | −32.2 ± 7.3 | −16.7 ± 5.1 |
| C1 | 1,128 | −27.1 ± 6.1 | −10.5 ± 4.2 |
| C4 | 1,240 | −42.6 ± 7.4 | −17.6 ± 5.5 |

![Images and controls behind the common magnitude comparison](/astro/armin/koji/syndiff/dev_runs/epsf_stage_trace_20261002/multifield/figs/control_comparison_five_fields.png)

The matched residual is consistent with zero in F2 for this magnitude interval. F1, S22 and C4 remain negative at about 3.2–3.6 statistical standard errors; C1 is about 2.5. These are not systematic-error-inclusive significances: nearest-source matching does not match source brightness, the complete neighbour scene, catalogue completeness or PS1 detection/masking effects. There are multiple magnitude/field comparisons, and no universal model term is claimed.

![All field-by-magnitude residual images and their aperture sums](/astro/armin/koji/syndiff/dev_runs/epsf_stage_trace_20261002/multifield/figs/matched_residual_grid.png)

![Summary metrics, interpreted alongside the underlying images](/astro/armin/koji/syndiff/dev_runs/epsf_stage_trace_20261002/multifield/figs/five_field_metrics.png)

## Corrections and boundaries

- Corrected a minor bookkeeping flaw in the previous neighbour test: it deduplicated sources before constructing all skycell/segment associations and omitted neighbours without a usable magnitude from the “zero” count. This extension counts all recorded associations first. On common source IDs, four previously zero-classified stars in each of C4 and F2 have recorded neighbours; half of those cases involve missing magnitudes. This is too small to explain the broad stack result, but “zero recorded neighbours” must mean what it says. The prior files remain intact.
- Sampling now spans a 3×3 grid on every CCD. The original C4 eight-cell set is preserved as a separate earlier result.
- Generalization keeps each field's PS1 units and saved Hotpants conversion; it does not copy the earlier nominal C4 conversion factor into other fields.
- C1's corrected WCS is asserted in the actual input FITS header. Old header-WCS products are not used.
- No science code bug or additional operator mismatch was found by this extension. Small plot-title layout collisions were corrected; they did not affect measurements.
- A **separate v3 overlap-fix rebuild** exists for F1/S22/C4 under `paper_dataset_20261001/template_v3/`, and for F2 under `vrow_validate_20261001/F2_bootstrap/`; C1's v3 bootstrap was absent at inspection. Those products were not mixed into this repeat of the original bootstrap audit. This result does not certify them or their seams.
- No ePSF training was run. Known injected faint-source recovery and the scientific adequacy of the fitted kernel remain separate tests.

## Records and canvas

- Full run and per-field manifests: `/astro/armin/koji/syndiff/dev_runs/epsf_stage_trace_20261002/multifield/`.
- Numerical comparison: `summary.json`, `summary.csv`; all per-field values in `<field>/tables/`.
- Local canvas, updated in place: `/home/kshukawa/syndiff_pipeline/doc/ps1_stage_trace_canvas/index.html`.
- Source write-up: this document, backed up with the diagnostic branch. The root experiment README and central INDEX link forward to this five-field extension.
- This session does not have the Claude Artifact publishing or SendUserFile tools. The local illustrated canvas is updated; the remote Claude URL is not republished.

**Conclusion:** the C4 stage result generalizes to all five original bootstrap templates in the sampled interiors. Control selection explains a substantial part of the apparent depression; a smaller, field-dependent contrast remains. Actual stellar photometric bias is still not established or excluded. The next discriminating experiment remains paired known-flux injection with explicit handling of recorded removed neighbours.
