- 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>
41 lines
1.5 KiB
Python
41 lines
1.5 KiB
Python
"""F3 horizons in ASCII format (X, Y, TWT ms) under Rawdata/Surface_data/."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import numpy as np
|
|
|
|
from ml_porosity.data.geometry import SurveyGeometry
|
|
from ml_porosity.paths import f3_root
|
|
|
|
# Ordered from shallow to deep in the well area.
|
|
F3_HORIZONS = ("Shallow", "FS8", "FS7", "Truncation", "Top-Foresets", "FS6", "MFS4")
|
|
|
|
|
|
def horizon_path(name: str) -> Path:
|
|
return f3_root() / "Rawdata" / "Surface_data" / f"F3-Horizon-{name}.txt"
|
|
|
|
|
|
def load_horizon_bins(name: str, geom: SurveyGeometry) -> dict[tuple[int, int], float]:
|
|
"""Map (IL, XL) → TWT (ms). Each XY row is assigned to the nearest bin."""
|
|
a = np.loadtxt(horizon_path(name))
|
|
il, xl = geom.xy_to_bin(a[:, 0], a[:, 1])
|
|
il, xl = np.rint(il).astype(int), np.rint(xl).astype(int)
|
|
return {(i, j): t for i, j, t in zip(il, xl, a[:, 2])}
|
|
|
|
|
|
def horizon_at(name: str, geom: SurveyGeometry, bins: list[tuple[int, int]], radius: int = 2) -> np.ndarray:
|
|
"""Horizon TWT at each bin; if a bin has no pick, the mean of the picks within the
|
|
(2r+1)² window is used, or NaN if the window is also empty."""
|
|
h = load_horizon_bins(name, geom)
|
|
out = []
|
|
for il, xl in bins:
|
|
if (il, xl) in h:
|
|
out.append(h[(il, xl)])
|
|
continue
|
|
vals = [h[(il + a, xl + b)] for a in range(-radius, radius + 1)
|
|
for b in range(-radius, radius + 1) if (il + a, xl + b) in h]
|
|
out.append(float(np.mean(vals)) if vals else np.nan)
|
|
return np.asarray(out)
|