yt.data_objects.data_containers.YTSelectionContainer2D.to_frb

YTSelectionContainer2D.to_frb(width, resolution, center=None, height=None, periodic=False)[source]

This function returns a FixedResolutionBuffer generated from this object.

A FixedResolutionBuffer is an object that accepts a variable-resolution 2D object and transforms it into an NxM bitmap that can be plotted, examined or processed. This is a convenience function to return an FRB directly from an existing 2D data object.

Parameters:

width : width specifier

This can either be a floating point value, in the native domain units of the simulation, or a tuple of the (value, unit) style. This will be the width of the FRB.

height : height specifier

This will be the physical height of the FRB, by default it is equal to width. Note that this will not make any corrections to resolution for the aspect ratio.

resolution : int or tuple of ints

The number of pixels on a side of the final FRB. If iterable, this will be the width then the height.

center : array-like of floats, optional

The center of the FRB. If not specified, defaults to the center of the current object.

periodic : bool

Should the returned Fixed Resolution Buffer be periodic? (default: False).

Returns:

frb : FixedResolutionBuffer

A fixed resolution buffer, which can be queried for fields.

Examples

>>> proj = ds.proj("Density", 0)
>>> frb = proj.to_frb( (100.0, 'kpc'), 1024)
>>> write_image(np.log10(frb["Density"]), 'density_100kpc.png')