# Calibration scope, current channel histories and identical-pixel comparison

> Later calibration-transfer test: [READOUT_REFERENCE_CONTROL.md](READOUT_REFERENCE_CONTROL.md) demonstrates dilution of injected output-specific gains by mixed-output references. Same-output calibration addresses that injected weakness but does not solve the real histories.

> Follow-up completed: [REQUANTIZATION_BRIDGE.md](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/REQUANTIZATION_BRIDGE.md) tests the cached coadd tables, integer rounding conventions and all-science fixed-profile variance. The earlier pending requantization analysis below is now historical; archived inclusion and full covariance remain unresolved.

**2026-10-03 conclusion:** calibration remains a plausible contributor, but a
single CCD-wide gain error is not established. Current output-channel and
within-channel magnitude/colour histories differ. An exact pilot comparison
of the same detector pixels attributes the large two-minute/FFI aperture
discrepancy primarily to background subtraction. Agreement between their
calibrated pixels does not exclude calibration errors shared by both products.
The instrument-free, photon-limited goal remains unmet.

Run: `/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/`.
Code: local branch `codex/temporal-raw-epsf`, worktree
`/home/kshukawa/syndiff_pipeline/dev/.worktrees/temporal-raw-epsf`.
No production calibration, WCS, candidate export or source-selection change.
No push, PR or merge.

## Calibration is not one scalar per CCD

Our unsubtracted “RAW” pixels are SPOC `_ffic` calibrated electrons/second;
uncalibrated `_ffir` products are separate digital coadds in ADU. Upstream
pixel calibration and our later reference-star photometric correction are
distinct stages.

| Pixel-calibration component | Spatial and temporal scope |
|---|---|
| Two-dimensional bias / black | Reference image per CCD |
| Variable bias | Exposure-dependent row polynomial from each output's overclock pixels |
| Nonlinearity and gain | Separate response for each of four readout outputs |
| Smear | Column correction estimated from virtual rows per exposure |
| Flat field | Pixel response map per CCD, not a uniform coefficient |

Sources: [NASA data-product description](https://heasarc.gsfc.nasa.gov/docs/tess/data-products.html)
and [Instrument Handbook, section 9.5](https://archive.stsci.edu/files/live/sites/mast/files/home/missions-and-data/active-missions/tess/_documents/TESS_Instrument_Handbook_v0.1.pdf).
The downloaded handbook text is retained in `inputs/calibration_audit/handbook_text.txt`.
The handbook describes the laboratory flat at 780 nm. A static map does not
establish the response at every stellar colour, illumination level or temperature.

![Actual CCD and readout geometry](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/calibration_provenance/calibration_layout.png)

The header audit and raw-to-calibrated reconstruction are recorded in
`CALIBRATION_AUDIT.md` and `APPLIED_CALIBRATION.md`. Constant recorded gain
coefficients do not measure physical gain stability. Reconstructing archived
CAL accurately establishes processing agreement, not independent detector truth.
The processing-version boundary at the orbit gap remains confounded with the
orbit itself; it is not proof of a calibration change.

## Latest channel histories, without new detrending

Input: `results/response_profile_badcols_full/reference_calibration/photometry.npz`
and its matching `stars.csv`. Use all 1,224 original FFIs and the same 165
eligible stars; no fresh rejection. Median-normalize each star, take medians
within the original globally aligned six-hour bins, then take group medians.
Empty time bins stay blank. Numerical source histories match the preceding
full-cadence assessment exactly on all populated bins.

| Group | Stars | Current six-hour median-history RMS [ppm] |
|---|---:|---:|
| Output A | 31 | 159.61 |
| Output B | 37 | 96.18 |
| Output C | 51 | 117.19 |
| Output D | 46 | 161.38 |
| All eligible stars | 165 | 74.26 |

These are descriptive scatter measures containing astrophysics, shared
reference effects and noise. They are not estimated gain errors or instrumental
significances. The reference calibration can suppress a truly global trend,
so the small final ensemble median cannot certify detector stability.

![Current histories before and after reference calibration](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/current_calibration_channels/channel_histories.png)

Within each output, fixed catalogue-median splits in TESS magnitude and Gaia
BP-RP show further differences; the smaller groups are not noise-free.
No temporal regression chooses these splits and no new correction is applied.
The constituent histories below are the measured data behind the summaries.

![Magnitude and colour halves with counts](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/current_calibration_channels/channel_magnitude_colour.png)

![All constituent source histories](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/current_calibration_channels/individual_histories.png)

## Identical-pixel two-minute / FFI pilot

Gaia 1625600183294357504 / TIC 198208038 has a downloaded DR35 target-pixel
file. Its physical WCS gives zero-based full-FFI origin (756,860), with an
11 by 11 footprint inside the existing RAW stamp. All 32 official SAP-aperture
pixels are in the existing science mask. Every FFI contains exactly 15
two-minute cadence centres. After accounting for the half-readout integration
boundary and measured spacecraft cadence clock, integration endpoints agree
within 4.39 microseconds, against a 0.2-ms predeclared gate.

The SAP pixel sum reproduces the archived light curve within float32
precision; the local profile/background replay differs fractionally by less
than 2.65e-8. Four direct FFI stamps equal the cached pixels exactly. One-pixel
origin-shift controls are much worse than the header origin. The diagnostics
retain all target-pixel quality flags, including scattered-light intervals.
The earlier clean-PDC coverage gate remains failed; this is processing diagnosis,
not a relaxation of science-quality acceptance.

For the same fixed aperture, the exact decomposition is

$$F_{\mathrm{TP},t}-F_{\mathrm{FFI},t}
=\sum_{p\in A}(C_{\mathrm{TP},t,p}-C_{\mathrm{FFI},t,p})
+\sum_{p\in A}(B_{\mathrm{ours},t,p}-B_{\mathrm{TP},t,p}).$$

Here $t$ labels an original FFI; $p$ labels a detector pixel; $A$ is the fixed
32-pixel SAP aperture; $C$ is calibrated pixel rate before background removal
in electrons/second/pixel; $B$ is the respective estimated background in the
same units; and $F$ is the background-subtracted aperture rate in electrons/second.
TP quantities average the 15 corresponding exposures. The FFI background
comes from our recorded response-aware profile fit. A single positive median
FFI aperture rate normalizes all components, and mean-centering preserves
the additive identity. Six-hour means are used here, unlike the channel
diagnostic's medians; these statistics must not be mixed.

| Difference component | Six-hour RMS [ppt] |
|---|---:|
| Total same-aperture discrepancy | 2.99072 |
| Calibrated/count difference | 0.02875 |
| Background difference | 2.99426 |

![Exact aperture decomposition](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/target_pixel_bridge_checked/aperture_decomposition.png)

![Actual matching calibrated pixels and backgrounds](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/target_pixel_bridge_checked/pixel_and_background_images.png)

The large difference is accounted for by the two background estimates. It is
not the RMS of our final reference-corrected light curve. Neither background
estimate is an independently known sky beneath the star, and shared CAL
errors cancel in this comparison.

## What produces the background difference

The existing opposite-orbit response model provides an exact algebraic split:

$$B_{\mathrm{ours},t,p}-B_{\mathrm{TP},t,p}
=(Q_{t,p}-1)b_{t,p}+(b_{t,p}-B_{\mathrm{TP},t,p}).$$

Here $Q$ is the dimensionless column response from the prior held-out sky
model and $b=B_{\mathrm{ours}}/Q$ is the fitted local smooth plane in
electrons/second/pixel. Both pixel and aperture closure are checked. The
response increment and smooth-plane difference have six-hour RMS 5.55953
and 2.58897 ppt and substantially cancel. Their RMS values cannot be added
in quadrature. The response increment correlates 0.9963 with the total
background difference; that is model attribution, not an independent sky test.

![Background component histories](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/target_pixel_bridge_checked/background_attribution/background_components.png)

![Actual background component images on a shared scale](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/target_pixel_bridge_checked/background_attribution/background_component_images.png)

On the 36 already-downloaded raw FFIs, remove each product's fixed RAW offset
before comparing coadds. FFI FXDOFF is 3,355,400 ADU, whereas 15 times the
TP offset is 3,145,500 ADU; failure to remove these creates a spurious
209,900-ADU difference. The remaining median per-image difference RMS is
48.00 ADU. Applying a first-order gain/exposure/flat conversion leaves median
calibrated-pixel disagreement of 0.04891 electrons/second/pixel, with visible
column/smooth structure. This approximation omits exact nonlinearity and
row/column CAL differences. It is not a complete CAL replay.

![Raw-count differences and residual CAL differences](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/target_pixel_bridge_checked/raw_count_control_images.png)

## Execution record and next tests

Authoritative outputs are `results/target_pixel_bridge_checked/`, its
`background_attribution/` subdirectory, and `results/current_calibration_channels/`.
The corresponding frozen local jobs are `condor/target_pixel_bridge_checked/`,
`condor/target_background_attribution/`, and `condor/current_calibration_channels/`.
All record exit 0; the last ran with two CPUs / 2,000-MB resource hint on
plscience3 with measured spare capacity. The local memory hint is not enforced.
The first bridge failed its literal nominal timing check; the corrected
timing attempt failed a final plotting operation. Their histories are retained
and are not the authoritative completed outputs. All figures above were inspected.

Next distinguish multiplicative drift (fractional flux, same-channel), additive
bias/smear/background (absolute counts and aperture-size dependence), and
colour/motion-dependent flat response using held-out stars and epochs. Extend
the identical-pixel bridge across detector regions before generalizing its
single-source result. Quantify onboard coadd requantization separately from
CAL uncertainty, checking whether the archived errors already include it
before adding a noise term. Both official coadd tables are now cached; their
paired uncertainty analysis is pending, not a completed explanation.

**Conclusion:** the CCD has structured calibration, and our own reference
correction can hide a global component. The latest channel histories retain
differences, while this single-source processing bridge isolates background
treatment as the dominant large discrepancy. It does not clear the upstream
calibration, identify every remaining cause or establish photon-noise dominance.
