yt 2.4 documentation

Configuration File

Configuration File Format

yt will look for and recognize the file $HOME/.yt/config as a configuration file, containing several options that can be modified and adjusted to control runtime behavior. For example, a sample $HOME/.yt/config file could look like:

[yt]
loglevel = 1
maximumstoredpfs = 10000

This configuration file would set the logging threshold much lower, enabling much more voluminous output from yt. Additionally, it increases the number of parameter files tracked between instantiations of yt.

Configuration Options At Runtime

In addition to setting parameters in the configuration file itself, you can set them at runtime.

Warning

Several parameters are only accessed when yt starts up: therefore, if you want to modify any configuration parameters at runtime, you should execute the appropriate commands at the very top of your script!

This involves importing the configuration object and then setting a given parameter to be equal to a specific string. Note that even for items that accept integers, floating points and other non-string types, you must set them to be a string or else the configuration object will consider them broken.

Here is an example script, where we adjust the logging at startup:

from yt.config import ytcfg
ytcfg["yt", "loglevel"] = "1"

from yt.mods import *
pf = load("my_data0001")
pf.h.print_stats()

This has the same effect as setting loglevel = 1 in the configuration file.

Setting Configuration On the Command Line

Options can also be set directly on the command line by specifying a command-line option. For instance, if you are running the script my_script.py you can specify a configuration option with the --config argument. As an example, to lower the log level (thus making it more verbose) you can specify:

$ python2.7 my_script.py --config loglevel=1

Any configuration option specific to yt can be specified in this manner. One common configuration option would be to disable serialization:

$ python2.7 my_script.py --config serialize=False

This way projections are always re-created.

Available Configuration Options

The following parameters are available.

  • __parallel (default: 'False'): Internal parameter governing whether this run is being executed in parallel or not. Can be read from.
  • __parallel_rank (default: '0'): Internal parameter governing the rank of the current processor. Can be read from.
  • __parallel_size (default: '1'): Internal parameter governing the size of the parallel job. Can be read from.
  • coloredlogs (default: 'False'): Should logs be colored?
  • inline (default: 'False'): Internal parameter indicating whether this session is being called from within a running simulation code.
  • loadfieldplugins (default: 'True'): Do we want to load the plugin file?
  • logfile (default: 'False'): Should we output to a log file in the filesystem?
  • loglevel (default: '20'): What is the threshold (0 to 50) for outputing log files?
  • maximumstoredpfs (default: '500'): How many parameter files should be tracked between sessions?
  • onlydeserialize (default: 'False'): If true, only pull from .yt files, never add to them.
  • parameterfilestore (default: 'parameter_files.csv'): The name of the file in $HOME/.yt/ in which parameter files will be tracked.
  • pluginfilename (default 'my_plugins.py') The name of our plugin file.
  • serialize (default: 'True'): Are we allowed to write to the .yt file?
  • storeparameterfiles (default: 'False'): Should we track parameter files between sessions?
  • suppressStreamLogging (default: 'False'): If true, execution mode will be quiet.
  • timefunctions (default: 'False'): Should (some) functions report their runtime?