Skip to content

Commit

Permalink
change to config_v1.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
rettigl committed Jan 16, 2025
1 parent 276b774 commit d84d0ea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/user_guide/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ The config module contains a mechanism to collect configuration parameters from
It will load an (optional) provided config file, or alternatively use a passed python dictionary as initial config dictionary, and subsequently look for the following additional config files to load:

* ``folder_config``: A config file of name :file:`sed_config.yaml` in the current working directory. This is mostly intended to pass calibration parameters of the workflow between different notebook instances.
* ``user_config``: A config file provided by the user, stored as :file:`.config/sed/config.yaml` in the current user's home directly. This is intended to give a user the option for individual configuration modifications of system settings.
* ``system_config``: A config file provided by the system administrator, stored as :file:`/etc/sed/config.yaml` on Linux-based systems, and :file:`%ALLUSERSPROFILE%/sed/config.yaml` on Windows. This should provide all necessary default parameters for using the sed processor with a given setup. For an example for an mpes setup, see :ref:`example_config`
* ``user_config``: A config file provided by the user, stored as :file:`.config/sed/config_v1.yaml` in the current user's home directly. This is intended to give a user the option for individual configuration modifications of system settings.
* ``system_config``: A config file provided by the system administrator, stored as :file:`/etc/sed/config_v1.yaml` on Linux-based systems, and :file:`%ALLUSERSPROFILE%/sed/config_v1.yaml` on Windows. This should provide all necessary default parameters for using the sed processor with a given setup. For an example for an mpes setup, see :ref:`example_config`
* ``default_config``: The default configuration shipped with the package. Typically, all parameters here should be overwritten by any of the other configuration files.

The config mechanism returns the combined dictionary, and reports the loaded configuration files. In order to disable or overwrite any of the configuration files, they can be also given as optional parameters (path to a file, or python dictionary).
Expand Down
10 changes: 5 additions & 5 deletions src/sed/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def parse_config(
user_config (dict | str, optional): user-based config dictionary
or file path. The loaded dictionary is completed with the user-based values,
taking preference over system and default values.
Defaults to the file ".config/sed/config.yaml" in the current user's home directory.
Defaults to the file ".config/sed/config_v1.yaml" in the current user's home directory.
system_config (dict | str, optional): system-wide config dictionary
or file path. The loaded dictionary is completed with the system-wide values,
taking preference over default values. Defaults to the file "/etc/sed/config.yaml"
on linux, and "%ALLUSERSPROFILE%/sed/config.yaml" on windows.
taking preference over default values. Defaults to the file "/etc/sed/config_v1.yaml"
on linux, and "%ALLUSERSPROFILE%/sed/config_v1.yaml" on windows.
default_config (dict | str, optional): default config dictionary
or file path. The loaded dictionary is completed with the default values.
Defaults to *package_dir*/config/default.yaml".
Expand Down Expand Up @@ -96,7 +96,7 @@ def parse_config(
user_dict = copy.deepcopy(user_config)
else:
if user_config is None:
user_config = str(USER_CONFIG_PATH.joinpath("config.yaml"))
user_config = str(USER_CONFIG_PATH.joinpath("config_v1.yaml"))
if Path(user_config).exists():
user_dict = load_config(user_config)
if verbose:
Expand All @@ -107,7 +107,7 @@ def parse_config(
system_dict = copy.deepcopy(system_config)
else:
if system_config is None:
system_config = str(SYSTEM_CONFIG_PATH.joinpath("config.yaml"))
system_config = str(SYSTEM_CONFIG_PATH.joinpath("config_v1.yaml"))
if Path(system_config).exists():
system_dict = load_config(system_config)
if verbose:
Expand Down
11 changes: 7 additions & 4 deletions src/sed/loader/mpes/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,10 +902,13 @@ def gather_metadata(
metadata=metadata,
)

metadata = metadata_retriever.fetch_elab_metadata(
runs=self.runs,
metadata=metadata,
)
if self.runs:
metadata = metadata_retriever.fetch_elab_metadata(
runs=self.runs,
metadata=metadata,
)
else:
logger.warning('Fetching elabFTW metadata only supported for loading from "runs"')

return metadata

Expand Down

0 comments on commit d84d0ea

Please sign in to comment.