Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)
Python acoustic-geolocationads-baircraft-trackingairplaneaudio-forensicsdoppler-effectdoppler-shiftgeolocationosintsignal-processing
Integrate current namespace and preserve final product coverage guards
Cinna Davis3c63d0116963
diff --cc scripts/benchmark_real_discovery.pyindex 78ff5f0,0000000..4f756e0mode 100644,000000..100644--- a/scripts/benchmark_real_discovery.py+++ b/scripts/benchmark_real_discovery.py@@@ -1,58 -1,0 +1,58 @@@+"""Run all40 published Livermore recordings through blind automatic MP3 intake.++No annotation, track or UTC is given to the CLI. This tests proposal generation,+not location accuracy or confirmed event-level precision. Requires ffmpeg/bwrap.+"""+import argparse+from pathlib import Path+import collections, json, subprocess, sys, time++parser=argparse.ArgumentParser(description=__doc__)+parser.add_argument("source",type=Path,help="Restored zenodo-23424278 directory")+parser.add_argument("--output",type=Path,required=True,help="New unused result directory")+args=parser.parse_args()+repo=Path(__file__).resolve().parents[1]+source=args.source.resolve()+output=args.output.resolve()+clips=sorted((source/'extracted').glob('*/*/audio.wav'))+if len(clips)!=40:+ parser.error("Expected all40 restored audio.wav recordings below source/extracted")+output.mkdir(parents=True,exist_ok=False)+inputs=output/'inputs'; inputs.mkdir()+mapping=[]+for index,path in enumerate(clips):+ key=f'clip-{index:03}'+ target=inputs/f'{key}.mp3'+ process=subprocess.run(['ffmpeg','-v','error','-nostdin','-i',str(path),'-map','0:a:0','-vn','-map_metadata','-1','-c:a','libmp3lame','-b:a','192k',str(target)],capture_output=True)+ mapping.append({'case_id':key,'source_case':path.parent.name,'category':path.parent.parent.name,'encode_returncode':process.returncode})+ if process.returncode: (output/f'{key}-encode-error.txt').write_bytes(process.stderr)+(output/'case-map.json').write_text(json.dumps(mapping,indent=2)+'\n')+print('Staged',len(clips),'audio-only opaque MP3 inputs',flush=True)+python=sys.executable+common=['bwrap','--die-with-parent','--unshare-net','--ro-bind','/','/','--dev','/dev','--proc','/proc','--tmpfs','/tmp','--bind',str(output),str(output),'--tmpfs',str(source),'--ro-bind','/dev/null',str(output/'case-map.json')]+for line in subprocess.check_output(['git','worktree','list','--porcelain'],cwd=repo,text=True).splitlines():+ if line.startswith('worktree '):+ truth=Path(line[9:])/'benchmarks/truth'+ if truth.is_dir(): common.extend(['--tmpfs',str(truth)])+common+=['--setenv','PYTHONPATH',str(repo/'src'),'--setenv','MPLCONFIGDIR','/tmp/mpl','--setenv','HOME','/tmp','--chdir',str(repo)]+rows=[]; started=time.monotonic()+for entry in mapping:+ key=entry['case_id']; jobs=output/key+ if entry['encode_returncode']:+ row={'case_id':key,'status':'failed','reason_code':'encoding_failed','proposal_groups':0}+ else:- command=common+[python,'-m','aircraft_geoloc.cli','analyze',str(inputs/f'{key}.mp3'),'--jobs',str(jobs),'--max-runtime','180']++ command=common+[python,'-m','dopplergeist.cli','analyze',str(inputs/f'{key}.mp3'),'--jobs',str(jobs),'--max-runtime','180']+ began=time.monotonic()+ with (output/f'{key}-process.log').open('wb') as log:+ process=subprocess.run(command,stdout=log,stderr=subprocess.STDOUT,timeout=210)+ results=list(jobs.glob('*/result.json'))+ if len(results)==1:+ result=json.loads(results[0].read_text())+ row={'case_id':key,'status':result['status'],'reason_code':result.get('reason_code'),'proposal_groups':len({event.get('harmonic_group_id',event['event_id']) for event in result.get('events',[])}),'event_records':len(result.get('events',[])),'elapsed_s':time.monotonic()-began,'result':str(results[0].relative_to(output))}+ else: row={'case_id':key,'status':'failed','reason_code':'missing_result','proposal_groups':0,'exit_code':process.returncode}+ rows.append(row)+ (output/'outcomes.json').write_text(json.dumps(rows,indent=2)+'\n')+ print(key,row['status'],row['reason_code'],'groups',row['proposal_groups'],flush=True)+summary={'scope':'Normal automatic CLI on all40 real positive clips, fixed192kbps MP3, no bands/windows/UTC/flights; discovery only, not location accuracy','source_commit':subprocess.check_output(['git','rev-parse','HEAD'],cwd=repo,text=True).strip(),'cases':len(rows),'clips_with_proposals':sum(r['proposal_groups']>0 for r in rows),'clips_without_proposals':sum(r['proposal_groups']==0 for r in rows),'proposal_groups':sum(r['proposal_groups'] for r in rows),'status_counts':dict(collections.Counter(r['status'] for r in rows)),'elapsed_s':time.monotonic()-started,'limitations':['All clips are published aircraft-positive passages; absent/extra groups do not provide event-level miss/false-alarm labels.','Annotations/KML and case mapping masked from workers; no independent microphone/sample-zero UTC evidence; not a location benchmark.']}+(output/'summary.json').write_text(json.dumps(summary,indent=2)+'\n')+print(json.dumps(summary,indent=2),flush=True)diff --cc tests/test_automatic.pyindex 63413bf,e62ae13..557e13c--- a/tests/test_automatic.py+++ b/tests/test_automatic.py@@@ -227,22 -227,20 +227,22 @@@ def test_invalid_operator_discovery_conassert not (tmp_path/"output/intake").exists()[email protected]("flag,changes,complete", [- (True, {}, True),- (False, {"unsupported_cpa_track_evaluations": 1}, False),- (False, {"unclassified_score_candidates": 2, "unknown_trials": 3}, False),- (True, {"unknown_trials": 1}, False),- (True, {"unknown_trials": False}, False),- (True, {"unknown_trials": None}, False),- (None, {}, False),[email protected]("flag,changes,complete,counts_known", [+ (True, {}, True, True),+ (False, {"unsupported_cpa_track_evaluations": 1}, False, True),+ (False, {"unclassified_score_candidates": 2, "unknown_trials": 3}, False, True),+ (True, {"unknown_trials": 1}, False, True),+ (True, {"unknown_trials": False}, False, False),+ (True, {"unknown_trials": None}, False, False),+ (None, {}, False, True),+ (True, {"unreported_trial_envelopes": 1}, False, True),+ (True, {"unreported_trial_envelopes": None}, False, False),])-def test_model_support_work_is_explicit_in_product_coverage(flag, changes, complete):+def test_model_support_work_is_explicit_in_product_coverage(flag, changes, complete, counts_known):- from aircraft_geoloc.automatic import _coverage+ from dopplergeist.automatic import _coveragesupport = {"unsupported_cpa_track_evaluations": 0, "unclassified_score_candidates": 0,"evaluated_trials": 4, "rejected_trials": 1, "unknown_trials": 0,- "diagnostics_directory": "support", **changes}+ "unreported_trial_envelopes": 0, "diagnostics_directory": "support", **changes}coverage = _coverage({"search": {"coverage": "conus"}},{"status": "complete", "tiles_total": 2, "tiles_completed": 2, "data_scope_complete": True,"model_support_complete": flag, "model_support": support}, {})diff --cc tests/test_automatic_support.pyindex 9df3cb4,0000000..80004bemode 100644,000000..100644--- a/tests/test_automatic_support.py+++ b/tests/test_automatic_support.py@@@ -1,38 -1,0 +1,38 @@@+"""Real producer-to-product coverage checks; no localization benchmark."""+import pytest+- from aircraft_geoloc import tiled_search- from aircraft_geoloc.automatic import _coverage- from aircraft_geoloc.terrain import Terrain- from aircraft_geoloc.tiled_search import SearchBudget, search_national++from dopplergeist import tiled_search++from dopplergeist.automatic import _coverage++from dopplergeist.terrain import Terrain++from dopplergeist.tiled_search import SearchBudget, search_national+from test_tiled_search import scenario++[email protected]("missing_accounting", [False, True])+def test_product_coverage_consumes_actual_model_support_report(tmp_path, monkeypatch, missing_accounting):+ index, _, events, measurements, bounds, times, origin = scenario(tmp_path)+ if missing_accounting:+ original = tiled_search.score_candidate++ def unreported(*args, **kwargs):+ row = original(*args, **kwargs)+ row.pop("scoring_assessment", None)+ return row++ monkeypatch.setattr(tiled_search, "score_candidate", unreported)+ report = search_national([index], Terrain(constant_m=0), events, measurements,+ time_range_s=times, output_dir=tmp_path/"search", bounds=bounds,+ budget=SearchBudget(spacing_m=1000, tile_cells=4, refine_spacing_m=1000),+ scoring={"mode": "robust_ridge", "recording_start_window_s": [origin, origin], "time_sweep_s": 0})+ assert report["ranked"]+ coverage = _coverage({"search": {"coverage": "conus"}}, report, {})+ assert coverage["data_status"] == "available"+ assert coverage["search_complete"] is (not missing_accounting)+ if missing_accounting:+ assert report["model_support"]["unknown_trials"] == 0+ count = report["model_support"]["unreported_trial_envelopes"]+ assert count > 0+ assert f"unreported trial envelopes: {count}" in " ".join(coverage["limitations"])+ else:+ assert report["model_support_complete"] is True+ assert not any("Trajectory model assessment is incomplete" in item for item in coverage["limitations"])