exspy.material
#

Convert atomic percent to weight percent. 

Convert weight percent (wt%) to atomic percent (at.%). 

Calculate the density of a mixture of elements. 

Mass absorption coefficient (mu/rho) of a Xray absorbed in a pure material. 

Calculate the mass absorption coefficient for Xray absorbed in a mixture of elements. 
 exspy.material.atomic_to_weight(atomic_percent, elements='auto')#
Convert atomic percent to weight percent.
 Parameters:
 Returns:
weight_percent – composition in weight percent.
 Return type:
as atomic_percent
Examples
Calculate the weight percent of modern bronze given its atomic percent: >>> hs.material.atomic_to_weight([93.2, 6.8], (“Cu”, “Sn”)) array([ 88.00501989, 11.99498011])
 exspy.material.density_of_mixture(weight_percent, elements='auto', mean='harmonic')#
Calculate the density of a mixture of elements.
The density of the elements is retrieved from an internal database. The calculation is only valid if there is no interaction between the components.
 Parameters:
weight_percent (list of float or list of signals) – A list of weight percent for the different elements. If the total is not equal to 100, each weight percent is divided by the sum of the list (normalization).
elements (list of str) – A list of element symbols, e.g. [‘Al’, ‘Zn’]. If elements is ‘auto’, take the elements in en each signal metadata of the weight_percent list.
mean ('harmonic' or 'weighted') – The type of mean use to estimate the density
 Returns:
density
 Return type:
The density in g/cm3.
Examples
Calculate the density of modern bronze given its weight percent: >>> hs.material.density_of_mixture([88, 12],[‘Cu’, ‘Sn’]) 8.6903187973131466
 exspy.material.mass_absorption_coefficient(element, energies)#
Mass absorption coefficient (mu/rho) of a Xray absorbed in a pure material.
The mass absorption is retrieved from the database of Chantler2005
 Parameters:
 Return type:
mass absorption coefficient(s) in cm^2/g
Examples
>>> hs.material.mass_absorption_coefficient( >>> element='Al', energies=['C_Ka','Al_Ka']) array([ 26330.38933818, 372.02616732])
See also
mass_absorption_mixture()
Note
See https://dx.doi.org/10.18434/T4HS32 Chantler, C.T., Olsen, K., Dragoset, R.A., Kishore, A.R., Kotochigova, S.A., and Zucker, D.S. (2005), XRay Form Factor, Attenuation and Scattering Tables (version 2.1).
 exspy.material.mass_absorption_mixture(weight_percent, elements='auto', energies='auto')#
Calculate the mass absorption coefficient for Xray absorbed in a mixture of elements.
The mass absorption coefficient is calculated as a weighted mean of the weight percent and is retrieved from the database of Chantler2005.
 Parameters:
weight_percent (list of float or list of signals) – The composition of the absorber(s) in weight percent. The first dimension of the matrix corresponds to the elements.
elements (list of str or 'auto') – The list of element symbol of the absorber, e.g. [‘Al’,’Zn’]. If elements is ‘auto’, take the elements in each signal metadata of the weight_percent list.
energies (list of float or list of str or 'auto') – The energy or energies of the Xray in keV, or the name of the Xrays, e.g. ‘Al_Ka’. If ‘auto’, take the lines in each signal metadata of the weight_percent list.
Examples
>>> hs.material.mass_absorption_mixture( >>> elements=['Al','Zn'], weight_percent=[50,50], energies='Al_Ka') 2587.41616439
 Returns:
float or array of float
mass absorption coefficient(s) in cm^2/g
See also
mass_absorption_coefficient()
Note
See https://dx.doi.org/10.18434/T4HS32 Chantler, C.T., Olsen, K., Dragoset, R.A., Kishore, A.R., Kotochigova, S.A., and Zucker, D.S. (2005), XRay Form Factor, Attenuation and Scattering Tables (version 2.1).
 exspy.material.weight_to_atomic(weight_percent, elements='auto')#
Convert weight percent (wt%) to atomic percent (at.%).
 Parameters:
 Returns:
atomic_percent – Composition in atomic percent.
 Return type:
as weight_percent
Examples
Calculate the atomic percent of modern bronze given its weight percent: >>> hs.material.weight_to_atomic((88, 12), (“Cu”, “Sn”)) array([ 93.19698614, 6.80301386])