Runtime Configuration¶
To configure the runtime behavior such as the logging system or other parameters, the configuration module reads several config files to build its final set of settings. It searches for the file ‘pyemma.cfg’ in several locations with different priorities:
- $CWD/pyemma.cfg
- $HOME/.pyemma/pyemma.cfg
- ~/pyemma.cfg
- $PYTHONPATH/pyemma/pyemma.cfg (always taken as default configuration file)
The same applies for the filename ”.pyemma.cfg” (hidden file).
The default values are stored in latter file to ensure these values are always defined. This is preferred over hardcoding them somewhere in the Python code.
After the first import of pyemma, you will find a .pyemma directory in your user directory. It contains a pyemma.cfg and logging.yml. The latter is a YAML file to configure the logging system. For details have a look at the brief documentation: https://docs.python.org/2/howto/logging.html
Default configuration file¶
Default settings are stored in a provided pyemma.cfg file, which is included in the Python package:
################################################################################
# PyEMMA configuration file
#
# notes:
# - comments are not allowed in line, since they would be appended to the value!
################################################################################
[pyemma]
# Source to logging configuration file (YAML)
# special value: DEFAULT (use default config)
# if this is set to a filename, it will be red to configure logging. If it is a
# relative path, it is assumed to be located next to where you start your interpreter
logging_config = DEFAULT
# show or hide progress bars globally?
show_progress_bars = True
# useful for trajectory formats, for which one has to read the whole file to get len
# eg. XTC format.
use_trajectory_lengths_cache = True
To access the config at runtime eg. the logging section:
>>> from pyemma import config
>>> print(config.show_progress_bars)
True
or
>>> config.show_progress_bars = False
>>> print(config.show_progress_bars)
False
Notes
All values are being stored as strings, so to compare eg. if a value is True, compare for:
if pyemma.config.show_progress_bars == 'True':
...
-
pyemma.util.config.
configParser
= <ConfigParser.SafeConfigParser instance>¶ instance of
ConfigParser.SafeConfigParser
to have always valid config values.
-
pyemma.util.config.
used_filenames
= ['/home/marscher/.pyemma/pyemma.cfg', '/home/marscher/.pyemma/pyemma.cfg']¶ these filenames have been tried to red to obtain basic configuration values.