yt.data_objects.derived_quantities.
WeightedVariance
(data_source)[source]¶Calculates the weighted variance and weighted mean for a field or list of fields.
Where f is the field, w is the weight, and <f_w> is the weighted mean, the weighted variance is Sum_i( (f_i - <f_w>)^2 * 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_variance([("gas", "density"),
... ("gas", "temperature")],
... ("gas", "cell_mass"))
Attributes
Methods