Recorded runs · real API calls · every printed number computed or checked by code

Read a ship's draft from ten seconds of video. Compute only with a program that reproduced the booklet's printed conditions.

SAM 3.1 tracks the painted draft numerals and the water surface in every frame; code averages the waterline through the swell into one draft with a stated uncertainty. Muse Spark 1.3 reads the mark labels and five code checks confirm them. Muse Wonder 1.0 wrote the survey program from a stability booklet, and that program had to reproduce the booklet's printed conditions before it may compute.

Live on this page, no code: the self-test re-run of Wonder's program in the sandbox. Recorded: the SAM 3.1 and Spark 1.3 outputs (response ids on /evidence). Weight accuracy is synthetic only; no physical scale check yet. Prototype, not a surveyor's certificate.

Run it live →

6813M246814M212.761 m

Marks as read on dB7X_t45; the line is its wave-averaged draft.

Proof 1 of 2

Measurement: video → draft

Does the clip give a stable, honest draft? Real hull clips have no ground truth, so only repeatability is stated; the synthetic barge checks the arithmetic against known geometry.

RECORDED · 2026-10-31 · real API callsthird-party test clip · no ground truth · frames not re-hosted

Real hull test clip dB7X_t45 (no ground truth)

6813M246814M212.612.813.013.213.413.613.814.014.212.595 m
Frame 0 of 60 at 6 fps · schematic from the geometry JSON, no video pixels
Per-frame draft over 60 frames with the running mean settling to 12.761 m ± 0.0864 m12.412.612.813.013.2frame 0frame 5912.761± 0.0864 m
per-frame draftrunning mean (band: illustrative, narrows to ± u)swell p5–p95
Draft d12.761 m
Repeatability u (k=1)
± 0.0864 m
Absolute u (k=1)
not stated — no ground truth
u parts
swell 0.0864 · random 0.0011
Frames kept
60 / 60
Dropped (reason)
none
Neff · lag-1 ρ
3.55 · 0.888
Swell p5–p95
12.562 – 13.052 m
One-pitch label shift
moves d by 0.20 m

Mark labels

Read by muse-spark-1.3 on 2 frames; code checks decide.

Tokenread · frame 0read · frame 10ConfirmedDraft (m)
t866612.6
t388812.8
t1anchor13M13M13M13.0
t622213.2
t444413.4
t266613.6
t088813.8
t5anchor14M14M14M14.0
t722214.2
  • monotone passed
  • pitch passed
  • residual passed
  • cross-frame passed
  • anchor passed

pitch 66.73 px · fit residual 0.44 px · shared tokens 9

Known blind spot: a consistent whole-metre misread passes all five checks, so a live run asks you to confirm the anchor crop before the reading is used.

Certificate decision

REFUSEOUT_OF_TABLEmatrix row 4

The draft is outside the vessel's hydrostatic table: the program refuses to extrapolate.

Open the printable certificate →

Model calls
  • sam-3.1 · 60 frames · 6.9 s · $0.012
  • sam-3.1 · 60 frames · 8.2 s · $0.012
  • muse-spark-1.3 · 1409 tok · 4.8 s · $0.0046
  • muse-spark-1.3 · 2930 tok · 9.8 s · $0.011
total $0.040

Proof 2 of 2

Program: booklet → survey program

RECORDED · 2026-10-31no scale truth

Agent loop: Wonder writes the program → the sandbox grades it on the booklet → failing ids and its own intermediates (or the gate error) go back → it rewrites (2 repairs).

Wonder's survey program proves itself on the Trieste booklet (no scale truth)

Program author
muse-wonder-1.0
Response id
resp_6ae5a63a238297fff10f457e
sha256
4b3aa8cd94879978…
Regenerations
2

Self-test on the printed conditions

PASS22/22 printed conditionsout-of-table probes refused 2/2vs our reference program, 200 cases · max difference 7.1e-5 % · 0 failures

Self-test: booklet printed displacement against the program output
ConditionPagePrinted tProgram tError %ResultFirst diverging
110111,244.111,244.70.0055PASS—
2.110815,082.015,081.0-0.0063PASS—
2.211713,664.713,662.1-0.0191PASS—
3.112615,984.015,980.6-0.0210PASS—
3.213715,140.115,133.5-0.0438PASS—
4.114817,827.717,825.8-0.0106PASS—
4.215916,955.316,953.6-0.0099PASS—
4.317017,265.717,265.2-0.0029PASS—
4.418117,283.117,282.7-0.0022PASS—
4.519217,319.817,318.2-0.0090PASS—
4.620316,808.516,808.70.0011PASS—
5.121417,035.417,034.3-0.0066PASS—
5.222515,650.915,649.4-0.0097PASS—
6.123617,057.417,057.1-0.0020PASS—
6.224715,673.015,670.9-0.0136PASS—
7.125816,516.916,517.70.0050PASS—
7.226915,132.515,129.3-0.0214PASS—
8.128016,569.316,570.80.0089PASS—
8.229115,184.815,182.5-0.0148PASS—
9.130216,785.016,782.3-0.0158PASS—
9.231315,400.615,391.4-0.0599PASS—
1032411,959.111,958.0-0.0092PASS—

How the program was earned

PASS22/22 printed conditionsdifferential max error 7.1e-5 %

0.89 min · $0.175 · 21912 tokens · resp_6ae5a63a238297fff10f457e · sha 4b3aa8cd9487…

Prompt = booklet pages + input drafts only (no standards hint). Attempt 1 rejected by the static gate, attempt 2 passed 14/22 (no second trim correction), attempt 3 passed 22/22 after feedback with failing cond ids + its own intermediates. A second run with a one-sentence UNECE hint (run-unece-hint/) passed 22/22 on attempt 1.

Proven program source (234 lines)
import math
import bisect
import re


def _num(text):
    return float(str(text).replace(",", "").rstrip("fF"))


def _interp(rows, drafts, x, key):
    if x <= drafts[0]:
        if x == drafts[0]:
            return float(rows[0][key])
        x0 = drafts[0]
        x1 = drafts[1]
        y0 = float(rows[0][key])
        y1 = float(rows[1][key])
        return y0 + (y1 - y0) * (x - x0) / (x1 - x0)
    if x >= drafts[-1]:
        if x == drafts[-1]:
            return float(rows[-1][key])
        x0 = drafts[-2]
        x1 = drafts[-1]
        y0 = float(rows[-2][key])
        y1 = float(rows[-1][key])
        return y1 + (y1 - y0) * (x - x1) / (x1 - x0)
    i = bisect.bisect_left(drafts, x)
    if drafts[i] == x:
        return float(rows[i][key])
    x0 = drafts[i - 1]
    x1 = drafts[i]
    y0 = float(rows[i - 1][key])
    y1 = float(rows[i][key])
    return y0 + (y1 - y0) * (x - x0) / (x1 - x0)


def parse_booklet(booklet):
    pages = booklet.get("pages", {}) if isinstance(booklet, dict) else {}
    ordered = []
    for key in sorted(pages.keys(), key=lambda z: int(z) if str(z).isdigit() else 9999):
        ordered.append(str(pages[key]))
    text = "\n".join(ordered)

    lpp = 150.0
    m = re.search(r"Length Between Perpendiculars\s+([0-9]+(?:\.[0-9]+)?)\s*m", text)
    if m:
        lpp = float(m.group(1))

    loa = None
    m = re.search(r"Length Overall\s+([0-9]+(?:\.[0-9]+)?)\s*m", text)
    if m:
        loa = float(m.group(1))

    breadth = None
    m = re.search(r"Breadth Molded\s+([0-9]+(?:\.[0-9]+)?)\s*m", text)
    if m:
        breadth = float(m.group(1))

    standard_sg = 1.025
    m = re.search(r"Water Specific Gravity\s+([0-9]+(?:\.[0-9]+)?)", text)
    if m:
        standard_sg = float(m.group(1))

    fore_corr = 1.2
    aft_corr = 8.8
    corr_divisor = 140.0
    pairs = re.findall(
        r"([0-9]+(?:\.[0-9]+)?)\s*\*\s*\(\s*\(\s*da\s*-\s*df\s*\)\s*/\s*([0-9]+(?:\.[0-9]+)?)\s*\)",
        text,
    )
    if len(pairs) >= 2:
        fore_corr = float(pairs[0][0])
        corr_divisor = float(pairs[0][1])
        aft_corr = float(pairs[1][0])
    elif len(pairs) == 1:
        fore_corr = float(pairs[0][0])
        corr_divisor = float(pairs[0][1])

    rows = []
    seen = {}
    for page_text in ordered:
        for line in page_text.splitlines():
            s = line.strip()
            mm = re.match(r"^([0-9]+\.[0-9]{3})\s+(.+)$", s)
            if not mm:
                continue
            draft = float(mm.group(1))
            toks = mm.group(2).split()
            # Columns: Displ LCB VCB LCF TPcm MTcm(/deg) KML KMT
            # KML may be printed with a thousands space, e.g. "1 394.363".
            if len(toks) < 8:
                continue
            try:
                displ = _num(toks[0])
                lcb = _num(toks[1])
                vcb = _num(toks[2])
                lcf = _num(toks[3])
                tpcm = _num(toks[4])
                mt_deg = _num(toks[5])
                rest = toks[6:]
                if len(rest) == 3:
                    kml = _num(rest[0] + rest[1])
                    kmt = _num(rest[2])
                elif len(rest) == 2:
                    kml = _num(rest[0])
                    kmt = _num(rest[1])
                else:
                    continue
            except ValueError:
                continue
            # Hydrostatic drafts in this booklet are 0.500 to 9.300 m.
            if draft < 0.4 or draft > 9.4:
                continue
            row = {
                "draft": float(draft),
                "displ": float(displ),
                "disp": float(displ),
                "lcb": float(lcb),
                "vcb": float(vcb),
                "lcf": float(lcf),
                "tpcm": float(tpcm),
                "mtcm_deg": float(mt_deg),
                "mtcm": float(mt_deg),
                "kml": float(kml),
                "kmt": float(kmt),
            }
            seen[float(draft)] = row
    for d in sorted(seen.keys()):
        rows.append(seen[d])

    ship = {
        "lpp": float(lpp),
        "lbp": float(lpp),
        "loa": float(loa) if loa is not None else float(lpp),
        "breadth": float(breadth) if breadth is not None else 0.0,
        "standard_sg": float(standard_sg),
        "sg_standard": float(standard_sg),
        "fore_corr": float(fore_corr),
        "aft_corr": float(aft_corr),
        "corr_divisor": float(corr_divisor),
        "draft_mark_divisor": float(corr_divisor),
        "hydrostatic": rows,
        "hydro": rows,
    }
    return ship


def survey(inputs, ship):
    fore_p = float(inputs["fore_p"])
    fore_s = float(inputs["fore_s"])
    mid_p = float(inputs["mid_p"])
    mid_s = float(inputs["mid_s"])
    aft_p = float(inputs["aft_p"])
    aft_s = float(inputs["aft_s"])
    sg = float(inputs["sg"])

    rows = ship["hydrostatic"] if "hydrostatic" in ship else ship["hydro"]
    drafts = [float(r["draft"]) for r in rows]
    lpp = float(ship["lpp"]) if "lpp" in ship else float(ship["lbp"])
    standard_sg = float(ship["standard_sg"]) if "standard_sg" in ship else 1.025
    fore_corr = float(ship["fore_corr"]) if "fore_corr" in ship else 1.2
    aft_corr = float(ship["aft_corr"]) if "aft_corr" in ship else 8.8
    divisor = float(ship["corr_divisor"]) if "corr_divisor" in ship else 140.0

    df = (fore_p + fore_s) / 2.0
    dm = (mid_p + mid_s) / 2.0
    da = (aft_p + aft_s) / 2.0

    # Booklet page 21: corrections from draft marks to FP / AP.
    # The divisor 140 m is the distance used in that printed formula,
    # not Lpp (150 m).
    apparent_trim = da - df
    d_fp = df - fore_corr * (apparent_trim / divisor)
    d_ap = da + aft_corr * (apparent_trim / divisor)
    d_ms = dm

    trim = d_ap - d_fp
    d_mm = (d_fp + 6.0 * d_ms + d_ap) / 8.0
    d_mean_ends = (d_fp + d_ap) / 2.0

    if d_mm < drafts[0] or d_mm > drafts[-1]:
        raise OutOfTable("mean draft outside hydrostatic table")

    disp_table = _interp(rows, drafts, d_mm, "displ")
    tpcm = _interp(rows, drafts, d_mm, "tpcm")
    lcf = _interp(rows, drafts, d_mm, "lcf")
    lcb = _interp(rows, drafts, d_mm, "lcb")
    mt_deg_mean = _interp(rows, drafts, d_mm, "mtcm_deg")

    # First trim correction, booklet page 22, item 3:
    # D2 = t * TPcm * 100 * (Lpp/2 - LCF) / Lpp   (LCF from AP)
    corr_trim1 = trim * tpcm * 100.0 * (lpp / 2.0 - lcf) / lpp

    # Second (Nemoto) trim correction. This is required to reproduce
    # the printed trimmed loading conditions, especially at large trim.
    # The table column headed MTcm is in MT-m/deg (see Sheet No.1:
    # "MTcm : (MT-m/deg)"). Convert moment per degree to moment per cm:
    # a trim of 1 degree is Lpp*100*tan(1 deg) cm of trim.
    # Corr2 = 50 * trim^2 / Lpp * (MCT at d+0.50 m - MCT at d-0.50 m)
    # with MCT in MT-m/cm. Values at d +/- 0.50 m are interpolated;
    # linear extrapolation from the end interval is used only for the
    # +/-0.50 m points if the mean draft itself is inside the table.
    cm_per_degree = lpp * 100.0 * math.tan(math.radians(1.0))
    mt_plus_deg = _interp(rows, drafts, d_mm + 0.5, "mtcm_deg")
    mt_minus_deg = _interp(rows, drafts, d_mm - 0.5, "mtcm_deg")
    mt_plus = mt_plus_deg / cm_per_degree
    mt_minus = mt_minus_deg / cm_per_degree
    corr_trim2 = 50.0 * trim * trim * (mt_plus - mt_minus) / lpp

    corr_density = (disp_table + corr_trim1 + corr_trim2) * (sg - standard_sg) / standard_sg
    disp_final = disp_table + corr_trim1 + corr_trim2 + corr_density

    return {
        "d_fp": float(d_fp),
        "d_ap": float(d_ap),
        "d_ms": float(d_ms),
        "trim": float(trim),
        "d_mm": float(d_mm),
        "d_m": float(d_mean_ends),
        "disp_table": float(disp_table),
        "corr_trim1": float(corr_trim1),
        "corr_trim2": float(corr_trim2),
        "corr_density": float(corr_density),
        "disp_final": float(disp_final),
        "df": float(df),
        "dm": float(dm),
        "da": float(da),
        "tpcm": float(tpcm),
        "lcf": float(lcf),
        "lcb": float(lcb),
        "mtcm": float(mt_deg_mean),
        "mtcm_deg": float(mt_deg_mean),
        "sg": float(sg),
    }

Survey on printed condition 4.1

Draft sheet
PositionDraft mSourceWeightt per mm
Fore P6.2050entered0.06250.092
Fore S6.2050entered0.06250.092
Mid P6.5000entered0.37501.405
Mid S6.5000entered0.37501.405
Aft P6.7650entered0.06250.376
Aft S6.7650entered0.06250.376
Intermediates (printed by code)
d_fp6.2002 m
d_ap6.8002 m
d_ms6.5000 m
d_mm6.5000 m
trim0.6000 m
disp_table17,690.41 t
corr_trim1+125.59 t
corr_trim2+9.82 t
corr_density+0.00 t
disp_final17,825.82 t
Displacement
17,825.8 t
Deductions
0.0 t (none entered; not a measured empty ship)
Net displacement
17,825.8 t
Cargo
not computed — needs a lightship constant or an initial net

u covers: draft + geometry uncertainty only — excludes entered drafts and deductibles

Booklet condition 4.1 (p. 148) prints 17,827.7 t; the program printed 17,825.8 t (-0.011 %).

Ro-Ro test ship: 1 cm at this draft = 36.99 t (illustrative, not a bulk carrier)

ISSUE WITH WARNINGmatrix row 9
  • POSITIONS_ENTERED Some draft positions were entered, not measured from a clip. (6 positions entered)

Open the printable certificate →

Program generation calls
  • muse-wonder-1.0 · attempt 1 · 33 s · $0.161
  • muse-wonder-1.0 · attempt 2 · 33 s · $0.145
  • muse-wonder-1.0 · attempt 3 · 53 s · $0.175
total $0.481