miblab.osf_fetch#

miblab.osf_fetch(dataset: str, folder: str, project: str = 'un5ct', token: str | None = None, extract: bool = True, verbose: bool = True)[source]#

Download a dataset from OSF (Open Science Framework).

This function downloads a specific dataset (folder or subfolder) from a public or private OSF project. Files are saved into the specified local directory. If a zip file is found, it will be extracted by default.

Parameters:
  • dataset (str) – Subfolder path inside the OSF project. If an empty string, all files in the root will be downloaded (use with caution).

  • folder (str) – Local folder where the dataset will be saved.

  • project (str, optional) – OSF project ID (default is “un5ct”).

  • token (str, optional) – Personal OSF token for accessing private projects. Read from OSF_TOKEN environment variable if needed.

  • extract (bool, optional) – Whether to automatically unzip downloaded .zip files (default is True).

  • verbose (bool, optional) – Whether to print progress messages (default is True).

Raises:
Returns:

Path to the local folder containing the downloaded data.

Return type:

str

Example

>>> from miblab import osf_fetch
>>> osf_fetch('TRISTAN/RAT/bosentan_highdose/Sanofi', 'test_download')