zea.set_data_pathsΒΆ

zea.set_data_paths(user_config=None, local=True, verify=True)[source]ΒΆ

Get data paths (absolute paths to location of data).

Parameters:
  • user_config (Union[str, dict, None]) – Path to a YAML file with user info. If None, uses ./users.yaml as the default file. Can also be a dictionary structured as shown below.

  • local (bool | None) – Whether to pick the local or the remote path for entries that define both (e.g. a local disk and a remote share). Default is True. Set to None when every path that applies is a plain string, i.e. shared between local and remote.

  • verify (bool) – Verify that the paths exist and are directories. Default is True.

Example YAML structure:

data_root: ...
output: ...

You can also specify different data_root for different users and machines:

my_username:
  my_hostname:
    system: windows
    data_root: ...
    output: ...
  other_hostname:
    system: linux
    data_root:
      local: ...
      remote: ...
  # If both my_hostname and other_hostname are not matching, fallback to:
  system: linux
  data_root: ...

other_username:
  data_root: ...

The machine section takes precedence over the user section, which takes precedence over the userless and machineless one at the bottom. Precedence is per key, so a section only needs to set what it changes: a machine that pins just system still inherits data_root and output from the levels above it.

Returns:

Absolute paths to location of data. Stores the following parameters:

data_root, zea_root, output, system, username, hostname

Return type:

Config

Raises:

ValueError – If user_config is not a string, dictionary or None.

Note

When user_config points to a YAML file that does not exist yet, an empty one is created and – when running interactively – you are offered to set up a profile, see create_new_user(). When no data_root can be resolved for the current user and machine, a warning is raised and a default path for the current operating system is used. output is optional and stays None when the file does not set one.