yt.raven.PlotCollectionInteractive.add_phase_object

PlotCollectionInteractive.add_phase_object(*args, **kwargs)

From an existing object, create a 2D, binned profile.

This function will accept an existing AMRData source and from that, it will generate a Binned2DProfile, based on the specified options. This is useful if you have extracted a region, or if you wish to bin some set of massages data – or even if you wish to bin anything other than a sphere. The profile will be 2D, which means while it can have an arbitrary number of fields, those fields will all be binned based on two fields.

Parameters :

data_source : yt.lagos.AMRData

This is a data source respecting the AMRData protocol (i.e., it has grids and so forth) that will be used as input to the profile generation.

fields : list of strings

The first element of this list is the field by which we will bin into the y-axis, the second is the field by which we will bin onto the y-axis. All subsequent fields will be binned and their profiles added to the underlying BinnedProfile2D.

cmap : string, optional

An acceptable colormap. See either raven.color_maps or http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps .

weight : string, default “CellMassMsun”

The weighting field for an average. This defaults to mass-weighted averaging.

accumulation : list of booleans, optional

If true, from the low-value to the high-value the values in all binned fields will be accumulated. This is useful for instance when adding an unweighted CellMassMsun to a radial plot, as it will show mass interior to that radius. The first value is for the x-axis, the second value for the y-axis. Note that accumulation will only be along each row or column.

x_bins : int, optional

How many bins should there be in the x-axis variable?

x_log : boolean, optional

Should the bin edges be log-spaced?

x_bounds : tuple of floats, optional

If specified, the boundary values for the binning. If unspecified, the min/max from the data_source will be used. (Non-zero min/max in case of log-spacing.)

y_bins : int, optional

How many bins should there be in the y-axis variable?

y_log : boolean, optional

Should the bin edges be log-spaced?

y_bounds : tuple of floats, optional

If specified, the boundary values for the binning. If unspecified, the min/max from the data_source will be used. (Non-zero min/max in case of log-spacing.)

lazy_reader : boolean, optional

If this is false, all of the data will be read into memory before any processing occurs. It defaults to true, and grids are binned on a one-by-one basis. Note that parallel computation requires this to be true.

id : int, optional

If specified, this will be the “semi-unique id” of the resultant plot. This should not be set.

figure : matplotlib.figure.Figure, optional

The figure onto which the axes will be placed. Typically not used unless axes is also specified.

axes : matplotlib.axes.Axes, optional

The axes object which will be used to create the image plot. Typically used for things like multiplots and the like.

fractional : boolean

If true, the plot will be normalized to the sum of all the binned values.

Returns :

plot : yt.raven.PlotTypes.PhasePlot

The plot that has been added to the PlotCollection.

See also

yt.lagos.BinnedProfile2D
This is the object that does the transformation of raw data into a 1D profile.

Examples

This will show the mass-distribution in the Density-Temperature plane.

>>> pf = load("RD0005-mine/RedshiftOutput0005")
>>> reg = pf.h.region([0.1, 0.2, 0.3], [0.0, 0.1, 0.2],
...                   [0.2, 0.3, 0.4])
>>> pc.add_phase_object(reg, ["Density", "Temperature", "CellMassMsun"],
...                     weight = None)

This Page