yt.data_objects.derived_quantities.
WeightedAverageQuantity
(data_source)[source]¶Calculates the weight average of a field or fields.
Where f is the field and w is the weight, the weighted average is Sum_i(f_i * w_i) / Sum_i(w_i).
Parameters: | fields : field or list of fields
weight : field
|
---|
Examples
>>> ds = load("IsolatedGalaxy/galaxy0030/galaxy0030")
>>> ad = ds.all_data()
>>> print ad.quantities.weighted_average_quantity([("gas", "density"),
... ("gas", "temperature")],
... ("gas", "cell_mass"))
Attributes
Methods