test: adopt native-validated 24-target probe layout
Horizontal y=56 and vertical x=38 through box 1, normal coordinates [12.5..26.125] (root128 physical). Nearest-ACTIVE mapping with deterministic tie rule (distance, finer level, smaller j, smaller i), duplicate-cell rejection, stored centers and displacements. Replaces my earlier offsets, which mapped two target pairs to the same U128 cell. U512 spacing 128/512 and root step r -> U512 step 4r unchanged. Tests: 24 unique cells per case, nested 3 L0 + 5 L1 + 4 L2 per transect, U128 max displacement 0.625. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1e188e7419
commit
caa573f978
4 files changed
+63
-42
No files matched your search
@@ -977,11 +977,17 @@ class ProbeTraceTests(unittest.TestCase):
|
||||
u512 = sp.select([np.ones((512, 512), bool)], 512)
|
||||
self.assertTrue(all(p["level"] == 0 for p in u128 + u512))
|
||||
for case in (nested, twin, u128, u512):
|
||||
self.assertEqual(len({(p["level"], p["i"], p["j"]) for p in case}), 24) # unique
|
||||
for p in case:
|
||||
# The stored center is the actual cell center containing the point (root units).
|
||||
h = 1.0 / (2 ** p["level"]) if case is not u512 else 0.25
|
||||
self.assertLessEqual(abs(p["center"][0] - p["point"][0]), h / 2)
|
||||
self.assertLessEqual(abs(p["center"][1] - p["point"][1]), h / 2)
|
||||
dx, dy = p["displacement"]
|
||||
self.assertEqual([p["center"][0] - p["point"][0], p["center"][1] - p["point"][1]],
|
||||
[dx, dy])
|
||||
self.assertEqual(max(math.hypot(*p["displacement"]) for p in u128), 0.625)
|
||||
self.assertLessEqual(max(math.hypot(*p["displacement"]) for p in u512), 0.25 * 0.7072)
|
||||
# Nested: 3 L0 + 5 L1 + 4 L2 per transect, as checked by native review.
|
||||
for name in sp.TRANSECTS:
|
||||
levels = [p["level"] for p in nested if p["transect"] == name]
|
||||
self.assertEqual([levels.count(v) for v in (0, 1, 2)], [3, 5, 4])
|
||||
# Different grids give different centers: no pretended collocation.
|
||||
self.assertNotEqual(u128[3]["center"], u512[3]["center"])
|
||||
self.assertEqual(sp.case_steps(512)[:3], [0, 4, 8])
|
||||
|
||||
Reference in new issue
Block a user