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:
2026-10-27 06:03:33 +00:00
parent a76e61398a
commit cee2ff0859
84 changed files with 8793 additions and 460 deletions

View File

@@ -1,8 +1,9 @@
"""Chuyển log từ miền độ sâu sang trục thời gian seismic, có lọc chống alias.
"""Depth-to-time conversion of logs onto the seismic time axis, with anti-alias filtering.
Luận văn nội suy điểm log 0.15 m xuống 4 ms (prepare_data.py:203–204), gây alias
(plan mục 1.1 #8). Ở đây log được đưa lên lưới thời gian mịn, lọc thông thấp
Butterworth pha không (sosfiltfilt) ở `cutoff_frac`·Nyquist của lưới đích, rồi mới lấy mẫu.
The thesis point-interpolates 0.15 m log samples directly to 4 ms (prepare_data.py:203–204),
which causes aliasing (plan §1.1 #8). Here the log is first mapped onto a fine time grid,
low-pass filtered with a zero-phase Butterworth filter (sosfiltfilt) at `cutoff_frac`·Nyquist
of the target grid, and only then resampled.
"""
from __future__ import annotations
@@ -22,10 +23,10 @@ def log_to_time(
cutoff_frac: float = 0.8,
order: int = 6,
) -> np.ndarray:
"""Giá trị log tại `t_out_ms` (lưới đều). NaN ở nơi log không phủ tới.
"""Log values at `t_out_ms` (regular grid). NaN where the log has no coverage.
Khoảng trống bên trong log được nội suy tuyến tính trước khi lọc rồi đặt lại NaN
ở những mẫu đích rơi vào khoảng trống."""
Internal gaps in the log are linearly interpolated before filtering, and target
samples falling inside a gap are reset to NaN afterwards."""
md = np.asarray(md, dtype=float)
v = np.asarray(values, dtype=float)
ok = np.isfinite(v)
@@ -46,7 +47,7 @@ def log_to_time(
out = np.interp(t_out_ms, t_fine, v_fine, left=np.nan, right=np.nan)
# Đánh dấu NaN tại mẫu đích nằm trong khoảng trống log dài hơn một mẫu đích.
# Set to NaN the target samples lying in log gaps longer than one target sample.
gaps = np.flatnonzero(np.diff(t_log) > dt_out)
for g in gaps:
out[(t_out_ms > t_log[g]) & (t_out_ms < t_log[g + 1])] = np.nan