Runtime Configuration

You can change some runtime behaviour of PyEMMA by setting a configuration value in PyEMMAs config module. These can be persisted to hard disk to be permanent on every import of the package.

Change values

To access the config at runtime eg. if progress bars should be shown:

>>> from pyemma import config 
>>> print(config.show_progress_bars) 
True
>>> config.show_progress_bars = False 
>>> print(config.show_progress_bars) 
False

Store your changes / Create a configuration directory

To create an editable configuration file, use the pyemma.config.save() method:

>>> from pyemma import config 
>>> config.save('/tmp/pyemma_current.cfg') 

This will store the current runtime configuration values in the given file. Note that these settings will not be used on the next start of PyEMMA, because you first need to tell us, where you have stored this file. To do so, please set the environment variable “PYEMMA_CFG_DIR” to the directory, where you have stored the config file.

  • For Linux/OSX this thread thread may be helpful.
  • For Windows have a look at this.

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]
# configuration notice shown?
show_config_notification = False

# 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
# maximum entries in database
traj_info_max_entries = 50000
# max size in MB
traj_info_max_size = 500

Configuration files

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)

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.

If no configuration file could be found, the defaults from the shipped package will apply.

Load a configuration file

In order to load a pre-saved configuration file, use the load() method:

>>> from pyemma import config 
>>> config.load('pyemma_silent.cfg')