def pure(cls, z, absorption_energy_eV=None): """ Returns the material for the specified pure element. :arg z: atomic number :type z: :class:`int` :arg absorption_energy_eV: absorption energy of the different particles :type absorption_energy_eV: :class:`dict` """ name = ep.name(z) composition = {z: 1.0} density_kg_m3 = ep.mass_density_kg_m3(z) return cls(composition, name, density_kg_m3, absorption_energy_eV)
def kanaya_okayama(composition, energy): """ Returns the electron range (in meters). :arg composition: composition in weight fraction. The composition is specified by a dictionary. The keys are the atomic numbers and the values are the weight fractions between ]0.0, 1.0]. :type composition: :class:`dict` :arg energy: beam energy in eV """ r = 0.0; for z, fraction in composition.items(): dr = (0.0276 * (ep.atomic_mass_kg_mol(z) * 1000.0) * (energy / 1000.0) ** 1.67) / \ (z ** 0.89 * (ep.mass_density_kg_m3(z) / 1000.0)) r += fraction / (dr * 1e-6) return 1.0 / r;
def calculate_density(composition): """ Returns an estimate density from the composition using the pure element density and this equation. .. math:: \\frac{1}{\\rho} = \\sum{\\frac{1}{\\rho_i}} :arg composition: composition in weight fraction. The composition is specified by a dictionary. The key are atomic numbers and the values weight fractions. No wildcard are accepted. :type composition: :class:`dict` """ density = 0.0 for z, fraction in composition.items(): density += fraction / ep.mass_density_kg_m3(z) return 1.0 / density
def testmass_density(self): self.assertAlmostEqual(7.1900, ep.mass_density_kg_m3(24) / 1000.0)
def testmass_density(self): self.assertAlmostEqual(7.1900, ep.mass_density_kg_m3(24) / 1000.0) self.assertRaises(ValueError, self.ep.mass_density_kg_m3, 85) self.assertRaises(ValueError, self.ep.mass_density_kg_m3, 87) self.assertRaises(ValueError, self.ep.mass_density_kg_m3, 118)