ridge-bake: tighten the stacked-planes bound to 6/255 (4.9 measured), mutate.py prints each verdict as it lands
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0e2bc509d3
commit
5ce2c02345
3 changed files with 5 additions and 4 deletions
|
|
@ -27,7 +27,7 @@ Files are `Copernicus_DSM_COG_10_<N|S>dd_00_<E|W>ddd_00_DEM.tif`; the list below
|
|||
|
||||
## Planes
|
||||
|
||||
`relight_planes` renders every layer twice, with haze colour 0 and 1; the relight is affine in the haze colour, so the difference is each pixel's haze share. That share becomes transparency and the sky behind supplies the haze. Far is slot 0 plus the floor, near is the last slot, mid is every slot between (a place needs at least 3). Colour is exact over the frame's own haze colour; over another sky it drifts by the difference between the two. Stacked planes over a flat sky stay within 9/255 mean of the opaque frame (about 7/255 measured on Vienna noon); the spec's 2/255 is not reachable with this trick.
|
||||
`relight_planes` renders every layer twice, with haze colour 0 and 1; the relight is affine in the haze colour, so the difference is each pixel's haze share. That share becomes transparency and the sky behind supplies the haze. Far is slot 0 plus the floor, near is the last slot, mid is every slot between (a place needs at least 3). Colour is exact over the frame's own haze colour; over another sky it drifts by the difference between the two. Stacked planes over a flat sky stay within 6/255 mean of the opaque frame (4.9/255 measured on Vienna noon); the spec's 2/255 is not reachable with this trick.
|
||||
|
||||
## Licence
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ def run(item):
|
|||
open(p, 'w').write(s.replace(a, b))
|
||||
r = subprocess.run([sys.executable, os.path.join(HERE, 'test_ridge.py')], env=dict(os.environ, RIDGE_SRC=os.path.join(d, 'src')), capture_output=True, text=True); shutil.rmtree(d)
|
||||
fails = [l.split('|')[0].strip() for l in r.stdout.splitlines() if l.startswith('FAIL')]
|
||||
return ('KILLED ' if r.returncode else 'SURVIVED ') + name + ' -> ' + (', '.join(fails) or 'no fixture failed'), r.returncode == 0
|
||||
line = ('KILLED ' if r.returncode else 'SURVIVED ') + name + ' -> ' + (', '.join(fails) or 'no fixture failed'); print(line, file=sys.stderr, flush=True) # progress: a killed run keeps what finished
|
||||
return line, r.returncode == 0
|
||||
if __name__ == '__main__':
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
with ThreadPoolExecutor(int(os.environ.get('MUTATE_JOBS', '6'))) as ex: res = list(ex.map(run, [(n, v) for n, v in MUTANTS.items() if n not in EQUIVALENT]))
|
||||
|
|
|
|||
|
|
@ -396,12 +396,12 @@ def test_the_far_plane_over_a_flat_sky_equals_the_opaque_relight_of_its_group():
|
|||
assert d.mean() < 1.0 and d.max() < 4.0, ('the far plane over a flat sky differs from its opaque relight', d.mean(), d.max())
|
||||
assert planes['far'][0, :, 3].max() < 0.01 and planes['near'][0, :, 3].max() < 0.01, 'the top row (sky) is not transparent'
|
||||
def test_stacked_planes_stay_close_to_the_opaque_relight_on_vienna_noon():
|
||||
"""Real Vienna bake at noon, three planes over a flat sky vs relight(flat=that sky): the stacking loss (a nearer group's haze veils the farther plane instead of the sky) measured 7/255 mean; the bound is 9, so a split
|
||||
"""Real Vienna bake at noon, three planes over a flat sky vs relight(flat=that sky): the stacking loss (a nearer group's haze veils the farther plane instead of the sky) measured 4.9/255 mean; the bound is 6, so a split
|
||||
that loses colour or alpha shows. The spec's 2/255 pin is not reachable with this trick (reported as a deviation)."""
|
||||
saved = ridge.P; ridge.configure(ridge.load_preset('vienna')); d, A, Hh, _ = ridge.stage0(False); r = ridge.sweep(d, A, Hh); ridge.set_view(r['slots']); L = ridge.bake(r['slots']); f = _statics_flat_grain()
|
||||
sun = export.sun_set(ridge.P, ridge.P['date'])['noon']; sky = export.SHEET_SKY; planes = ridge.relight_planes(L, sun['az'], sun['el'], *f, shadows=False, ref=sky)
|
||||
err = np.abs(_over(planes, sky) - ridge.win(ridge.relight(L, sun['az'], sun['el'], *f, shadows=False, flat=sky))).mean() * 255; ridge.P = saved
|
||||
assert err < 9.0, ('stacked planes drift from the opaque relight', err)
|
||||
assert err < 6.0, ('stacked planes drift from the opaque relight', err)
|
||||
def test_plane_grouping_far_mid_near_and_refuses_fewer_than_three_slots():
|
||||
"""far = slot 0, near = the last slot, mid = every slot between (the union); a 3-slot place fills all three planes; fewer than 3 slots are refused."""
|
||||
assert ridge.group_slots(3) == dict(far=[0], mid=[1], near=[2]) and ridge.group_slots(6) == dict(far=[0], mid=[1, 2, 3, 4], near=[5])
|
||||
|
|
|
|||
Loading…
Reference in a new issue