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:

  1. $CWD/pyemma.cfg
  2. $HOME/.pyemma/pyemma.cfg
  3. ~/pyemma.cfg
  4. $PYTHONPATH/pyemma/pyemma.cfg (always taken as default configuration file)

The same applies for the filename ”.pyemma.cfg” (hidden file).

Note that you can also override the location of the configuration directory by setting an environment variable named “PYEMMA_CFG_DIR” to a writeable path to override the location of the config files.

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