The Plugin File

The plugin file is a means of modifying the available fields, quantities, data objects and so on without modifying the source code of yt.

The following configuration parameters need to be set in the ~/.yt/config file in order to enable the usage of a plugin file:

[lagos]

loadfieldplugins: True
pluginfilename: my_plugins.py

You can call your plugin file whatever you like, and after the imports inside the lagos module are completed, it is executed in that namespace.

The code in this file can thus add fields, add derived quantities, add datatypes, and on and on. For example, if I created a plugin file containing:

def _myfunc(field, data):
    return na.random.random(data["Density"].shape)
add_field("SomeQuantity", function=_myfunc)

then all of my data objects would have access to the field “SomeQuantity” despite its lack of use.

Comments

Feel free to leave comments! If you've got a GMail account, you can use https://www.google.com/accounts/o8/id as your OpenID URL.
comments powered by Disqus

Previous topic

Plot Modification Mechanisms

Next topic

Creating 3D Datatypes

This Page