Archived
Implement Gre24 reproduction and freeze v5 preparation evidence
This commit is contained in:
1 parent
baf2ac8145
commit
8409910b1e
49 files changed
+30910
No files matched your search
@@ -0,0 +1,39 @@
|
||||
"""Accepted unit-change checks, with original eleven checks on new adapter."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
import resource
|
||||
import time
|
||||
import unittest
|
||||
import numpy as np
|
||||
import gre24_features_v2 as v2
|
||||
import test_gre24_features as original
|
||||
|
||||
# Route the existing analytic tests to the new module without editing old evidence.
|
||||
for name in ('mesh','exterior_faces','gate_nodes','solve_eikonal','cell_flow_speed','strict_volume_cdf',
|
||||
'nodal_gradient','spatial_moment','per_geometry_metrics','appendix_summary','features'):
|
||||
setattr(original,name,getattr(v2,name))
|
||||
|
||||
|
||||
class ScaleChecks(unittest.TestCase):
|
||||
def test_scale_invariance(self):
|
||||
x,t=original.box();g=v2.mesh(x,t);src=np.flatnonzero(x[:,0]==0)
|
||||
a=v2.solve_eikonal(g,src,2.,scale_override=1.)
|
||||
b=v2.solve_eikonal(g,src,2.,scale_override=100.)
|
||||
np.testing.assert_allclose(a,b,atol=1e-9,rtol=1e-9)
|
||||
|
||||
def test_tiny_speed_reaches_same_analytic_solution(self):
|
||||
x,t=original.box();g=v2.mesh(x,t);src=np.flatnonzero(x[:,0]==0)
|
||||
a=v2.solve_eikonal(g,src,.001)
|
||||
np.testing.assert_allclose(a,x[:,0]/.001,atol=1e-6,rtol=1e-9)
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
start=time.monotonic()
|
||||
suite=unittest.TestSuite([unittest.defaultTestLoader.loadTestsFromTestCase(original.Gre24Checks),
|
||||
unittest.defaultTestLoader.loadTestsFromTestCase(ScaleChecks)])
|
||||
result=unittest.TextTestRunner(verbosity=2).run(suite)
|
||||
usage=resource.getrusage(resource.RUSAGE_SELF)
|
||||
Path('artifacts/gre24-reproduction-2026-11-15/synthetic-v2-receipt.json').write_text(json.dumps(dict(
|
||||
tests=result.testsRun,failures=len(result.failures),errors=len(result.errors),passed=result.wasSuccessful(),
|
||||
CPU_seconds=usage.ru_utime+usage.ru_stime,wall_seconds=time.monotonic()-start,peak_rss_bytes=usage.ru_maxrss*1024),indent=2))
|
||||
raise SystemExit(0 if result.wasSuccessful() else 1)
|
||||
Reference in new issue
Block a user