Split webapp for Raspberry Pi deployment, remote generation API and sync

La webapp (carte + vignettes) et la génération de tuiles se déploient sur
deux machines : image légère Dockerfile.webapp (FastAPI + Pillow AVIF
natif + pyproj) sur Raspberry Pi, pipeline complet sur la machine de
traitement. LIDAR_GENERATION_URL délègue /api/generate, /api/preview et
/api/status ; /api/sync ramène les tuiles par rsync puis régénère
vignettes et index localement. Token partagé optionnel
(LIDAR_API_TOKEN/LIDAR_REMOTE_TOKEN). Retire du dépôt les journaux
internes (.swival, audit-findings) et les données (data/, notebooks/).
Doc : docs/DEPLOY_WEBAPP.md.
This commit is contained in:
Antoine Jacquin
2026-09-02 19:44:39 +02:00
parent ed3e90ea89
commit 422f58d772
24 changed files with 2390 additions and 329 deletions

View File

@ -97,6 +97,30 @@ class TestApplyColormap:
assert result is not None
assert result.exists()
def test_knots_mode_fixed_transfer(self):
"""L'étalonnage quantile figé (ondelette) : même valeur → même couleur.
Les nœuds sont constants (pas de percentile local) : clamp aux
extrêmes, médiane (1.0) → 0.5, transfert monotone.
"""
from lidar_pipeline.rendering import COLORMAPS, _apply_colormap
info = COLORMAPS['wavelet']
kv, kt = info['knots'][0.5]
assert kv[6] == 1.0 and kt[6] == 0.5 # nœud médian
vals = np.array([0.05, kv[0], 1.0, kv[-1], 50.0], dtype=float)
out, cmap, *_ = _apply_colormap(vals, 'x_wavelet.tif', resolution=0.5)
assert cmap == 'inferno'
assert out[0] == 0.0 and out[1] == 0.01 # clamp bas
assert abs(out[2] - 0.5) < 1e-9 # médiane → 0.5
assert out[3] == 0.995 and out[4] == 1.0 # nœud haut, puis clamp au-delà
# Monotonie (pas d'inversion de teinte)
s = np.sort(np.random.default_rng(1).uniform(0.2, 3.0, 500))
o, *_ = _apply_colormap(s, 'x_wavelet.tif', resolution=0.5)
assert np.all(np.diff(o) >= -1e-12)
# Les nœuds 0.2 m diffèrent de ceux 0.5 m (calibrations distinctes)
kv02, _ = info['knots'][0.2]
assert kv02 != kv
class TestTifToCrop:
"""Conversion TIF → dalle cartographique (tif_to_crop)."""