Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)
Python acoustic-geolocationads-baircraft-trackingairplaneaudio-forensicsdoppler-effectdoppler-shiftgeolocationosintsignal-processing
Record compatible-subset margin controls for all-event decisions (#9)
Cinna Davis7a49b750fe5c
diff --git a/evidence/product-20261103/check_compatible_subset_margin.py b/evidence/product-20261103/check_compatible_subset_margin.pynew file mode 100644index 0000000..4f0a66e--- /dev/null+++ b/evidence/product-20261103/check_compatible_subset_margin.py@@ -0,0 +1,78 @@+"""Logical decision controls only; no audio, search, truth or calibration."""+from copy import deepcopy+import hashlib+import json+from pathlib import Path+import subprocess+import sys++from aircraft_geoloc import confidence, matching+++def control(count, *, same_association=False, discarded=False):+ events = [{"event_id": f"e{i}", "harmonic_group_id": f"g{i}",+ "start_s": i*100., "end_s": i*100.+20., "band_hz": [90., 200.],+ "quality": {"frequency_sigma_hz": 1.},+ "ridge": [{"time_s": i*100.+t, "frequency_hz": 140.-t}+ for t in (0., 10., 20.)]} for i in range(count)]+ def candidate(selected):+ core = matching.association_score(+ {"score": 0., "event_scores": [0.]*len(selected)}, selected)+ return {"lat": 40., "lon": -100., "score": core["score"],+ "score_kind": core["score_kind"],+ "event_ids": [e["event_id"] for e in selected],+ "flight_ids": [f"f{i}" for i in range(len(selected))],+ "recording_start_utc": "2026-09-21T14:13:20Z",+ "uncertainty": {"radius_m": 50., "kind": "sensitivity",+ "method": "controlled_full_profile"}}+ best = candidate(events)+ other = candidate(events if same_association else events[:-1])+ candidates = [best] if discarded else [best, other]+ identities = ["all-groups"] if discarded else ["all-groups", "other"]+ modes = [{"mode_id": key, "score": row["score"], "event_groups": len(row["event_ids"])}+ for key, row in zip(identities, candidates)]+ finite = {"schema_version": 1, "scope": "evaluated_finite_grid", "complete": True,+ "score_kind": best["score_kind"], "spacing_m": 2000., "refine_spacing_m": 100.,+ "max_event_groups": count, "retained_modes": modes,+ "discarded_count": int(discarded),+ "best_discarded_score": other["score"] if discarded else None,+ "pruning_accounted_for": True,+ "limitations": ["Controlled finite decision evidence; no measured recording."]}+ evidence = {"clock_locked": True, "alternatives_evaluated": False,+ "recording_start_window_s": [1790000000., 1790000000.],+ "unmatched_event_ids": [], "refinement_boundary_limited": False,+ "sensitivity": {"complete": True, "boundary_limited": False, "radius_m": 50.,+ "sources": ["frequency", "clock", "altitude", "sound_speed"]},+ "finite_search_evidence": finite,+ "candidate_mode_ids": identities, "assessed_mode_ids": identities}+ for event in events:+ evidence[event["event_id"]] = {"rmse_hz": 0., "outlier_fraction": 0.,+ "support_fraction": 1., "drift_at_bound": False}+ coverage = {"search_complete": True, "data_status": "available", "limitations": []}+ before = deepcopy((events, candidates, coverage, evidence))+ decision = confidence.decide_location(events, candidates, coverage, matching_diagnostics=evidence)+ assert before == (events, candidates, coverage, evidence)+ return {"groups": count, "same_association": same_association, "discarded": discarded,+ "best_score": best["score"], "other_score": other["score"],+ "normalized_gap": (best["score"]-other["score"])/count,+ "best_association": dict(zip(best["event_ids"], best["flight_ids"])),+ "other_association": dict(zip(other["event_ids"], other["flight_ids"])),+ "status": decision["status"], "reason_code": decision["reason_code"],+ "diagnostics": decision["diagnostics"]}+++if __name__ == "__main__":+ cases = [control(n) for n in (4, 5, 6)]+ cases += [control(6, same_association=True), control(6, discarded=True)]+ report = {"source_commit": subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip(),+ "source_sha256": {module.__name__: hashlib.sha256(Path(module.__file__).read_bytes()).hexdigest()+ for module in (matching, confidence)},+ "harness_sha256": hashlib.sha256(Path(__file__).read_bytes()).hexdigest(),+ "scope": "Abstract perfect-fit policy controls, not detection/search/real accuracy.",+ "cases": cases}+ with Path(sys.argv[1]).open("x") as output:+ json.dump(report, output, indent=2, allow_nan=False)+ output.write("\n")+ for case in cases:+ print(case["groups"], case["same_association"], case["discarded"],+ case["normalized_gap"], case["status"], case["reason_code"])diff --git a/evidence/product-20261103/compatible-subset-margin-control.json b/evidence/product-20261103/compatible-subset-margin-control.jsonnew file mode 100644index 0000000..12b0a6b--- /dev/null+++ b/evidence/product-20261103/compatible-subset-margin-control.json@@ -0,0 +1,388 @@+{+ "source_commit": "f2aa5ec6adf5013940de919554c90660e0d3d866",+ "source_sha256": {+ "aircraft_geoloc.matching": "b735cdc0fcb38632b16309a44dfaffce5937a8e1b6d2c9946d6f77a30c97f8ce",+ "aircraft_geoloc.confidence": "fe45e81d9dd026d1eae093eeca41c42238eb117a3919c68b1d6cbc637de162f6"+ },+ "harness_sha256": "e6cfe8a91e449f7a95aa075d82d668ddf6a270d7f215631785f277ad1de9bf00",+ "scope": "Abstract perfect-fit policy controls, not detection/search/real accuracy.",+ "cases": [+ {+ "groups": 4,+ "same_association": false,+ "discarded": false,+ "best_score": 4.0,+ "other_score": 3.0,+ "normalized_gap": 0.25,+ "best_association": {+ "e0": "f0",+ "e1": "f1",+ "e2": "f2",+ "e3": "f3"+ },+ "other_association": {+ "e0": "f0",+ "e1": "f1",+ "e2": "f2"+ },+ "status": "succeeded",+ "reason_code": "supported_by_evidence_checks",+ "diagnostics": {+ "policy": {+ "target_radius_m": 1000.0,+ "min_independent_events": 2,+ "max_event_rmse_hz": 3.0,+ "max_outlier_fraction": 0.25,+ "min_support_fraction": 0.95,+ "near_tie_loss_per_event_hz": 0.5,+ "near_tie_support_per_group": 0.2+ },+ "policy_version": "engineering-v5-finite-envelope",+ "calibration": "uncalibrated",+ "probability": null,+ "limitations": [+ "Archive availability does not establish capture of every aircraft.",+ "Sensitivity checks are not a calibrated confidence interval.",+ "Only the declared finite grids/refinements were compared; continuous-space uniqueness is not established."+ ],+ "independent_event_groups": 4,+ "recording_start_window_s": [+ 1790000000.0,+ 1790000000.0+ ],+ "known_clock_single_event": false,+ "unmatched_event_ids": [],+ "unmatched_proposal_status": "unconfirmed acoustic proposals; not labelled aircraft misses",+ "finite_search": {+ "scope": "evaluated_finite_grid",+ "spacing_m": 2000.0,+ "refine_spacing_m": 100.0,+ "retained_modes": 2,+ "discarded_count": 0,+ "best_discarded_score": null,+ "limitations": [+ "Controlled finite decision evidence; no measured recording."+ ],+ "continuous_space_uniqueness": "not established"+ },+ "sensitivity_sources": [+ "frequency",+ "clock",+ "altitude",+ "sound_speed"+ ],+ "radius_m": 50.0,+ "finite_envelope": {+ "base_profile_radius_m": 50.0,+ "base_reported_radius_m": 50.0,+ "finite_point_extent_m": 0.0,+ "radius_m": 50.0,+ "included_candidate_indices": [+ 0+ ],+ "included_mode_ids": [+ "all-groups"+ ],+ "limitations": [+ "Union covers evaluated same-association points and actually reported test envelopes.",+ "Unperformed competitor profiles/refinements remain unbounded; no coverage probability is inferred."+ ]+ }+ }+ },+ {+ "groups": 5,+ "same_association": false,+ "discarded": false,+ "best_score": 5.0,+ "other_score": 4.0,+ "normalized_gap": 0.2,+ "best_association": {+ "e0": "f0",+ "e1": "f1",+ "e2": "f2",+ "e3": "f3",+ "e4": "f4"+ },+ "other_association": {+ "e0": "f0",+ "e1": "f1",+ "e2": "f2",+ "e3": "f3"+ },+ "status": "inconclusive",+ "reason_code": "ambiguous_flight_match",+ "diagnostics": {+ "policy": {+ "target_radius_m": 1000.0,+ "min_independent_events": 2,+ "max_event_rmse_hz": 3.0,+ "max_outlier_fraction": 0.25,+ "min_support_fraction": 0.95,+ "near_tie_loss_per_event_hz": 0.5,+ "near_tie_support_per_group": 0.2+ },+ "policy_version": "engineering-v5-finite-envelope",+ "calibration": "uncalibrated",+ "probability": null,+ "limitations": [+ "Archive availability does not establish capture of every aircraft.",+ "Sensitivity checks are not a calibrated confidence interval.",+ "Only the declared finite grids/refinements were compared; continuous-space uniqueness is not established."+ ],+ "independent_event_groups": 5,+ "recording_start_window_s": [+ 1790000000.0,+ 1790000000.0+ ],+ "known_clock_single_event": false,+ "unmatched_event_ids": [],+ "unmatched_proposal_status": "unconfirmed acoustic proposals; not labelled aircraft misses",+ "finite_search": {+ "scope": "evaluated_finite_grid",+ "spacing_m": 2000.0,+ "refine_spacing_m": 100.0,+ "retained_modes": 2,+ "discarded_count": 0,+ "best_discarded_score": null,+ "limitations": [+ "Controlled finite decision evidence; no measured recording."+ ],+ "continuous_space_uniqueness": "not established"+ },+ "competing_hypothesis": {+ "separation_m": 0.0,+ "score_gap": 0.2,+ "gap_units": "support_units_per_group",+ "same_flight_association": false,+ "checked_radius_m": 50.0+ }+ }+ },+ {+ "groups": 6,+ "same_association": false,+ "discarded": false,+ "best_score": 6.0,+ "other_score": 5.0,+ "normalized_gap": 0.16666666666666666,+ "best_association": {+ "e0": "f0",+ "e1": "f1",+ "e2": "f2",+ "e3": "f3",+ "e4": "f4",+ "e5": "f5"+ },+ "other_association": {+ "e0": "f0",+ "e1": "f1",+ "e2": "f2",+ "e3": "f3",+ "e4": "f4"+ },+ "status": "inconclusive",+ "reason_code": "ambiguous_flight_match",+ "diagnostics": {+ "policy": {+ "target_radius_m": 1000.0,+ "min_independent_events": 2,+ "max_event_rmse_hz": 3.0,+ "max_outlier_fraction": 0.25,+ "min_support_fraction": 0.95,+ "near_tie_loss_per_event_hz": 0.5,+ "near_tie_support_per_group": 0.2+ },+ "policy_version": "engineering-v5-finite-envelope",+ "calibration": "uncalibrated",+ "probability": null,+ "limitations": [+ "Archive availability does not establish capture of every aircraft.",+ "Sensitivity checks are not a calibrated confidence interval.",+ "Only the declared finite grids/refinements were compared; continuous-space uniqueness is not established."+ ],+ "independent_event_groups": 6,+ "recording_start_window_s": [+ 1790000000.0,+ 1790000000.0+ ],+ "known_clock_single_event": false,+ "unmatched_event_ids": [],+ "unmatched_proposal_status": "unconfirmed acoustic proposals; not labelled aircraft misses",+ "finite_search": {+ "scope": "evaluated_finite_grid",+ "spacing_m": 2000.0,+ "refine_spacing_m": 100.0,+ "retained_modes": 2,+ "discarded_count": 0,+ "best_discarded_score": null,+ "limitations": [+ "Controlled finite decision evidence; no measured recording."+ ],+ "continuous_space_uniqueness": "not established"+ },+ "competing_hypothesis": {+ "separation_m": 0.0,+ "score_gap": 0.16666666666666666,+ "gap_units": "support_units_per_group",+ "same_flight_association": false,+ "checked_radius_m": 50.0+ }+ }+ },+ {+ "groups": 6,+ "same_association": true,+ "discarded": false,+ "best_score": 6.0,+ "other_score": 6.0,+ "normalized_gap": 0.0,+ "best_association": {+ "e0": "f0",+ "e1": "f1",+ "e2": "f2",+ "e3": "f3",+ "e4": "f4",+ "e5": "f5"+ },+ "other_association": {+ "e0": "f0",+ "e1": "f1",+ "e2": "f2",+ "e3": "f3",+ "e4": "f4",+ "e5": "f5"+ },+ "status": "succeeded",+ "reason_code": "supported_by_evidence_checks",+ "diagnostics": {+ "policy": {+ "target_radius_m": 1000.0,+ "min_independent_events": 2,+ "max_event_rmse_hz": 3.0,+ "max_outlier_fraction": 0.25,+ "min_support_fraction": 0.95,+ "near_tie_loss_per_event_hz": 0.5,+ "near_tie_support_per_group": 0.2+ },+ "policy_version": "engineering-v5-finite-envelope",+ "calibration": "uncalibrated",+ "probability": null,+ "limitations": [+ "Archive availability does not establish capture of every aircraft.",+ "Sensitivity checks are not a calibrated confidence interval.",+ "Only the declared finite grids/refinements were compared; continuous-space uniqueness is not established."+ ],+ "independent_event_groups": 6,+ "recording_start_window_s": [+ 1790000000.0,+ 1790000000.0+ ],+ "known_clock_single_event": false,+ "unmatched_event_ids": [],+ "unmatched_proposal_status": "unconfirmed acoustic proposals; not labelled aircraft misses",+ "finite_search": {+ "scope": "evaluated_finite_grid",+ "spacing_m": 2000.0,+ "refine_spacing_m": 100.0,+ "retained_modes": 2,+ "discarded_count": 0,+ "best_discarded_score": null,+ "limitations": [+ "Controlled finite decision evidence; no measured recording."+ ],+ "continuous_space_uniqueness": "not established"+ },+ "sensitivity_sources": [+ "frequency",+ "clock",+ "altitude",+ "sound_speed"+ ],+ "radius_m": 50.0,+ "finite_envelope": {+ "base_profile_radius_m": 50.0,+ "base_reported_radius_m": 50.0,+ "finite_point_extent_m": 0.0,+ "radius_m": 50.0,+ "included_candidate_indices": [+ 0,+ 1+ ],+ "included_mode_ids": [+ "all-groups",+ "other"+ ],+ "limitations": [+ "Union covers evaluated same-association points and actually reported test envelopes.",+ "Unperformed competitor profiles/refinements remain unbounded; no coverage probability is inferred."+ ]+ }+ }+ },+ {+ "groups": 6,+ "same_association": false,+ "discarded": true,+ "best_score": 6.0,+ "other_score": 5.0,+ "normalized_gap": 0.16666666666666666,+ "best_association": {+ "e0": "f0",+ "e1": "f1",+ "e2": "f2",+ "e3": "f3",+ "e4": "f4",+ "e5": "f5"+ },+ "other_association": {+ "e0": "f0",+ "e1": "f1",+ "e2": "f2",+ "e3": "f3",+ "e4": "f4"+ },+ "status": "inconclusive",+ "reason_code": "retention_may_hide_alternatives",+ "diagnostics": {+ "policy": {+ "target_radius_m": 1000.0,+ "min_independent_events": 2,+ "max_event_rmse_hz": 3.0,+ "max_outlier_fraction": 0.25,+ "min_support_fraction": 0.95,+ "near_tie_loss_per_event_hz": 0.5,+ "near_tie_support_per_group": 0.2+ },+ "policy_version": "engineering-v5-finite-envelope",+ "calibration": "uncalibrated",+ "probability": null,+ "limitations": [+ "Archive availability does not establish capture of every aircraft.",+ "Sensitivity checks are not a calibrated confidence interval."+ ],+ "independent_event_groups": 6,+ "recording_start_window_s": [+ 1790000000.0,+ 1790000000.0+ ],+ "known_clock_single_event": false,+ "unmatched_event_ids": [],+ "unmatched_proposal_status": "unconfirmed acoustic proposals; not labelled aircraft misses",+ "finite_search": {+ "scope": "evaluated_finite_grid",+ "spacing_m": 2000.0,+ "refine_spacing_m": 100.0,+ "retained_modes": 1,+ "discarded_count": 1,+ "best_discarded_score": 5.0,+ "limitations": [+ "Controlled finite decision evidence; no measured recording."+ ],+ "continuous_space_uniqueness": "not established",+ "discarded_score_gap_per_group": 0.16666666666666666+ }+ }+ }+ ]+}diff --git a/evidence/product-20261103/compatible-subset-margin.md b/evidence/product-20261103/compatible-subset-margin.mdnew file mode 100644index 0000000..aeac5e5--- /dev/null+++ b/evidence/product-20261103/compatible-subset-margin.md@@ -0,0 +1,45 @@+# Compatible subset margin control++This is a bounded logical confidence-policy experiment, not an acoustic/search+benchmark. It supplies perfect controlled fit evidence to the actual unchanged+matching score helper and confidence consumer. No audio, flight archive, location+truth, manual event-selection hint or accuracy evaluation is involved.++Reproduce in a new output file:++```bash+PYTHONPATH=src /home/cinna/aircraft-audio-geolocation/.venv/bin/python \+ evidence/product-20261103/check_compatible_subset_margin.py \+ /new/path/compatible-subset-margin-control.json+```++The artifact records the exact source and harness hashes. Inputs are immutable.+All required coverage, clock, finite accounting, support and full leading profile+controls are satisfied in this abstract fixture. Both rows share the identical+point and clock. Every common event maps to the same flight. The nested subset+only omits the final event; it assigns no contradictory flight.++| All groups | Other groups | Score gap per maximum group | Actual decision |+| --- | --- | --- | --- |+| 4 | 3 | 0.25 | succeeded |+| 5 | 4 | 0.20 | inconclusive / ambiguous_flight_match |+| 6 | 5 | 0.1666667 | inconclusive / ambiguous_flight_match |+| 6 | 6, identical mapping | 0 | succeeded |+| 6 | 5, moved to the discard bound | 0.1666667 | inconclusive / retention_may_hide_alternatives |++One fully supported event contributes at most one support unit. At the same+fixed state, adding a supported event therefore increases this score by at most+one. Dividing that difference by N gives at most 1/N; for N >= 5 it cannot exceed+the conservative 0.2 near-tie margin. An otherwise identical retained N-1 subset+is treated as a different association. A generic score-only discard bound also+cannot distinguish this compatible nested representation from a contradictory or+distant alternative.++This identifies a decision/accounting question for W4/W2 and the primary under+the existing all-supported-event requirement. It does not authorize lowering a+margin, deleting real competitors, relabelling unknown trials or promoting any+historical result. A resolution needs a declared distinction between a provably+compatible nested representation at the same complete model state and a genuinely+competing flight/clock/location hypothesis. Producer identity and exact fitted+state matter; shared flight names alone do not prove dominance. Until owners+resolve that distinction, the recorded conservative outcomes remain authoritative.