Files
ML-Porosity/README.md
lamlvh 760dbfea4f Address simulated referee reports: same-information point ties, wording, benchmark sigma_a stress
- Exploratory analyses, each declared and hashed before computing and kept
  outside every lock: sharpening transfer, permutation null of the decision
  rules and a truth-free warp check (script 42); BCa and t intervals and the
  comparison with the anchor-only mean (43); point ties with the same
  information as the SMC posterior, SMC-MAP and Anchor-LS (44); a powered
  independence test for the Berkson structure and sign, Wilcoxon and paired-t
  power for the number of blind wells (45).
- Findings: the mode of the SMC posterior already gives most of the gain over
  deterministic ties and averaging adds at most 3%; no sharpening was seen
  and the tie error is not independent of the data; paired tests need 25-50%
  fewer blind wells than the sign test.
- Paper: "hash-locked" replaces "pre-registered"; Berkson sharpening is a
  prediction that failed where testable; new Sec. 3.3 on the benchmark
  package; abstract, introduction, Secs. 5-7, App. C and conclusions revised;
  eight further verified references.
- Benchmark package: two anchor-uncertainty settings (R10__sa3.5, R10__sa14);
  658 tasks, 1316 content hashes (no earlier hash changed), 46,320 reference
  runs.
- Reproduction package: post-review outputs archived, six new verify steps;
  the clean-room check passes 18/18 steps with no differing file.
- Record the Fable (R4) and Opus (R5) referee reports.

No verdict, threshold or locked protocol changed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 14:47:07 +00:00

26 KiB
Raw Blame History

ML-Porosity

Dự đoán porosity từ seismic F3 khi well tie không chắc chắn. Kế hoạch: docs/plan.md; tiến độ: report.html.

Cài đặt

python -m venv .venv
.venv/bin/pip install -r requirements-lock.txt
.venv/bin/pip install --no-deps -e .

Môi trường Linux của các lock protocol_volve/protocol_bench (Python 3.13.15, torch 2.14.0+cu130, numpy 2.5.4): repro/requirements-linux.txt; requirements-lock.txt là môi trường P0 cũ (numpy 2.5.3). Môi trường của P3 trên Windows: requirements-windows-rtx3060.txt.

Dữ liệu F3 Demo 2023 đặt ở data/F3_Demo_2023/F3_Demo_2023/, dữ liệu Volve ở data/Volve/, LAS và TD của NLOG ở data/NLOG/ (hoặc trỏ ML_POROSITY_F3_ROOT tới thư mục chứa .survey). Kết quả ghi vào outputs/ (đổi bằng ML_POROSITY_OUTPUTS).

Code luận văn được lưu ở code_thesis/, các output gốc ở outputs_thesis/. SHA-256 của 7 artifact nằm trong data_manifest/thesis_outputs.json; kết quả kiểm tra ngày 27/10/2026 ở thesis-output-audit.md. Pipeline nghiên cứu ghi kết quả mới vào outputs/.

P3 trên Windows / RTX 3060

Môi trường trên máy này: Python 3.12.16, PyTorch 2.11.0+cu128, driver NVIDIA 577.00, RTX 3060 12 GB và RAM 24 GB. Các phiên bản được lưu riêng trong requirements-windows-rtx3060.txt; không thay bản khóa môi trường Linux. Cài vào venv bằng uv pip install --python .venv/Scripts/python.exe -r requirements-windows-rtx3060.txt, rồi cài project bằng uv pip install --python .venv/Scripts/python.exe --no-deps -e ..

P3 dùng configs/protocol_f3.yaml. Bản khóa kèm theo lưu SHA-256 của protocol, code, dữ liệu đầu vào và phiên bản thư viện. Checkpoint được chọn bằng ba vòng validation bên trong, giếng ngoài chỉ dùng để chấm điểm. Đọc chi tiết rà soát và giới hạn khoa học ở p3-code-review.md.

# Chỉ dùng khi chưa khóa/chưa chạy P3; không khóa lại sau khi có kết quả.
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/run_p3.ps1 -Stage lock
# Chạy toàn bộ: registration, 1.320 trajectory, diagnostics, LOWO, 20 mô hình volume.
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/run_p3.ps1 -Stage all -Device cuda:0 -Workers 4 -Detach

Lệnh all có thể chạy lại để resume đúng fingerprint; job hoàn tất được kiểm tra checksum trước khi tái sử dụng. Không chạy đồng thời hai scheduler trên cùng thư mục output. Tiến độ cập nhật mỗi 10 giây khi mở report.html, kể cả qua file://; dữ liệu gốc ở outputs/p3/progress.json, log ở logs/runs/. Process giữ máy thức trong thời gian chạy, không đổi chính sách nguồn toàn hệ thống. Driver giới hạn mỗi worker ở hai luồng CPU và chạy cửa sổ nền ẩn.

Benchmark thực tế so sánh 1/2/3/4/6 worker: 4 nhanh nhất (khoảng 319 bước/s). Riêng huấn luyện dự kiến 1,6–3,3 giờ; tổng thời gian có thêm registration, diagnostics và volume được lưu ở outputs/p3/progress.json sau pilot. Đây là khoảng dự toán thời gian, không phải khoảng tin cậy thống kê.

Theo yêu cầu phiên làm việc: không chạy script 04 hoặc 09. P3 chỉ fit wavelet/prior cục bộ theo đúng giếng train, ghi trong outputs/p3/; hai artifact cũ outputs/wavelets.npz và outputs/p2/warp_prior_f3.json được bảo vệ bằng hash. G-C giữ nguyên: cải thiện ít nhất 3/4 giếng và coverage 80/90% trong ±5 điểm %. Kết quả G-C nằm ở outputs/p3/summary/gate_gc.json; fail vẫn được báo cáo.

Chạy

scripts/run_p0.sh          # toàn bộ pipeline P0 và test
scripts/run_p1.sh          # P1: tie QC, LOWO baseline (khoảng 16 phút với GPU)
scripts/run_p2.sh          # P2: prior warp F3, QC D2, test, lưới D2, H1, tổng hợp (GPU cuda:1; đổi bằng DEVICE=...)
scripts/run_p2r_dev.sh      # chuẩn bị P2r (chạy lại P2) trên dev 900/901: screen, train, stability, sigma_a, f3, h3 (+ stability_m5, b3d_old, train_sa)
scripts/run_p2r_main.sh     # lưới chính P2r trên realization 8–15
scripts/run_p4.sh           # P4 Volve: register, train, summarize nhánh σ_a chính (DEVICE mặc định cuda:1)
ARMS=sensitivity scripts/run_p4.sh register train   # nhánh σ_a = 3,5 / 14 ms; sau đó ARMS=all scripts/run_p4.sh summarize
scripts/run_bench.sh lock                                        # P6 protocol_bench: khoá lần đầu (sau khi duyệt bản nháp)
STUDIES="S1" DEVICE=cuda:0 WORKERS=4 scripts/run_bench.sh posterior train   # S1 trên cuda:0; các study khác tương tự (STUDIES, REGIMES, PRESETS, RIDS, DEV=1)
scripts/run_bench.sh summarize | status | repro                  # tổng hợp theo luật đã khai báo; tiến độ; ô tái lập P2r
CUDA_VISIBLE_DEVICES= .venv/bin/python scripts/36_bench_verdicts.py   # sau summarize: verdict cuối theo đúng lời phát biểu → outputs/bench/summary/verdict_final.{json,md}
CUDA_VISIBLE_DEVICES= .venv/bin/python scripts/37_bench_package.py generate   # S7: gói benchmark; sau đó lần lượt tables, selftest → outputs/bench/package/ (hash: benchmark/MANIFEST.json)
CUDA_VISIBLE_DEVICES= .venv/bin/python scripts/37_bench_package.py score --pred DIR --name TÊN     # chấm một phương pháp theo luật protocol_bench (hướng dẫn: benchmark/README.md)
CUDA_VISIBLE_DEVICES= .venv/bin/python scripts/38_bench_figures.py [--only bench_s1,bench_s8] [--flipband]   # hình Thí nghiệm 3 của bài → paper/figures/; --flipband in bảng cos/cos² của S8
CUDA_VISIBLE_DEVICES= OMP_NUM_THREADS=2 .venv/bin/python scripts/39_repro_package.py build | verify   # P5 gói tái lập: archive dữ liệu dẫn xuất → outputs/repro/, manifest repro/MANIFEST.json; phòng sạch → repro/verify_report.md (hướng dẫn: repro/README.md)
CUDA_VISIBLE_DEVICES= OMP_NUM_THREADS=2 .venv/bin/python scripts/40_band_spectra.py   # post hoc: phổ trong dải địa chấn của nhãn F3, nhãn synthetic và dự đoán Oracle → outputs/band_spectra/ (bảng tab:bandspectra của bài)
CUDA_VISIBLE_DEVICES=0 OMP_NUM_THREADS=2 .venv/bin/python scripts/41_lambda_limit.py --stage all --workers 4 --device cuda:0   # exploratory: nhánh λ → 0 của bank SMC (khai báo docs/research/lambda-limit.md) → outputs/lambda_limit/
CUDA_VISIBLE_DEVICES= OMP_NUM_THREADS=2 .venv/bin/python scripts/42_referee_r4.py --stage all --workers 12   # exploratory: ba phân tích theo referee R4 (khai báo docs/research/referee-r4-analyses.md) → outputs/referee_r4/
CUDA_VISIBLE_DEVICES= OMP_NUM_THREADS=2 .venv/bin/python scripts/43_referee_r5_ci.py   # exploratory: BCa và t-interval cho 38 tỉ số chính, đối chiếu anchor mean (khai báo docs/research/referee-r5-ci.md) → outputs/referee_r5/
CUDA_VISIBLE_DEVICES=0 OMP_NUM_THREADS=2 .venv/bin/python scripts/44_point_tie_arm.py --stage all --workers 4 --device cuda:0   # exploratory: tie điểm cùng thông tin (SMC-MAP, Anchor-LS; khai báo docs/research/point-tie-arm.md) → outputs/point_tie/
CUDA_VISIBLE_DEVICES= OMP_NUM_THREADS=2 .venv/bin/python scripts/45_referee_r5_followups.py --stage all --workers 8   # exploratory: kiểm độc lập Berkson (F1) và n* theo Wilcoxon/t cặp (F2) (khai báo docs/research/referee-r5-followups.md) → outputs/referee_r5/
# Run dài: chạy trong tmux server của người dùng, ví dụ tmux new-session -d -s p6_s2 -c $PWD "env STUDIES=S2 DEVICE=cuda:0 WORKERS=2 MEM_GB=2 scripts/run_bench.sh posterior train >> logs/bench_s2_cuda0.out 2>&1"
# (setsid nohup bị dừng khi phiên agent kết thúc, 29/10). operations/p6_s1_watcher.sh khởi động S1 khi GPU có chỗ trống (đã dùng 15:43–16:06 UTC 29/10, rồi bỏ khi GPU trống).
# operations/p6_supervisor.py (tmux p6_supervisor): mỗi 5 phút chạy lại driver P6 chết và dồn worker khi một study xong; log logs/p6_supervisor.out. Đã dừng 02:16 UTC 30/10 khi P6 xong. Lỗi đã biết: khi dồn worker, nó khởi động lại driver kể cả lúc số worker không đổi, làm mất job đang dở.

Log và runtime: mỗi lần chạy run_p*.sh tạo logs/runs/<YYYYmmdd-HHMMSS>_p*/, mỗi bước là một thư mục con có log.txt (stdout + stderr, cả của worker, đầu dòng có thời gian đã trôi) và meta.json (lệnh, git commit + hash mã nguồn, biến luồng, thiết bị, wall/CPU time, RSS và VRAM đỉnh, mã thoát). Mỗi bước thêm một dòng vào logs/index.csv. Chạy lẻ một script thì bọc bằng scripts/runlog.sh:

scripts/runlog.sh scripts/15_diag_train.py --rids 900 901 --device cuda:1   # file .py chạy bằng .venv/bin/python
scripts/runlog.sh -n ten_rieng --note "ghi chú" -- <lệnh bất kỳ>
scripts/runlog.sh ls                                                        # các lần chạy gần nhất, cả lần đang chạy

logs/runs/ không đẩy lên git; logs/index.csv thì có thể commit. Các dòng có source=backfill là lần chạy trước ngày 27/10/2026, dựng lại từ log còn lại và transcript (trường nào không đo được thì để trống). Chạy lại sau khi bị ngắt: 11_run_d2.py, 14_diag_posterior.py, 15_diag_train.py bỏ qua các ô đã có CSV kết quả; 05_lowo.py và 12_h1_blur.py chạy lại từ đầu.

P2 theo configs/protocol_p2.yaml (khoá bằng configs/protocol_p2.sha256) và bộ sinh configs/d2_synth.yaml. P2r, tức chạy lại P2 trên realization mới sau khi cổng G-B trượt (không phải pha P3 F3 của plan), theo configs/protocol_p2r.yaml (khoá bằng configs/protocol_p2r.sha256 và tag git protocol-p2r) và configs/d2_synth_p2r.yaml (cùng bộ sinh, thêm các chế độ SNR × mật độ anchor); mọi lựa chọn của P3 dựa trên dev 900/901, tổng hợp ở outputs/p2/diag/p2rdev/summary.md; lưới chính dùng realization 8–15.

Biến môi trường máy đặt sẵn OMP_NUM_THREADS=40 (cả MKL, OpenBLAS): các script nhiều worker tự giới hạn luồng, còn khi chạy tay thì đặt rõ OMP_NUM_THREADS, MKL_NUM_THREADS, OPENBLAS_NUM_THREADS (và CUDA_VISIBLE_DEVICES= cho việc chỉ dùng CPU). Lý thuyết (Mệnh đề 1–2, chọn λ, các baseline là trường hợp riêng của RML): docs/theory.md.

Script Việc
scripts/00_data_manifest.py [--check] [--dataset f3|volve|nlog|thesis] Ghi/kiểm SHA-256 theo data_manifest/*.json (F3: 279 file; thesis: 7 artifact trong outputs_thesis/)
scripts/01_build_wells.py Vị trí giếng từ .survey, 4 TDR (legacy, calibrated, anchors, wlt), log sang thời gian có chống alias, trích patch seismic → outputs/f3_wells.npz
scripts/02_td_qc.py Lệch của các nguồn TD so với marker → outputs/figures/td_drift.png, outputs/td_qc.csv
scripts/03_train.py --config configs/b2_smoke.yaml CNN–GRU v2 + loss gốc (B2), split tách rời train/val/test (chạy thử P0)
scripts/04_wavelet_tie.py Wavelet, synthetic 4 giếng, misregistration còn lại và ngưỡng nhiễu → outputs/tie_qc.csv, outputs/figures/ties.png
scripts/05_lowo.py LOWO 5 seed cho B0a, B0b, B1, B2, B3a, B3b theo configs/protocol.yaml (kiểm hash trong configs/protocol.sha256)
scripts/06_summarize_p1.py Bảng macro/theo giếng, calibration, G-A → outputs/p1/summary.md, outputs/figures/p1_lowo.png
scripts/07_volve_interp_qc.py QC horizon, well picks, checkshot và cube ST10010 của Volve theo configs/d3_volve.yaml → outputs/volve/
scripts/08_d1_label_check.py Kiểm tra D-1: porosity theo RHOB đo của NLOG so với nhãn sonic PHIE_DT → outputs/d1/
scripts/09_fit_warp_prior_f3.py Fit prior warp GP Matérn-3/2 (type-II ML) trên marker TD của F3, kiểm tra leave-one-anchor-out → outputs/p2/warp_prior_f3.json, outputs/figures/p2_f3_drift.png. File json đã ghi hash trong protocol P2: không chạy lại khi đã có
scripts/10_build_d2.py QC bộ sinh D2 so với F3 (nhãn, anchor, drift) → outputs/d2/qc.json, outputs/figures/p2_d2_qc.png
scripts/11_run_d2.py --dev|--main [--workers 6] [--device cuda:1] Mỗi ô (realization, c, N): đăng ký warp giếng train, huấn luyện Oracle, B3a–B3d, B4a–B4d, M1, M2 với 5 seed, chấm điểm trên 8 giếng test → outputs/p2/{dev,main}/. --dev chọn ngân sách bước; --main cần protocol khớp hash
scripts/12_h1_blur.py [--workers 6] [--device cuda:1] H1: huấn luyện MSE với nhãn lệch δ ~ N(0, σ²), so hàm truyền đo được với exp(−2π²σ²f²) → outputs/p2/h1/
scripts/13_summarize_p2.py [--mode main|dev] Cổng G-B, bản đồ pha v1, H1, H3 (M2-ens so với B5), H4, chẩn đoán warp → outputs/p2/summary/<mode>/, outputs/figures/p2_*.png
scripts/14_diag_posterior.py [--snr] [--anchor-density] [--sigma-a-reg] [--particles] [--smc-seeds] [--device cuda:1] Chẩn đoán posterior warp trên dev: SMC tôi luyện có điều kiện seismic (γ = 1/κ, pha phase_R ước lượng qua log Z), sai số warp, độ phủ, σ_post → outputs/p2/diag/…
scripts/15_diag_train.py [--post-dir] [--methods] [--budgets-from] [--save-preds] Huấn luyện trên dev với nhãn từ posterior SMC (B3d-Sa, M2-Sa…) và các baseline, cổng kiểu G-B, ensemble kiểu H3 → outputs/p2/diag/train*/
scripts/16_f3_posterior.py [--device cuda:1] Đặt F3 lên trục σ_post (chỉ mô tả): posterior SMC trên 4 giếng F3 → outputs/p2/diag/f3_posterior/
scripts/17_summarize_p2r_dev.py [--only …] Tổng hợp dev cho P2r: screen, train/dose-response H2b, B(σ), stability, σ_a, F3 → outputs/p2/diag/p2rdev/summary.md
scripts/18_summarize_p2r.py [--root DIR] Phán quyết của protocol_p2r trên lưới chính (realization 8–15): H2a, H2b, σ_a, H3, H4 → outputs/p2r/summary/ (verdict.json, summary.md)
scripts/19_run_f3.py <stage> [--device] [--workers] P3 F3: prepare → benchmark → lock → register → train → diagnostics → summarize theo configs/protocol_f3.yaml → outputs/p3/
scripts/20_summarize_f3.py Tổng hợp lượt P3 đã khóa, cổng G-C → outputs/p3/summary/
scripts/21_predict_f3.py Mô hình triển khai và volume F3 mô tả (649 inline) sau LOWO của P3 → outputs/p3/volume/
scripts/22_paper_figures.py [--only …] Hình cho bài báo (paper/figures/*.pdf), chỉ đọc các summary đã khóa
scripts/23_build_volve_wells.py [--config configs/d3_volve.yaml] Dữ liệu 6 giếng nghiêng Volve trên miền thời gian (survey, TDR calibrated và blind, patch 3×3 dọc đường giếng, nhãn PHIF) → outputs/volve/volve_wells.npz, volve_wells_summary.json
scripts/24_run_volve.py <stage> [--arms primary|sensitivity|all] [--device] [--workers] P4 Volve: benchmark → lock → register → train → summarize theo configs/protocol_volve.yaml, cổng G-D → outputs/p4/
scripts/25_p4_posthoc.py Post hoc P4, ngoài khóa, không đổi G-D: hằng số bằng trung bình giếng train và tách RMSE thành bias + SD → outputs/p4/posthoc/
scripts/26_applicability.py Điều kiện áp dụng C1, C2 (khai báo ở docs/research/applicability-teapot.md), hồi cứu trên F3 và Volve; chỉ đọc output đã khóa và nhãn giếng train của từng fold, không train → outputs/applicability/
scripts/27_t3_power.py T3 exploratory: chấm lại dự đoán P2r đã lưu với tham chiếu lệch σ_ref, power của luật k-of-n và sign test theo số giếng blind (beta-binomial) → outputs/t3/
python -P scripts/28_teapot_inventory.py --root data/Teapot/raw/rmotc --out outputs/teapot/inventory T0 kiểm kê Teapot Dome (chỉ header và độ phủ đường cong; không đọc quan hệ porosity–seismic). Dữ liệu là archive tải về, chạy bằng python -P từ gốc repo → outputs/teapot/inventory/
python -P scripts/29_teapot_pilot.py Pilot P-a Teapot (Deviation 2): hình học, độ phủ horizon, σ̂_knot trên giếng dev (inline ≤ 200), không đọc porosity → outputs/teapot/pilot_pa/
scripts/30_t4_coverage.py T4 post hoc, mô tả: tỉ số phân tán ξ (cột kappa), coverage90 và phần do số vòng lặp của các ensemble 5 seed, từ outputs/p2r/train/*/cells/*.npz và dev P2 → outputs/t4/
scripts/31_p2r_posthoc.py Post hoc H2b, đọc outputs/p2r/summary/ và dự đoán Oracle trong outputs/p2r/train/<regime>/cells/*.npz (khoảng 6 phút): tỉ số Oracle / B3d-Sa / M2-Sa, phần khoảng cách đã đóng; cận 1/B cho cấu trúc (a) classical (đã đăng ký) và (b) Berkson (thêm biến thể giữ hệ số ở 60 Hz và biến thể phổ chéo), tại σ_post và tại sai số warp; cờ vượt mép lưới B → outputs/p2r/posthoc/{bound.csv, blur_ab.csv, meta.json}
scripts/32_t2_mechanism.py T2 (P6, exploratory, khai báo trước ở docs/research/t2-mechanism.md): năm phép kiểm cơ chế của lợi ích bank trên realization 8–15 của P2r; --tests i ii v huấn luyện lại (GPU), --tests iii iv đọc particle (CPU, khoảng 7 phút); tự kiểm tái lập so với outputs/p2r/train/ → outputs/t2/. Kết quả: docs/research/t2-results.md
scripts/33_bench_generator_qc.py QC bộ sinh cho S2 (P6, p6-gen; CPU, khoảng 1 phút): với realization dev 902 và từng preset misspec trong configs/d2_synth_bench.yaml, đo thay đổi AI thật, wavelet thật (pha hằng khớp nhất, tần số đỉnh, băng 90 %), warp thật (RMS, bước nhảy, jitter), sai số mô hình mà registration thấy tại warp thật (wavelet F3 danh nghĩa và thành viên tốt nhất trong họ wavelet thống kê + pha hằng, quy ra dB), tie chỉ anchor (Laplace, N = 4); --sweep quét từng núm đơn; --smc --device cuda:1 (hoặc cpu) chạy registration + SMC tie posterior như P2r cho từng preset ở R10/Rm5, N = 4, nối tiếp ô đã xong → outputs/bench/dev/{generator_qc.json, generator_qc.png, generator_sweep.json, smc_qc_rid902.json}. Thiết kế: docs/research/bench-generator.md
scripts/34_run_bench.py <stage…> [--studies S1 S2 S3 S4 S8] [--device] [--workers] [--gpu-mem-gb] [--dev --rids 902…] Runner của configs/protocol_bench.yaml (P6, mức B): lock (khoá: .sha256 + .lock.json gồm code, môi trường, input, artifact P2r tham chiếu, fingerprint bộ sinh danh nghĩa), posterior (SMC như scripts/14, nhánh estR, P = 1024, lưu hạt γ = 1/κ), train (như scripts/15 + B4a–d, nhánh S8 hai mode, backbone TCN), summarize (luật đã khai báo trước → outputs/bench/summary/), repro (ô tái lập P2r → outputs/bench/repro/comparison.json), dev-budgets (ngân sách TCN trên dev). Realization 8–15 chỉ chạy sau khi khoá; --dev chỉ nhận 900–905 và ghi vào outputs/bench/dev/. Resume theo fingerprint + checksum. Mã: ml_porosity/benchmark/
scripts/35_bench_calibration.py [--rids 902 903 904 905] Bảng hiệu chuẩn mức S2 (dev): gộp outputs/bench/dev/smc_qc_rid*.json (scripts/33 --smc) thành calibration.{csv,md}: sai số mô hình trong họ so với nhiễu regime, SMC warp RMSE / coverage90 / σ_post / overconfidence, phase_R, B3c, theo preset × regime
scripts/36_bench_verdicts.py Verdict cuối của protocol_bench (02/11/2026): kiểm lock (freeze(check=True)), đọc verdict.json của summarize và áp đúng lời phát biểu ở ba chỗ code đã khoá khác (S1-H1 lọc N ∈ {4, 16}; S2-H1 theo từng trục; S3-H1 đối thủ {B3b, B3c, B3c-R, B4a–d}, không có Ctl-GP) bằng chính hàm của ml_porosity/benchmark/summary.py → outputs/bench/summary/{verdict_final.json,verdict_final.md,s3_h2a_stated.csv}. Ngoài tập hash của lock; không sửa output của summarize (docs/plan.md §12 ý 28)
scripts/37_bench_package.py <lệnh> [--out DIR] (generate, check, tables, score, selftest) S7 đóng gói benchmark (02/11/2026; ngoài lock, generate và tables kiểm lock trước): generate ghi 658 task (test 8–15, dev 900–905; 5 regime danh nghĩa × 5 c, 14 setting S2, 6 setting S8, 2 setting σ_a sai), truth công khai, input và inputs/analyst.json vào outputs/bench/package/ (khoảng 845 MB), rồi so sha256 nội dung với benchmark/MANIFEST.json (lần đầu thì ghi); check kiểm một bản tải về; tables gộp 46.320 run tham chiếu → reference/runs.csv.gz, benchmark/reference/{cells.csv,main_table.md}; score --pred DIR --name TÊN chấm dự đoán r<rid>_c<c>_n<N>_s<seed>.npz (metric của scripts/11, luật ô H2a và luật better của summary.py) → DIR/score/; selftest chép dự đoán tham chiếu đã lưu thành bài nộp và kiểm metric, truth và luật khớp. Hướng dẫn cho người dùng: benchmark/README.md
scripts/38_bench_figures.py [--only bench_s1,bench_s8] [--flipband] Hình Thí nghiệm 3 của bài (02/11/2026; ngoài lock, kiểm lock trước, không ghi vào outputs/): bench_s1 (phase diagram S1 từ outputs/bench/summary/s1_cells.csv) và bench_s8 (hàm truyền hai mode từ s8_transfer_curves.json; băng dùng được tính lại từ file dự đoán S8 như summary.py) → paper/figures/{bench_s1,bench_s8}.pdf, cùng style với scripts/22. --flipband chỉ in ra stdout bảng post hoc của Sec. 6.5: trung bình cos(πfΔ), cos²(πfΔ) (Hệ quả 3) và transfer đo được của PM2/BK2/HM2 trong băng 1/(2Δ) < f < 3/(2Δ) (D-14)
scripts/39_repro_package.py <lệnh> [--out DIR] (build, check, verify, code) P5 gói tái lập (02/11/2026; ngoài mọi lock, không train, không ghi vào outputs/ gốc): build chọn file của outputs/ theo RULES và ghi 5 archive tar.gz tất định theo giấy phép dữ liệu (f3_results, f3_predictions, f3_volume: CC BY-SA 3.0; volve: CC BY-NC-SA 4.0; teapot: CC0, cần kiểm) vào outputs/repro/, cùng repro/MANIFEST.json (11.112 file, sha256 từng file, script sinh ra); check --root DIR kiểm một cây đã giải nén; verify [--only …] [--keep] dựng phòng sạch (code + archive, không SEG-Y/Volve/Teapot thô), chạy lại 12 bước tổng hợp, post hoc, bảng và hình, theo dõi file mở bằng audit hook rồi so với bản gốc → repro/verify_report.md (02/11: 12/12 bước khớp, 63 file trùng byte, 3 trùng giá trị, 0 khác); code --rev REV ghi git archive của một commit. Hướng dẫn cho người đọc (tiếng Anh): repro/README.md
scripts/40_band_spectra.py Mô tả post hoc (09/11/2026; ngoài mọi lock và ngoài các archive tái lập, không train): phân bố công suất trên 6 Hz trong cửa sổ 600–1100 ms của PHIE_DT F3 (4 giếng), nhãn synthetic và dự đoán Oracle (N = 16, c = 1; R10, R0, Rm5), cùng cách ước lượng periodogram với scripts/31_p2r_posthoc.py → outputs/band_spectra/{table.csv,groups.csv,meta.json}; dùng cho bảng tab:bandspectra (Phụ lục C) và mục "Band of the benchmark" của bài.
scripts/41_lambda_limit.py --stage all Exploratory (09–10/11/2026; ngoài mọi lock và archive tái lập): huấn luyện lại bank SMC ở λ = 10⁻³ và MSE trên nhãn trung bình của bank ở 8 ô rộng + 3 ô hẹp của P2r, kiểm hash khai báo docs/research/lambda-limit.md trước khi chạy; resume theo ô. Kết quả docs/research/lambda-limit-results.md.
`scripts/42_referee_r4.py --stage all b1
scripts/43_referee_r5_ci.py Exploratory (10/11/2026; ngoài mọi lock và archive tái lập, không train, CPU 10 s): khoảng percentile, BCa và t-interval (log tỉ số, 7 bậc tự do) cho 38 tỉ số chính của bài; tỉ số B3d-Sa/B3d; band RMSE trên Oracle ở c = 0; kiểm hash khai báo docs/research/referee-r5-ci.md. Kết quả docs/research/referee-r5-ci-results.md.
`scripts/44_point_tie_arm.py --stage all train
`scripts/45_referee_r5_followups.py --stage all f1

code_thesis/ là bản lưu trữ code luận văn. Giữ nguyên nội dung để đối chiếu: các script này còn đường dẫn máy cũ và ghi vào outputs/, nên cần một bản sao đã điều chỉnh đường dẫn nếu muốn chạy lại. Kiểm tra bộ artifact hiện có bằng python scripts/00_data_manifest.py --dataset thesis --check.