Files
Jacquin Antoine ad762e682d Suppression éclairage solaire, GPU accéléré, --file multi, tests unitaires
- Suppression de generate_solar (éclairage solaire) des visualisations
- Accélération GPU de hillshade, slope, aspect, curvature, depressions,
  anomalies, roughness, texture GLCM, flow (sink filling)
- Nettoyage mémoire GPU entre visualisations (gpu_cleanup)
- Correction OOM texture GLCM: calcul entropie bin par bin au lieu d'un
  tableau 3D massif sur GPU
- Correction bug: xp_minimum_filter manquant dans imports visualizations
- Option --file accepte plusieurs noms complets sans extension
- run.sh affiche l'aide si appelé sans arguments
- Option --test pour exécuter les tests unitaires dans Docker
- Filtre ReturnNumber>=1 intégré dans le pipeline PDAL (plus d'erreur SMRF)
- 60 tests unitaires: GPU, visualisations, rendering, DTM, pipeline, CLI
- Ajout pytest au Dockerfile

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-10 00:57:39 +02:00

71 lines
1.9 KiB
Python

"""Shared fixtures for LiDAR pipeline tests."""
import numpy as np
import rasterio
from rasterio.transform import from_bounds
import pytest
from pathlib import Path
@pytest.fixture
def tmp_output_dir(tmp_path):
"""Create a temporary output directory."""
out = tmp_path / "output"
out.mkdir()
return out
@pytest.fixture
def synthetic_dem(tmp_path):
"""Create a small synthetic DEM GeoTIFF with realistic terrain features.
Includes:
- A gaussian hill (tumulus)
- A linear ridge (wall)
- A depression (ditch)
- Background noise
"""
size = 200
x = np.linspace(0, 1000, size)
y = np.linspace(0, 1000, size)
X, Y = np.meshgrid(x, y)
# Base terrain with gentle slope
dem = 100.0 + 0.01 * X + 0.005 * Y
# Gaussian hill (tumulus) at center
dem += 5.0 * np.exp(-((X - 500)**2 + (Y - 500)**2) / (2 * 80**2))
# Linear ridge (wall) running SW-NE
dist_to_wall = np.abs((X - 200) * 0.707 + (Y - 300) * 0.707) / np.sqrt(2)
dem += 1.5 * np.exp(-dist_to_wall**2 / (2 * 10**2))
# Depression (ditch)
dist_to_ditch = np.abs(X - 800)
dem -= 2.0 * np.exp(-dist_to_ditch**2 / (2 * 15**2)) * (Y > 300) * (Y < 700)
# Small random noise
rng = np.random.default_rng(42)
dem += rng.normal(0, 0.05, dem.shape)
# Save as GeoTIFF (Lambert 93)
dem_file = tmp_path / "test_dem.tif"
transform = from_bounds(660000, 6700000, 661000, 6701000, size, size)
with rasterio.open(
dem_file, 'w',
driver='GTiff', height=size, width=size,
count=1, dtype='float32',
crs='EPSG:2154', transform=transform,
compress='lzw'
) as dst:
dst.write(dem.astype('float32'), 1)
return dem_file
@pytest.fixture
def synthetic_dem_data(synthetic_dem):
"""Return (array, transform, crs) from the synthetic DEM."""
with rasterio.open(synthetic_dem) as src:
return src.read(1), src.transform, src.crs