mass_density

plasmapy.physics.parameters.mass_density(density, particle: Optional[str] = None, z_mean: Optional[numbers.Real] = None) -> Unit("kg / m3")

Utility function to merge two possible inputs for particle charge.

Parameters:
  • density (Quantity) – Either a particle density (number of particles per unit volume, in units of 1/m^3) or a mass density (in units of kg/m^3 or equivalent).
  • particle (str, optional) – Representation of the particle species (e.g., 'p' for protons, 'D+' for deuterium, or 'He-4 +1' for singly ionized helium-4), which defaults to electrons. If no charge state information is provided, then the particles are assumed to be singly charged.
  • z_mean (float) – An optional float describing the average ionization of a particle species.
Raises:

ValueError – If the density has units incovertible to either a particle density or a mass density, or if you pass in a number density without a particle.

Returns:

The mass density calculated from all the provided sources of information.

Return type:

Quantity