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>
62 lines
3.0 KiB
Python
62 lines
3.0 KiB
Python
"""Audit P3 completion and data integrity without changing scientific outputs."""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
import numpy as np
|
|
|
|
from ml_porosity.f3.progress import write_json
|
|
from ml_porosity.f3.protocol import freeze, load_protocol
|
|
from ml_porosity.f3.runner import job_path, reg_path, registration_jobs, reusable, training_jobs
|
|
from ml_porosity.paths import outputs_dir
|
|
|
|
|
|
def main():
|
|
stamp, p = freeze(check=True), load_protocol()
|
|
root = outputs_dir()/'p3'
|
|
jobs = training_jobs(p, stamp, root, 'cuda:0')
|
|
assert len(jobs) == 1320
|
|
for job in jobs:
|
|
path = job_path(root, job['names'], job['method'], job['label'], job['seed'], job['sa'])
|
|
assert reusable(path, job['key']), str(path)
|
|
registrations = registration_jobs(p, stamp, root, 'cuda:0')
|
|
registrations += registration_jobs(p, stamp, root, 'cuda:0', deployment=True)
|
|
for job in registrations:
|
|
path = reg_path(root, job['names'], job['sa'], job['no_anchors'])
|
|
assert reusable(path, job['key']), str(path)
|
|
meta = json.loads((root/'volume/metadata.json').read_text(encoding='utf-8'))
|
|
assert meta['shape'] == [651, 951, 126]
|
|
assert meta['members'] == 20 and not meta['sections_only'] and not meta['pilot']
|
|
state = json.loads((root/'volume/state.json').read_text(encoding='utf-8'))
|
|
assert sorted(state['completed_ilines']) == list(range(1, 650))
|
|
stats = {}
|
|
for name in ('mean', 'sigma'):
|
|
arr = np.load(root/f'volume/{name}.npy', mmap_mode='r')
|
|
assert list(arr.shape) == meta['shape'] and arr.dtype == np.float32
|
|
assert all(np.isnan(edge).all() for edge in (arr[0], arr[-1], arr[:, 0], arr[:, -1]))
|
|
low, high = float('inf'), float('-inf')
|
|
for i in range(1, len(arr)-1):
|
|
values = arr[i, 1:-1]
|
|
assert np.isfinite(values).all(), f'{name}: nonfinite interior row {i}'
|
|
low, high = min(low, float(values.min())), max(high, float(values.max()))
|
|
if name == 'sigma':
|
|
assert low >= 0
|
|
stats[name] = {'shape': list(arr.shape), 'interior_finite_values': 649*949*126,
|
|
'minimum_fraction': low, 'maximum_fraction': high,
|
|
'one_trace_border_all_nan': True}
|
|
recovery = json.loads((root/'volume_recovery.json').read_text(encoding='utf-8'))
|
|
assert recovery['status'] == 'complete' and recovery['completed_rows_preserved'] and recovery['gate_preserved']
|
|
result = {'status': 'passed', 'protocol_sha256': stamp['protocol_sha256'],
|
|
'frozen_code_data_environment_and_protected_artifacts': 'match',
|
|
'verified_lowo_prediction_checkpoint_pairs': len(jobs),
|
|
'verified_registration_bundles': len(registrations),
|
|
'completed_volume_inlines': 649, 'volume': stats,
|
|
'gate': json.loads((root/'summary/gate_gc.json').read_text(encoding='utf-8'))}
|
|
write_json(root/'completion_checks.json', result)
|
|
print(json.dumps(result, ensure_ascii=False, indent=2))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|