hyperspy.misc.eds.utils module
- hyperspy.misc.eds.utils._get_element_and_line(xray_line)
Returns the element name and line character for a particular X-ray line as a tuple.
By example, if xray_line = ‘Mn_Ka’ this function returns (‘Mn’, ‘Ka’)
- hyperspy.misc.eds.utils._get_energy_xray_line(xray_line)
Returns the energy (in keV) associated with a given X-ray line.
By example, if xray_line = ‘Mn_Ka’ this function returns 5.8987
- hyperspy.misc.eds.utils._get_xray_lines_family(xray_line)
Returns the family to which a particular X-ray line belongs.
By example, if xray_line = ‘Mn_Ka’ this function returns ‘Mn_K’
- hyperspy.misc.eds.utils._quantification_cliff_lorimer(intensities, kfactors, absorption_correction, ref_index=0, ref_index2=1)
Quantification using Cliff-Lorimer
- Parameters
intensities (numpy.array) – the intensities for each X-ray lines. The first axis should be the elements axis.
absorption_correction (numpy.ndarray) – value between 0 and 1 in order to correct the intensities based on estimated absorption.
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’]
ref_index (int) – index of the elements that will be in the denominator. Should be non zeros if possible.
ref_index2 (int) – index of the elements that will be in the denominator. Should be non zeros if possible.
- Returns
numpy.array containing the weight fraction with the same
shape as intensities.
- 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).
- 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
- 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
- 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_abs_corr_cross_section(composition, number_of_atoms, take_off_angle, probe_area)
Calculate absorption correction terms.
- hyperspy.misc.eds.utils.get_abs_corr_zeta(weight_percent, mass_thickness, take_off_angle)
Calculate absorption correction terms.
- 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
- Return type
List of xray-lines sorted by energy difference to given energy.
- hyperspy.misc.eds.utils.quantification_cliff_lorimer(intensities, kfactors, absorption_correction=None, 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’]
absorption_correction (numpy.ndarray or None) – If None (default), absorption correction is ignored, otherwise, the array must contain values between 0 and 1 to correct the intensities based on estimated absorption.
mask (array of bool, signal of bool or None) – 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, absorption_correction=None)
Quantification using EDX cross sections Calculate the atomic compostion and the number of atoms per pixel from the raw X-ray intensity
- Parameters
intensity (numpy.ndarray) – The integrated intensity for each X-ray line, where the first axis is the element axis.
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.
absorption_correction (numpy.ndarray or None) – If None (default), absorption correction is ignored, otherwise, the array must contain values between 0 and 1 to correct the intensities based on estimated absorption.
- 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, absorption_correction=None)
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).
absorption_correction (numpy.ndarray or None) – If None (default), absorption correction is ignored, otherwise, the array must contain values between 0 and 1 to correct the intensities based on estimated absorption.
- 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, beta_tilt=0.0)
Calculate the take-off-angle (TOA).
TOA is the angle with which the X-rays leave the surface towards the detector.
- Parameters
alpha_tilt (float) – The alpha-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 alpha tilt axis.
elevation_angle (float) – The elevation of the detector in degrees.
beta_tilt (float) – The beta-tilt of the stage in degrees. The sample is facing positive 90 in the azimuthal direction when positively tilted.
- Returns
take_off_angle – In degrees.
- Return type
float.
Examples
>>> hs.eds.take_off_angle(alpha_tilt=10., beta_tilt=0. >>> azimuth_angle=45., elevation_angle=22.) 28.865971201155283
- 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 = xray_lines_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
- 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).