Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)
Python acoustic-geolocationads-baircraft-trackingairplaneaudio-forensicsdoppler-effectdoppler-shiftgeolocationosintsignal-processing
Keep required abstentions out of distance-tier success counts (#3)
Cinna Davis6163da2dac13
diff --git a/src/aircraft_geoloc/evaluation.py b/src/aircraft_geoloc/evaluation.pyindex 83b90dc..afe7c5c 100644--- a/src/aircraft_geoloc/evaluation.py+++ b/src/aircraft_geoloc/evaluation.py@@ -150,7 +150,7 @@ def evaluate(manifest, predictions, truth, threshold_m=1000, iou_threshold=0.3):"false_localization_rate": false / len(assessed) if assessed else None,"false_localization_denominator": len(assessed),"successful_locations_by_threshold_m": {str(t): sum(r.get("location_error_m", math.inf) <= t and- r.get("flight_ids_correct") is not False for r in fixes) for t in thresholds},+ not false_at(r, t) for r in fixes) for t in thresholds},"false_localizations_by_threshold_m": {str(t): sum(false_at(r, t) for r in assessed) for t in thresholds},"inconclusive_rate": sum(r["status"] == "inconclusive" for r in selected) / n if n else None,"execution_failures": sum(r["status"] in {"failed", "missing"} for r in selected),diff --git a/tests/test_evaluation.py b/tests/test_evaluation.pyindex 7ed77c9..3dd91a2 100644--- a/tests/test_evaluation.py+++ b/tests/test_evaluation.py@@ -63,6 +63,30 @@ def test_distance_tiers_keep_abstained_diagnostics_out_of_success_counts():assert report["cases"][1]["location_returned"] is False+def test_distance_tiers_reject_an_eligible_fix_when_abstention_is_required():+ cases = {"cases": [{"case_id": "ambiguous", "split": "held_out", "scope": "control"}]}+ truth = {"ambiguous": {"location": [40, -100], "location_accuracy_eligible": True,+ "flight_ids": ["flight-a"], "expect_inconclusive": True}}+ predictions = {"ambiguous": {"status": "succeeded", "candidates": [+ {"lat": 40, "lon": -100, "flight_ids": ["flight-a"]}]}}++ report = evaluate(cases, predictions, truth)++ # A coincident coordinate and correct flight do not justify accepting an+ # ambiguous case whose independent labels require an inconclusive result.+ case = report["cases"][0]+ assert case["location_error_m"] == 0+ assert case["within_threshold"] is True+ assert case["flight_ids_correct"] is True+ assert case["false_localization"] is True+ for summary in (report["summary"], report["by_split"]["held_out"], report["by_scope"]["control"]):+ assert summary["eligible_location_cases"] == 1+ assert summary["successful_locations_within_threshold"] == 0+ assert summary["successful_locations_by_threshold_m"] == {"100": 0, "500": 0, "1000": 0}+ assert summary["false_localizations"] == 1+ assert summary["false_localizations_by_threshold_m"] == {"100": 1, "500": 1, "1000": 1}++def test_runner_does_not_require_truth_and_measures_each_process(tmp_path):import hashlibmodule_path = Path(__file__).resolve().parents[1] / "scripts/run_benchmark.py"