Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)
Python acoustic-geolocationads-baircraft-trackingairplaneaudio-forensicsdoppler-effectdoppler-shiftgeolocationosintsignal-processing
Merge remote-tracking branches 'origin/swarm/w4-evaluation-confidence', 'origin/swarm/w1-discovery', 'origin/swarm/w3-partial-association', 'origin/swarm/w2-data-scale' and 'origin/worker/index-invariants-20261103' into review/integration-20261103
Cinna Davis5e40a563956a
diff --cc src/aircraft_geoloc/search.pyindex 2261f9b,c390d5e,050124e,c390d5e,522f1f8..0fb3e83--- a/src/aircraft_geoloc/search.py+++ b/src/aircraft_geoloc/search.py@@@@@@ -202,13 -216,37 -212,52 -216,37 -212,37 +216,52 @@@@@@ def event_score(track, observer, spectrdef score_candidate(candidate, point, tracks, events, measurements, mode="brightness",time_origin=None, time_sweep_s=5.0, time_step_s=0.5, c=343.0):++ ++ association = "event_indices" in candidate++ ++ association_fields = {}++ ++ if association:++ ++ if mode != "robust_ridge":++ ++ raise ValueError("Partial-event association requires robust_ridge scoring")++ ++ indices = candidate["event_indices"]++ ++ if not indices or indices != sorted(set(indices)) or any(i < 0 or i >= len(events) for i in indices):++ ++ raise ValueError("Association event indices must be unique, ordered and in range")++ ++ association_fields = {"event_indices": indices,++ ++ "event_ids": [events[i].get("event_id", str(i)) for i in indices],++ ++ "unmatched_event_ids": [e.get("event_id", str(i)) for i, e in enumerate(events) if i not in indices]}++ ++ events, measurements = [events[i] for i in indices], [measurements[i] for i in indices]+ if not events or len(events) != len(measurements) or len(events) != len(candidate["passes"]):+ raise ValueError("Need exactly one pass and measurement for each event")+ if mode not in ("brightness", "ridge", "robust_ridge"):+ raise ValueError(f"Unknown scoring mode: {mode}")+ if time_step_s <= 0 or time_sweep_s < 0:+ raise ValueError("Need positive clock step and nonnegative sweep")observer = ecef(point.lat,point.lon,point.elev_m)# Derive one recording start from the first event; all other events retain# their true absolute geometry/time. This implements the locked offset.anchor = time_origin if time_origin is not None else candidate["passes"][0]["receive_time"]-events[0]["cpa_receive_s"]shifts = np.linspace(-time_sweep_s,time_sweep_s,max(1,int(np.ceil(2*time_sweep_s/time_step_s)))+1)+ if mode == "robust_ridge" and "recording_start_bounds_s" in candidate:+ lower, upper = candidate["recording_start_bounds_s"]+ # CPA intervals propose a shared clock; the physical model may move it+ # within the same declared sweep used by legacy scoring.+ lower, upper = lower-time_sweep_s, upper+time_sweep_s+ if time_origin is not None:+ lower, upper = max(lower,anchor-time_sweep_s), min(upper,anchor+time_sweep_s)+ if lower > upper:+ shifts = []+ else:+ shifts = np.linspace(lower-anchor,upper-anchor,max(1,int(np.ceil((upper-lower)/time_step_s)))+1)best = {"score":-np.inf}for shift in shifts:+ if mode == "robust_ridge":+ from .matching import score_ridges+ result = score_ridges([tracks[p["flight_id"]] for p in candidate["passes"]],+ events,measurements,observer,anchor+shift,c)++ ++ if association:++ ++ from .matching import association_score++ ++ result = association_score(result, events)+ if result["score"] > best["score"]:+ best = dict(result,recording_start_time_s=float(anchor+shift),time_adjustment_s=float(shift))+ continuescores,f0s = [],[]for event,measurement,flyover in zip(events,measurements,candidate["passes"]):spec,ridge,weight,_ = measurement