fix: refine hysteresis recalculation with MA pre-smoothing and lower thresholds

- dem.py: pre-smooth elevation with 30s moving average before hysteresis
  in recalculate_elevation_hysteresis(); thresholds drop from 5m/10m to
  1m (barometric) / 3m (GPS) — accurate after noise is smoothed out
- dem.py: widen DEM median-filter window 45s → 60s
- dem.py: rename response key source → altitude_source for consistency
- writer.py: write altitude_source into detail JSON at extract time
- tests/test_dem.py: 21 unit tests for pure functions and file-level hysteresis
- tests/test_edit_server.py: 11 TestClient API tests for both recalculate endpoints
- add httpx as dev dependency (required by FastAPI TestClient)
This commit is contained in:
Davide Scaini
2026-04-22 10:57:28 +02:00
parent 88b24a6274
commit df496a017f
6 changed files with 481 additions and 13 deletions
+1
View File
@@ -93,6 +93,7 @@ def write_activity(
"source": source,
"source_file": activity.source_file,
"source_hash": activity.source_hash,
"altitude_source": activity.altitude_source,
"strava_id": activity.strava_id,
"duplicate_of": duplicate_of,
"privacy": privacy,