# calibration-8k consolidation (k8v2qm): one pose set for every viewer, before the Oct 31 demo

Lane: calib8k, Ansel (01a16f0a) for BOS-Takeoff-Veillance (8ac6d87f), Claude Code chat ef1a66e3, 2026-10-25.
Stephen approved the consolidation pass ("yes start it") and the webcam sources ("yes add those types"), both relayed by the
coordinator.

Follows:
- [calibration-115459-ground-phase_gp5t8w.md](calibration-115459-ground-phase_gp5t8w.md): the fix of 115459's first moments;
- [calibration-8k-v03_q4v9m2.md](calibration-8k-v03_q4v9m2.md): v0.3.

The new id for everything is **k8v2qm**:
- No b8k3t5, q4v9m2 or gp5t8w file was changed.
- Every edited consumer file has a backup, `.bak-20261025` (and `.bak-20261025-step5` for the webcam pass).

## Before and after

| | before | after (k8v2qm) |
|---|---|---|
| 115459 held-out, median / max (deg) | 0.54 / 2.98 (q4v9m2) | **0.10 / 0.29** |
| 115531 held-out, median / max (deg) | 0.114 / 0.328 | **0.075 / 0.183** |
| 115634 held-out, median / max (deg) | 0.068 / 0.117 | **0.058 / 0.108** |
| coastline check, every 30th frame (px at 1920): 115459 / 115531 / 115634 | 5.54 / 4.71 / 4.52 | **3.98 / 4.65 / 3.79** |
| clock offset (s) | 0 (photo-sync) | 115459 +0.083 (scan: +0.078 ± 0.017), 115531 **+0.178 ± 0.016**, 115634 **+0.152 ± 0.017** |
| eye height offset above the ADS-B geometric height (m) | 0 | 115459 +6 (scan: +5.7 ± 0.5), 115531 +6.8 ± 1.8, 115634 +13.8 ± 1.1 |
| Lynn Shore Drive absolute test, no lock: median offset (m) | 11.96 (q4v9m2) | **6.69** (4.30 along the road, 5.12 across) |
| along-road drift over 14 s (m) | 10.37 | **2.08** |
| ROP stability with lock: frame-shift rms (m) | 1.045 (v1) | **0.745** (v2) |
| ROP stability with lock: inliers / inlier rms / frame-to-frame | 0.853 / 2.23 px / 8.4 px | 0.891 / 1.89 px / 6.0 px |
| ROP without lock, against the absolute reference: frame-shift rms (m) | 10.09 | **6.57** |
| ROP without lock, against the stack median (drift only) | – | 1.41 m, inliers 0.77 |
| ROP absolute step (lock reference to the Google true-ortho) | 11.40 along, 1.53 across (11.5 m) | 4.34 along, 5.87 across (**7.3 m**) |
| KLT pairs held | 412/514, 1850/1851, 2059/2059 | 513/514, 1850/1851, 2059/2059 |
| per-clip field (hfov, deg): 115531 / 115634 | 61.89 / 62.18 | 62.15 / 62.25 |

## 1. All three clips under one id

Files: `calibration-8k/poses_<clip>_k8v2qm.json` (schema bos-calib8k-poses/2) and `poses-index_k8v2qm.json`.

- **Eye.** `eyetrack_gp5t8w.mjs`: the full-rate ADS-B trace only (no runway rule, no phone-photo heights), with the cabin offset.
  - A per-clip **height offset** and **clock offset** come from `eyescan_k8v2qm.mjs`.
    - Method: at 8-17 keyframes per clip, one Google 3D Tiles scene is re-rendered (memory only) from eyes shifted in time
      along the trace and in height, and the rotation is re-fitted at each shift.
    - The peak per keyframe goes through a parabola; the clip value is the median, with 1.4826 MAD / sqrt n as its sigma.
  - The gp5t8w value of +6 m up holds for 115531 (+6.8 m) but not at 1-1.8 km for 115634 (+13.8 m). Each clip uses its own.
  - The clock offset lumps the photo-sync clock error, ADS-B timing and the seat-vs-antenna along-track offset; they cannot be
    separated.
- **115531 and 115634.** `calibrate_k8v2qm.mjs` is `calibrate_q4v9m2.mjs` with that eye and that clock. Everything else is
  unchanged: the same 3D Tiles, coast and drape anchors, KLT and AKAZE, one field per clip, the lens and the Boston geoid.
  - 115634: 69/69 tiles anchors (tiles z 0.47-0.59).
  - 115531: 60 tiles anchors and 2 drape. One anchor has a 1.88 deg residual, outvoted by the flow.
- **115459.** Re-emitted from gp5t8w by `reemit-115459_k8v2qm.mjs`.
  - The rotations and the eye are unchanged. gp5t8w's +7 m along track equals +0.083 s, and the independent scan gives
    +0.078 ± 0.017 s.
  - The clock goes into meta and the utc column.
- **Geoid.** Kept constant at -28.6 m. A per-position lookup (Nahant about -28.2 m) moves the eye 0.4 m, below every height
  offset's sigma, so it was not done.
- **Meta.**
  - `t0_utc` is corrected; `t0_photo_sync_utc`, `clock_offset_s` and `clock_offset_sigma_s` are added.
  - `camera_module` is `camera-distort_k8v2qm.mjs`.
- **Common coastline check.** `coastcheck_k8v2qm.mjs` writes `coastcheck_k8v2qm.json`. It measures before and after alike, at
  every 30th frame.

## 2. The off-axis bug

`camera-distort_k8v2qm.mjs` has the same interface as q4v9m2. `projectDir` returns null in three cases:
- behind the camera;
- beyond 0.95 x the lens polynomial's **fold radius**: with k1 < 0, r(1 + k1 r²) turns over at r = sqrt(-1/(3 k1)), about 83.5°
  off-axis for k1 = -0.00436, and rays past it folded back into the image;
- beyond a **field limit** of 2 x the half-diagonal tangent, about 54° (`D.maxTan` overrides).

Inside the field the result is identical to q4v9m2.

`test-camera-distort_k8v2qm.mjs` passes 27 tests:
- behind the camera, and ±89° horizontal and vertical, with and without the lens;
- the 86.18° ray that q4v9m2 put inside the image;
- the 115459 f300 taxiway-M point;
- an in-field round trip identical to q4v9m2;
- the fold radius;
- maxTan.

## 3. Per-clip clock offset

Values are in the table above. 115634's +0.152 s is close to the +0.12 s the Lynn Shore test had suggested.

`abs-test_k8v2qm.mjs` writes `abs-test_k8v2qm.json`. It reuses the abs-test_q4v9m2 ortho and registration with no lock and the
DSM in true MSL:
- The absolute offset falls from 11.96 to 6.69 m, and the along-road part from 10.86 to 4.30 m.
- The **remaining 5.1 m is across the road** and did not change. It is not a clock or along-track error. A height or lateral
  eye term is the candidate (the 6-DOF patch fits kept asking for 5-15 m lateral); not solved.

## 4. Consumers switched and re-rendered

### takeoff-player (`js/data.mjs`)

- Uses `poses-index_k8v2qm` and `poses_*_k8v2qm`.
- When `clock_offset_s` is present, the clip t0 is the pose file's corrected one, not the media manifest's.
- All six modules import camera from `../../calibration-8k/camera-distort_k8v2qm.mjs`. Without `D`, `makeCamera` uses the
  reference lens at the clip's focal, which is exactly `meta.distortion`.
- `chase.mjs`: the search radius now also covers the **object's** ADS-B position uncertainty at its range (atan 25 m).
  - AAL1205's own offset is 2.04° (its antenna ahead of the centroid, plus latency). With the correct poses it is no longer
    inside the old 12° rough-stretch radius, so it went unfound until this change.
  - Now 63 of 92 frames are found, residual a constant 2.04° right, 0.03° down (it was -10 to +6° with the old poses).

### takeoff-3d 0.1.1 (`js/app.mjs`)

- Poses come through the player's `data.mjs`; camera from `camera-distort_k8v2qm`.
- Proxy frames are matched **by index** in `takeoff-player/data/proxy-pts.json` (the player's `proxyRow` and `proxyTimeOf`),
  which fixes the half-frame bug in `poseAt` and `stepFrames`.
- The engine Projector remains a pinhole. The lens is about 2 px at the corners.
- Through-camera residual (`verify/residual.mjs`): median **1.9 px** at 1920 on 115634 t = 20 s, and **5.6 px** on 115459 f86
  (eye 125 m; near-field outliers on the coarse mesh).

### Render probe

`rop/sources/build-sources-index_p5r8x2kd.mjs` now reads k8v2qm, the camera with its lens, the clock sigma, and `playerVideo` /
`playerT0Utc` for the YouTube windows. It was re-run; `probe/handler.mjs` reloads the index by mtime.

### ROP (`rop/lynn-shore-nahant-circle/v2/`, a new version folder; v1 untouched)

The tools gained env switches whose defaults reproduce v1:
- `ROP_CAM=k8v2qm` (camera in rop-lib);
- `ROP_POSES=k8v2qm` and `ROP_DH=-6.9` (the DSM in h_calib moved to the poses' true MSL) in render;
- `ROP_VERSION=2` (STAC version field, predecessor link) in stac;
- `ROP_ID` and `ROP_CLOCK_SHIFT_S` in nahant-fuse and nahant-stac.

Run (the env switches above set):

```
render pass1 → lock → lock absolute → render pass2 → lock measure → stac → nahant-fuse fused → nahant-stac → verify, verify-page
```

**Output (440 tiles, 273 MB):**
- `v2/tiles/`, `v2/items/`, `v2/collection.json` (id `lynn-shore-nahant-circle-v2`, `version` 2, predecessor-version
  `../collection.json`); v1's `collection.json` gained successor-version and latest-version links.
- `v2/tiles-fused/`, `v2/index.json`, `v2/index-fused.json`, `v2/lock/`, `v2/verify/`, the stack MP4s, `render-stats*.json`.

**Viewers:**
- `index.html` and `index-fused.html` now redirect to `v2/` and keep the query string.
- **v1 stays reachable** at `index-v1.html` and `index-fused-v1.html`.

**Nahant fusion on v2:**
- Each 8K frame is re-paired with the Nahant frame nearest its corrected time: +0.152 s = +5 Nahant frames. The pairing is in
  `v2/render-stats-nahant-paired_k8v2qm.json`.
- The Nahant-only products (tiles, thumbs and visuals, the Nahant MP4, the GSD map) don't depend on the 8K poses. v2 references
  v1's copies (`../`).
- **Caveat:** only 145 of the re-paired Nahant PT0.033S frames have a v1 tile, so v2 lists 145 such items (v1 had 440). The
  fused tiles are complete (440), because the fuse gathers from the decoded video.

### Not redone

**The measurement lane's speeds, waves and tide were measured on ROP v1 (b8k3t5 poses).** They were not redone; they are v1
numbers.

The 8K frame service (`frame/handler.mjs`) still reads b8k3t5. It uses only `f` and `t`, which are unchanged.

## 5. Posed webcams as player sources (takeoff-player v0.6.0)

### What was added

- `data.mjs` `loadSources()` reads the probe's sources index.
  - Each posed webcam becomes a clip-shaped source: kind `webcam`, the window video, one row per frame sharing the static pose,
    and its lens `D = { k1, k2 }`.
  - Unposed cameras with an archived window are listed apart.
  - The Nahant cam: 1280x720 at 30 fps, 11100 frames; UTC = 15:53:25.188Z + t, which is the first segment's ingest minus 0.601 s.
- The webcam picture lives in the 7680x4320 overlay space, so its readouts are in 8K-equivalent px. The camera model is
  resolution independent and the frame is 16:9.
- The 8K-only paths are skipped on a webcam: stills, the frame service, mobile crops and prefetch. Its paused frame is the
  native frame.
- The track view's proxy factor is per source: 8 for the 960 proxies, 6 for a 1280 webcam.
- **Timeline:** row 0 holds the 8K clips, row 1 the posed webcams, row 2 the unposed cameras, greyed with "needs pose" (6
  YouTube streams).
- **One shared UTC clock:** the source menu (`#srcSel`) and the map's camera marker switch at the same instant.
  `pickSourceAt` prefers the source on screen, then an 8K clip covering the time.
- **The subject aircraft:** the traffic build carries a0b846's later callsign of the day (UAL1356). It is relabelled UAL414,
  its ADS-B flight field during this takeoff, so the webcam shows "UAL414" and `?track=UAL414` works.
- **Links:**
  - `?clip=yt:KziwCV7db9s&utc=15:59:28`
  - `?fix=yt:KziwCV7db9s:201.8&rect=0,2100,7680,1300`
  - `?track=UAL414&clip=yt:KziwCV7db9s`
- **Probe:** posed webcam lanes are labelled from their title, and tapping the lane opens the source at its span. The detail
  panel has "open in the player" and "fixed view on the place" (the bbox scaled to 8K-equivalent px). The probe's video link
  is the window file.

### Verified in headless Chrome (`takeoff-player/verify/k8v2qm/*.png`)

| check | screenshot | result |
|---|---|---|
| UAL414 label on the webcam | `webcam_UAL414_1559-28.png` | at 15:59:28Z, top-right edge (u 7665, 18.4 km), crossing to u 7167 by :34; the burned-in webcam clock reads 11:59:28 |
| map | same | the camera's view wedge from Nahant |
| track UAL414 on the webcam | `webcam_track_UAL414*.png` | proxy scan 155/160 found over f10781-f11099 |
| fixed view plus coast | `webcam_fix_coast_1556-47.png` | 96% cover; OSM coast on the Lynn shore. The lock says HOLD (0 static patches: sea and surf), so the identity warp stands |
| switching 115634 ↔ Nahant cam at 15:56:47Z | `switch_*.png` | clocks 47.000 / 47.001 / 47.002 |
| mobile 390x844 | `mobile_webcam_UAL414_1559-31.png` | works |
| probe over Lynn Shore Drive | `probe_*.png` | lanes 8K 115634, Nahant cam [open], photo, 2 unposed ("needs pose"), UAL414; tapping Nahant opens it at 15:56:31Z |
| 8K regression: `?track=AAL1205` | `player_track_AAL1205.png` | see the takeoff-player notes above |
| 8K regression: `?fix=115531:16.15&rect=3000,2250,1900,1070` | `player_fix_115531.png` | lock residual 1.5 px, cover 100% |
| takeoff-3d | `t3d_*` | see above |
| ROP | `rop_v2_*`, `rop_v1_index.png` | v2 viewer, v2 fused, v1 |

## Paths

All under `C:\Users\steph\Documents\sites\stephenguerin.live\agents\8ac6d87f-3192-4fdb-a260-583dbee74291\artifacts\`:

- **calibration-8k:**
  - poses: `poses_115459_k8v2qm.json`, `poses_115531_k8v2qm.json`, `poses_115634_k8v2qm.json`, `poses-index_k8v2qm.json`
  - camera: `camera-distort_k8v2qm.mjs`, `test-camera-distort_k8v2qm.mjs`
  - code: `eyescan_k8v2qm.mjs`, `calibrate_k8v2qm.mjs`, `reemit-115459_k8v2qm.mjs`, `make-index_k8v2qm.mjs`
  - checks: `coastcheck_k8v2qm.mjs` (`.json`), `abs-test_k8v2qm.mjs` (`.json`)
  - logs and overlays: `calib-log_115531_k8v2qm.json`, `calib-log_115634_k8v2qm.json`, `overlays_k8v2qm/`
- **rop:**
  - `lynn-shore-nahant-circle/v2/`, with `index-v1.html` and `index-fused-v1.html` alongside
  - `tools/{rop-lib,render,stac,nahant-fuse_kz7w,nahant-stac_kz7w}.mjs`, edited with backups
  - `sources/sources-index_p5r8x2kd.json`
- **takeoff-player:** v0.6.0, `verify/k8v2qm/`.
- **takeoff-3d:** v0.1.1.
- **Scratch:** `_scratch/bos-calib8k/k8v2qm/` holds the eye scans and the run logs.

## Open

- The 5 m across-road absolute offset on Lynn Shore Drive.
- 115459 f0 alone (see gp5t8w).
- Webcam readouts are in 8K-equivalent px.
- Pose the other YouTube cameras (the 6 "needs pose" rows): they will then appear in the player automatically.
