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,11 +1,12 @@
|
||||
"""Đọc trace từ SEG-Y post-stack theo (IL, XL) mà không nạp cả cube.
|
||||
"""Read traces from a post-stack SEG-Y by (IL, XL) without loading the whole cube.
|
||||
|
||||
Lưu ý F3_entire.segy: DelayRecordingTime = 4 ms nên mẫu đầu ở 4 ms (segyio đã tính),
|
||||
trong khi `.survey` ghi Z range bắt đầu từ 0.
|
||||
Note on F3_entire.segy: DelayRecordingTime = 4 ms, so the first sample is at 4 ms (handled by segyio),
|
||||
whereas `.survey` gives a Z range starting at 0.
|
||||
|
||||
Lưu ý stack ST10010 của Volve: (1) thiếu 26 trace ở rìa nên segyio không mở được ở chế độ strict, phải tra
|
||||
trace theo header; (2) byte 215 (scalar cho các trường thời gian) = 3, không phải luỹ thừa của 10, nhưng segyio
|
||||
vẫn nhân DelayRecordingTime = 4 với 3, khiến mẫu đầu thành 12 ms thay vì 4 ms như textual header ghi.
|
||||
Note on the Volve ST10010 stack: (1) 26 edge traces are missing, so segyio cannot open it in strict mode and
|
||||
traces must be looked up from the headers; (2) byte 215 (scalar for the time fields) = 3, which is not a power
|
||||
of 10, yet segyio still multiplies DelayRecordingTime = 4 by 3, placing the first sample at 12 ms instead of
|
||||
the 4 ms stated in the textual header.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -17,7 +18,7 @@ import segyio
|
||||
|
||||
from ml_porosity.paths import f3_segy
|
||||
|
||||
# Giá trị hợp lệ của scalar thời gian (byte 215) theo SEG-Y rev 1; 0 nghĩa là không áp dụng
|
||||
# Valid values of the time scalar (byte 215) per SEG-Y rev 1; 0 means not applied
|
||||
_TIME_SCALARS = {0, 1, -1, 10, -10, 100, -100, 1000, -1000, 10000, -10000}
|
||||
|
||||
|
||||
@@ -28,13 +29,13 @@ class SeismicCube:
|
||||
try:
|
||||
self._f = segyio.open(str(self.path), "r")
|
||||
if self._f.sorting != segyio.TraceSortingFormat.INLINE_SORTING:
|
||||
raise ValueError("chỉ hỗ trợ SEG-Y sắp xếp theo inline")
|
||||
raise ValueError("only inline-sorted SEG-Y is supported")
|
||||
self.ilines = np.asarray(self._f.ilines)
|
||||
self.xlines = np.asarray(self._f.xlines)
|
||||
except ValueError as e:
|
||||
if "sắp xếp" in str(e):
|
||||
if "inline-sorted" in str(e):
|
||||
raise
|
||||
# lưới không đủ trace: tra chỉ số trace theo header IL/XL
|
||||
# incomplete grid: look up trace indices from the IL/XL headers
|
||||
self._f = segyio.open(str(self.path), "r", ignore_geometry=True)
|
||||
il = self._f.attributes(segyio.TraceField.INLINE_3D)[:]
|
||||
xl = self._f.attributes(segyio.TraceField.CROSSLINE_3D)[:]
|
||||
@@ -58,16 +59,16 @@ class SeismicCube:
|
||||
def _index(self, il: int, xl: int) -> int:
|
||||
if self._lut is not None:
|
||||
if (il, xl) not in self._lut:
|
||||
raise KeyError(f"bin ({il}, {xl}) không có trace trong cube")
|
||||
raise KeyError(f"bin ({il}, {xl}) has no trace in the cube")
|
||||
return self._lut[(il, xl)]
|
||||
i = np.searchsorted(self.ilines, il)
|
||||
j = np.searchsorted(self.xlines, xl)
|
||||
if i >= len(self.ilines) or self.ilines[i] != il or j >= len(self.xlines) or self.xlines[j] != xl:
|
||||
raise KeyError(f"bin ({il}, {xl}) nằm ngoài cube")
|
||||
raise KeyError(f"bin ({il}, {xl}) lies outside the cube")
|
||||
return int(i * len(self.xlines) + j)
|
||||
|
||||
def coords(self, il: int, xl: int) -> tuple[float, float]:
|
||||
"""Toạ độ CDP (byte 181/185) của bin, đã áp scalar ở byte 71."""
|
||||
"""CDP coordinates (bytes 181/185) of the bin, with the byte-71 scalar applied."""
|
||||
h = self._f.header[self._index(il, xl)]
|
||||
sc = h[segyio.TraceField.SourceGroupScalar]
|
||||
mul = 1 / abs(sc) if sc < 0 else (sc or 1)
|
||||
@@ -77,8 +78,8 @@ class SeismicCube:
|
||||
return np.asarray(self._f.trace[self._index(il, xl)], dtype=np.float32)
|
||||
|
||||
def patch(self, il: int, xl: int, radius: int) -> np.ndarray:
|
||||
"""Các trace trong ô (2r+1)×(2r+1) quanh (il, xl), thứ tự IL rồi XL: shape (C, nt).
|
||||
Khác luận văn: không kẹp chỉ số ở biên mà báo lỗi nếu ô vượt ra ngoài cube."""
|
||||
"""Traces in the (2r+1)×(2r+1) window around (il, xl), ordered by IL then XL: shape (C, nt).
|
||||
Unlike the thesis, indices are not clamped at the edges; an error is raised if the window extends outside the cube."""
|
||||
return np.stack(
|
||||
[
|
||||
self.trace(il + di, xl + dx)
|
||||
@@ -88,5 +89,5 @@ class SeismicCube:
|
||||
)
|
||||
|
||||
def window(self, t0_ms: float, t1_ms: float) -> np.ndarray:
|
||||
"""Mặt nạ boolean cho các mẫu trong [t0, t1]."""
|
||||
"""Boolean mask of the samples within [t0, t1]."""
|
||||
return (self.times_ms >= t0_ms) & (self.times_ms <= t1_ms)
|
||||
|
||||
Reference in New Issue
Block a user