Complete P3 F3 evaluation and Windows execution
Implement the frozen F3 protocol, nested LOWO, posterior label banks, ablations, diagnostics, checkpoint validation and full-volume inference. Record the negative G-C result: improvement at 1/4 wells, coverage80 52.38% and coverage90 60.91%, with unchanged thresholds and historical P2 results. Add native Windows logging, the RTX 3060 environment lock, detached runs, and an audited dashboard-lock recovery that preserves frozen scientific code. Update report.html, the plan and agent guidance with completed P3 status. Archive thesis sources under code_thesis with identical Git blobs and record the original-output audit without committing large data or model artifacts. Validation: 129 tests passed, 13 skipped; CUDA end-to-end smoke passed; completion audit verified 1,320 checkpoint/prediction pairs, 28 registration bundles and all 649 interior volume inlines. Scripts 04 and 09 were not rerun. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
85
code_thesis/plot_pred.py
Normal file
85
code_thesis/plot_pred.py
Normal file
@@ -0,0 +1,85 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
plot_pred.py — Hiển thị lát cắt porosity từ file .npz đã predict
|
||||
• Vẽ lát cắt theo inline hoặc crossline hoặc time-slice
|
||||
• Chỉnh các tham số ở mục cấu hình bên dưới
|
||||
"""
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import os
|
||||
|
||||
# ----------------------------
|
||||
# CẤU HÌNH
|
||||
# ----------------------------
|
||||
NPZ_PATH = "outputs/porosity_volume_600_1100ms.npz"
|
||||
MODE = "inline" # "inline", "xline", hoặc "time"
|
||||
SLICE_INDEX = 362 # số hiệu inline hoặc xline hoặc thời gian (ms)
|
||||
CMAP = "Spectral" # hoặc "plasma", "seismic", "inferno"
|
||||
OUT_FILE = f"{MODE}_{SLICE_INDEX}.png"
|
||||
|
||||
# ----------------------------
|
||||
# TẢI DỮ LIỆU
|
||||
# ----------------------------
|
||||
D = np.load(NPZ_PATH)
|
||||
vol = D["vol"] # (nI, nX, L)
|
||||
ilines = D["ilines"] # (nI,)
|
||||
xlines = D["xlines"] # (nX,)
|
||||
times_ms = D["times_ms"] # (L,)
|
||||
y_lo = float(D["y_lo"])
|
||||
y_hi = float(D["y_hi"])
|
||||
|
||||
# Giải scale về porosity thật
|
||||
vol_real = vol * (y_hi - y_lo) + y_lo # scale [0,1] → [y_lo, y_hi]
|
||||
|
||||
# ----------------------------
|
||||
# CHỌN lát cắt
|
||||
# ----------------------------
|
||||
if MODE == "inline":
|
||||
if SLICE_INDEX not in ilines:
|
||||
raise ValueError(f"Inline {SLICE_INDEX} không có trong tập dữ liệu.")
|
||||
idx = np.where(ilines == SLICE_INDEX)[0][0]
|
||||
img = vol_real[idx, :, :] # (nX, L)
|
||||
xlabel = "Crossline"
|
||||
ylabel = "Time (ms)"
|
||||
xticks = xlines
|
||||
yticks = times_ms
|
||||
|
||||
elif MODE == "xline":
|
||||
if SLICE_INDEX not in xlines:
|
||||
raise ValueError(f"Xline {SLICE_INDEX} không có trong tập dữ liệu.")
|
||||
idx = np.where(xlines == SLICE_INDEX)[0][0]
|
||||
img = vol_real[:, idx, :] # (nI, L)
|
||||
xlabel = "Inline"
|
||||
ylabel = "Time (ms)"
|
||||
xticks = ilines
|
||||
yticks = times_ms
|
||||
|
||||
elif MODE == "time":
|
||||
if SLICE_INDEX not in times_ms:
|
||||
raise ValueError(f"Time {SLICE_INDEX} ms không có trong tập dữ liệu.")
|
||||
idx = np.where(times_ms == SLICE_INDEX)[0][0]
|
||||
img = vol_real[:, :, idx] # (nI, nX)
|
||||
xlabel = "Crossline"
|
||||
ylabel = "Inline"
|
||||
xticks = xlines
|
||||
yticks = ilines
|
||||
|
||||
else:
|
||||
raise ValueError("MODE phải là 'inline', 'xline' hoặc 'time'")
|
||||
|
||||
# ----------------------------
|
||||
# HIỂN THỊ
|
||||
# ----------------------------
|
||||
plt.figure(figsize=(10, 6))
|
||||
im = plt.imshow(img.T, aspect="auto", cmap=CMAP,
|
||||
origin="lower", vmin=y_lo, vmax=y_hi)
|
||||
|
||||
plt.colorbar(im, label="Porosity")
|
||||
plt.xlabel(xlabel)
|
||||
plt.ylabel(ylabel)
|
||||
plt.title(f"Predicted Porosity — {MODE.capitalize()} {SLICE_INDEX}")
|
||||
plt.tight_layout()
|
||||
plt.savefig(OUT_FILE, dpi=300)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user