Skip to content

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

Report 100m 500m and 1km tiers and check every supported event

Cinna Davised806545beb1
diff --git a/benchmarks/README.md b/benchmarks/README.md
index 35f30b8..1e6271a 100644
--- a/benchmarks/README.md
+++ b/benchmarks/README.md
@@ -1,5 +1,10 @@
# Evaluation corpus and separation
+Current reports use the updated 1,000 m acceptance target and show the 100, 500
+and 1,000 m tiers separately. Historical runs retain their original 100 m target.
+Uncalibrated sensitivity and diagnostic candidates are distinct from measured
+error of an accepted location.
+
`inventory.json` pins input hashes from the published checkpoint manifest, source,
license status, clock evidence and coordinate precision. The 40-passage record is
CC BY 4.0 (Praveen Pathak). The public reference recording has no independently
diff --git a/docs/CONFIDENCE.md b/docs/CONFIDENCE.md
index 4226cea..0f0b269 100644
--- a/docs/CONFIDENCE.md
+++ b/docs/CONFIDENCE.md
@@ -16,12 +16,15 @@ scope and availability of requested archives, not capture of every aircraft.
## Default policy and evidence
-The current default `DecisionPolicy` is `engineering-v2`; the original v1 receipts
+The current default `DecisionPolicy` is `engineering-v3`; the original v1 receipts
remain preserved. Development negative controls motivated explicit abstention
for noise, absent tracks, harmonic duplicates, incomplete coverage, bad residuals
and multiple plausible hypotheses. The engineering thresholds are deliberately
simple and predeclared: normally at least two independent flyovers, <=3 Hz event RMSE,
-<=25% outliers, >=95% trajectory support, and 100 m maximum sensitivity radius.
+<=25% outliers and >=95% trajectory support. The current precision target is
+1,000 m, following the updated project acceptance requirement; 100–500 m or better
+remains preferred. Earlier 100 m runs retain their original policy/threshold.
+Sensitivity radius is an engineering envelope, not measured location error.
For `negative_robust_ridge_loss_hz`, a competing loss within 0.5 Hz per independent
event is a near tie. The declared subset-support score has a separate
dimensionless near-tie threshold of 0.2 support units per independent group;
@@ -48,6 +51,12 @@ IDs. Entire harmonic groups must be retained. These omitted proposals remain
unconfirmed sounds, not labelled aircraft misses or silently deleted evidence.
Different retained subsets remain comparable only using their declared support
score and may still trigger flight/location ambiguity. Matching diagnostics
+may also supply `supported_event_ids`: independently supported flyovers must all
+appear in the winning association. Three, four and more matched groups are all
+checked; there is no decision-stage maximum event count. A four-event regression
+ensures the fourth event's inconsistent residual cannot be ignored.
+
+Matching diagnostics
use event-ID keys with `rmse_hz`, `outlier_fraction`, `support_fraction` and
`drift_at_bound`. Other required evidence keys are `clock_locked`,
`refinement_boundary_limited`, `alternatives_evaluated` and `sensitivity`.
@@ -81,6 +90,7 @@ branch; it does not establish that the real producer has provided such evidence.
| `inconsistent_harmonic_association` | Harmonics map to different flights |
| `incomplete_harmonic_group` | Partial association omits a matched event's harmonic |
| `unexplained_events` | Unmatched proposals lack explicit subset-association evidence |
+| `unmatched_supported_events` | The hypothesis omits independently supported flyovers |
| `recording_clock_mismatch` | Fitted start is outside the trusted original window |
| `timing_not_established` | Shared clock unverified |
| `matching_diagnostics_missing` | Event-fit evidence unavailable |
@@ -115,3 +125,9 @@ These public, author-constructed fixture splits verify decision logic only. The
zero errors and false-localization counts do not estimate audio or real-world
localization accuracy. The audio controls and the frozen audit remain separate;
see `benchmarks/README.md` for their evidence limits and real-data gap.
+
+New evaluation reports include successes and false localizations at each of
+100, 500 and 1,000 m, with the active threshold stated separately. The frozen
+historical runner explicitly retains its original 100 m threshold. An abstained
+best candidate may have a diagnostic error at these tiers, but it never counts
+as an accepted localization success.
diff --git a/scripts/evaluate_benchmark.py b/scripts/evaluate_benchmark.py
index b1a0408..c7fbcd0 100644
--- a/scripts/evaluate_benchmark.py
+++ b/scripts/evaluate_benchmark.py
@@ -12,10 +12,11 @@ def main():
parser.add_argument("predictions", type=Path)
parser.add_argument("truth", type=Path)
parser.add_argument("--output", required=True, type=Path)
+ parser.add_argument("--threshold-m", type=float, default=1000)
args = parser.parse_args()
if args.output.exists():
parser.error("Output already exists; use a new experiment path")
- report = evaluate(*(json.loads(p.read_text()) for p in (args.manifest, args.predictions, args.truth)))
+ report = evaluate(*(json.loads(p.read_text()) for p in (args.manifest, args.predictions, args.truth)), threshold_m=args.threshold_m)
report["input_sha256"] = {p.name: sha256(p) for p in (args.manifest, args.predictions, args.truth)}
args.output.parent.mkdir(parents=True, exist_ok=True)
args.output.write_text(json.dumps(report, indent=2, allow_nan=False) + "\n")
diff --git a/scripts/evaluate_frozen.py b/scripts/evaluate_frozen.py
index 6d7ff24..4ac5271 100644
--- a/scripts/evaluate_frozen.py
+++ b/scripts/evaluate_frozen.py
@@ -38,7 +38,8 @@ if __name__ == "__main__":
manifest = json.loads((base / "frozen-manifest.json").read_text())
truth = json.loads((base / "truth/frozen-labels.json").read_text())
predictions = frozen_predictions(args.root)
- result = evaluate(manifest, predictions, truth)
+ # Preserve the historical acceptance threshold while also reporting tiers.
+ result = evaluate(manifest, predictions, truth, threshold_m=100)
result["evidence_sha256"] = {str(p.relative_to(args.root)): sha256(p)
for p in sorted((args.root / "evidence/results").rglob("*.json"))}
result["limits"].append("Frozen feature recall is annotation-band-assisted case detection, not automatic event-window recall.")
diff --git a/src/aircraft_geoloc/confidence.py b/src/aircraft_geoloc/confidence.py
index 2a56408..92a5938 100644
--- a/src/aircraft_geoloc/confidence.py
+++ b/src/aircraft_geoloc/confidence.py
@@ -15,7 +15,7 @@ from .contracts import utc_timestamp, validate_result
@dataclass(frozen=True)
class DecisionPolicy:
"""Predeclared engineering limits, not fitted confidence calibration."""
- target_radius_m: float = 100.0
+ target_radius_m: float = 1000.0
min_independent_events: int = 2
max_event_rmse_hz: float = 3.0
max_outlier_fraction: float = 0.25
@@ -50,7 +50,7 @@ def decide_location(events, candidates, coverage, *, matching_diagnostics=None,
policy = policy or DecisionPolicy()
if not isinstance(policy, DecisionPolicy):
raise TypeError("policy must be a DecisionPolicy")
- diagnostics = {"policy": asdict(policy), "policy_version": "engineering-v2",
+ diagnostics = {"policy": asdict(policy), "policy_version": "engineering-v3",
"calibration": "uncalibrated", "probability": None,
"limitations": ["Archive availability does not establish capture of every aircraft.",
"Sensitivity checks are not a calibrated confidence interval."]}
@@ -118,6 +118,12 @@ def decide_location(events, candidates, coverage, *, matching_diagnostics=None,
policy.min_independent_events == 2 and known_clock):
return result("insufficient_independent_events", "Too few independent flyovers constrain location; harmonics count once.")
unmatched = set(lookup) - set(best["event_ids"])
+ supported = evidence.get("supported_event_ids")
+ if supported is not None:
+ if not isinstance(supported, list) or not all(isinstance(key, str) for key in supported) or set(supported) - set(lookup):
+ return result("invalid_evidence", "Supported-event identifiers must resolve to discovered events.", "failed")
+ if set(supported) - set(best["event_ids"]):
+ return result("unmatched_supported_events", "The hypothesis omits independently supported flyovers.")
if unmatched:
declared = evidence.get("unmatched_event_ids")
if (best["score_kind"] != "matched_group_support_minus_normalized_residual" or
diff --git a/src/aircraft_geoloc/evaluation.py b/src/aircraft_geoloc/evaluation.py
index e9d4062..83b90dc 100644
--- a/src/aircraft_geoloc/evaluation.py
+++ b/src/aircraft_geoloc/evaluation.py
@@ -58,7 +58,7 @@ def detection_counts(expected, observed, iou_threshold=0.3):
"false_alarms": len(predictions) - hits}
-def evaluate(manifest, predictions, truth, threshold_m=100, iou_threshold=0.3):
+def evaluate(manifest, predictions, truth, threshold_m=1000, iou_threshold=0.3):
"""Join case-ID keyed result/truth dictionaries, preserving the manifest order.
Eligible real cases require independently established clock and location.
@@ -67,6 +67,7 @@ def evaluate(manifest, predictions, truth, threshold_m=100, iou_threshold=0.3):
"""
if not math.isfinite(threshold_m) or threshold_m <= 0:
raise ValueError("Distance threshold must be positive and finite")
+ thresholds = sorted({100, 500, 1000, threshold_m})
rows = []
ids = [c["case_id"] for c in manifest["cases"]]
if len(ids) != len(set(ids)):
@@ -106,6 +107,7 @@ def evaluate(manifest, predictions, truth, threshold_m=100, iou_threshold=0.3):
if not math.isfinite(best[name]) or not low <= best[name] <= high:
raise ValueError(f"Invalid {name} for {key}")
row["diagnostic_best_candidate_error_m"] = distance_m([best["lat"], best["lon"]], label["location"])
+ row["diagnostic_within_thresholds_m"] = {str(t): row["diagnostic_best_candidate_error_m"] <= t for t in thresholds}
if "flight_ids" in label:
row["diagnostic_flight_ids_correct"] = best.get("flight_ids") == label["flight_ids"]
if located:
@@ -135,6 +137,11 @@ def evaluate(manifest, predictions, truth, threshold_m=100, iou_threshold=0.3):
assessed = [r for r in selected if r["location_accuracy_eligible"] or
truth.get(r["case_id"], {}).get("expect_inconclusive", False)]
false = sum(r.get("false_localization", False) for r in assessed)
+ def false_at(row, threshold):
+ label = truth.get(row["case_id"], {})
+ return row["location_returned"] and (label.get("expect_inconclusive", False) or
+ row.get("flight_ids_correct") is False or
+ (row["location_accuracy_eligible"] and row.get("location_error_m", math.inf) > threshold))
return {"cases": n, "eligible_location_cases": len(eligible),
"successful_locations_within_threshold": sum(r.get("within_threshold", False) and
not r.get("false_localization", False) for r in fixes),
@@ -142,6 +149,9 @@ def evaluate(manifest, predictions, truth, threshold_m=100, iou_threshold=0.3):
"false_localizations": false,
"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},
+ "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),
"needs_input": sum(r["status"] == "needs_input" for r in selected),
@@ -149,7 +159,7 @@ def evaluate(manifest, predictions, truth, threshold_m=100, iou_threshold=0.3):
"detection_recall": tp / (tp + fn) if tp + fn else None,
"detection_precision": tp / (tp + fp) if tp + fp else None}
- return {"schema_version": 1, "threshold_m": threshold_m, "event_iou_threshold": iou_threshold,
+ return {"schema_version": 1, "threshold_m": threshold_m, "distance_thresholds_m": thresholds, "event_iou_threshold": iou_threshold,
"cases": rows, "summary": summarize(rows),
"by_split": {split: summarize([r for r in rows if r["split"] == split])
for split in sorted({r["split"] for r in rows})},
diff --git a/tests/test_confidence.py b/tests/test_confidence.py
index 510f70c..ae49cb3 100644
--- a/tests/test_confidence.py
+++ b/tests/test_confidence.py
@@ -67,7 +67,7 @@ def test_insufficient_evidence_abstains(kind, reason):
elif kind == "drift": diag["e0"]["drift_at_bound"] = True
elif kind == "altitude_only": diag["sensitivity"]["sources"] = ["altitude"]
elif kind == "no_alternatives": diag["alternatives_evaluated"] = False
- elif kind == "wide": candidates[0]["uncertainty"]["radius_m"] = 500
+ elif kind == "wide": candidates[0]["uncertainty"]["radius_m"] = 1500
elif kind == "boundary": diag["sensitivity"]["boundary_limited"] = True
elif kind == "no_tracks": candidates = []
result = decide((events, candidates, coverage, diag))
@@ -147,9 +147,27 @@ def test_explicit_subset_keeps_unconfirmed_proposals_without_forcing_matches():
result = decide((events, candidates, coverage, diag))
assert result["status"] == "succeeded"
assert result["diagnostics"]["unmatched_event_ids"] == ["e2"]
+ diag["supported_event_ids"] = ["e0", "e1", "e2"]
+ assert decide((events, candidates, coverage, diag))["reason_code"] == "unmatched_supported_events"
+ diag["supported_event_ids"] = ["e0", "e1"]
alternative = dict(candidates[0], lat=45., event_ids=["e0", "e2"], flight_ids=["a", "c"], score=1.7)
assert decide((events, candidates+[alternative], coverage, diag))["reason_code"] == "ambiguous_locations"
alternative["score"] = 0.5
assert decide((events, candidates+[alternative], coverage, diag))["status"] == "succeeded"
extra["harmonic_group_id"] = "g0"
assert decide((events, candidates, coverage, diag))["reason_code"] == "incomplete_harmonic_group"
+
+
+def test_all_four_independent_flyovers_are_checked():
+ events, candidates, coverage, diag = evidence()
+ for i in (2, 3):
+ event = deepcopy(events[0])
+ event.update(event_id=f"e{i}", harmonic_group_id=f"g{i}", start_s=i*100, end_s=i*100+20)
+ event["ridge"] = [dict(point, time_s=point["time_s"]+i*100) for point in event["ridge"]]
+ events.append(event)
+ candidates[0]["event_ids"].append(event["event_id"])
+ candidates[0]["flight_ids"].append(f"flight-{i}")
+ diag[event["event_id"]] = deepcopy(diag["e0"])
+ assert decide((events, candidates, coverage, diag))["status"] == "succeeded"
+ diag["e3"]["rmse_hz"] = 8
+ assert decide((events, candidates, coverage, diag))["reason_code"] == "inconsistent_event_match"
diff --git a/tests/test_evaluation.py b/tests/test_evaluation.py
index 6a2c9b3..7ed77c9 100644
--- a/tests/test_evaluation.py
+++ b/tests/test_evaluation.py
@@ -49,6 +49,20 @@ def test_case_ids_and_terminal_results_are_required():
evaluate(cases, {"a": {"status": "succeeded"}}, {})
+def test_distance_tiers_keep_abstained_diagnostics_out_of_success_counts():
+ from pyproj import Geod
+ cases = {"cases": [{"case_id": key, "split": "held_out", "scope": "test"} for key in ("accepted", "abstained")]}
+ truth = {key: {"location": [40, -100], "location_accuracy_eligible": True} for key in ("accepted", "abstained")}
+ lon, lat, _ = Geod(ellps="WGS84").fwd(-100, 40, 90, 400)
+ predictions = {"accepted": {"status": "succeeded", "candidates": [{"lat": lat, "lon": lon}]},
+ "abstained": {"status": "inconclusive", "candidates": [{"lat": 40, "lon": -100}]}}
+ report = evaluate(cases, predictions, truth)
+ assert report["summary"]["successful_locations_by_threshold_m"] == {"100": 0, "500": 1, "1000": 1}
+ assert report["summary"]["false_localizations_by_threshold_m"] == {"100": 1, "500": 0, "1000": 0}
+ assert report["cases"][1]["diagnostic_best_candidate_error_m"] == 0
+ assert report["cases"][1]["location_returned"] is False
+
+
def test_runner_does_not_require_truth_and_measures_each_process(tmp_path):
import hashlib
module_path = Path(__file__).resolve().parents[1] / "scripts/run_benchmark.py"
@@ -82,7 +96,7 @@ def test_frozen_replay_preserves_all_cases():
spec.loader.exec_module(module)
manifest = json.loads((root / "benchmarks/frozen-manifest.json").read_text())
truth = json.loads((root / "benchmarks/truth/frozen-labels.json").read_text())
- report = evaluate(manifest, module.frozen_predictions(root), truth)
+ report = evaluate(manifest, module.frozen_predictions(root), truth, threshold_m=100)
assert len(report["cases"]) == 48
assert report["summary"]["detection_misses"] == 7
assert report["summary"]["execution_failures"] == 3