load_study_local#

pypillometry.load_study_local(path, config_file='pypillometry_conf.py', subjects=None, cache_dir=None, autodelete=None, force_download=False)[source]#

Read a study from a local directory (or an SSH URL) using the configuration file.

The configuration file must define a dict raw_data (subject ID -> dict of data files, relative to path) and a function read_subject(info) that returns the data for one subject; it is called with the working directory changed to path.

If path is an SSH URL (ssh://server/folder/, see fetch_url()), the configuration file and the data files of the selected subjects are downloaded to cache_dir before they are read.

Parameters:
  • path (str) – Local path or SSH URL where the study data is stored

  • config_file (str) – Name of the configuration file. Default is “pypillometry_conf.py”. It is first looked up in the current working directory and, if not found there, in path.

  • 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.

  • cache_dir (Optional[str]) – only for SSH URLs: directory to download the files to; if None, a temporary directory is used

  • autodelete (Optional[bool]) – only for SSH URLs: if True, the data files of each subject are deleted after they were read (and a temporary directory is removed at the end). If None (default), this is done only when a temporary directory is used (no cache_dir).

  • force_download (bool) – only for SSH URLs: download files again even if they are already in cache_dir

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)