laion_fmri.download

Download logic for the LAION-fMRI dataset.

Functions

accept_licenses([include_stimuli])

Walk through the license-acceptance flow without downloading.

download(subject[, ses, task, space, desc, ...])

Download dataset files for a subject, narrowed by BIDS entities.

laion_fmri.download.accept_licenses(include_stimuli=False)[source]

Walk through the license-acceptance flow without downloading.

Same prompts download() triggers internally on first use:

  • The dataset license (CC0 1.0) is always presented.

  • The stimulus license is presented when include_stimuli is True.

On acceptance the marker files are written so subsequent download(...) calls won’t prompt again.

Parameters:

include_stimuli (bool) – If True, also prompt for the stimulus license.

Raises:
  • LicenseNotAcceptedError – If the dataset license is declined.

  • RuntimeError – If the stimulus license is declined when requested.

laion_fmri.download.download(subject, ses=None, task=None, space=None, desc=None, stat=None, suffix=None, extension=None, include_stimuli=False, n_jobs=1)[source]

Download dataset files for a subject, narrowed by BIDS entities.

The download is idempotent: a file whose local size already matches the S3 size is skipped, so re-running after an interrupted transfer only fetches what’s missing.

Parameters:
  • subject (int, str, or "all") – Subject identifier (BIDS ID, integer index, or “all”).

  • ses (str or list[str], optional) – BIDS-entity filters. Each accepts a bare value (ses="04") or the full BIDS token (ses="ses-04"). A list narrows to multiple values. Files that don’t carry an entity are not excluded by a filter on it (so subject-level summaries survive a ses= filter).

  • task (str or list[str], optional) – BIDS-entity filters. Each accepts a bare value (ses="04") or the full BIDS token (ses="ses-04"). A list narrows to multiple values. Files that don’t carry an entity are not excluded by a filter on it (so subject-level summaries survive a ses= filter).

  • space (str or list[str], optional) – BIDS-entity filters. Each accepts a bare value (ses="04") or the full BIDS token (ses="ses-04"). A list narrows to multiple values. Files that don’t carry an entity are not excluded by a filter on it (so subject-level summaries survive a ses= filter).

  • desc (str or list[str], optional) – BIDS-entity filters. Each accepts a bare value (ses="04") or the full BIDS token (ses="ses-04"). A list narrows to multiple values. Files that don’t carry an entity are not excluded by a filter on it (so subject-level summaries survive a ses= filter).

  • stat (str or list[str], optional) – BIDS-entity filters. Each accepts a bare value (ses="04") or the full BIDS token (ses="ses-04"). A list narrows to multiple values. Files that don’t carry an entity are not excluded by a filter on it (so subject-level summaries survive a ses= filter).

  • suffix (str or list[str], optional) – BIDS suffix filter ("statmap", "events", …).

  • extension (str or list[str], optional) – File extension filter ("nii.gz", "tsv", …).

  • include_stimuli (bool) – Whether to include stimulus images (requires ToU acceptance).

  • n_jobs (int) – Number of parallel download workers (aws s3 cp subprocesses). 1 (default) is sequential.

Raises:
  • SubjectNotFoundError – If the subject identifier is invalid.

  • LicenseNotAcceptedError – If the dataset license is declined.