yt.visualization.volume_rendering.transfer_function_helper module

class yt.visualization.volume_rendering.transfer_function_helper.TransferFunctionHelper(ds)[source]

Bases: object

A transfer function helper.

This attempts to help set up a good transfer function by finding bounds, handling linear/log options, and displaying the transfer function combined with 1D profiles of rendering quantity.


ds (A Dataset instance) – A static output that is currently being rendered. This is used to help set up data bounds.



Builds the transfer function according to the current state of the TransferFunctionHelper.


Return type

A ColorTransferFunction object.

plot(fn=None, profile_field=None, profile_weight=None)[source]

Save the current transfer function to a bitmap, or display it inline.


fn (string, optional) – Filename to save the image to. If None, the returns an image to an IPython session.


Return type

If fn is None, will return an image to an IPython notebook.

profiles = None

Set the bounds of the transfer function.


bounds (array-like, length 2, optional) – A length 2 list/array in the form [min, max]. These should be the raw values and not the logarithm of the min and max. If bounds is None, the bounds of the data are calculated from all of the data in the dataset. This can be slow for very large datasets.


Set the field to be rendered


field (string) – The field to be rendered.


Set whether or not the transfer function should be in log or linear space. Also modifies the ds.field_info[field].take_log attribute to stay in sync with this setting.


log (boolean) – Sets whether the transfer function should use log or linear space.


Setup a default colormap

Creates a ColorTransferFunction including 10 gaussian layers whose colors sample the ‘nipy_spectral’ colormap. Also attempts to scale the transfer function to produce a natural contrast ratio.

setup_profile(profile_field=None, profile_weight=None)[source]