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.
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 >>> pyphi.config.ASSUME_CUTS_CANNOT_CREATE_NEW_CONCEPTS False
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
BigMipinstances need to be in memory at once.
>>> pyphi.config.PARALLEL_CUT_EVALUATION True
Control the number of CPU cores to evaluate unidirectional cuts. Negative numbers count backwards from the total number of available cores, with
-1meaning “use all available cores”.
>>> pyphi.config.NUMBER_OF_CORES -1
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 0
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.config.MAXIMUM_CACHE_MEMORY_PERCENTAGE 50
PyPhi is equipped with a transparent caching system for the
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.
BigMipobjects are cached and automatically retreived.
>>> pyphi.config.CACHE_BIGMIPS False
Conceptobjects are cached and automatically retrieved.
>>> pyphi.config.CACHE_CONCEPTS False
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 True
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 'fs'
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 0
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 '__pyphi_cache__'
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'] 'localhost' >>> pyphi.config.MONGODB_CONFIG['port'] 27017 >>> pyphi.config.MONGODB_CONFIG['database_name'] 'pyphi' >>> pyphi.config.MONGODB_CONFIG['collection_name'] 'test'
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'] True
Control the name of the logfile.
>>> pyphi.config.LOGGING_CONFIG['file']['filename'] 'pyphi.log'
Control the concern level of file logging. Can be one of
>>> pyphi.config.LOGGING_CONFIG['file']['level'] 'INFO'
Control whether logs are written to standard output.
>>> pyphi.config.LOGGING_CONFIG['stdout']['enabled'] True
Control the concern level of standard output logging. Same possible values as file logging.
>>> pyphi.config.LOGGING_CONFIG['stdout']['level'] 'INFO'
Controls whether the current configuration is printed when PyPhi is imported.
>>> pyphi.config.LOG_CONFIG_ON_IMPORT True
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-PRECISIONwill be considered insignificant and treated as zero. The default value is about as accurate as the EMD computations get.
>>> pyphi.config.PRECISION 6
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 False
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).
>>> pyphi.config.SINGLE_NODES_WITH_SELFLOOPS_HAVE_PHI False
Load a configuration.
Return a string representation of the currently loaded configuration.
Print the current configuration.