osl_dynamics.files.fetch_file#
- osl_dynamics.files.fetch_file(path)#
Local path to a file in osl-files, downloading it if it isn’t cached.
Any file listed in the osl-files registry can be fetched, including ones osl-dynamics does not use itself.
Files are cached in
~/Library/Caches/osl-fileson macOS and~/.cache/osl-fileson Linux. Set theOSL_DATAenvironment variable to cache them somewhere else.- Parameters:
- pathstr
Path of the file within osl-files, e.g.
"parcellation/atlas-AAL_nparc-78_space-MNI_res-8x8x8.nii.gz".
- Returns:
- pathpathlib.Path
Full path to the cached file.
- Raises:
- FileNotFoundError
If osl-files has no file at that path.
- DownloadError
If the file is not cached and could not be downloaded.
Examples
>>> from osl_dynamics.files import fetch_file >>> fetch_file("parcellation/atlas-AAL_nparc-78_space-MNI_res-8x8x8.nii.gz")