Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)
Python acoustic-geolocationads-baircraft-trackingairplaneaudio-forensicsdoppler-effectdoppler-shiftgeolocationosintsignal-processing
Test normalization-order height changes and fabricated nonzero motion fields
Cinna Davisa422148ab46a
diff --git a/research/trajectory-motion/PROTOCOL.md b/research/trajectory-motion/PROTOCOL.mdindex 9ea2160..000f0d2 100644--- a/research/trajectory-motion/PROTOCOL.md+++ b/research/trajectory-motion/PROTOCOL.md@@ -41,3 +41,13 @@ Fresh normalization alone does not repair an observation jump. Hand measuredhandling requirements to W2/W3; leave issue64 open until production handling andexplicit lost-coverage semantics pass verification. The audit uses no audio,recording coordinates, flight-match truth or new worker deployment.++Follow-up ablation after the first run: the height difference is specifically+137.16m, with historical barometric labels versus fresh ellipsoidal-interpolated+labels. Test the normalization order by applying the SAME current normalizer to+the clipped raw trace and to the full raw trace before clipping. This tests whether+outside-window geometric-minus-baro observations explain the difference; it does+not assert either interpolation is independently verified physical altitude. Also+count historical nonzero components where the fresh source is missing, because+a missing heading treated as zero can fabricate a northward component as well as+zero eastward velocity. Preserve the first frozen report alongside this follow-up.diff --git a/scripts/audit_trajectory_motion.py b/scripts/audit_trajectory_motion.pyindex 5e9d28e..33b8052 100644--- a/scripts/audit_trajectory_motion.py+++ b/scripts/audit_trajectory_motion.py@@ -108,8 +108,12 @@ def compare_observations(canonical, fresh):return {"canonical_only_times": int((common._merge == "left_only").sum()),"fresh_only_times": int((common._merge == "right_only").sum()), "paired_times": len(paired),"max_ecef_observation_difference_m": float(np.linalg.norm(xyz[0] - xyz[1], axis=1).max()) if len(paired) else None,+ "height_delta_fresh_minus_canonical_m": [float((paired.alt_m_fresh-paired.alt_m_canonical).min()),+ float((paired.alt_m_fresh-paired.alt_m_canonical).max())] if len(paired) else None,+ "altitude_basis_pairs": paired.groupby(["altitude_basis_canonical", "altitude_basis_fresh"]).size().rename_axis(["canonical", "fresh"]).reset_index(name="rows").to_dict("records"),"velocity_components": {col: {"canonical_zero_fresh_missing": int(((paired[col+"_canonical"] == 0) & paired[col+"_fresh"].isna()).sum()),+ "canonical_nonzero_fresh_missing": int((paired[col+"_canonical"].notna() & (paired[col+"_canonical"] != 0) & paired[col+"_fresh"].isna()).sum()),"both_finite_differing": int((paired[col+"_canonical"].notna() & paired[col+"_fresh"].notna() &(abs(paired[col+"_canonical"] - paired[col+"_fresh"]) > 1e-9)).sum())}for col in ("east_mps", "north_mps", "up_mps")}}@@ -136,7 +140,7 @@ def main():write(args.output / "declaration.json", declaration)canonical = pd.read_parquet(args.canonical, filters=[("flight_id", "in", args.ids)])canonical.to_json(args.output / "canonical-observations.json", orient="records", double_precision=15)- fresh, fresh_full, raw_members, scanned = {}, {}, [], 0+ fresh, fresh_full, raw_members, order_comparisons, scanned = {}, {}, [], {}, 0with io.BufferedReader(SplitReader(args.parts), buffer_size=1024*1024) as stream, tarfile.open(fileobj=stream, mode="r|*") as archive:while (member := archive.next()) is not None:archive.members.clear()@@ -161,6 +165,9 @@ def main():frame = tracks.adsblol_frame(document) # Normalize full trace before restricting time.fresh_full[identity] = framefresh[identity] = frame[frame.time_s.between(*args.window)].copy()+ clipped = dict(document, trace=[p for p in document["trace"]+ if args.window[0] <= document["timestamp"]+p[0] <= args.window[1]])+ order_comparisons[identity] = compare_observations(tracks.adsblol_frame(clipped), fresh[identity])raw_members.append({"member": member.name, "bytes": len(raw), "sha256": hashlib.sha256(raw).hexdigest(),"raw_observations": len(document["trace"]), "normalized_full_rows": len(frame)})print(json.dumps({"found": identity, "window_rows": len(fresh[identity])}), flush=True)@@ -181,6 +188,7 @@ def main():frame = pd.DataFrame(json.loads(gzip.decompress(payload)))indexed.append({"id": name, "audit": audit_frame(frame, 343.0)})audits.append({"identity": identity, "observation_comparison": compare_observations(old, current),+ "normalization_order_comparison": order_comparisons[identity],"canonical": audit_frame(old, 343.0), "fresh": audit_frame(current, 343.0),"fresh_full_support": audit_frame(fresh_full[identity], 343.0, interval_window=args.window),"indexed": indexed})diff --git a/tests/test_trajectory_motion_audit.py b/tests/test_trajectory_motion_audit.pyindex 317818f..4ae1894 100644--- a/tests/test_trajectory_motion_audit.py+++ b/tests/test_trajectory_motion_audit.py@@ -67,6 +67,20 @@ def test_audit_keeps_measured_zeros_and_does_not_bridge_a_gap():assert compared["velocity_components"]["up_mps"]["canonical_zero_fresh_missing"] == 1+def test_clipping_before_normalization_can_remove_height_reference_observations():+ from aircraft_geoloc.tracks import adsblol_frame+ raw = {"icao": "abcdef", "timestamp": 1000., "trace": [+ [i, 40., -100., 1000., None, None, 0, 0, {}, 0, 1450. if i == 0 else None, 0]+ for i in range(3)]}+ full = adsblol_frame(raw)+ window = full[full.time_s >= 1001]+ clipped = adsblol_frame(dict(raw, trace=raw["trace"][1:]))+ comparison = audit.compare_observations(clipped, window)+ assert comparison["paired_times"] == 2+ assert comparison["height_delta_fresh_minus_canonical_m"] == pytest.approx([137.16, 137.16])+ assert comparison["altitude_basis_pairs"] == [{"canonical": "barometric", "fresh": "ellipsoidal_interpolated", "rows": 2}]++@pytest.mark.parametrize("duration", [0., -1., np.inf])def test_invalid_duration_is_explicit(duration):with pytest.raises(ValueError, match="duration"):