Skip to content

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

Expose whole-recording discovery in installed CLI (#359)

Cinna Davis81082211f219
diff --git a/README.md b/README.md
index 5d4bb76..5f5f50f 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ See the [Quickstart](#quickstart) to get started.
| Area | Available now | Entry point or remaining work |
| --- | --- | --- |
| Configured localization | Event measurement, flight ranking and physical refinement | `dopplergeist run` and `dopplergeist measure` on `main` |
-| Automatic acoustic discovery | Whole-recording decoding, frequency-track discovery and harmonic grouping without supplied event windows or bands | `scripts/discover_audio.py`; produces event proposals and diagnostics |
+| Automatic acoustic discovery | Whole-recording decoding, frequency-track discovery and harmonic grouping without supplied event windows or bands | `dopplergeist discover`; produces event proposals and diagnostics |
| Historical inputs | Reusable flight indexes, gap-aware trajectory queries and cached terrain/geoid data | [Data acquisition and search APIs](docs/DATA_AND_SCALE.md) on `main` |
| Geographic search | US/CONUS and Germany profiles, parallel resumable tiles, joint matching across independent flyovers and disk-backed candidate accounting | [Country profiles](docs/COUNTRIES.md), [search](docs/DATA_AND_SCALE.md#search) and [finite-search evidence](docs/FINITE_SEARCH_PRODUCER.md) |
| Local upload application | CLI/API orchestration, persistent jobs and inspectable browser results on `main` | `dopplergeist analyze`, `dopplergeist serve` and `dopplergeist job`; see [Local upload workflow](docs/PRODUCT.md) |
@@ -115,7 +115,7 @@ monitor it using `job JOB_ID --jobs jobs --watch`. If the service is stopped,
Automatic discovery scans an entire recording for moving acoustic frequency patterns **without hand-selecting event windows or frequency bands**. Replace `path/to/recording.mp3` with your real recording; this step needs no flight-data download or data-service credentials:
```bash
-.venv/bin/python scripts/discover_audio.py \
+.venv/bin/dopplergeist discover \
path/to/recording.mp3 \
--output results/my-discovery
```
diff --git a/docs/AUDIO_DISCOVERY.md b/docs/AUDIO_DISCOVERY.md
index 62f090c..f13a2bf 100644
--- a/docs/AUDIO_DISCOVERY.md
+++ b/docs/AUDIO_DISCOVERY.md
@@ -43,12 +43,16 @@ span; the full measured ridge remains in JSON/CSV. Existing discovery outputs
are refused. A reproducible whole-file entry point is:
```bash
-PYTHONPATH=src .venv/bin/python scripts/discover_audio.py input.mp3 --output results/new-audio-scan
+dopplergeist discover input.mp3 --output results/new-audio-scan
```
-The script records source/code hashes, git state, settings, runtime and peak RSS.
-It does not consume evaluation labels. Run post-hoc evaluation in a separate
-process. Use a new output directory for every run.
+The installed CLI records the source hash, settings, measured events and chunk
+counts in its output. It does not consume evaluation labels. Run post-hoc
+evaluation in a separate process. Use a new output directory for every run.
+Pass `--plot-summary` for the overview or `--plot-event-details` for individual
+spectrograms; plotting is off by default in the CLI.
+The checkout-only `scripts/discover_audio.py` additionally records its Git state,
+code hash, runtime and peak RSS for research comparisons.
Development evidence before DG-02 controls: full synthetic WAV (1180 s), 2
proposals spanning both planted passes, 7.24 s / 238044 KiB peak RSS; full public
diff --git a/src/dopplergeist/cli.py b/src/dopplergeist/cli.py
index d4bec93..125a4d6 100644
--- a/src/dopplergeist/cli.py
+++ b/src/dopplergeist/cli.py
@@ -102,6 +102,11 @@ def main():
measure.add_argument("--end",type=float,required=True)
measure.add_argument("--band",type=float,nargs=2,required=True)
measure.add_argument("--output",required=True)
+ discover=sub.add_parser("discover",help="Scan a complete recording for acoustic event proposals")
+ discover.add_argument("audio")
+ discover.add_argument("--output",required=True,help="New directory for the scan and diagnostics")
+ discover.add_argument("--plot-summary",action="store_true",help="Render a recording-level ridge overview")
+ discover.add_argument("--plot-event-details",action="store_true",help="Render a spectrogram for each proposal")
analyze=sub.add_parser("analyze",help="Automatically locate aircraft audio, or explain insufficient evidence")
analyze.add_argument("audio")
analyze.add_argument("--start-utc",help="Earliest UTC recording start, including explicit timezone")
@@ -154,6 +159,23 @@ def main():
from .audio import measure
result=measure(args.audio,{"start_s":args.start,"end_s":args.end,"band_hz":args.band},args.output)
print(json.dumps(result[-1],indent=2))
+ elif args.command=="discover":
+ from .discovery import discover_events
+ from .intake import intake_recording
+ output=Path(args.output)
+ try:
+ output.mkdir(parents=True,exist_ok=False)
+ recording=intake_recording(args.audio,output/"intake")
+ events=discover_events(recording,output_dir=output/"discovery",
+ plot_summary=args.plot_summary,plot_event_details=args.plot_event_details)
+ summary={"recording":recording.metadata,"time_status":recording.time_status,
+ "events_found":len(events),
+ "groups_found":len({event.get("harmonic_group_id") or event["event_id"] for event in events}),
+ "scope":"Acoustic proposals only; aircraft identity and location are not established"}
+ (output/"summary.json").write_text(json.dumps(summary,indent=2,allow_nan=False)+"\n")
+ except (OSError, ValueError) as exc:
+ parser.error(f"Could not complete discovery: {exc}")
+ print(json.dumps(summary,indent=2))
elif args.command=="serve":
from .service import serve
try:
diff --git a/tests/test_cli_input_errors.py b/tests/test_cli_input_errors.py
index ccad708..c6c9eb6 100644
--- a/tests/test_cli_input_errors.py
+++ b/tests/test_cli_input_errors.py
@@ -29,6 +29,16 @@ def test_analyze_rejects_time_source_without_start_utc(tmp_path):
assert not jobs.exists()
+def test_discover_refuses_existing_output_directory(tmp_path):
+ marker = tmp_path / "preserve.txt"
+ marker.write_text("existing output")
+ run = _run_cli("discover", Path(__file__), "--output", tmp_path)
+
+ assert run.returncode == 2
+ assert "Could not complete discovery" in run.stderr
+ assert marker.read_text() == "existing output"
+
+
def test_analyze_reports_job_store_initialization_error_without_traceback():
existing_file = Path(__file__)
run = _run_cli("analyze", existing_file, "--jobs", existing_file)