Files
gps-denied-onboard/scripts/download_dataset.py
T
Yuzviak b57187e1b8 test(e2e): rename registry entry to euroc_machine_hall with real SHA256
The prior registry entry was speculative: ``euroc_mh01`` pointing at an
old ``robotics.ethz.ch`` URL that no longer resolves (TCP timeout).
The dataset moved to ETH Research Collection (DOI 10.3929/ethz-b-000690084)
as a single 12.6 GB ``machine_hall.zip`` bundle containing MH_01…MH_05.
There's no stable direct download URL — DSpace gates behind a UI —
so:

- Renamed entry: ``euroc_mh01`` → ``euroc_machine_hall`` (matches the
  actual artifact).
- SHA256 set to the real bundle hash 5ed7d07…
- URL left empty (same pattern as ``vpair_sample``); the CLI now
  exits 3 and prints fetch instructions for empty-URL entries instead
  of crashing on ``urllib.request.urlretrieve("")``.
- Adapter ``DatasetNotAvailableError`` message and conftest skip-reason
  updated to tell engineers how to fetch/unpack manually.
- ``test_registry_has_euroc_machine_hall`` pin test replaces the old
  pin; asserts real hash (not the ``"0"*64`` placeholder).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 17:52:06 +03:00

50 lines
1.7 KiB
Python

"""CLI: python scripts/download_dataset.py <dataset_name>
Registered datasets: see DATASET_REGISTRY in gps_denied.testing.download.
Entries with an empty URL are manual-download-only (e.g. EuRoC via ETH
Research Collection, VPAIR via a Zenodo form) — this script prints the
instructions and exits instead of guessing a download URL.
"""
import sys
from pathlib import Path
from gps_denied.testing.download import DATASET_REGISTRY, download_dataset
def main(argv: list[str]) -> int:
if len(argv) != 2:
print(f"usage: {argv[0]} <dataset_name>", file=sys.stderr)
print(f"available: {', '.join(DATASET_REGISTRY)}", file=sys.stderr)
return 2
name = argv[1]
if name not in DATASET_REGISTRY:
print(f"unknown dataset: {name}", file=sys.stderr)
print(f"available: {', '.join(DATASET_REGISTRY)}", file=sys.stderr)
return 2
spec = DATASET_REGISTRY[name]
if not spec.url:
print(
f"Dataset '{name}' has no automated download URL.",
file=sys.stderr,
)
print(
"Fetch manually, then place the archive so its SHA256 matches:\n"
f" expected sha256: {spec.sha256}\n"
f" expected path subdir under datasets/: {spec.target_subdir}\n"
"See DATASET_REGISTRY comments in src/gps_denied/testing/download.py "
"for per-dataset instructions.",
file=sys.stderr,
)
return 3
root = Path("datasets") / spec.target_subdir
dest = root / Path(spec.url).name
print(f"{dest}")
download_dataset(spec, dest)
print("OK")
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv))