Skip to content

Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)

Report matched harmonic-group coverage

Cinna Davis2f01c6701d1e
diff --git a/src/dopplergeist/confidence.py b/src/dopplergeist/confidence.py
index c8fe338..ce9e2c9 100644
--- a/src/dopplergeist/confidence.py
+++ b/src/dopplergeist/confidence.py
@@ -179,11 +179,16 @@ def _candidate_evidence_summary(events, candidate, evidence):
if name in fit},
})
all_groups = {event.get("harmonic_group_id", event["event_id"]) for event in events}
+ matched_group_count = len(group_flights)
+ total_group_count = len(all_groups)
return {
"matched_event_ids": sorted(matched_events),
"unmatched_event_ids": sorted(set(lookup) - matched_events),
"matched_group_ids": sorted(group_flights),
"unmatched_group_ids": sorted(all_groups - set(group_flights)),
+ "matched_group_count": matched_group_count,
+ "total_group_count": total_group_count,
+ "matched_group_fraction": matched_group_count / total_group_count,
"distinct_flight_segments": len(flights_groups),
"flight_segments_with_multiple_groups": [
{"flight_id": flight_id, "group_ids": sorted(group_ids)}
diff --git a/tests/test_real_confidence_diagnostics.py b/tests/test_real_confidence_diagnostics.py
index a3b382c..de6a024 100644
--- a/tests/test_real_confidence_diagnostics.py
+++ b/tests/test_real_confidence_diagnostics.py
@@ -9,14 +9,15 @@ from dopplergeist.confidence import decide_location
DATA = Path(__file__).parent / "data"
CASES = (
- ("real-eclipse-rochester-decision.json", "search_incomplete"),
- ("real-eclipse-fort-worth-decision.json", "source_drift_unresolved"),
- ("real-eclipse-east-texas-decision.json", "search_incomplete"),
+ ("real-eclipse-rochester-decision.json", "search_incomplete", 1, 6),
+ ("real-eclipse-fort-worth-decision.json", "source_drift_unresolved", 3, 5),
+ ("real-eclipse-east-texas-decision.json", "search_incomplete", 2, 6),
)
[email protected](("filename", "reason_code"), CASES)
-def test_real_saved_results_keep_ranked_candidate_diagnostics(filename, reason_code):
[email protected](("filename", "reason_code", "matched_group_count", "total_group_count"), CASES)
+def test_real_saved_results_keep_ranked_candidate_diagnostics(
+ filename, reason_code, matched_group_count, total_group_count):
saved = json.loads((DATA / filename).read_text())
result = decide_location(
saved["events"], [saved["candidate"]], saved["coverage"],
@@ -36,6 +37,9 @@ def test_real_saved_results_keep_ranked_candidate_diagnostics(filename, reason_c
assert summary["matched_event_ids"] == sorted(candidate["event_ids"])
assert summary["matched_group_ids"] == sorted(matched_groups)
assert summary["unmatched_group_ids"] == sorted(all_groups - matched_groups)
+ assert summary["matched_group_count"] == matched_group_count
+ assert summary["total_group_count"] == total_group_count
+ assert summary["matched_group_fraction"] == matched_group_count / total_group_count
assert summary["unmatched_event_ids"]
assert {fit["event_id"] for fit in summary["event_fits"]} == set(candidate["event_ids"])
assert all("drift_at_bound" in fit for fit in summary["event_fits"])