mass_density(density, particle: str = None, z_mean: float = None) -> Unit("kg / m3")¶
Utility function to merge two possible inputs for particle charge.
- density (Quantity) – Either a particle density (number of particles per density, 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.,
'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.
ValueError– If the
densityhas units incovertible to either a particle density or a mass density, or if you pass in a number density without a particle.
The mass density calculated from all the provided sources of information.