Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)
Python acoustic-geolocationads-baircraft-trackingairplaneaudio-forensicsdoppler-effectdoppler-shiftgeolocationosintsignal-processing
Preserve passive source, checkpoint and event-contribution audit (#13)
Cinna Davis7b37338137a4
diff --git a/evidence/verification/physical-20261103/passive-audit/README.md b/evidence/verification/physical-20261103/passive-audit/README.mdnew file mode 100644index 0000000..9ae3dc1--- /dev/null+++ b/evidence/verification/physical-20261103/passive-audit/README.md@@ -0,0 +1,7 @@+# Passive completed-run audit++This read-only auditor checks stored source hashes, audio bytes, configuration identity, all tile hashes and work counts, public/internal candidate consistency, shared clocks, original event mapping and per-event score contributions. It does not run any scientific producer, read evaluation labels, change a decision or establish location accuracy.++The preserved first execution audits the already completed two-event run `bb3e96c615d44abaa75bcf75db2cbeb3` against published source `98b14955741f32cf6fb7592bbf44df050a5bd309`. Every integrity check passed, including all 19,278 tile records. Its decision remains `inconclusive/ambiguous_locations`; this audit does not convert a close candidate into acceptance or fix the known historical full-profile ordering issue.++The same auditor is prepared for the upload verifier's canonical four-event result. That job has not been audited by this worker yet. Pass its actual terminal job directory, source revision and canonical audio digest, with `--expected-groups 4`, then write to a new output path. Keep all observations, including failed integrity checks. A separate post-run truth join is required for distance thresholds and physical accuracy.diff --git a/evidence/verification/physical-20261103/passive-audit/audit_completed_run.py b/evidence/verification/physical-20261103/passive-audit/audit_completed_run.pynew file mode 100644index 0000000..1529fed--- /dev/null+++ b/evidence/verification/physical-20261103/passive-audit/audit_completed_run.py@@ -0,0 +1,145 @@+"""Read-only audit of a completed automatic run; never opens evaluation truth.++This checks persisted evidence, not localization accuracy or calibration. It+does not call the detector, scorer, optimizer, decision rule or HTTP service.+"""+import argparse+from datetime import datetime, timezone+import hashlib+import json+import math+from pathlib import Path+import subprocess+++def read(path):+ def reject(value):+ raise ValueError(f"Nonfinite JSON constant: {value}")+ return json.loads(path.read_text(), parse_constant=reject)+++def digest(path):+ with path.open("rb") as stream:+ return hashlib.file_digest(stream, "sha256").hexdigest()+++def content_hash(value):+ return hashlib.sha256(json.dumps(value, sort_keys=True, allow_nan=False).encode()).hexdigest()+++def timestamp(value):+ return datetime.fromisoformat(value.replace("Z", "+00:00")).timestamp()+++def close(a, b):+ return math.isclose(a, b, abs_tol=1e-8, rel_tol=1e-10)+++def audit(args):+ run = args.run.resolve(strict=True)+ if args.output.exists():+ raise FileExistsError("Preserve previous audit outputs")+ result = read(run / "result.json")+ if result["status"] in {"queued", "running"}:+ raise ValueError("Audit requires a terminal job result")+ names = ["result.json", "request.json", "operator.json", "provenance.json",+ "decision.json", "refined-candidates.json", "search/manifest.json",+ "search/search-report.json"]+ records = {name: read(run / name) for name in names}+ provenance = records["provenance.json"]+ manifest = records["search/manifest.json"]+ search = records["search/search-report.json"]+ refinement = records["refined-candidates.json"]+ decision = records["decision.json"]+ configuration = manifest["configuration"]+ checks = []++ def check(name, passed, **details):+ checks.append(dict(check=name, passed=bool(passed), **details))++ source_files = {}+ for name, expected in provenance["implementation_files"].items():+ blob = subprocess.check_output(["git", "show", args.source_commit + ":src/aircraft_geoloc/" + name], cwd=args.repo)+ actual = hashlib.sha256(blob).hexdigest()+ source_files[name] = dict(expected=expected, actual=actual, matches=expected == actual)+ check("source_files_match_declared_commit", all(r["matches"] for r in source_files.values()), files=source_files)+ check("search_and_orchestration_source_agree", configuration["code"] == provenance["implementation_files"])+ original = run / "input.mp3"+ check("canonical_audio_bytes", digest(original) == args.expected_audio_sha == provenance["source_sha256"], sha256=digest(original))+ check("operator_configuration_hash", hashlib.sha256(json.dumps(records["operator.json"], sort_keys=True).encode()).hexdigest() == provenance["operator_configuration_sha256"])+ run_hash = content_hash(configuration)+ check("configuration_and_run_hashes", run_hash == manifest["run_hash"] == search["run_hash"] == provenance["search_run_hash"], run_hash=run_hash)+ tile_count, points, bad_tiles = 0, 0, []+ for path in sorted((run / "search").glob("tile-*.json")):+ tile = read(path)+ tile_count += 1+ points += tile["payload"]["grid_points"]+ if tile["run_hash"] != run_hash or tile["payload_hash"] != content_hash(tile["payload"]):+ bad_tiles.append(path.name)+ check("checkpoint_payload_hashes", not bad_tiles, checked=tile_count, mismatches=bad_tiles)+ check("checkpoint_work_counts", tile_count == search["tiles_completed"] and points == search["grid_points_searched"], checkpoint_tiles=tile_count, checkpoint_points=points)+ check("decision_result_consistency", result["status"] == decision["status"] and result.get("reason_code") == decision.get("reason_code") and result["candidates"] == decision["candidates"])+ rows, candidates = refinement["ranked"], result["candidates"]+ check("candidate_count_consistency", len(rows) == len(candidates), raw=len(rows), public=len(candidates))+ differences = [i for i, (raw, public) in enumerate(zip(rows, candidates)) if any(not close(raw[k], public[k]) for k in ("lat", "lon", "score"))]+ check("candidate_coordinates_and_scores", not differences, mismatches=differences)+ check("candidate_order", all(a["score"] + 1e-8 >= b["score"] for a, b in zip(rows, rows[1:])))+ prepared = configuration["events"]+ groups = {e.get("harmonic_group_id") or e["event_id"] for e in result["events"]}+ check("every_discovered_group_prepared", len(groups) == len(prepared), discovered=len(groups), prepared=len(prepared))+ start_window = result["recording"]["time_window"]+ low, high = (timestamp(start_window[k]) for k in ("start_utc", "end_utc"))+ outside = [i for i, r in enumerate(rows) if not low - 1e-6 <= r["recording_start_time_s"] <= high + 1e-6]+ check("all_hypothesis_clocks_in_trusted_window", not outside, outside=outside, window_s=[low, high])+ check("shared_clock_evidence", search.get("scoring_time_is_locked") is True and refinement["matching_diagnostics"].get("clock_locked") is True)+ contribution = []+ if rows:+ best, public = rows[0], candidates[0]+ indices = best.get("event_indices", list(range(len(prepared))))+ selected = [prepared[i] for i in indices]+ expected_ids, expected_flights = [], []+ for event, flight in zip(selected, best["flight_ids"]):+ ids = event.get("event_ids", [event["event_id"]])+ expected_ids.extend(ids)+ expected_flights.extend([flight] * len(ids))+ check("matched_groups_and_diagnostic_lengths", len(indices) >= args.expected_groups and len(indices) == len(best["flight_ids"]) == len(best["event_scores"]) == len(best["event_diagnostics"]), matched_groups=len(indices), expected_minimum=args.expected_groups)+ check("original_event_and_flight_mapping", public["event_ids"] == expected_ids and public["flight_ids"] == expected_flights)+ check("public_clock_matches_joint_clock", abs(timestamp(public["recording_start_utc"]) - best["recording_start_time_s"]) <= 1e-6)+ expected_score = sum(best["event_scores"])+ for index, event, value, fit in zip(indices, selected, best["event_scores"], best["event_diagnostics"]):+ quality = event.get("quality", {})+ scale = quality.get("frequency_loss_scale_hz", quality.get("frequency_sigma_hz", max(1.0, quality.get("frequency_uncertainty_hz", 1.0))))+ contribution.append(dict(prepared_index=index, original_event_ids=event.get("event_ids", [event["event_id"]]), residual_score=value, normalized_support=1 + value / (3 * scale), rmse_hz=fit.get("rmse_hz"), sample_count=fit.get("sample_count")))+ check("per_event_residual_evidence", all(close(score, fit["score"]) for score, fit in zip(best["event_scores"], best["event_diagnostics"])))+ if best["score_kind"] == "matched_group_support_minus_normalized_residual":+ check("raw_residual_score_preserved", close(best.get("residual_score", math.inf), expected_score), expected=expected_score, recorded=best.get("residual_score"))+ expected_score = sum(row["normalized_support"] for row in contribution)+ check("all_matched_events_contribute_to_score", close(best["score"], expected_score), expected=expected_score, recorded=best["score"])+ check("diagnostics_match_selected_sensitivity", refinement["matching_diagnostics"].get("sensitivity", {}) == best.get("sensitivity", {}))+ summary = {+ "completed_at_utc": datetime.now(timezone.utc).isoformat(),+ "run": str(run), "source_commit": args.source_commit,+ "auditor_sha256": digest(Path(__file__)),+ "status": result["status"], "reason_code": result.get("reason_code"),+ "integrity_checks_passed": all(c["passed"] for c in checks),+ "accepted_location": result["status"] == "succeeded",+ "localization_accuracy_evaluated": False, "truth_opened": False,+ "scope": "Independent persisted-evidence audit; no producer execution, accuracy acceptance or calibrated uncertainty claim.",+ "files": [{"path": name, "sha256": digest(run / name), "bytes": (run / name).stat().st_size} for name in names],+ "event_contributions": contribution, "checks": checks,+ }+ args.output.parent.mkdir(parents=True, exist_ok=True)+ args.output.write_text(json.dumps(summary, indent=2, allow_nan=False) + "\n")+ print(json.dumps({k: summary[k] for k in ("status", "reason_code", "integrity_checks_passed", "accepted_location", "localization_accuracy_evaluated")}))+ print("Failed checks:", [c["check"] for c in checks if not c["passed"]])+++if __name__ == "__main__":+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("--run", type=Path, required=True)+ parser.add_argument("--repo", type=Path, required=True)+ parser.add_argument("--source-commit", required=True)+ parser.add_argument("--expected-audio-sha", required=True)+ parser.add_argument("--expected-groups", type=int, required=True)+ parser.add_argument("--output", type=Path, required=True)+ audit(parser.parse_args())diff --git a/evidence/verification/physical-20261103/passive-audit/automatic-v3-audit.json b/evidence/verification/physical-20261103/passive-audit/automatic-v3-audit.jsonnew file mode 100644index 0000000..14d3fd5--- /dev/null+++ b/evidence/verification/physical-20261103/passive-audit/automatic-v3-audit.json@@ -0,0 +1,276 @@+{+ "completed_at_utc": "2026-11-03T01:44:50.411454+00:00",+ "run": "/workspace/scratch/4cfe67e9d1bc/DOPPLERGEIST/results/physics-automatic-cli-v3-20261103/bb3e96c615d44abaa75bcf75db2cbeb3",+ "source_commit": "98b14955741f32cf6fb7592bbf44df050a5bd309",+ "auditor_sha256": "e84ad6e8b4945df6f9633a4f179496f307443e392ab0aea30c69b88e508ba96e",+ "status": "inconclusive",+ "reason_code": "ambiguous_locations",+ "integrity_checks_passed": true,+ "accepted_location": false,+ "localization_accuracy_evaluated": false,+ "truth_opened": false,+ "scope": "Independent persisted-evidence audit; no producer execution, accuracy acceptance or calibrated uncertainty claim.",+ "files": [+ {+ "path": "result.json",+ "sha256": "f0631ba6474cfeda49459f6a8f8f7558f0ad93b20d3f4b6a918bf59afe686cde",+ "bytes": 84326+ },+ {+ "path": "request.json",+ "sha256": "133c43158160589a760eb5fec2ec92ffee51e3846233528b7c444311d1e42097",+ "bytes": 452+ },+ {+ "path": "operator.json",+ "sha256": "3c82098cda1c04e416bd4a5387dfc11c64587ee7c4bc6101c862fac8496dd6da",+ "bytes": 384+ },+ {+ "path": "provenance.json",+ "sha256": "2f1d9db8bb15e265d122838e3d0abcc417d9d3ce61918f2fb176a6b250a2b370",+ "bytes": 3112+ },+ {+ "path": "decision.json",+ "sha256": "f35757aafc73a8c332b276a63f4dda6bbe3313638969cf6f99d6eeb92b740879",+ "bytes": 43670+ },+ {+ "path": "refined-candidates.json",+ "sha256": "e69ab2fa7e941a004749b4f5c7e9eebbd30870b122e1aee304379ebd9646ed77",+ "bytes": 265305+ },+ {+ "path": "search/manifest.json",+ "sha256": "f0b7e9a6db2aec241d259fbd8c4b2819758ad283ffba009b26795096d060b078",+ "bytes": 47529+ },+ {+ "path": "search/search-report.json",+ "sha256": "3e2586bfa4b6f4075d414055dc78164743096c79e743c29850aa4083cba45b3b",+ "bytes": 247861+ }+ ],+ "event_contributions": [+ {+ "prepared_index": 0,+ "original_event_ids": [+ "event-0001"+ ],+ "residual_score": -0.10658564550404626,+ "normalized_support": 0.9644714514986512,+ "rmse_hz": 0.10799687068185512,+ "sample_count": 137+ },+ {+ "prepared_index": 1,+ "original_event_ids": [+ "event-0002"+ ],+ "residual_score": -0.06548345789728503,+ "normalized_support": 0.978172180700905,+ "rmse_hz": 0.06559767536523628,+ "sample_count": 155+ }+ ],+ "checks": [+ {+ "check": "source_files_match_declared_commit",+ "passed": true,+ "files": {+ "__init__.py": {+ "expected": "01428b7938817c1cfe7eb3cf7e186f35b3fa7bc2d85f14204d07e0aa251d2c88",+ "actual": "01428b7938817c1cfe7eb3cf7e186f35b3fa7bc2d85f14204d07e0aa251d2c88",+ "matches": true+ },+ "audio.py": {+ "expected": "f9248876059f7f05f3f3db8575e43b9c12f96c536c70b8afc298cfdebcb977a0",+ "actual": "f9248876059f7f05f3f3db8575e43b9c12f96c536c70b8afc298cfdebcb977a0",+ "matches": true+ },+ "automatic.py": {+ "expected": "088620bc081ab8458c3a4e343aeca73e4ee08e38993e61cee99fcf9d7dc2f3d5",+ "actual": "088620bc081ab8458c3a4e343aeca73e4ee08e38993e61cee99fcf9d7dc2f3d5",+ "matches": true+ },+ "cli.py": {+ "expected": "91f62e955aa3a343ae2f916cff83ef7f58bc3b55e13dc5f40ff795bb6bd7e447",+ "actual": "91f62e955aa3a343ae2f916cff83ef7f58bc3b55e13dc5f40ff795bb6bd7e447",+ "matches": true+ },+ "confidence.py": {+ "expected": "2d30077fe25c51522786f4314192666a60830697e3013f064ffe5ac2cee6c801",+ "actual": "2d30077fe25c51522786f4314192666a60830697e3013f064ffe5ac2cee6c801",+ "matches": true+ },+ "contracts.py": {+ "expected": "66e311197e69fc6636dea33e25ae2acccfeba2845b0561963f33112c932a969f",+ "actual": "66e311197e69fc6636dea33e25ae2acccfeba2845b0561963f33112c932a969f",+ "matches": true+ },+ "data_access.py": {+ "expected": "88eabb03560a97942ec131f8edd56fba3719a7b1e407f517e7bc45994fe67218",+ "actual": "88eabb03560a97942ec131f8edd56fba3719a7b1e407f517e7bc45994fe67218",+ "matches": true+ },+ "discovery.py": {+ "expected": "c357a6cdf01364bdcf0e05e1241a913073a43123ebbfdb6e06a4e0f61477c589",+ "actual": "c357a6cdf01364bdcf0e05e1241a913073a43123ebbfdb6e06a4e0f61477c589",+ "matches": true+ },+ "evaluation.py": {+ "expected": "5331eee02df2e22396e44c8c07110129297c9cedadeee4d9bccd415b9b0ad071",+ "actual": "5331eee02df2e22396e44c8c07110129297c9cedadeee4d9bccd415b9b0ad071",+ "matches": true+ },+ "geometry.py": {+ "expected": "f892fac88864d8095ce47a1e3e6139235b86061fb0814944867436cb5a92bb94",+ "actual": "f892fac88864d8095ce47a1e3e6139235b86061fb0814944867436cb5a92bb94",+ "matches": true+ },+ "intake.py": {+ "expected": "c1d4c792c9e1cec1a9315b354d6fa58c0d4326c6773b19719bd859e7571c5648",+ "actual": "c1d4c792c9e1cec1a9315b354d6fa58c0d4326c6773b19719bd859e7571c5648",+ "matches": true+ },+ "jobs.py": {+ "expected": "b493140edabde20674d46022d683a462002bb336a30e2db4fde6f65890a8e0d9",+ "actual": "b493140edabde20674d46022d683a462002bb336a30e2db4fde6f65890a8e0d9",+ "matches": true+ },+ "matching.py": {+ "expected": "e90115129818d03bd36771e17f5db0169db0df0e934a877346a8d923d029b0dd",+ "actual": "e90115129818d03bd36771e17f5db0169db0df0e934a877346a8d923d029b0dd",+ "matches": true+ },+ "pipeline.py": {+ "expected": "d2361725283053a0911a803717f8dab6e59ed8e1c20e305f191aeea693156adb",+ "actual": "d2361725283053a0911a803717f8dab6e59ed8e1c20e305f191aeea693156adb",+ "matches": true+ },+ "search.py": {+ "expected": "ac8414127d58192119b85bd1519a288aca1eda7ed24ceb07385b2b601c6ad47b",+ "actual": "ac8414127d58192119b85bd1519a288aca1eda7ed24ceb07385b2b601c6ad47b",+ "matches": true+ },+ "service.py": {+ "expected": "0a5c81b6c88a7bf83a487272019e14a102dccc8fe27b823ad4f3335a28476f4d",+ "actual": "0a5c81b6c88a7bf83a487272019e14a102dccc8fe27b823ad4f3335a28476f4d",+ "matches": true+ },+ "terrain.py": {+ "expected": "b8258fa2d950c2348c78e019f9e97ce9fe6c760cf7fd47a81d1a21d23362948a",+ "actual": "b8258fa2d950c2348c78e019f9e97ce9fe6c760cf7fd47a81d1a21d23362948a",+ "matches": true+ },+ "tiled_search.py": {+ "expected": "1baf17e409479cffc0d6cfbbdacf5e562082c80180080487ec56eb778a966ab5",+ "actual": "1baf17e409479cffc0d6cfbbdacf5e562082c80180080487ec56eb778a966ab5",+ "matches": true+ },+ "tracks.py": {+ "expected": "523b9d629083ba2792a1da2cd34d8b89ef57236febcc284f62886ba103ef20ec",+ "actual": "523b9d629083ba2792a1da2cd34d8b89ef57236febcc284f62886ba103ef20ec",+ "matches": true+ }+ }+ },+ {+ "check": "search_and_orchestration_source_agree",+ "passed": true+ },+ {+ "check": "canonical_audio_bytes",+ "passed": true,+ "sha256": "20f7322e8fc8bc18b63c9d88f12f031b2b1a1cc4a1c6d2411fff8afdc325f6b2"+ },+ {+ "check": "operator_configuration_hash",+ "passed": true+ },+ {+ "check": "configuration_and_run_hashes",+ "passed": true,+ "run_hash": "74c3d39765fc99f88393477fe519f255dd556ee73980d94dbc48dc7f0c66797d"+ },+ {+ "check": "checkpoint_payload_hashes",+ "passed": true,+ "checked": 19278,+ "mismatches": []+ },+ {+ "check": "checkpoint_work_counts",+ "passed": true,+ "checkpoint_tiles": 19278,+ "checkpoint_points": 17664+ },+ {+ "check": "decision_result_consistency",+ "passed": true+ },+ {+ "check": "candidate_count_consistency",+ "passed": true,+ "raw": 111,+ "public": 111+ },+ {+ "check": "candidate_coordinates_and_scores",+ "passed": true,+ "mismatches": []+ },+ {+ "check": "candidate_order",+ "passed": true+ },+ {+ "check": "every_discovered_group_prepared",+ "passed": true,+ "discovered": 2,+ "prepared": 2+ },+ {+ "check": "all_hypothesis_clocks_in_trusted_window",+ "passed": true,+ "outside": [],+ "window_s": [+ 1790000000.0,+ 1790000000.0+ ]+ },+ {+ "check": "shared_clock_evidence",+ "passed": true+ },+ {+ "check": "matched_groups_and_diagnostic_lengths",+ "passed": true,+ "matched_groups": 2,+ "expected_minimum": 2+ },+ {+ "check": "original_event_and_flight_mapping",+ "passed": true+ },+ {+ "check": "public_clock_matches_joint_clock",+ "passed": true+ },+ {+ "check": "per_event_residual_evidence",+ "passed": true+ },+ {+ "check": "all_matched_events_contribute_to_score",+ "passed": true,+ "expected": -0.1720691034013313,+ "recorded": -0.1720691034013313+ },+ {+ "check": "diagnostics_match_selected_sensitivity",+ "passed": true+ }+ ]+}diff --git a/evidence/verification/physical-20261103/passive-audit/manifest.json b/evidence/verification/physical-20261103/passive-audit/manifest.jsonnew file mode 100644index 0000000..3e41863--- /dev/null+++ b/evidence/verification/physical-20261103/passive-audit/manifest.json@@ -0,0 +1,19 @@+{+ "files": [+ {+ "path": "README.md",+ "bytes": 1227,+ "sha256": "d09ed02acabc45706918d6a217cdebdd72f9394efde262a5eddb39e67b22b662"+ },+ {+ "path": "audit_completed_run.py",+ "bytes": 9213,+ "sha256": "e84ad6e8b4945df6f9633a4f179496f307443e392ab0aea30c69b88e508ba96e"+ },+ {+ "path": "automatic-v3-audit.json",+ "bytes": 9321,+ "sha256": "bcab1c65ff6bc910d8bb0f138ede4a408fb5c0d7a2cb02016cc297da33133b23"+ }+ ]+}