load_ONharmony

load_ONharmony#

uniharmony.datasets.load_ONharmony(subjects: str | list[str] | Literal['all', '03286', '03997', '10975', '12813', '13192', '13305', '14221', '14229', '14230', '14482', '15320', '16745', '16766', '16793', '16794', '16841', '16842', '16974', '16975', '16981'], sessions: str | list[str], modalities: str | list[str] | Literal['all', 'anat', 'dwi', 'fmap', 'func', 'swi'], suffixes: str | list[str] = 'T1w', extensions: str | list[str] = '.json', target_path: str | Path = './ON-Harmony', dataset_url: str = 'https://github.com/OpenNeuroDatasets/ds004712.git', root_files: str | list[str] = 'participants.tsv', force_download: bool = False, copy: bool = True, hidden: bool = True, tmp_clean: bool = False, tmp_dir_name: str = 'datalad_cache') None#

Download derivatives from the ON-Harmony dataset and store them as files in a user-visible directory.

This function transparently uses a hidden DataLad dataset (stored in a temporary location) to retrieve files from OpenNeuro. All DataLad operations happen in the background. The user-visible directory contains only regular files (no symbolic links, Git metadata, or DataLad traces).

Only the requested files are downloaded. Each file is copied as a real file into the visible dataset directory and immediately dropped from the hidden DataLad cache to minimize disk usage.

Parameters:
subjectsstr or list

Subject identifiers to download.

sessionsstr or list

Session identifiers to download.

modalitiesstr or list

Modalities to download (“all”, “anat”, “ dwi”, “fmap”, “func”, “swi”).

suffixesstr or list, optional (default “T1w”)

BIDS suffixes to match in filenames (e.g., ‘T1w’, ‘T2w’).

extensionsstr or list, optional (default “.json”)

File extensions to download (e.g., ‘.json’, ‘.nii.gz’).

target_pathstr or pathlib.Path, optional (default “./ONHarmony”)

Path to the visible dataset directory where files will be stored.

dataset_urlstr, optional (default “OpenNeuroDatasets/”)

Source URL or path to the ON-Harmony dataset.

root_files: str or list, optional (default “participants.tsv”)

Name of the file list of files to get from the dataset’s root.

force_downloadbool, optional (default False)

Whether to force re-download the dataset if it already exists in cache.

copybool, optional (default True)

Whether to copy the downloaded files to the target directory to make it visible.

hiddenbool, optional (default True)

Whether to use a hidden directory or not. If hidden=False, no hidden folder is made and the target directory acts as hidden. This will avoid getting the files in /tmp/{tmp_dir_name} and then copying them to the target directory.

tmp_cleanbool, optional (default False)

Whether to drop the downloaded files from the hidden DataLad dataset after copying. If True, files are dropped immediately after copying to the target directory (if copy=True), to minimize disk usage. Ignored when hidden=False.

tmp_dir_namestr, optional (default “datalad_cache”)

Name of the temporary directory to store the hidden dataset. Ignored when hidden=False.

Notes

  • The visible dataset directory will contain only regular files following the BIDS derivatives structure.

  • Repeated calls are safe and will only download missing files.

Examples#

Load ON-Harmony dataset

Load ON-Harmony dataset