hyperspy.misc.eds.utils module¶
-
hyperspy.misc.eds.utils.
edx_cross_section_to_zeta
(cross_sections, elements)¶ Convert a list of cross_sections in barns (b) to zeta-factors (kg/m^2).
Parameters: - cross_section (list of float) – A list of cross sections in barns.
- elements (list of str) – A list of element chemical symbols in the same order as the cross sections e.g. [‘Al’,’Zn’]
Returns: zeta_factors – zeta_factors with units kg/m^2.
Return type: list of float
-
hyperspy.misc.eds.utils.
electron_range
(element, beam_energy, density='auto', tilt=0)¶ Returns the maximum electron range for a pure bulk material according to the Kanaya-Okayama parameterziation.
Parameters: - element (str) – The element symbol, e.g. ‘Al’.
- beam_energy (float) – The energy of the beam in keV.
- density ({float, 'auto'}) – The density of the material in g/cm3. If ‘auto’, the density of the pure element is used.
- tilt (float.) – The tilt of the sample in degrees.
Returns: Return type: Electron range in micrometers.
Examples
>>> # Electron range in pure Copper at 30 kV in micron >>> hs.eds.electron_range('Cu', 30.) 2.8766744984001607
Notes
From Kanaya, K. and S. Okayama (1972). J. Phys. D. Appl. Phys. 5, p43
See also the textbook of Goldstein et al., Plenum publisher, third edition p 72.
-
hyperspy.misc.eds.utils.
get_FWHM_at_Energy
(energy_resolution_MnKa, E)¶ Calculates an approximate FWHM, accounting for peak broadening due to the detector, for a peak at energy E given a known width at a reference energy.
The factor 2.5 is a constant derived by Fiori & Newbury as references below.
Parameters: - energy_resolution_MnKa (float) – Energy resolution of Mn Ka in eV
- E (float) – Energy of the peak in keV
Returns: float
Return type: FWHM of the peak in keV
Notes
This method implements the equation derived by Fiori and Newbury as is documented in the following:
Fiori, C. E., and Newbury, D. E. (1978). In SEM/1978/I, SEM, Inc., AMF O’Hare, Illinois, p. 401.
Goldstein et al. (2003). “Scanning Electron Microscopy & X-ray Microanalysis”, Plenum, third edition, p 315.
-
hyperspy.misc.eds.utils.
get_xray_lines_near_energy
(energy, width=0.2, only_lines=None)¶ Find xray lines near a specific energy, more specifically all xray lines that satisfy only_lines and are within the given energy window width around the passed energy.
Parameters: - energy (float) – Energy to search near in keV
- width (float) – Window width in keV around energy in which to find nearby energies, i.e. a value of 0.2 keV (the default) means to search +/- 0.1 keV.
- only_lines – If not None, only the given lines will be added (eg. (‘a’,’Kb’)).
Returns: Return type: List of xray-lines sorted by energy difference to given energy.
-
hyperspy.misc.eds.utils.
quantification_cliff_lorimer
(intensities, kfactors, mask=None)¶ Quantification using Cliff-Lorimer
Parameters: - intensities (numpy.array) – the intensities for each X-ray lines. The first axis should be the elements axis.
- kfactors (list of float) – The list of kfactor in same order as intensities eg. kfactors = [1, 1.47, 1.72] for [‘Al_Ka’,’Cr_Ka’, ‘Ni_Ka’]
- mask (array of bool) – The mask with the dimension of intensities[0]. If a pixel is True, the composition is set to zero.
Returns: - numpy.array containing the weight fraction with the same
- shape as intensities.
-
hyperspy.misc.eds.utils.
quantification_cross_section
(intensities, cross_sections, dose)¶ Quantification using EDX cross sections Calculate the atomic compostion and the number of atoms per pixel from the raw X-ray intensity :param intensity: The integrated intensity for each X-ray line, where the first axis
is the element axis.Parameters: - cross_sections (list of floats) – List of X-ray scattering cross-sections in the same order as the intensities.
- dose (float) – the dose per unit area given by i*t*N/A, i the current, t the acquisition time, and N the number of electron by unit electric charge.
Returns: - numpy.array containing the atomic fraction of each element, with
- the same shape as the intensity input.
- numpy.array of the number of atoms counts for each element, with the same
- shape as the intensity input.
-
hyperspy.misc.eds.utils.
quantification_zeta_factor
(intensities, zfactors, dose)¶ Quantification using the zeta-factor method
Parameters: - intensities (numpy.array) – The intensities for each X-ray line. The first axis should be the elements axis.
- zfactors (list of float) – The list of zeta-factors in the same order as intensities e.g. zfactors = [628.10, 539.89] for [‘As_Ka’, ‘Ga_Ka’].
- dose (float) – The total electron dose given by i*t*N, i the current, t the acquisition time and N the number of electrons per unit electric charge (1/e).
Returns: - A numpy.array containing the weight fraction with the same
- shape as intensities and mass thickness in kg/m^2.
-
hyperspy.misc.eds.utils.
take_off_angle
(tilt_stage, azimuth_angle, elevation_angle)¶ Calculate the take-off-angle (TOA).
TOA is the angle with which the X-rays leave the surface towards the detector.
Parameters: - tilt_stage (float) – The tilt of the stage in degrees. The sample is facing the detector when positively tilted.
- azimuth_angle (float) – The azimuth of the detector in degrees. 0 is perpendicular to the tilt axis.
- elevation_angle (float) – The elevation of the detector in degrees.
Returns: take_off_angle – In degrees.
Return type: float.
Examples
>>> hs.eds.take_off_angle(tilt_stage=10., >>> azimuth_angle=45., elevation_angle=22.) 28.865971201155283
Notes
Defined by M. Schaffer et al., Ultramicroscopy 107(8), pp 587-597 (2007)
-
hyperspy.misc.eds.utils.
xray_lines_model
(elements, beam_energy=200, weight_percents=None, energy_resolution_MnKa=130, energy_axis=None)¶ Generate a model of X-ray lines using a Gaussian distribution for each peak.
The area under a main peak (alpha) is equal to 1 and weighted by the composition.
Parameters: - elements (list of strings) – A list of chemical element symbols.
- beam_energy (float) – The energy of the beam in keV.
- weight_percents (list of float) – The composition in weight percent.
- energy_resolution_MnKa (float) – The energy resolution of the detector in eV
- energy_axis (dic) – The dictionary for the energy axis. It must contains ‘size’ and the units must be ‘eV’ of ‘keV’.
Example
>>> s = utils_eds.simulate_model(['Cu', 'Fe'], beam_energy=30) >>> s.plot()
-
hyperspy.misc.eds.utils.
xray_range
(xray_line, beam_energy, density='auto')¶ Return the maximum range of X-ray generation according to the Anderson-Hasler parameterization.
Parameters: - xray_line (str) – The X-ray line, e.g. ‘Al_Ka’
- beam_energy (float) – The energy of the beam in kV.
- density ({float, 'auto'}) – The density of the material in g/cm3. If ‘auto’, the density of the pure element is used.
Returns: Return type: X-ray range in micrometer.
Examples
>>> # X-ray range of Cu Ka in pure Copper at 30 kV in micron >>> hs.eds.xray_range('Cu_Ka', 30.) 1.9361716759499248
>>> # X-ray range of Cu Ka in pure Carbon at 30kV in micron >>> hs.eds.xray_range('Cu_Ka', 30., hs.material.elements.C. >>> Physical_properties.density_gcm3) 7.6418811280855454
Notes
From Anderson, C.A. and M.F. Hasler (1966). In proceedings of the 4th international conference on X-ray optics and microanalysis.
See also the textbook of Goldstein et al., Plenum publisher, third edition p 286
-
hyperspy.misc.eds.utils.
zeta_to_edx_cross_section
(zfactors, elements)¶ Convert a list of zeta-factors (kg/m^2) to cross_sections in barns (b).
Parameters: - zfactors (list of float) – A list of zeta-factors.
- elements (list of str) – A list of element chemical symbols in the same order as the cross sections e.g. [‘Al’,’Zn’]
Returns: cross_sections – cross_sections with units in barns.
Return type: list of float