P2 diagnosis on dev, P3 dev experiments, lock protocol_p3
- P2: SMC tie posterior (numpy + torch), RML/soft-DTW losses, bank training, D2 synthetic generator, scripts 09-13, protocol_p2 (locked) and its outcome (G-B failed; H1 not rejected, H3 rejected, H4 not rejected). - Diagnosis on dev realizations 900/901 only (scripts 14-17, run_p3_dev.sh): posterior screen, SMC stability (P = 1024, K = 1), sigma_a misspecification stress and training, H3 with the SMC posterior, F3 placement on sigma_post. - protocol_p3: H2 split into H2a (posterior-mean labels vs point ties) and H2b (RML vs posterior mean as a function of sigma_post); H3 descriptive only; sigma_a arm; new D2 config d2_synth_p3.yaml; main grid on realizations 8-15. Locked by configs/protocol_p3.sha256 and tag protocol-p3. - runlog: per-run logs and runtime index (logs/index.csv). - Docs: plan §12 items 10-11, theory, technical overview, report; wording aligned with Gunning & Glinsky (2006): the tie posterior is not claimed as new. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
"""Kiểm tra D-1 (định nghĩa nhãn F3) bằng density đo của NLOG.
|
||||
"""Check D-1 (the F3 label definition) against the measured NLOG density.
|
||||
|
||||
python scripts/08_d1_label_check.py
|
||||
|
||||
PHIE của bộ demo ở F03-2, F03-4, F06-1 là hàm tuyến tính của DT (plan mục 1.2d). Script so porosity theo density đo
|
||||
φ_D = (2650 − RHOB)/1600 (RHOB từ LAS NLOG) với nhãn sonic PHIE_DT = −0.2018 + 0.0011·DT trong cửa sổ 600–1100 ms,
|
||||
trên lưới 4 ms như nhãn huấn luyện:
|
||||
- F02-1, F03-4: giếng demo, TD calibrated từ outputs/f3_wells.npz; độ sâu NLOG căn theo tương quan DT;
|
||||
- F03-03, F03-06: giếng NLOG ngoài bộ demo, TD theo file TZ (giả định MD − APD ≈ TVDSS ở đoạn nông);
|
||||
- F03-2, F06-1: RHOB đo của NLOG bắt đầu ở 1641 và 1836 m MD, dưới cửa sổ, nên không có φ_D.
|
||||
Kèm chỉ số chất lượng trong cửa sổ: |DRHO| và caliper (từ composite LAS; chưa có bit size nên chưa kết luận washout).
|
||||
Đầu ra: outputs/d1/label_check.csv, summary.json
|
||||
The demo PHIE at F03-2, F03-4, F06-1 is a linear function of DT (plan §1.2d). This script compares the porosity from
|
||||
measured density φ_D = (2650 − RHOB)/1600 (RHOB from the NLOG LAS) with the sonic label PHIE_DT = −0.2018 + 0.0011·DT
|
||||
in the 600–1100 ms window, on the same 4 ms grid as the training labels:
|
||||
- F02-1, F03-4: demo wells, calibrated TD from outputs/f3_wells.npz; NLOG depth aligned by DT correlation;
|
||||
- F03-03, F03-06: NLOG wells outside the demo set, TD from the TZ file (assuming MD − APD ≈ TVDSS in the shallow section);
|
||||
- F03-2, F06-1: measured NLOG RHOB starts at 1641 and 1836 m MD, below the window, so no φ_D.
|
||||
Also reports in-window quality indicators: |DRHO| and caliper (from the composite LAS; no bit size yet, so no washout conclusion).
|
||||
Outputs: outputs/d1/label_check.csv, summary.json
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -26,7 +26,7 @@ from ml_porosity.data.resample import log_to_time
|
||||
from ml_porosity.data.tdr import TDR
|
||||
from ml_porosity.paths import REPO_ROOT, nlog_root, outputs_dir
|
||||
|
||||
# (LAS composite có RHOB/DRHO, LAS composite có CALI theo feet, file TZ); tên gốc NLOG có tiền tố giếng
|
||||
# (composite LAS with RHOB/DRHO, composite LAS with CALI in feet, TZ file); original NLOG names carry a well prefix
|
||||
NLOG_FILES = {
|
||||
"F02-1": ("F02-01__8727_f0201_1976_comp.las", "F02-01-S1__F021_Composite-TOTAL~LF1.las", None),
|
||||
"F03-4": ("F03-04__7035_f0304_1976_comp.las", "F03-04__F034_Composite-TOTAL~LF1.las", None),
|
||||
@@ -35,7 +35,7 @@ NLOG_FILES = {
|
||||
}
|
||||
WINDOW_MS = (600.0, 1100.0)
|
||||
T = np.arange(WINDOW_MS[0], WINDOW_MS[1] + 0.1, 4.0)
|
||||
SOS_BAND = signal.butter(4, 6 / 125, "high", output="sos") # băng seismic > 6 Hz (plan mục 2.3) trên lưới 4 ms
|
||||
SOS_BAND = signal.butter(4, 6 / 125, "high", output="sos") # seismic band > 6 Hz (plan §2.3) on the 4 ms grid
|
||||
|
||||
|
||||
def phi_d(rhob):
|
||||
@@ -47,7 +47,7 @@ def phi_dt(dt):
|
||||
|
||||
|
||||
def read_nlog(comp: str, composite: str) -> tuple[pd.DataFrame, float]:
|
||||
"""MD (m, từ LMF) → DT µs/m, RHOB và DRHO kg/m³, CALI inch; kèm APD (m trên MSL)."""
|
||||
"""MD (m, from LMF) → DT µs/m, RHOB and DRHO kg/m³, CALI inch; plus APD (m above MSL)."""
|
||||
raw = nlog_root() / "raw"
|
||||
las = lasio.read(raw / comp)
|
||||
df = las.df().sort_index()
|
||||
@@ -71,7 +71,7 @@ def corr(a: np.ndarray, b: np.ndarray) -> float:
|
||||
|
||||
|
||||
def compare(a: np.ndarray, b: np.ndarray) -> dict:
|
||||
"""a, b theo p.u. trên lưới T; r băng tính trên đoạn liên tục chung."""
|
||||
"""a, b in p.u. on grid T; band r computed over the common contiguous segment."""
|
||||
ok = np.isfinite(a) & np.isfinite(b)
|
||||
r = corr(a, b)
|
||||
i = np.flatnonzero(ok)
|
||||
@@ -99,7 +99,7 @@ def main() -> None:
|
||||
for w, (comp, composite, tz) in NLOG_FILES.items():
|
||||
df, apd = read_nlog(comp, composite)
|
||||
info = {"apd_m": apd}
|
||||
if tz is None: # giếng demo: căn độ sâu NLOG theo DT, so với LAS demo
|
||||
if tz is None: # demo well: align NLOG depth by DT against the demo LAS
|
||||
W = load_well(w)
|
||||
tdr = TDR(Z[f"{w}/tdr/calibrated/md"], Z[f"{w}/tdr/calibrated/twt_ms"], "calibrated")
|
||||
d0, d1 = tdr.depth_at(WINDOW_MS)
|
||||
@@ -116,7 +116,7 @@ def main() -> None:
|
||||
"rms": round(float(np.sqrt(np.mean(d ** 2))), 1)}
|
||||
labels = {"PHIE_DT": log_to_time(W.md, phi_dt(W.curve("DT")), tdr, T),
|
||||
"PHIE": log_to_time(W.md, W.curve("PHIE"), tdr, T)}
|
||||
else: # giếng NLOG mới: chỉ có DT của NLOG
|
||||
else: # new NLOG well: only the NLOG DT is available
|
||||
tdr = read_tz(tz, apd)
|
||||
d0, d1 = tdr.depth_at(WINDOW_MS)
|
||||
md, shift = df.index.to_numpy(), 0.0
|
||||
@@ -134,7 +134,7 @@ def main() -> None:
|
||||
(out / "summary.json").write_text(json.dumps(summary, indent=1, ensure_ascii=False))
|
||||
print(R.to_string(index=False))
|
||||
print(json.dumps(summary["wells"], indent=1, ensure_ascii=False))
|
||||
print("ghi:", out.relative_to(REPO_ROOT) if out.is_relative_to(REPO_ROOT) else out)
|
||||
print("written:", out.relative_to(REPO_ROOT) if out.is_relative_to(REPO_ROOT) else out)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user