Skip to content

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

Exclude provably distant unsupported spline trajectories

Cinna Davis3478734ba788
diff --git a/docs/DATA_AND_SCALE.md b/docs/DATA_AND_SCALE.md
index 3ca8551..52b6d4c 100644
--- a/docs/DATA_AND_SCALE.md
+++ b/docs/DATA_AND_SCALE.md
@@ -113,11 +113,20 @@ shared-machine replay of two real grid points from a full-day search, one worker
took 64.93 seconds and two took 38.95 seconds including startup, with identical
payloads and ledgers. This small sample does not predict nationwide runtime.
-In one real full-day grid cell, the track retry reduced 1,929 queried tracks to
-614 within the configured memory limit. All 200 tracks with unsupported motion
-remained. Complete scoring with the full and reduced sets produced identical
-results, support records and retention checksums. This does not establish that
-other overloaded cells will fit within the limits or resolve unsupported motion.
+Before the spline-hull improvement below, one real full-day grid cell's track
+retry reduced 1,929 queried tracks to 614 within the configured memory limit,
+retaining all 200 tracks with unsupported motion. Complete scoring with the full
+and reduced sets produced identical results, support records and retention
+checksums. Other overloaded cells may still exceed the limits.
+
+For a trajectory with unsupported motion, the distance sieve can still exclude
+it when the bounding boxes of every cubic-spline control hull are outside the
+observer set's search radius. This proof does not assume subsonic motion. In a
+different full-day cell, it excluded 122 distant unsupported trajectories
+while leaving 20 unsupported trajectories visible; all 23,136 supported
+associations were unchanged. One track-query timing was about six CPU seconds
+with either version, so this is a coverage-accounting improvement, not a
+demonstrated nationwide speedup.
Candidate scores are merged deterministically with approach identities, then
global finalists are refined on the same global grid in bounded subtiles. The
diff --git a/src/dopplergeist/geometry.py b/src/dopplergeist/geometry.py
index 6701fdb..07bc666 100644
--- a/src/dopplergeist/geometry.py
+++ b/src/dopplergeist/geometry.py
@@ -125,7 +125,29 @@ class Track:
separation larger than the radius proves the entire cubic trajectory
and its sampled polyline cannot enter any observer's search sphere.
"""
- self.validate_motion_support(c)
+ try:
+ self.validate_motion_support(c)
+ except AcousticSupportError:
+ # A non-subsonic track can still be excluded without assuming a
+ # speed limit: every cubic Hermite segment lies in the convex hull
+ # of its four Bezier control points. Bound each hull and the whole
+ # observer set by boxes, and exclude only if every pair is distant.
+ observers = np.asarray(observers, dtype=float).reshape(-1, 3)
+ if len(observers) and np.isfinite(radius) and np.all(np.isfinite(observers)):
+ dt = np.diff(self.time)[:, None]
+ velocity = self.speed_vector(self.time)
+ p0, p1 = self.xyz[:-1], self.xyz[1:]
+ controls = np.stack((p0, p0 + dt * velocity[:-1] / 3,
+ p1 - dt * velocity[1:] / 3, p1), axis=1)
+ if np.all(np.isfinite(controls)):
+ lo, hi = controls.min(axis=1), controls.max(axis=1)
+ lower, upper = observers.min(axis=0), observers.max(axis=0)
+ separation = np.maximum(np.maximum(lo - upper, lower - hi), 0)
+ scale = max(1., float(np.max(np.abs(controls))), float(np.max(np.abs(observers))), abs(radius))
+ margin = 1e-6 + 128 * np.finfo(float).eps * scale
+ if np.all(np.linalg.norm(separation, axis=1) > radius + margin):
+ return True
+ raise
if not np.isfinite(radius):
return False
scale = max(1.0, float(np.max(np.abs(self._xyz_min))),
diff --git a/tests/test_real_unsupported_distance.py b/tests/test_real_unsupported_distance.py
new file mode 100644
index 0000000..65e4f68
--- /dev/null
+++ b/tests/test_real_unsupported_distance.py
@@ -0,0 +1,56 @@
+"""Conservative spline distance filtering on actual unsupported flight tracks."""
+from dataclasses import replace
+import json
+import os
+from pathlib import Path
+
+import numpy as np
+import pytest
+
+from dopplergeist.data_access import CachedTerrain, FlightIndex
+from dopplergeist.geometry import AcousticSupportError, ecef
+from dopplergeist.matching import prepare_events
+from dopplergeist.tiled_search import (SearchBudget, _expanded_bounds, _split_tile_cells,
+ _tracks, grid_tiles, tile_points)
+
+
+def test_real_unsupported_tracks_only_excluded_when_their_hulls_are_distant():
+ job, cache = (os.environ.get(name) for name in ("DOPPLERGEIST_REAL_JOB_ROOT", "DOPPLERGEIST_REAL_CACHE_ROOT"))
+ if not job or not cache:
+ pytest.skip("set the real job and cache roots")
+ job, cache = Path(job), Path(cache)
+ config = json.loads((job / "search/manifest.json").read_text())["configuration"]
+ events, _ = prepare_events(json.loads((job / "discovery/discovery.json").read_text())["events"])
+ budget = SearchBudget(**config["budget"])
+ cells = dict(grid_tiles(config["bounds"], budget.spacing_m, budget.tile_cells, config["crs"]))["-33_51"]
+ for choice in (1, 2, 0, 1, 1):
+ cells = _split_tile_cells(cells)[choice]
+ radius = max(event["slant_range_m"][1] for event in events)
+ terrain = CachedTerrain(cache / "terrain", offline=False)
+ points = tile_points(cells, budget.spacing_m, config["bounds"], terrain, config["crs"])
+ observers = ecef(points.lat.to_numpy(), points.lon.to_numpy(), points.elev_m.to_numpy())
+ indexes = [FlightIndex(cache / "flights" / day / "staging-0/all-types-v2-543f483cee75.sqlite")
+ for day in ("2026-09-08", "2026-09-09")]
+ tracks = _tracks(indexes, _expanded_bounds(cells, budget.spacing_m, radius, config["crs"]),
+ config["time_range_s"], replace(budget, max_tracks_per_tile=20000,
+ max_track_samples_per_tile=5000000))
+ excluded = retained = 0
+ for track in tracks:
+ try:
+ track.validate_motion_support()
+ except AcousticSupportError:
+ try:
+ far = track.outside_observer_radius(observers, radius)
+ except AcousticSupportError:
+ retained += 1
+ continue
+ assert far
+ # Independently check the original spline at all real observation
+ # times and interval midpoints; the implementation's hull proof is
+ # stronger than these sampled checks.
+ times = np.sort(np.r_[track.time, (track.time[:-1] + track.time[1:]) / 2])
+ distances = np.linalg.norm(track.position(times)[:, None, :] - observers[None, :, :], axis=2)
+ assert np.all(distances > radius)
+ excluded += 1
+ assert excluded >= 122 and retained >= 20
+ print(f"real unsupported trajectories: {excluded} proven distant, {retained} retained")