read_config#
- read_config(filename, verbose=False)[source]#
Read a single configuration file.
If the input filename does not specifically include a directory, it is looked for in the default
PACKAGE_PATH.joinpath("config")directory.Currently, only
.tomlconfiguration files are supported.
- Parameters:
filename (
str,listordict) –Filename of the configuration file. If no extension is provided,
.tomlis assumed:filename="supernova"is equivalent tofilename="supernova.toml". A dict is returned as is.filenamecan also be a list of names, dicts, or a mix of both. These nested dictionaries are merged from left to right, such that forfilename = ["supernova", "zodi"], the configuration from"zodi"overwrites the corresponding (nested) entries from"supernova". A dict element is assumed to be a configuration. For example,["supernova", {"scene": {"pointsource": {"source": [lbda_ref, flux_ref]}}}]overwrites thescene.pointsource.sourceentry of the"supernova"configuration.verbose (
bool, optional) – If True, print the name of the file being read (not propagated to the elements of a list). Default is False.
- Returns:
dict– Configuration as a nested dictionary.- Raises:
NotImplementedError – If the configuration file extension is not supported.