From 2e3e9133c01dc59810a5d4ddca4d2096c238df3b Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 20 Nov 2026 13:59:43 +0100 Subject: [PATCH] Ridge baker tests: check wall distance and albedo in every wall column The face-up albedo mutant still survives (no fixture has a wall under a face steep enough to move the albedo: not yet reached); the card-0 wall mutant is killed by the near-hill fixture. Co-Authored-By: Claude Sonnet 5.5 --- scripts/ridge-bake/tests/test_ridge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ridge-bake/tests/test_ridge.py b/scripts/ridge-bake/tests/test_ridge.py index cd3c8e60..8a323cf5 100644 --- a/scripts/ridge-bake/tests/test_ridge.py +++ b/scripts/ridge-bake/tests/test_ridge.py @@ -307,7 +307,7 @@ def test_wall_rows_flagged(): k0, a0 = _first_sample_angle(b, i); want = (lo[:, None] < a0[None, :])[c['top']:c['top'] + c['alpha'].shape[0]]; assert (c['wall'] == want).all(), ('wall rows are not the rows below the first sample', i, int((c['wall'] != want).sum())); seen += int(want.sum()) geo = export.decode(export.encode_geometry(c['n_r'], c['n_t'], c['logd'], b['meta']['encoding'], c['wall'])); r, t = geo[..., 0] / 255.0 * 2 - 1, geo[..., 1] / 255.0 * 2 - 1; code = (geo[..., 0] == 255) & (geo[..., 1] == 255) assert (code == c['wall']).all() and (r[~code] ** 2 + t[~code] ** 2 <= 1.02).all(), 'the wall code is not on exactly the wall pixels, or a real normal reaches it' - for x in np.flatnonzero(c['wall'].any(0))[::40]: + for x in np.flatnonzero(c['wall'].any(0)): rows = np.flatnonzero(c['wall'][:, x]); ld = c['logd'][rows, x]; assert np.ptp(ld) < 1e-5 and abs(math.exp(ld[0]) - D[k0[x]]) < 1e-3 * D[k0[x]] + 60, ('a wall keeps its sample distance', x) want_alb = ridge.albedo(np.array([b['h'][k0[x], x]]), np.array([1.0]))[0]; assert np.abs(c['albedo'][rows, x] - want_alb).max() < 1e-5, ('wall albedo is not the ground material with the face up', x) assert seen > 1000, 'the fixture has no wall'