Files
ML-Porosity/tests/test_seismic_io.py
lamlvh a76e61398a 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>
2026-10-26 08:41:11 +00:00

47 lines
1.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import numpy as np
import pytest
import segyio
from ml_porosity.data.geometry import SurveyGeometry
from ml_porosity.data.seismic_io import SeismicCube
from ml_porosity.paths import f3_root, f3_segy
pytestmark = [
pytest.mark.data,
pytest.mark.skipif(not f3_segy().exists(), reason="thiếu F3_entire.segy"),
]
@pytest.fixture(scope="module")
def cube():
with SeismicCube() as c:
yield c
def test_axes(cube):
assert (cube.ilines[0], cube.ilines[-1], len(cube.ilines)) == (100, 750, 651)
assert (cube.xlines[0], cube.xlines[-1], len(cube.xlines)) == (300, 1250, 951)
# DelayRecordingTime = 4 ms: mẫu đầu ở 4 ms, không phải 0
assert cube.times_ms[0] == 4.0 and cube.dt_ms == 4.0 and len(cube.times_ms) == 462
@pytest.mark.parametrize("il,xl", [(100, 300), (244, 387), (722, 848), (750, 1250)])
def test_trace_index_matches_headers(cube, il, xl):
idx = cube._index(il, xl)
h = cube._f.header[idx]
assert (h[segyio.TraceField.INLINE_3D], h[segyio.TraceField.CROSSLINE_3D]) == (il, xl)
# Tọa độ trong header (scalar −100) khớp phép biến đổi của .survey
geom = SurveyGeometry.from_survey(f3_root())
x, y = geom.bin_to_xy(il, xl)
assert h[segyio.TraceField.CDP_X] / 100 == pytest.approx(x, abs=0.5)
assert h[segyio.TraceField.CDP_Y] / 100 == pytest.approx(y, abs=0.5)
def test_patch(cube):
p = cube.patch(244, 387, 1)
assert p.shape == (9, 462)
np.testing.assert_array_equal(p[4], cube.trace(244, 387))
np.testing.assert_array_equal(p[0], cube.trace(243, 386))
with pytest.raises(KeyError):
cube.patch(100, 300, 1)