# Observed-pixel means and conditional readout modulation

**2026-10-05 conclusion:** matching each observed pixel's mean is insufficient
to reconcile these count-loss predictions. Preserving absolute modulation
produces negative rates in one pair and fails to remove the discrepancy in
the other two. Preserving fractional modulation reduces but does not remove
the disagreement. The inherited readout response needs independent validation;
no new science correction is adopted and the full goal remains unmet.

Run: `/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001`.
Worktree: `/home/kshukawa/syndiff_pipeline/dev/.worktrees/temporal-raw-epsf`,
branch `codex/temporal-raw-epsf`, script `temporal_raw_epsf/observed_mean_count_loss.py`.
Code remains local. All results stay under `results/observed_mean_count_loss/`.

Use three previously identified overlap pairs, auxiliary indices 134/138,
359/358 and 191/190, on FFIs 1, 601 and 1225. Preserve their original mutual
pixel masks, receiver aperture weights and flux denominators, measured
quaternion tracks, WCS, read noise, linear response and unity-flat convention.
These selected cases diagnose a known model inconsistency; they do not
validate the full stellar population. Actual shared RAW pixels must match
exactly before any comparison.

For each source's existing per-readout photon mean, define two alternatives:

$$\mu^{A}_{r,p}=\mu_{r,p}-\overline\mu_p+\tau D_p,
\qquad
\mu^{F}_{r,p}=\mu_{r,p}\frac{\tau D_p}{\overline\mu_p}.$$

Here $r$ indexes the 900 readout/telemetry samples before trimming, $p$ is a
physical detector pixel, $\mu$ is the historical model mean in electrons per
readout, $\overline\mu$ is its arithmetic mean over samples, $\tau$ is the
header integration time (seconds), and $D$ is the measured SPOC-calibrated
pixel rate in electrons/second/pixel. Superscripts $A$ and $F$ identify
preserved absolute and fractional modulation respectively. A static control
uses $\mu^0_{r,p}=\tau D_p$. Both overlap models receive the same target mean.

This imposed mean agreement is not independent validation. The measured
coadd is noisy and already affected by onboard trimming; it is not the true
ordinary photon mean. A successful diagnostic would still need restoration
convergence, mean uncertainty, shared-pixel/source injections, independent
profile response and full light-curve validation before use. Earlier tests
adjusted only a source amplitude and smooth sky; this test replaces each
pixel's mean, including spatial model residuals.

First run a no-Monte-Carlo positivity check. Negative readout means fail an
entire pair/frame arm; do not clip them or remove offending pixels. Then
use 64 fresh Poisson/read-noise replicates, coupled across means for reduced
Monte Carlo variance. Different epochs have independent draws. Compute the
trimmed-minus-ordinary rate using the fixed onboard min/max rejection rule.
Compare same-pixel corrections and their FFI601-minus-FFI1 changes. Monte
Carlo standard errors do not include image/model/calibration uncertainty.

Exact launch sequence from the worktree, through the activated environment:

```bash
/home/kshukawa/syndiff_pipeline/syndiff_pipeline/common/orchestration/condor_wrapper.sh python temporal_raw_epsf/launch_diagnostics.py --local --job observed_mean_check --cpus 2 --memory 3000 observed_mean_count_loss.py --check-only --save
/home/kshukawa/syndiff_pipeline/syndiff_pipeline/common/orchestration/condor_wrapper.sh python temporal_raw_epsf/launch_diagnostics.py --local --job observed_mean_count_loss --cpus 2 --memory 3000 observed_mean_count_loss.py --reps 64 --save
```

Each job freezes code and hashes under `condor/<job>/` and records exact
host, PID and exit status. The local memory hint is not enforced. Host load
and free memory were checked before launching. Required evidence: underlying
observed/model means, readout modulation maps, correction-difference maps,
paired scores with Monte Carlo errors, and explicit positivity failures.

## Completed comparison

Both local jobs exit 0. The positivity-only check took about 7 seconds and
the 64-replicate run about 29 seconds on plscience3. Three focused tests pass:
preservation of additive/fractional modulation, explicit exposure of negative
rates, and known deterministic trimming translation/scaling identities.
All seven figures below were inspected.

The signed projected disagreement is the partner model's trimmed-minus-
ordinary rate minus the receiver model's, passed through the receiver's
unchanged aperture/sky operator and divided by its fixed positive rate.
The reported temporal contrast subtracts the FFI1 disagreement from FFI601.
Because the aperture operator subtracts sky, its sign need not match an
individual pixel's loss. These are model differences, not errors relative
to detector truth or adopted changes to the light curves.

| Receiver / partner | Mutual pixels | Old temporal difference [ppm] | Additive anchor [ppm] | Fractional anchor [ppm] |
|---|---:|---:|---:|---:|
| 134 / 138 | 58 | 342.31 ± 4.10 | Fails positivity | 212.57 ± 3.89 |
| 359 / 358 | 10 | 164.52 ± 4.33 | 176.90 ± 3.49 | 100.24 ± 3.08 |
| 191 / 190 | 55 | 24.15 ± 1.40 | 23.34 ± 1.74 | 7.85 ± 1.68 |

Uncertainties are one Monte Carlo standard error across 64 new replicates;
epochs use independent random draws. They exclude uncertainty in the
observed pixel means, profiles, calibration, WCS and aperture operator.
The old response comparison agrees with the preceding fresh-MC experiment
within its Monte Carlo errors, providing a separate numerical cross-check.

![All three-epoch disagreements](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/observed_mean_count_loss/overlap_disagreement.png)

For pair 134/138 the partner's additive arm has negative rates in 2, 4 and
2 retained pixels at FFIs 1, 601 and 1225. Its smallest mean is −65.42
electrons/readout. Each failed pair/frame arm remains failed; no pixel is
dropped or rate clipped. The fractional construction is positive for every
tested pair/frame but leaves temporal disagreements above its Monte Carlo
errors. Its imposed mean agreement is therefore not sufficient validation.

![Pair 134/138: measured means and model modulation](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/observed_mean_count_loss/mean_and_modulation_pair0.png)
![Pair 134/138: correction differences](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/observed_mean_count_loss/loss_difference_pair0.png)
![Pair 359/358: measured means and model modulation](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/observed_mean_count_loss/mean_and_modulation_pair1.png)
![Pair 359/358: correction differences](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/observed_mean_count_loss/loss_difference_pair1.png)
![Pair 191/190: measured means and model modulation](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/observed_mean_count_loss/mean_and_modulation_pair2.png)
![Pair 191/190: correction differences](/astro/armin/koji/syndiff/dev_runs/temporal_raw_epsf_20261001/results/observed_mean_count_loss/loss_difference_pair2.png)

The mean and modulation panels use separate shared scales; modulation is
predicted, not independently observed at the readout cadence. Blank pixels
are the fixed preexisting mutual mask. The narrow strip in the second pair
is its actual overlap, not a newly selected subset.

The next distinct test reconstructs readout modulation from a sampled coadd
and measures its error against independent analytic photon scenes. See
`COADD_MOTION_ORACLE_20261005.md`. This is preferable to treating one of two
inconsistent stellar descriptions as the correct detector response.

**Conclusion:** mean anchoring alone is not a sufficient repair within the
tested constructions. The response model remains the limiting uncertainty
for this comparison; upstream calibration and the full population's remaining
trends are not ruled out. Photon-noise dominance is not established.
