yt.data_objects.profiles.create_profile

yt.data_objects.profiles.create_profile(data_source, bin_fields, fields, n_bins=64, extrema=None, logs=None, units=None, weight_field='cell_mass', accumulation=False, fractional=False, deposition='ngp')[source]

Create a 1, 2, or 3D profile object.

The dimensionality of the profile object is chosen by the number of fields given in the bin_fields argument.

Parameters:

data_source : YTSelectionContainer Object

The data object to be profiled.

bin_fields : list of strings

List of the binning fields for profiling.

fields : list of strings

The fields to be profiled.

n_bins : int or list of ints

The number of bins in each dimension. If None, 64 bins for each bin are used for each bin field. Default: 64.

extrema : dict of min, max tuples

Minimum and maximum values of the bin_fields for the profiles. The keys correspond to the field names. Defaults to the extrema of the bin_fields of the dataset. If a units dict is provided, extrema are understood to be in the units specified in the dictionary.

logs : dict of boolean values

Whether or not to log the bin_fields for the profiles. The keys correspond to the field names. Defaults to the take_log attribute of the field.

units : dict of strings

The units of the fields in the profiles, including the bin_fields.

weight_field : str or tuple field identifier

The weight field for computing weighted average for the profile values. If None, the profile values are sums of the data in each bin.

accumulation : bool or list of bools

If True, the profile values for a bin n are the cumulative sum of all the values from bin 0 to n. If -True, the sum is reversed so that the value for bin n is the cumulative sum from bin N (total bins) to n. If the profile is 2D or 3D, a list of values can be given to control the summation in each dimension independently. Default: False.

fractional : If True the profile values are divided by the sum of all

the profile data such that the profile represents a probability distribution function.

deposition : Controls the type of deposition used for ParticlePhasePlots.

Valid choices are ‘ngp’ and ‘cic’. Default is ‘ngp’. This parameter is ignored the if the input fields are not of particle type.

Examples

Create a 1d profile. Access bin field from profile.x and field data from profile[<field_name>].

>>> ds = load("DD0046/DD0046")
>>> ad = ds.h.all_data()
>>> profile = create_profile(ad, [("gas", "density")],
...                              [("gas", "temperature"),
...                               ("gas", "velocity_x")])
>>> print profile.x
>>> print profile["gas", "temperature"]