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 valid fixed-clock association boundaries
Cinna Davisc97d90cf793d
diff --git a/src/dopplergeist/matching.py b/src/dopplergeist/matching.pyindex 5c4b5e2..fe1ca8d 100644--- a/src/dopplergeist/matching.py+++ b/src/dopplergeist/matching.py@@ -171,7 +171,15 @@ def association_candidates(table, events, offset_tolerance_s=5.0, time_origin=Norecords = table.to_dict("records")grouped, survivors = [], []for event in events:- frame = filter_event(table, event, time_origin, time_tolerance_s)+ frame = filter_event(table, event, None, time_tolerance_s)+ if time_origin is not None:+ start = frame.receive_time - event["cpa_receive_s"]+ tolerance = event.get("quality", {}).get("cpa_tolerance_s", 0) + offset_tolerance_s/2+ # Use the same inclusive shared-clock intervals as the traversal.+ # A separate CPA filter omitting offset tolerance can discard valid+ # boundary passages before the intersection is considered.+ frame = frame[(start - tolerance <= time_origin + time_tolerance_s) &+ (start + tolerance >= time_origin - time_tolerance_s)]reserve(len(frame))survivors.append(len(frame))grouped.append({p: [records[i] for i in group.index] for p, group in frame.groupby("point_id")})diff --git a/tests/test_real_fixed_clock_filter.py b/tests/test_real_fixed_clock_filter.pynew file mode 100644index 0000000..ca5e224--- /dev/null+++ b/tests/test_real_fixed_clock_filter.py@@ -0,0 +1,31 @@+"""Fixed-clock boundary regression using an observed ADS-B passage and audio proposal."""+import numpy as np+import pandas as pd++from dopplergeist.matching import association_candidates+++def test_real_passage_is_kept_at_inclusive_clock_endpoints():+ event = {'cpa_receive_s': 301.25, 'speed_range_mps': [1.0, 308.7],+ 'slant_range_m': [1.0, 20000.0], 'quality': {'cpa_tolerance_s': 7.25}}+ passage = {'point_id': 0, 'flight_id': '06a128', 'emission_time': 1788899665.5239854,+ 'receive_time': 1788899668.4499502, 'distance_m': 1003.605901071673,+ 'speed_mps': 88.57298283028696}+ center = passage['receive_time'] - event['cpa_receive_s']+ tolerance = event['quality']['cpa_tolerance_s'] + 2.5+ left, right = center - tolerance, center + tolerance+ for clock, expected in ((np.nextafter(left, -np.inf), False), (left, True),+ (np.nextafter(left, np.inf), True), (np.nextafter(right, -np.inf), True),+ (right, True), (np.nextafter(right, np.inf), False)):+ candidates, _ = association_candidates(pd.DataFrame([passage]), [event],+ offset_tolerance_s=5, time_origin=clock,+ time_tolerance_s=0)+ assert bool(candidates) is expected++ # The declared clock window may itself span multiple seconds.+ for clock, expected in ((np.nextafter(left - 3, -np.inf), False), (left - 3, True),+ (right + 3, True), (np.nextafter(right + 3, np.inf), False)):+ candidates, _ = association_candidates(pd.DataFrame([passage]), [event],+ offset_tolerance_s=5, time_origin=clock,+ time_tolerance_s=3)+ assert bool(candidates) is expected