pnpl.datasets.mixins.OpenNeuroDownloadMixin

pnpl.datasets.mixins.OpenNeuroDownloadMixin#

class pnpl.datasets.mixins.OpenNeuroDownloadMixin[source]#

Mixin providing OpenNeuro download functionality.

Classes using this mixin should define:

  • OPENNEURO_DATASET_ID: str — e.g. "ds007523".

Optional class-level overrides:

  • OPENNEURO_SNAPSHOT_TAG: str — version tag, e.g. "1.0.1". Only used by list_remote_files(); downloads themselves go against the bucket root and pick up whatever the HEAD of the bucket holds (OpenNeuro keeps every published version forever, so missing files only mean the path is wrong, not that the version moved).

  • OPENNEURO_S3_BASE: str — defaults to https://s3.amazonaws.com/openneuro.org.

Expected instance attributes:

  • data_path: str — local data directory; remote paths are mapped relative to this.

  • download: bool — whether downloading is enabled.

__init__()#

Methods

__init__()

ensure_file(fpath)

Ensure a file exists locally, downloading from OpenNeuro if needed.

list_remote_files([refresh])

Return dataset-relative file paths advertised by OpenNeuro's GraphQL API for the configured snapshot.

prefetch_files(file_paths)

Prefetch multiple files in parallel (skips already-present).

resolve_remote_file(rel_path)

Return {"size", "url"} for a remote path via HEAD.

Attributes

OPENNEURO_DATASET_ID

OPENNEURO_S3_BASE

OPENNEURO_SNAPSHOT_TAG