From df1b2bd8e34638ee9574bd59ade3aa2018a20bd8 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 24 Nov 2026 23:33:49 +0100 Subject: [PATCH] ridge-bake: drop the skirt source and blur pins (the skirt colour is redesigned later); mutants follow the nearest-terrain names Co-Authored-By: Claude Sonnet 5.5 --- scripts/ridge-bake/tests/mutate.py | 8 ++------ scripts/ridge-bake/tests/test_ridge.py | 8 -------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/scripts/ridge-bake/tests/mutate.py b/scripts/ridge-bake/tests/mutate.py index 0b27f9f5..f9bd7212 100644 --- a/scripts/ridge-bake/tests/mutate.py +++ b/scripts/ridge-bake/tests/mutate.py @@ -31,16 +31,12 @@ MUTANTS = { # name -> (text in ridge.py or export.py, replacement) 'skirt: the blur is a hair (0.01 degrees)': ("SKIRT_BLUR_DEG = 4.0 ", "SKIRT_BLUR_DEG = 0.01 "), 'skirt: the blur sigma is in columns, not degrees': ("SKIRT_BLUR_DEG * HPX_DEG)", "SKIRT_BLUR_DEG)"), 'skirt: each tile blurs its own columns (the ring is not blurred whole)': ("skirt=cols(sk, t))", "skirt=ridge.blurw(cols(h, t)[0], ridge.SKIRT_BLUR_DEG * ridge.HPX_DEG))"), - 'skirt: the height is read at sample 1, not sample 0': ("return blurw(np.asarray(h)[0], SKIRT_BLUR_DEG * HPX_DEG)", "return blurw(np.asarray(h)[1], SKIRT_BLUR_DEG * HPX_DEG)"), - 'skirt: the blur is 1 degree': ("SKIRT_BLUR_DEG = 4.0 ", "SKIRT_BLUR_DEG = 1.0 "), - 'skirt: the blur is 40 degrees': ("SKIRT_BLUR_DEG = 4.0 ", "SKIRT_BLUR_DEG = 40.0 "), - 'skirt: the blur sigma is four times too wide': ("return blurw(np.asarray(h)[0], SKIRT_BLUR_DEG * HPX_DEG)", "return blurw(np.asarray(h)[0], 4 * SKIRT_BLUR_DEG * HPX_DEG)"), 'r_max: the tile median binds, not the nearest terrain': ("r_max = solve_r_max(near, bands, ppd); r_fwd = solve_r_max(near, bands, ppd, phis=1)", "r_max = solve_r_max(dist, bands, ppd); r_fwd = solve_r_max(dist, bands, ppd, phis=1)"), 'r_max: a tile of skirt only binds at its wall distance': ("if solid.any() else None)", "if solid.any() else dm)"), 'r_max: the nearest pixel is the farthest solid one': ("nrow.append(float(np.exp(ld[solid].min()))", "nrow.append(float(np.exp(ld[solid].max()))"), 'near clip: the writer compares the float32 distance strictly': ("if rmin < ridge.NEAR_CLIP_M * (1 - 1e-5): raise", "if rmin < ridge.NEAR_CLIP_M: raise"), 'near clip: the march starts nearer than the clip': ("d = [NEAR_CLIP_M]", "d = [100.0]"), - 'near clip: a card 0 inside the clip is accepted by the writer': ("if rmin < ridge.NEAR_CLIP_M: raise", "if False: raise"), + 'near clip: a card 0 inside the clip is accepted by the writer': ("if rmin < ridge.NEAR_CLIP_M * (1 - 1e-5): raise", "if False: raise"), 'view: the 1x floor is back': ("lo, hi = E_MIN * HPX_DEG, 10 * HPX_DEG", "lo, hi = HPX_DEG, 10 * HPX_DEG"), 'view: the horizon anchor is dropped (the scale is the skyline fit alone)': ("ppd = float(np.clip(min(fit, hold), lo, hi))", "ppd = float(np.clip(fit, lo, hi))"), 'view: a skyline that cannot hold the ground rows is not refused': ("if hold < lo: raise", "if False: raise"), @@ -66,7 +62,7 @@ MUTANTS = { # name -> (text in ridge.py or export.py, replacement) 'budget: the run length forgets the margin tiles': ("math.ceil(arc / TILE_DEG) + 1 + 4", "math.ceil(arc / TILE_DEG)"), 'r_max: the camera sweeps forward only (phi = 0)': ("PHI_STEPS = 24 ", "PHI_STEPS = 1 "), 'r_max: every card of a tile is fitted at the nearest card distance': ("fit_px(d, r, px_per_deg, phis) for d in row", "fit_px(row[0] if row[0] is not None else d, r, px_per_deg, phis) for d in row"), - 'r_max_forward: the forward offset is searched over the whole circle': ("r_fwd = solve_r_max(dist, bands, ppd, phis=1)", "r_fwd = solve_r_max(dist, bands, ppd)"), + 'r_max_forward: the forward offset is searched over the whole circle': ("r_fwd = solve_r_max(near, bands, ppd, phis=1)", "r_fwd = solve_r_max(near, bands, ppd)"), 'r_max_forward: the resident gate is not checked at the forward offset': ("for r in (camera['r_max_m'], camera['r_max_forward_m']): check_budget", "for r in (camera['r_max_m'],): check_budget"), 'r_max_forward: a forward offset below r_max_m is accepted': ("if camera['r_max_forward_m'] < camera['r_max_m']: raise", "if False: raise"), 'fit: the line is the least squares of 33 uniform samples, as the first gate drew it': ("x, w = np.polynomial.legendre.leggauss(FIT_QUAD)", "x = np.linspace(-1, 1, 33); w = np.full(33, 2 / 33)"), diff --git a/scripts/ridge-bake/tests/test_ridge.py b/scripts/ridge-bake/tests/test_ridge.py index de629fcb..54ddee9e 100644 --- a/scripts/ridge-bake/tests/test_ridge.py +++ b/scripts/ridge-bake/tests/test_ridge.py @@ -549,14 +549,6 @@ def test_r_max_holds_for_the_nearest_terrain_of_every_tile_and_skirt_only_tiles_ assert r < export.solve_r_max([[1200.0 if (t, i) == (7, 0) else None for i in range(3)] for t in range(32)], [[100] * 3 for _ in range(32)], ppd) - 5, 'the range is the median model' skirt_free = export.pack(_toy()); assert pk['camera']['r_max_m'] < skirt_free['camera']['r_max_m'], 'the 600 m pixels do not bind' only = export.pack(dict(b, cards=[[dict(cs[t][i]) if (t, i) != (7, 0) else dict(b['cards'][7][0]) for i in range(3)] for t in range(32)])); assert only['camera'] == skirt_free['camera'], ('a skirt-only tile binds r_max', only['camera'], skirt_free['camera']) -def test_the_skirt_reads_sample_zero_at_the_authored_blur(): - """skirt_height is the sample-0 height of the ring march blurred round the ring by a Gaussian of 4 degrees of azimuth: it equals an independent periodic convolution (np.convolve over the wrapped ring with the full Gaussian of sigma 4 x HPX_DEG columns) within 10 m on a ring (the baker cuts its kernel at 3 sigma, 5 m off here) whose sample 0 steps between 100 and 2100 m and whose other samples stand at 3000 m, - so a skirt read at sample 1, at 1 or 40 degrees, or at four times the sigma, is off by hundreds of metres. The authored constant is pinned with the others.""" - assert ridge.SKIRT_BLUR_DEG == 4.0, 'the authored blur is pinned' - K = len(D); h = np.full((K, W), 3000.0); step = (np.arange(W) // 400) % 2; h[0] = np.where(step == 0, 100.0, 2100.0) - sigma = 4.0 * W / 360.0; r = int(6 * sigma); k = np.exp(-0.5 * (np.arange(-r, r + 1) / sigma) ** 2); k /= k.sum(); wrapped = np.concatenate([h[0, -r:], h[0], h[0, :r]]); want = np.convolve(wrapped, k, mode='valid') - assert want.shape == (W,) and np.abs(ridge.skirt_height(h) - want).max() < 10.0, ('the skirt is not the sample-0 height blurred by 4 degrees', float(np.abs(ridge.skirt_height(h) - want).max())) - assert np.abs(want - h[0]).max() > 500 and np.abs(want - 3000.0).max() > 900, 'the fixture cannot tell the blur from the raw height or from sample 1' def test_the_near_clip_compare_does_not_depend_on_float32_rounding(): """A card 0 exactly at the near clip is accepted whatever the clip's value: exp of a float32 ln 700 is 699.99994, which a strict compare against a 700 m clip refuses; one 1.5 per mille under the clip is still refused.""" saved = ridge.NEAR_CLIP_M; d = tempfile.mkdtemp()