galpy.potential.Potential.mass

Potential.mass(R, z=None, t=0.0, forceint=False)[source]

Evaluate the mass enclosed.

Parameters:
  • R (float or Quantity) – Cylindrical Galactocentric radius.

  • z (float or Quantity, optional) – Vertical height up to which to integrate (default: None).

  • t (float or Quantity, optional) – Time (default: 0.0).

  • forceint (bool, optional) – If True, calculate the mass through integration of the density, even if an explicit expression for the mass exists (default: False).

Returns:

Mass enclosed within the spherical shell with radius R if z is None else mass in the slab <R and between -z and z; except: potentials inheriting from EllipsoidalPotential, which if z is None return the mass within the ellipsoidal shell with semi-major axis R.

Return type:

float or Quantity

Notes

  • 2014-01-29 - Written - Bovy (IAS)

  • 2019-08-15 - Added spherical warning - Bovy (UofT)

  • 2021-03-15 - Changed to integrate to spherical shell for z is None slab otherwise - Bovy (UofT)

  • 2021-03-18 - Switched to using Gauss’ theorem - Bovy (UofT)