Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)
Python acoustic-geolocationads-baircraft-trackingairplaneaudio-forensicsdoppler-effectdoppler-shiftgeolocationosintsignal-processing
Tie batch safety guard to emission solver tolerance
Cinna Davis7f6f03531acc
diff --git a/src/dopplergeist/geometry.py b/src/dopplergeist/geometry.pyindex 7fcfda5..6701fdb 100644--- a/src/dopplergeist/geometry.py+++ b/src/dopplergeist/geometry.py@@ -11,6 +11,8 @@ from scipy.interpolate import CubicHermiteSplinefrom scipy.optimize import minimize_scalarfrom scipy.signal import find_peaks+_EMISSION_ITERATION_TOLERANCE_S = 1e-7+class AcousticSupportError(ValueError):"""A trajectory cannot support the assumed emission-time acoustic model."""@@ -186,7 +188,7 @@ class Track:tau = updated# A fixed point at Unix-epoch precision would repeat identically# even when its unrounded correction exceeds the tolerance.- if np.max(np.abs(correction)) < 1e-7 or unchanged:+ if np.max(np.abs(correction)) < _EMISSION_ITERATION_TOLERANCE_S or unchanged:breakdelta = self.position(tau) - observerdistance = np.linalg.norm(delta, axis=-1)diff --git a/src/dopplergeist/matching.py b/src/dopplergeist/matching.pyindex f5a1512..5740633 100644--- a/src/dopplergeist/matching.py+++ b/src/dopplergeist/matching.py@@ -16,7 +16,7 @@ import numpy as npfrom pyproj import Transformerfrom scipy.optimize import minimize-from .geometry import Track, ecef+from .geometry import Track, _EMISSION_ITERATION_TOLERANCE_S, ecef@dataclass@@ -449,11 +449,11 @@ def batch_acoustic_trials(tracks, measurements, observer, starts, c=343.0, max_sfor track, measurement in zip(tracks, measurements):spec, ridge, weight, _ = measurementtimes, ridge, weight = (np.asarray(a, dtype=float) for a in (spec.time, ridge, weight))- # The solver's 1e-7 stopping tolerance is below half a floating-point- # ULP throughout these emission times. Once an individual trial has- # stopped, further vector iterations therefore leave it unchanged.- # Older epochs retain the original per-trial path.- if track.time[0] < 2**30:+ # Once the solver tolerance is below half an emission-time ULP, a+ # stopped individual trial remains unchanged in further iterations.+ # Negative or lower-precision epochs retain the per-trial path.+ if (track.time[0] < 0 or+ np.spacing(track.time[0]) <= 2 * _EMISSION_ITERATION_TOLERANCE_S):batches.append(None)continueif times.shape != ridge.shape or times.shape != weight.shape or times.ndim != 1: