Skip to content

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

Keep unconverged emission-time solves unknown (#64)

Cinna Davisc1578ca6f3c2
diff --git a/docs/MOTION_SUPPORT.md b/docs/MOTION_SUPPORT.md
index c54f9cf..42593dd 100644
--- a/docs/MOTION_SUPPORT.md
+++ b/docs/MOTION_SUPPORT.md
@@ -37,6 +37,14 @@ elsewhere. An entire native interval is conservatively unsupported, including
its slower portions; this guard does not split or repair it. Existing
`non_monotone_arrival` failures and messages are preserved.
+The finite Newton iteration must also finish with an emission-time correction
+within 1e-7 s or four receive-timestamp ULPs, whichever is larger. A finite last
+iterate is insufficient: a subsonic straight near-sonic control previously
+returned emission times about 293 s from the analytic solution after ten
+iterations. An unfinished solve now raises `emission_solver_not_converged` and
+remains unknown. Samples outside the declared trajectory support retain NaNs;
+they do not require an extrapolated converged root.
+
The robust clock-trial adapter records these failures as unknown, never as an
acoustic rejection or an evaluated fit. A perfect ridge match cannot establish
physical support. The guard does not change source observations, velocity
diff --git a/src/aircraft_geoloc/geometry.py b/src/aircraft_geoloc/geometry.py
index 4a5aded..a48ea3e 100644
--- a/src/aircraft_geoloc/geometry.py
+++ b/src/aircraft_geoloc/geometry.py
@@ -166,6 +166,13 @@ class Track:
radial = np.sum(delta * self.speed_vector(tau), axis=-1) / distance
factor = c / (c + radial)
self._check_motion_support(t, observer, c)
+ arrival_derivative = 1+radial/c
+ if np.any(arrival_derivative <= 0):
+ raise AcousticSupportError(self.id, "non_monotone_arrival")
+ remaining_correction = (tau-t+distance/c)/arrival_derivative
+ tolerance = np.maximum(1e-7, 4*np.abs(np.spacing(t)))
+ if np.any(supported & (~np.isfinite(remaining_correction) | (np.abs(remaining_correction) > tolerance))):
+ raise AcousticSupportError(self.id, "emission_solver_not_converged")
return tuple(np.where(supported, a, np.nan) for a in (factor, tau, distance))
def closest_approaches(self, observer, max_distance=np.inf, c=343.0, step=2.0):
diff --git a/tests/test_motion_support.py b/tests/test_motion_support.py
index f7d82a2..aa8bbd6 100644
--- a/tests/test_motion_support.py
+++ b/tests/test_motion_support.py
@@ -129,3 +129,20 @@ def test_continuous_speed_extrema_cover_independent_dense_spline_oracle():
peak = np.linalg.norm(track.speed_vector(sample), axis=1).max()
assert track._speed_peak[i] >= peak-1e-7
assert track._speed_peak[i]-peak <= 1e-5*max(1, peak)
+
+
+def test_finite_newton_iterate_is_not_accepted_as_a_converged_emission_solution():
+ # A genuinely subsonic straight path has a unique analytic emission time.
+ # Close to c, the old ten-iteration result can be ~293 s from that time.
+ observer = ecef(40, -100, 100)
+ speed, slant = 342.9999, 100.
+ knots = np.array([-1000., 0., 1000.])
+ xyz = observer+np.column_stack((speed*knots, np.full(3, slant), np.zeros(3)))
+ lon, lat, height = Transformer.from_crs(4978, 4979, always_xy=True).transform(*xyz.T)
+ track = Track("near-sonic", knots, lat, lon, height, velocity=np.tile([speed, 0, 0], (3, 1)))
+ track.validate_motion_support()
+ emitted = np.linspace(-990, 990, 1001)
+ received = emitted+np.hypot(speed*emitted, slant)/343
+ with pytest.raises(AcousticSupportError) as failure:
+ track.acoustic(received, observer)
+ assert failure.value.reason == "emission_solver_not_converged"