exception pecans.utilities.config.ConfigurationError[source]

An error that represents something wrong in the PECANS configuration.

This should be raised specifically if there is something wrong with what the user has given in the config file.

pecans.utilities.config.get_domain_size_from_config(config: dict, all_dims=False)[source]

Helper function that reads the domain size (as a tuple) from a configuration object.

Parameters:
  • config (BetterConfig) – the configuration object to read the domain size from.

  • all_dims (bool) – whether to include just non-zero dimensions (False, default) or all dimensions (True)

Returns:

the shape of the domain, as a tuple with 1, 2, or 3 elements depending if the domain is 1-, 2-, or 3- D.

Return type:

tuple of int

pecans.utilities.config.load_config_file(config_file)[source]

Reads a configuration file and returns a BetterConfig instance representing it

This function automatically instantiates a BetterConfig instance, sets it to parse values into Python literals (including tuples or dicts) :param config_file: the file to read. :type config_file: str or list :return: the BetterConfig object