load_study_osf#

pypillometry.load_study_osf(osf_id, path, subjects=None, force_download=False, config_file='pypillometry_conf.py', session=None)[source]#

Read a study from OSF using the configuration file. Example: https://osf.io/p2u74/

The configuration file (downloaded from the project) must define a dict raw_data (subject ID -> dict of data files; entries that are not files in the project are passed on unchanged) and a function read_subject(info) that returns the data for one subject. The listing of the project’s files is cached in path/info_osf.pkl and data files are only downloaded if they are not yet in path.

Parameters:
  • osf_id (str) – The OSF project ID

  • path (str) – Local path where files should be downloaded/stored

  • subjects (list[str]) – Subject ID or list of subject IDs to load. If None, all subjects will be loaded. IDs that are not in the study raise a ValueError.

  • force_download (bool) – If True, force re-download (including the file listing) even if files exist locally. Default False.

  • config_file (str) – Name of the configuration file. Default is “pypillometry_conf.py”

  • session (Optional[Session]) – Authenticated session for accessing private projects. If None, uses unauthenticated requests.

Returns:

  • study_data (dict) – Dictionary containing the loaded study data (subject ID -> result of read_subject)

  • config (module) – Module containing the configuration (pypillometry_conf.py imported as a module)