Rename protocol_p3 to protocol_p2r; close P2

protocol_p3 (cee2ff0) was the rerun of P2 on new realizations, not the
plan's phase P3 (F3 field). Renamed to P2r before any of realizations 8-15
was generated: protocol, D2 config, dev runner and summary script, output
dir outputs/p2/diag/p2rdev, tag protocol-p3 -> protocol-p2r. Protocol
content changes only names plus two notes in p2_outcome: the deviation from
protocol_p2's if_fail rule (pivot) and what the diagnosis did not test
(sigma_b, rock-physics stress). Re-locked: sha256 eb887311...

Docs: plan §12 item 12 and report section closing P2 (locked verdict kept,
diagnosis, decision, deviation, untested items, link to phase P3 / G-C).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 06:48:52 +00:00
parent cee2ff0859
commit f95123174f
16 changed files with 96 additions and 64 deletions

View File

@@ -51,7 +51,7 @@ def main() -> None:
cfg = yaml.safe_load(open(REPO_ROOT / "configs" / "d1_f3.yaml"))
wells = f3_anchor_wells(cfg)
# The "tau" and "note" strings below are written verbatim into warp_prior_f3.json, whose SHA-256 is locked in
# protocol_p2/protocol_p3; they are deliberately left untranslated so that a re-run reproduces the locked file.
# protocol_p2/protocol_p2r; they are deliberately left untranslated so that a re-run reproduces the locked file.
res = {"tau": "sonic_tdr qua marker TD đầu tiên", "anchors_window_ms": cfg["ext_window_ms"],
"tau_range_ms": TAU_RANGE, "n_anchors": {w["name"]: int(len(w["tau_k"])) for w in wells}, "fits": {}}
for kern in ["matern32", "se"]:

View File

@@ -24,7 +24,7 @@ cell_pass requires both.
→ outputs/p2/diag/train/: cells/r{rid}_c{c}_n{N}.csv (+ _diag.csv), results.csv, runs.csv, budgets.json, gate.csv,
gate.json
Stress tests (preparation of protocol_p3, dev only): --snr, --anchor-density and --sigma-a-reg must match the
Stress tests (preparation of protocol_p2r, dev only): --snr, --anchor-density and --sigma-a-reg must match the
scripts/14 run in --post-dir (checked via the register phase). The SNR also changes the seismic of the test wells.
--variants selects variants with particles in --post-dir (the scripts/14 stress grid stores only estR: "a" and "1");
--methods restricts the methods; --budgets-from reuses budgets selected in a previous run (budgets.json) instead of

View File

@@ -1,4 +1,4 @@
"""Placing F3 on the σ_post axis (preparation of protocol_p3, descriptive only): SMC warp posterior on the 4 real F3 wells.
"""Placing F3 on the σ_post axis (preparation of protocol_p2r, descriptive only): SMC warp posterior on the 4 real F3 wells.
python scripts/16_f3_posterior.py --device cuda:1

View File

@@ -1,7 +1,7 @@
"""Summary of the dev experiments preparing protocol_p3 (scripts/run_p3_dev.sh). Uses dev realizations 900/901 only.
"""Summary of the dev experiments preparing protocol_p2r (scripts/run_p2r_dev.sh). Uses dev realizations 900/901 only.
python scripts/17_summarize_p3_dev.py # every section with available data
python scripts/17_summarize_p3_dev.py --only screen
python scripts/17_summarize_p2r_dev.py # every section with available data
python scripts/17_summarize_p2r_dev.py --only screen
Sections:
screen posterior stress grid (outputs/p2/diag/stress/snr*_{full,half,topbottom}/). Each cell (SNR, anchor
@@ -11,7 +11,7 @@ Sections:
- r at the posterior-mean warp and at the true warp; κ; γ.
A cell is "wide" if σ_post (estR wavelet, γ = 1/κ) ≥ 1.5 ms. Threshold from Proposition 1: the transfer
coefficient at 50 Hz is exp(−2π²σ²f²) ≤ 0.90. Wide cells are written to wide_cells.txt, which the train
stage of run_p3_dev.sh reads.
stage of run_p2r_dev.sh reads.
stability independent SMC runs (stability/p256, p1024; same registration seed):
- |Δτ̄(t)| between each pair of runs over the main window;
- p95 against the 0.5 ms criterion;
@@ -24,7 +24,7 @@ Sections:
- band RMSE of M2-Sa / B3d-Sa / B3c-R / Oracle per cell;
- M2-Sa/B3d-Sa ratio per seed and per realization, joined with the cell's σ_post;
- H3 results written by scripts/15 (h3.json).
→ outputs/p2/diag/p3dev/: screen.csv, wide_cells.txt, stability.csv, sigma_a.csv, f3.csv, train.csv, blur.csv, summary.md
→ outputs/p2/diag/p2rdev/: screen.csv, wide_cells.txt, stability.csv, sigma_a.csv, f3.csv, train.csv, blur.csv, summary.md
"""
from __future__ import annotations
@@ -326,10 +326,10 @@ def main() -> None:
ap.add_argument("--only", nargs="+", default=None, choices=["screen", "stability", "sigma_a", "f3", "train", "blur"])
args = ap.parse_args()
want = lambda s: args.only is None or s in args.only
out = DIAG / "p3dev"
out = DIAG / "p2rdev"
out.mkdir(parents=True, exist_ok=True)
pd.set_option("display.width", 250)
lines = ["# Dev experiments for protocol_p3 (realizations 900/901)", ""]
lines = ["# Dev experiments for protocol_p2r (realizations 900/901)", ""]
tab = screen(out) if want("screen") or want("train") else None
if tab is not None:

14
scripts/run_p3_dev.sh → scripts/run_p2r_dev.sh Executable file → Normal file
View File

@@ -1,9 +1,9 @@
#!/usr/bin/env bash
# Dev experiments in preparation for protocol_p3 (plan §10): dev realizations 900/901 only; main grid 0–7 is not used.
# scripts/run_p3_dev.sh # all stages in order
# scripts/run_p3_dev.sh stability sigma_a # only the named stages
# Dev experiments in preparation for protocol_p2r (plan §10): dev realizations 900/901 only; main grid 0–7 is not used.
# scripts/run_p2r_dev.sh # all stages in order
# scripts/run_p2r_dev.sh stability sigma_a # only the named stages
# screen SMC posterior over SNR {10, 5, 0, −5} dB × anchor density {full, half, topbottom} × c {1, 2} × N {4, 16}
# train training (scripts/15) in the screen cells with σ_post ≥ 1.5 ms (outputs/p2/diag/p3dev/wide_cells.txt,
# train training (scripts/15) in the screen cells with σ_post ≥ 1.5 ms (outputs/p2/diag/p2rdev/wide_cells.txt,
# written by scripts/17): M2-Sa, B3d-Sa, B3c-R, Oracle… 5 seeds, fixed budgets
# stability 4 independent SMC runs with P = 256 and 2 with P = 1024 (SNR 10, full): warp difference between runs
# stability_m5 as stability at SNR −5 dB, full (the F3-like regime): 2 runs with P = 1024 (the chosen setting)
@@ -16,7 +16,7 @@
set -euo pipefail
cd "$(dirname "$0")/.."
PY="${PY:-.venv/bin/python}"
[[ -n "${RUNLOG_DIR:-}" ]] || exec "$PY" -m ml_porosity.runlog -n p3dev -- bash "scripts/$(basename "$0")" "$@"
[[ -n "${RUNLOG_DIR:-}" ]] || exec "$PY" -m ml_porosity.runlog -n p2rdev -- bash "scripts/$(basename "$0")" "$@"
step() { "$PY" -m ml_porosity.runlog "$@" || echo "step failed: $*" >&2; }
DEVICE="${DEVICE:-cuda:1}"
WORKERS="${WORKERS:-6}"
@@ -39,12 +39,12 @@ for stage in ${@:-screen train stability sigma_a f3 h3}; do
done
done ;;
train)
CUDA_VISIBLE_DEVICES= "$PY" scripts/17_summarize_p3_dev.py --only screen > /dev/null
CUDA_VISIBLE_DEVICES= "$PY" scripts/17_summarize_p2r_dev.py --only screen > /dev/null
while read -r snr dens cs <&3; do
# shellcheck disable=SC2086 # cs is a list of c values and must be word-split
step -n "train_snr${snr}_${dens}" -- "$PY" "${TRAIN[@]}" --snr "$snr" --anchor-density "$dens" --c $cs \
--workers 4 --post-dir "$OUT/stress/snr${snr}_${dens}" --out-dir "$OUT/train_stress/snr${snr}_${dens}"
done 3< "$OUT/p3dev/wide_cells.txt" ;;
done 3< "$OUT/p2rdev/wide_cells.txt" ;;
stability)
step -n stab_p256 -- "$PY" "${POST[@]}" --smc-seeds 0 1 2 3 --wavelets estR --workers "$WORKERS" \
--out-dir "$OUT/stability/p256"