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>
71 lines
2.1 KiB
Python
71 lines
2.1 KiB
Python
import numpy as np
|
|
import pytest
|
|
|
|
from ml_porosity.data.geometry import SurveyGeometry
|
|
from ml_porosity.paths import f3_root
|
|
|
|
SURVEY = f3_root() / ".survey"
|
|
pytestmark = pytest.mark.skipif(not SURVEY.exists(), reason="thiếu F3 .survey")
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def geom():
|
|
return SurveyGeometry.from_survey(SURVEY)
|
|
|
|
|
|
def test_parses_survey(geom):
|
|
assert geom.il_range == (100, 750, 1)
|
|
assert geom.xl_range == (300, 1250, 1)
|
|
assert geom.epsg == 23031
|
|
assert len(geom.set_points) == 3
|
|
|
|
|
|
def test_set_points_forward_and_inverse(geom):
|
|
for il, xl, x, y in geom.set_points:
|
|
xp, yp = geom.bin_to_xy(il, xl)
|
|
assert xp == pytest.approx(x, abs=0.01)
|
|
assert yp == pytest.approx(y, abs=0.01)
|
|
ilp, xlp = geom.xy_to_bin(x, y)
|
|
assert ilp == pytest.approx(il, abs=1e-3)
|
|
assert xlp == pytest.approx(xl, abs=1e-3)
|
|
|
|
|
|
def test_bin_spacing_25m(geom):
|
|
assert geom.bin_spacing() == pytest.approx((25.0, 25.0), abs=0.01)
|
|
|
|
|
|
def test_round_trip_vectorised(geom):
|
|
rng = np.random.default_rng(0)
|
|
il = rng.uniform(100, 750, 100)
|
|
xl = rng.uniform(300, 1250, 100)
|
|
il2, xl2 = geom.xy_to_bin(*geom.bin_to_xy(il, xl))
|
|
np.testing.assert_allclose(il2, il, atol=1e-6)
|
|
np.testing.assert_allclose(xl2, xl, atol=1e-6)
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"name,xy,expected",
|
|
[ # bảng IL/XL thật ở plan mục 1.2a
|
|
("F02-1", (606554, 6080126), (362, 336)),
|
|
("F03-2", (619101, 6089491), (722, 848)),
|
|
("F03-4", (623256, 6082586), (442, 1007)),
|
|
("F06-1", (607903, 6077213), (244, 387)),
|
|
],
|
|
)
|
|
def test_well_bins_match_plan(geom, name, xy, expected):
|
|
assert geom.nearest_bin(*xy) == expected
|
|
assert geom.in_survey(*expected)
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"legacy,xy,km",
|
|
[ # vị trí luận văn dùng và độ lệch ở plan mục 1.2a
|
|
((418, 608), (606554, 6080126), 6.94),
|
|
((362, 821), (623256, 6082586), 5.05),
|
|
((283, 842), (607903, 6077213), 11.42),
|
|
],
|
|
)
|
|
def test_legacy_offsets(geom, legacy, xy, km):
|
|
x, y = geom.bin_to_xy(*legacy)
|
|
assert np.hypot(x - xy[0], y - xy[1]) / 1000 == pytest.approx(km, abs=0.01)
|