P0 + P1: ml_porosity package, audited F3 data, LOWO baselines, protocol v2

P0
- ml_porosity/: survey geometry, LAS/TDR/SEG-Y readers (4 ms delay fix,
  invalid time scalar, header LUT for incomplete cubes), anti-aliased
  log-to-time resampling, CNN-GRU v2 with the thesis loss, 41+ unit tests.
- Full F3 Demo 2023 under data/ (text well/fault files tracked, bulk data
  ignored); the filtered copy and its cleanup notes are removed.
- SHA-256 manifests for F3, Volve, NLOG and the thesis outputs.

P1
- configs/protocol.yaml v2, locked by SHA-256 at 2026-10-26T04:28:09Z,
  before the first LOWO run (04:30:50Z); 05_lowo.py refuses to run on a
  hash mismatch. This commit postdates the runs.
- Wavelet/synthetic tie QC, residual misregistration, LOWO 5 seeds for
  B0a, B0b, B1, B2, B3a, B3b (scripts 04-06); gate G-A: no pivot.
- Volve D3: horizons, well picks, checkshots and the ST10010 cube read
  from data/Volve (scripts/07).
- D-1 label check against measured NLOG density (scripts/08): PHIE_DT
  stays the primary label.
- docs/plan.md, Volve and NLOG inventories, report.html.

Full-text reference PDFs in refs/ stay local (ignored).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-26 08:41:11 +00:00
parent d11b7b1bb5
commit a76e61398a
163 changed files with 120177 additions and 2742 deletions

View File

@@ -0,0 +1,53 @@
"""Chuyển log từ miền độ sâu sang trục thời gian seismic, có lọc chống alias.
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.
"""
from __future__ import annotations
import numpy as np
from scipy import signal
from ml_porosity.data.tdr import TDR
def log_to_time(
md: np.ndarray,
values: np.ndarray,
tdr: TDR,
t_out_ms: np.ndarray,
fine_dt_ms: float = 0.25,
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.
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."""
md = np.asarray(md, dtype=float)
v = np.asarray(values, dtype=float)
ok = np.isfinite(v)
t_log = tdr.time_at(md[ok])
v = v[ok]
if v.size < 2:
return np.full(t_out_ms.shape, np.nan)
dt_out = float(t_out_ms[1] - t_out_ms[0])
t_fine = np.arange(t_log[0], t_log[-1] + fine_dt_ms / 2, fine_dt_ms)
v_fine = np.interp(t_fine, t_log, v)
if t_fine.size > 3 * (order + 1):
nyq_out = 0.5 / dt_out
nyq_fine = 0.5 / fine_dt_ms
sos = signal.butter(order, cutoff_frac * nyq_out / nyq_fine, output="sos")
v_fine = signal.sosfiltfilt(sos, v_fine)
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.
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
return out