Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)
Python acoustic-geolocationads-baircraft-trackingairplaneaudio-forensicsdoppler-effectdoppler-shiftgeolocationosintsignal-processing
Allow larger recordings in direct analyze (#301)
Cinna Davis62778c9b697b
diff --git a/README.md b/README.mdindex 707805e..a989434 100644--- a/README.md+++ b/README.md@@ -49,6 +49,10 @@ Native Windows execution is unverified.This scans the complete recording and saves an inspectable job. To permit historical search, add `--start-utc` and `--end-utc` for a defensible recording-start window, `--time-source` describing its evidence, and `--online` for public data acquisition. Missing clock evidence returns `needs_input`.+The direct `analyze` command accepts recordings up to 100 MiB by default. For a+larger local file, set `--max-upload-mb` to a suitable limit, for example+`--max-upload-mb 250`.+Initial data acquisition can take hours and tens of gigabytes; [the workflow guide](docs/PRODUCT.md) covers caching, runtime limits and resuming stopped jobs.To limit the geographic search when you have independent regional context, adddiff --git a/docs/PRODUCT.md b/docs/PRODUCT.mdindex a4898ac..5d3a49e 100644--- a/docs/PRODUCT.md+++ b/docs/PRODUCT.md@@ -84,6 +84,10 @@ job JSON to standard output. Pieces can have different sizes and costs, so theirrate is not an ETA; remotely staged work appears after it is imported. PressingCtrl-C stops the watcher without cancelling the analysis.+Direct `analyze` accepts up to 100 MiB by default. Set `--max-upload-mb 250`,+for example, to allow a larger local recording. The `serve` command has its own+`--max-upload-mb` setting for uploads through the local web interface.+`cancel` sends the cancellation request to the local service at`http://127.0.0.1:8765`. If `serve` uses a different port, pass its base URL with`--server-url`. The service must be running and managing the job directory.diff --git a/src/dopplergeist/cli.py b/src/dopplergeist/cli.pyindex 9d1abbc..7d2793c 100644--- a/src/dopplergeist/cli.py+++ b/src/dopplergeist/cli.py@@ -105,6 +105,7 @@ def main():analyze.add_argument("--config",help="Operator provider/cache/search configuration JSON")analyze.add_argument("--online",action="store_true",help="Download public data to the local cache; this can require tens of gigabytes and hours")analyze.add_argument("--max-runtime",type=positive_runtime,default=3600,help="Wall-time limit in seconds")+ analyze.add_argument("--max-upload-mb",type=positive_int,default=100,help="Maximum recording size in MiB (default: 100)")serve=sub.add_parser("serve",help="Launch the local MP3 upload interface and job API")serve.add_argument("--jobs",default="jobs")serve.add_argument("--config",help="Operator provider/cache/search configuration JSON")@@ -150,6 +151,12 @@ def main():audio=Path(args.audio)if not audio.is_file():parser.error(f"Audio file is unavailable or not a regular file: {audio}")+ try:+ audio_size=audio.stat().st_size+ except OSError as exc:+ parser.error(f"Could not read recording: {exc}")+ if audio_size > args.max_upload_mb*1024*1024:+ parser.error(f"Recording exceeds the {args.max_upload_mb} MiB limit; increase --max-upload-mb")if args.time_source and not args.start_utc:parser.error("--time-source requires --start-utc")if args.end_utc and not args.start_utc:@@ -166,12 +173,16 @@ def main():except ValueError as exc:parser.error(str(exc))try:- manager=JobManager(args.jobs,config,max_runtime_s=args.max_runtime)- except (OSError, ValueError) as exc:+ manager=JobManager(args.jobs,config,max_runtime_s=args.max_runtime,+ max_upload_bytes=args.max_upload_mb*1024*1024)+ except (OSError, ValueError, OverflowError) as exc:parser.error(f"Could not open job store: {exc}")try:- with audio.open("rb") as source:- queued=manager.submit(request,source,audio.stat().st_size,suffix=audio.suffix)+ try:+ with audio.open("rb") as source:+ queued=manager.submit(request,source,audio_size,suffix=audio.suffix)+ except (OSError, ValueError, OverflowError) as exc:+ parser.error(f"Could not submit recording: {exc}")print(f"Job {queued['job_id']} started. Monitor: dopplergeist job {queued['job_id']} "f"--jobs {shlex.quote(str(args.jobs))} --watch",file=sys.stderr,flush=True)print(json.dumps(manager.wait(queued["job_id"]),indent=2))diff --git a/tests/test_cli_arguments.py b/tests/test_cli_arguments.pyindex 6565dd4..99dcfc0 100644--- a/tests/test_cli_arguments.py+++ b/tests/test_cli_arguments.py@@ -24,3 +24,15 @@ def test_serve_rejects_invalid_limits_before_startup(monkeypatch, capsys, tmp_paassert error.value.code == 2assert message in capsys.readouterr().errassert not jobs.exists()++[email protected]("value", ["0", "-1"])+def test_analyze_rejects_nonpositive_upload_limit_before_startup(monkeypatch, capsys, tmp_path, value):+ jobs = tmp_path / "jobs"+ monkeypatch.setattr(sys, "argv", ["dopplergeist", "analyze", "not-needed.mp3", "--jobs", str(jobs),+ "--max-upload-mb", value])+ with pytest.raises(SystemExit) as error:+ main()+ assert error.value.code == 2+ assert "Value must be a positive integer" in capsys.readouterr().err+ assert not jobs.exists()diff --git a/tests/test_real_analyze_upload_limit.py b/tests/test_real_analyze_upload_limit.pynew file mode 100644index 0000000..3e7f64a--- /dev/null+++ b/tests/test_real_analyze_upload_limit.py@@ -0,0 +1,33 @@+"""Optional CLI size-boundary check using an existing real large recording."""+import json+import os+from pathlib import Path+import subprocess+import sys++import pytest+++def test_real_large_recording_can_raise_upload_limit(tmp_path):+ value = os.environ.get("DOPPLERGEIST_REAL_LARGE_MP3")+ if not value:+ pytest.skip("set a real recording larger than 100 MiB")+ audio = Path(value)+ assert 100 * 1024 * 1024 < audio.stat().st_size < 200 * 1024 * 1024+ jobs = tmp_path / "jobs"+ base = [sys.executable, "-m", "dopplergeist.cli", "analyze", str(audio), "--jobs", str(jobs)]+ rejected = subprocess.run(base, capture_output=True, text=True, timeout=30)+ assert rejected.returncode == 2+ assert "increase --max-upload-mb" in rejected.stderr+ assert "Traceback" not in rejected.stderr+ assert not jobs.exists()+ # A short, isolated run checks actual ingestion and the size override; it is+ # not an accuracy or completion test, and does not alter the source audio.+ allowed = subprocess.run(base + ["--max-upload-mb", "200", "--max-runtime", "2"],+ capture_output=True, text=True, timeout=90)+ assert allowed.returncode == 0, allowed.stderr+ result = json.loads(allowed.stdout)+ assert result["status"] in {"failed", "inconclusive", "needs_input", "succeeded"}+ saved = jobs / result["job_id"] / "input.mp3"+ assert saved.stat().st_size == audio.stat().st_size+ assert "Traceback" not in allowed.stderr