download_meta#

torch_brain.utils.openneuro.download_meta(dataset_id, target_dir, filename, *, redownload=False, required=False)[source]#

Download a metadata file from OpenNeuro S3.

Parameters:
  • dataset_id (str) – The OpenNeuro dataset identifier

  • target_dir (Path) – Local directory to download to

  • filename (str) – Metadata filename at the dataset root (for example, "dataset_description.json" or "participants.tsv")

  • redownload (bool) – If True, re-download and overwrite any existing local file. If False (default), an existing local file is returned as-is.

  • required (bool) – If True, raise RuntimeError when the file is missing on S3. If False (default), return None when the file is absent.

Return type:

Path | None

Returns:

Path to the downloaded or existing local file, or None if the file is not present on S3 and required is False.

Raises:

RuntimeError – If the download fails, or if the file is missing on S3 and required is True.