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:
@@ -11,7 +11,7 @@ from ml_porosity.data.tdr import (
|
||||
)
|
||||
from ml_porosity.paths import f3_wells_dir
|
||||
|
||||
# ---------- tổng hợp, không cần dữ liệu ----------
|
||||
# ---------- synthetic, no data required ----------
|
||||
|
||||
|
||||
def constant_velocity_log(v=2000.0, z0=0.0, z1=1000.0, dz=0.5):
|
||||
@@ -51,13 +51,13 @@ def test_legacy_starts_at_zero():
|
||||
def test_calibration_honors_anchors_and_is_monotone():
|
||||
md, dt = constant_velocity_log(v=2000.0, z1=1500.0)
|
||||
base = sonic_tdr(md, dt, md0=0.0, t0_ms=0.0)
|
||||
# Anchor lệch tới ±40 ms so với sonic, kiểu drift của F06-1.
|
||||
# Anchors offset by up to ±40 ms from the sonic, an F06-1-style drift.
|
||||
za = np.array([100.0, 400.0, 700.0, 1000.0, 1300.0])
|
||||
ta = za + np.array([5.0, -20.0, 30.0, -40.0, 10.0]) # ở 2000 m/s, TWT (ms) = MD (m)
|
||||
ta = za + np.array([5.0, -20.0, 30.0, -40.0, 10.0]) # at 2000 m/s, TWT (ms) = MD (m)
|
||||
cal = calibrate_to_anchors(base, za, ta)
|
||||
np.testing.assert_allclose(misfit_at_anchors(cal, za, ta), 0.0, atol=1e-9)
|
||||
assert np.all(np.diff(cal.twt_ms) > 0)
|
||||
# ngoài phạm vi anchor: dịch đều theo anchor gần nhất
|
||||
# outside the anchor range: constant shift from the nearest anchor
|
||||
assert cal.time_at(50.0) == pytest.approx(base.time_at(50.0) + 5.0)
|
||||
assert cal.time_at(1400.0) == pytest.approx(base.time_at(1400.0) + 10.0)
|
||||
|
||||
@@ -78,7 +78,7 @@ def test_calibration_rejects_crossing_anchors():
|
||||
|
||||
|
||||
def test_log_to_time_antialias():
|
||||
# Log tuyến tính theo thời gian được giữ nguyên; sin 200 Hz (trên Nyquist 125 Hz của 4 ms) bị lọc.
|
||||
# A log linear in time is preserved; a 200 Hz sine (above the 125 Hz Nyquist of 4 ms) is filtered out.
|
||||
md, dt = constant_velocity_log(v=2000.0, dz=0.15)
|
||||
tdr = sonic_tdr(md, dt, md0=0.0, t0_ms=0.0)
|
||||
t_log = tdr.time_at(md)
|
||||
@@ -93,23 +93,23 @@ def test_log_to_time_marks_gaps():
|
||||
md, dt = constant_velocity_log(v=2000.0, dz=0.15)
|
||||
tdr = sonic_tdr(md, dt, md0=0.0, t0_ms=0.0)
|
||||
v = np.ones_like(md)
|
||||
v[(md > 400) & (md < 450)] = np.nan # khoảng trống 50 ms
|
||||
v[(md > 400) & (md < 450)] = np.nan # 50 ms gap
|
||||
out = log_to_time(md, v, tdr, np.arange(300.0, 600.0, 4.0))
|
||||
t_out = np.arange(300.0, 600.0, 4.0)
|
||||
assert np.all(np.isnan(out[(t_out > 402) & (t_out < 448)]))
|
||||
assert np.all(np.isfinite(out[(t_out < 398) | (t_out > 452)]))
|
||||
|
||||
|
||||
# ---------- trên dữ liệu F3 ----------
|
||||
# ---------- on F3 data ----------
|
||||
|
||||
needs_f3 = pytest.mark.skipif(not (f3_wells_dir() / "Lasfiles").exists(), reason="thiếu dữ liệu giếng F3")
|
||||
needs_f3 = pytest.mark.skipif(not (f3_wells_dir() / "Lasfiles").exists(), reason="missing F3 well data")
|
||||
|
||||
|
||||
@needs_f3
|
||||
@pytest.mark.data
|
||||
@pytest.mark.parametrize(
|
||||
"name,n_anchors,lo,hi",
|
||||
[ # plan mục 1.2b và 1.2e: TWT tích phân DT − marker TD trong 600–1100 ms
|
||||
[ # plan §1.2b and §1.2e: integrated-DT TWT − TD marker within 600–1100 ms
|
||||
("F02-1", 11, -44, 2),
|
||||
("F03-2", 9, -14, -3),
|
||||
("F03-4", 9, -52, -42),
|
||||
@@ -147,7 +147,7 @@ def test_f3_calibrated_tdr(name):
|
||||
@pytest.mark.data
|
||||
@pytest.mark.parametrize(
|
||||
"name,mean_ms",
|
||||
[("F02-1", 40.5), ("F03-2", 40.2), ("F03-4", 25.2), ("F06-1", -14.6)], # plan mục 1.2c
|
||||
[("F02-1", 40.5), ("F03-2", 40.2), ("F03-4", 25.2), ("F06-1", -14.6)], # plan §1.2c
|
||||
)
|
||||
def test_f3_dt_model_offset_matches_plan(name, mean_ms):
|
||||
from ml_porosity.data.las_io import load_td_source, load_well
|
||||
|
||||
Reference in New Issue
Block a user