Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)
Python acoustic-geolocationads-baircraft-trackingairplaneaudio-forensicsdoppler-effectdoppler-shiftgeolocationosintsignal-processing
Expose fitted recording clock window diagnostics
Cinna Davis88b12a8ca7f3
diff --git a/docs/CONFIDENCE.md b/docs/CONFIDENCE.mdindex 3059e09..c79706e 100644--- a/docs/CONFIDENCE.md+++ b/docs/CONFIDENCE.md@@ -58,6 +58,13 @@ inferred from the fitted candidate. W5 supplies the validated original requestwindow as `recording_start_window_s`; W3 profiles expose the tested span in`sensitivity.settings.clock_bounds_s`.+When a candidate clock falls inside the supplied window, diagnostics also report+`recording_start_window_fit`: the window width, fit offset from the midpoint,+and distance to the nearest edge, all in seconds. These are geometric+descriptions of the optimizer result, not a clock-error estimate or calibration.+They do not change the score, ranking, or decision; the caller remains responsible+for supplying a defensible clock window.+Matched flyovers use one locked recording clock; harmonics count once and mustmap to the same flight. The minimum independent-flyover gate counts distinctmatched flight segments: multiple acoustic groups assigned to one segment maydiff --git a/src/dopplergeist/confidence.py b/src/dopplergeist/confidence.pyindex f850fb7..4bd03d1 100644--- a/src/dopplergeist/confidence.py+++ b/src/dopplergeist/confidence.py@@ -274,6 +274,22 @@ def decide_location(events, candidates, coverage, *, matching_diagnostics=None,evidence = matching_diagnostics or {}if not isinstance(evidence, dict):return result("invalid_evidence", "Matching diagnostics must be a mapping.", "failed")++ def interval(value):+ return (isinstance(value, (list, tuple)) and len(value) == 2 and+ all(not isinstance(v, bool) and isinstance(v, (int, float)) and math.isfinite(v) for v in value)+ and value[0] <= value[1])++ window = evidence.get("recording_start_window_s")+ if candidates and interval(window):+ fitted = utc_timestamp(candidates[0]["recording_start_utc"]).timestamp()+ if window[0] <= fitted <= window[1]:+ diagnostics["recording_start_window_s"] = list(window)+ diagnostics["recording_start_window_fit"] = {+ "window_width_s": float(window[1] - window[0]),+ "fit_offset_from_midpoint_s": float(fitted - (window[0] + window[1]) / 2),+ "fit_distance_to_nearest_edge_s": float(min(fitted - window[0], window[1] - fitted)),+ }if not events:return result("no_doppler_events", "No supported Doppler event was discovered in the recording.")if (not candidates or coverage is None or coverage["search_complete"] is not True@@ -316,20 +332,12 @@ def decide_location(events, candidates, coverage, *, matching_diagnostics=None,diagnostics["matched_event_group_count"] = len(groups)diagnostics["independent_event_groups"] = len({flight_id for _, flight_id in groups.values()})sensitivity = evidence.get("sensitivity", {})- window = evidence.get("recording_start_window_s")-- def interval(value):- return (isinstance(value, (list, tuple)) and len(value) == 2 and- all(not isinstance(v, bool) and isinstance(v, (int, float)) and math.isfinite(v) for v in value)- and value[0] <= value[1])-if window is not None:if not interval(window):return result("invalid_evidence", "The trusted recording-start window must have two finite ordered endpoints.", "failed")fitted = utc_timestamp(best["recording_start_utc"]).timestamp()if not window[0] <= fitted <= window[1]:return result("recording_clock_mismatch", "The fitted recording start lies outside the trusted recording window.")- diagnostics["recording_start_window_s"] = list(window)settings = sensitivity.get("settings", {}) if isinstance(sensitivity, dict) else {}tested_clock = settings.get("clock_bounds_s") if isinstance(settings, dict) else Noneknown_clock = (interval(window) and interval(tested_clock) and