mass_density¶
-
plasmapy.formulary.parameters.
mass_density
(density: [Unit("1 / m3"), Unit("kg / m3")], particle: Union[plasmapy.particles.particle_class.Particle, str], z_ratio: Optional[numbers.Real] = 1) -> Unit("kg / m3")¶ Calculates the mass density from a number density.
\[\rho = \left| \frac{Z_{s}}{Z_{particle}} \right| n_{s} m_{particle} = | Z_{ratio} | n_{s} m_{particle}\]where \(m_{particle}\) is the particle mass, \(n_{s}\) is a number density for plasma species \(s\), \(Z_{s}\) is the integer charge of species \(s\), and \(Z_{particle}\) is the integer charge of
particle
. For example, if the electron density is given for \(n_s\) andparticle
is a doubly ionized atom, then \(Z_{ratio} = -1 / 2\).Aliases:
rho_
Parameters: - density (
Quantity
) – Either a particle number density (in units of \(m^{-3}\) or equivalent) or a mass density (in units of \(kg/m^3\) or equivalent). Ifdensity
is a mass density, then it will be passed through and returned without modification. - particle (
Particle
) – The particle for which the mass density is being calculated for. Must be aParticle
or a value convertible to aParticle
(e.g.,'p'
for protons,'D+'
for deuterium, or'He-4 +1'
for singly ionized helium-4). - z_ratio (
int
,float
, optional) – The ratio of the integer charges corresponding to the plasma species represented bydensity
and theparticle
. For example, if the givendensity
is and electron density andparticle
is doubly ionizedHe
, thenz_ratio = -0.5
. Default is1
.
Raises: UnitTypeError
– If thedensity
does not have units equivalent to a number density or mass density.TypeError
– Ifdensity
is not of typeQuantity
, or convertible.TypeError
– Ifparticle
is not of type or convertible toParticle
.TypeError
– Ifz_ratio
is not of typeint
orfloat
.ValueError
– Ifdensity
is negative.
Returns: The mass density for the plasma species represented by
particle
.Return type: Examples
>>> import astropy.units as u >>> mass_density(1 * u.m ** -3, 'p') <Quantity 1.67262...e-27 kg / m3> >>> mass_density(4 * u.m ** -3, 'D+') <Quantity 1.33743...e-26 kg / m3> >>> mass_density(2.e12 * u.cm ** -3, 'He') <Quantity 1.32929...e-08 kg / m3> >>> mass_density(2.e12 * u.cm ** -3, 'He', z_ratio=0.5) <Quantity 6.64647...e-09 kg / m3> >>> mass_density(1.0 * u.g * u.m ** -3, "") <Quantity 0.001 kg / m3>
- density (