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>
25 lines
792 B
Python
25 lines
792 B
Python
import torch
|
||
|
||
from ml_porosity.losses.legacy_v2 import LegacyV2Loss, pcc_loss, shape_loss
|
||
from ml_porosity.models.cnn_gru import CNNGRU
|
||
|
||
|
||
def test_cnn_gru_shape():
|
||
m = CNNGRU(in_ch=9, d=16)
|
||
assert m(torch.randn(2, 9, 126)).shape == (2, 1, 126)
|
||
|
||
|
||
def test_shape_loss_redundant_with_pcc():
|
||
# plan mục 1.1 #7: L_shape = 2·L_PCC − 2/L (z-score dùng std không chệch, Σx² = L − 1)
|
||
torch.manual_seed(0)
|
||
p, t = torch.randn(4, 1, 126), torch.randn(4, 1, 126)
|
||
assert torch.allclose(shape_loss(p, t), 2 * pcc_loss(p, t) - 2 / 126, atol=1e-5)
|
||
|
||
|
||
def test_legacy_loss_finite_and_differentiable():
|
||
m = CNNGRU(in_ch=9, d=8)
|
||
x, y = torch.randn(2, 9, 64), torch.randn(2, 1, 64)
|
||
loss = LegacyV2Loss()(m(x), y)
|
||
loss.backward()
|
||
assert torch.isfinite(loss)
|