The configuration is loaded upon import from a YAML file in the directory where PyPhi is run: pyphi_config.yml. If no file is found, the default configuration is used.

The various options are listed here with their defaults.

Theoretical approximations

This section with deals assumptions that speed up computation at the cost of theoretical accuracy.

  • In certain cases, making a cut can actually cause a previously reducible concept to become a proper, irreducible concept. Assuming this can never happen can increase performance significantly, however the obtained results are not strictly accurate.

    >>> import pyphi

System resources

These settings control how much processing power and memory is available for PyPhi to use. The default values may not be appropriate for your use-case or machine, so please check these settings before running anything. Otherwise, there is a risk that simulations might crash (potentially after running for a long time!), resulting in data loss.

  • Control whether system cuts are evaluated in parallel, which requires more memory. If cuts are evaluated sequentially, only two BigMip instances need to be in memory at once.

    >>> pyphi.config.PARALLEL_CUT_EVALUATION
  • Control the number of CPU cores to evaluate unidirectional cuts. Negative numbers count backwards from the total number of available cores, with -1 meaning “use all available cores”.

    >>> pyphi.config.NUMBER_OF_CORES
  • If parallel computation is enabled, it will have its own, separate messages, which are always sent to standard output. This setting controls their verbosity, an integer from 0 to 100.

    >>> pyphi.config.PARALLEL_VERBOSITY
  • PyPhi employs several in-memory caches to speed up computation. However, these can quickly use a lot of memory for large networks or large numbers of them; to avoid thrashing, this options limits the percentage of a system’s RAM that the caches can collectively use.



PyPhi is equipped with a transparent caching system for the BigMip and Concept objects, which stores them as they are computed to avoid having to recompute them later. This makes it easy to play around interactively with the program, or to accumulate results with minimal effort. For larger projects, however, it is recommended that you manage the results explicitly, rather than relying on the cache. For this reason it is disabled by default.

  • Control whether BigMip objects are cached and automatically retreived.

    >>> pyphi.config.CACHE_BIGMIPS
  • Control whether Concept objects are cached and automatically retrieved.

    >>> pyphi.config.CACHE_CONCEPTS


Concept caching only has an effect when a database is used as the the caching backend.

  • Control whether TPMs should be normalized as part of concept normalization. TPM normalization increases the chances that a precomputed concept can be used again, but is expensive.

    >>> pyphi.config.NORMALIZE_TPMS
  • Control whether precomputed results are stored and read from a database or from a local filesystem-based cache in the current directory. Set this to ‘fs’ for the filesystem, ‘db’ for the database. Caching results on the filesystem is the easiest to use but least robust caching system. Caching results in a database is more robust and allows for caching individual concepts, but requires installing MongoDB.

    >>> pyphi.config.CACHING_BACKEND
  • Control how much caching information is printed. Takes a value between 0 and 11. Note that printing during a loop iteration can slow down the loop considerably.

    >>> pyphi.config.FS_CACHE_VERBOSITY
  • If the caching backend is set to use the filesystem, the cache will be stored in this directory. This directory can be copied and moved around if you want to reuse results _e.g._ on a another computer, but it must be in the same directory from which PyPhi is being run.

    >>> pyphi.config.FS_CACHE_DIRECTORY
  • Set the configuration for the MongoDB database backend. This only has an effect if the caching backend is set to use the database.

    >>> pyphi.config.MONGODB_CONFIG['host']
    >>> pyphi.config.MONGODB_CONFIG['port']
    >>> pyphi.config.MONGODB_CONFIG['database_name']
    >>> pyphi.config.MONGODB_CONFIG['collection_name']


These are the settings for PyPhi logging. You can control the format of the logs and the name of the log file. Logs can be written to standard output, a file, both, or none. See the documentation on Python’s logger for more information.

  • Control whether logs are written to a file.

    >>> pyphi.config.LOGGING_CONFIG['file']['enabled']
  • Control the name of the logfile.

    >>> pyphi.config.LOGGING_CONFIG['file']['filename']
  • Control the concern level of file logging. Can be one of 'DEBUG', 'INFO', 'WARNING', 'ERROR', or 'CRITICAL'.

    >>> pyphi.config.LOGGING_CONFIG['file']['level']
  • Control whether logs are written to standard output.

    >>> pyphi.config.LOGGING_CONFIG['stdout']['enabled']
  • Control the concern level of standard output logging. Same possible values as file logging.

    >>> pyphi.config.LOGGING_CONFIG['stdout']['level']
  • Controls whether the current configuration is printed when PyPhi is imported.

    >>> pyphi.config.LOG_CONFIG_ON_IMPORT

Numerical precision

  • Computations in PyPhi rely on finding the Earth Mover’s Distance. This is done via an external C++ library that uses flow-optimization to find a good approximation of the EMD. Consequently, systems with zero \(\Phi\) will sometimes be computed to have a small but non-zero amount. This setting controls the number of decimal places to which PyPhi will consider EMD calculations accurate. Values of \(\Phi\) lower than 10e-PRECISION will be considered insignificant and treated as zero. The default value is about as accurate as the EMD computations get.

    >>> pyphi.config.PRECISION


  • Control whether PyPhi checks if the network’s current state is possible, given the TPM and the past state. Nodes with no inputs are assumed to be able to have any state, and will not constrain the possible states.

    >>> pyphi.config.VALIDATE_NETWORK_STATE
  • If set to True, this defines the Phi value of subsystems containing only a single node with a self-loop to be 0.5. If set to False, their \(\Phi\) will be actually be computed (to be zero, in this implementation).



Load a configuration.


Return a string representation of the currently loaded configuration.


Print the current configuration.