yt.data_objects.derived_quantities.CenterOfMass

class yt.data_objects.derived_quantities.CenterOfMass(data_source)[source]

Calculates the center of mass, using gas and/or particles.

The center of mass is the mass-weighted mean position.

Parameters:

use_gas : bool

Flag to include gas in the calculation. Gas is ignored if not present. Default: True

use_particles : bool

Flag to include particles in the calculation. Particles are ignored if not present. Default: False

Examples

>>> ds = load("IsolatedGalaxy/galaxy0030/galaxy0030")
>>> ad = ds.all_data()
>>> print ad.quantities.center_of_mass()

Attributes

Methods