fluorescence Module

This module creates a namespace for X-Ray Fluorescence

class skbeam.fluorescence.Lorentzian2Model(*args, **kwargs)

Bases: lmfit.model.Model

Wrap the lorentzian2 function for fitting within lmfit framework 1-d lorentzian squared profile

Parameters
xarray

independent variable

areafloat

area of lorentzian squared peak, If area is set as 1, the integral is unity.

centerfloat

center position

sigmafloat

standard deviation

class skbeam.fluorescence.ComptonModel(*args, **kwargs)

Bases: lmfit.model.Model

Wrap the compton function for fitting within lmfit framework

Model compton peak, which is generated as an inelastic peak and always stays to the left of elastic peak on the spectrum.

Parameters
xarray

energy value

compton_amplitudefloat

area for gaussian peak, gaussian step and gaussian tail functions

coherent_sct_energyfloat

incident energy

fwhm_offsetfloat

global fitting parameter for peak width

fwhm_fanoprimefloat

global fitting parameter for peak width

e_offsetfloat

offset of energy calibration

e_linearfloat

linear coefficient in energy calibration

e_quadraticfloat

quadratic coefficient in energy calibration

compton_anglefloat

compton angle in degree

compton_fwhm_corrfloat

correction factor on peak width

compton_f_stepfloat

weight factor of the gaussian step function

compton_f_tailfloat

weight factor of gaussian tail on lower side

compton_gammafloat

normalization factor of gaussian tail on lower side

compton_hi_f_tailfloat

weight factor of gaussian tail on higher side

compton_hi_gammafloat

normalization factor of gaussian tail on higher side

epsilonfloat

energy to create a hole-electron pair for Ge 2.96, for Si 3.61 at 300K needs to double check this value

Returns
countsarray

compton peak

References

1

M. Van Gysel etc, “Description of Compton peaks in energy-dispersive x-ray fluorescence spectra”, X-Ray Spectrometry, vol. 32, pp. 139-147, 2003.

class skbeam.fluorescence.ElasticModel(*args, **kwargs)

Bases: lmfit.model.Model

Wrap the elastic function for fitting within lmfit framework Model of elastic peak in X-Ray fluorescence

Parameters
xarray

energy value

coherent_sct_amplitudefloat

area of elastic peak

coherent_sct_energyfloat

incident energy

fwhm_offsetfloat

global fitting parameter for peak width

fwhm_fanoprimefloat

global fitting parameter for peak width

e_offsetfloat

offset of energy calibration

e_linearfloat

linear coefficient in energy calibration

e_quadraticfloat

quadratic coefficient in energy calibration

epsilonfloat

energy to create a hole-electron pair for Ge 2.96, for Si 3.61 at 300K needs to double check this value

Returns
valuearray

elastic peak

class skbeam.fluorescence.XrfElement(element)

Bases: skbeam.core.constants.basic.BasicElement

Object to return all the elemental information related to fluorescence

Parameters
elementstr or int

Element symbol, name or atomic number (‘Zinc’, ‘Zn’ or 30)

Examples

>>> # Create an `Element` object
>>> e = Element('Zn') # or e = Element(30)
>>> # get the atomic mass
>>> e.mass
65.37
>>> # get the density in grams / cm^3
>>> e.density
7.14
>>> from skbeam.core.constants.xrf import XrfElement as Element
>>> e = Element('Zn')
>>> # Get the emission energy for the Kα1 line.
>>> e.emission_line['Ka1']
8.638900756835938
>>> # Cross section [barns/atom] for Kα1 line at 10 keV incident energy
>>> e.csb(10)['Ka1']
5987.081587605121
>>> # Cross section [cm2/g] for Kα1 line at 10 keV incident energy
>>> e.cs(10)['Ka1']
55.146912259583296
>>> # fluorescence yield for K shell
>>> e.fluor_yield['K']
0.46936899423599243
>>> # Find all emission lines within with in the range [9.5, 10.5]
>>> # keV with an incident energy of 12 KeV.
>>> e.find(10, 0.5, 12)
{'kb1': 9.571999549865723}
>>> # List all of the known emission lines
>>> e.emission_line.all # list all the emission lines
[('ka1', 8.638900756835938),
 ('ka2', 8.615799903869629),
 ('kb1', 9.571999549865723),
 ('kb2', 0.0),
 ('la1', 1.0116000175476074),
 ('la2', 1.0116000175476074),
 ('lb1', 1.0346999168395996),
 ('lb2', 0.0),
 ('lb3', 1.1069999933242798),
 ('lb4', 1.1069999933242798),
 ('lb5', 0.0),
 ('lg1', 0.0),
 ('lg2', 0.0),
 ('lg3', 0.0),
 ('lg4', 0.0),
 ('ll', 0.8837999701499939),
 ('ln', 0.9069000482559204),
 ('ma1', 0.0),
 ('ma2', 0.0),
 ('mb', 0.0),
 ('mg', 0.0)]
>>> # List all of the known cross sections [barns/atom]
>>> e.csb(10).all
[('ka1', 5987.081587605121),
 ('ka2', 3076.4914784265347),
 ('kb1', 821.0572112842519),
 ('kb2', 0.0),
 ('la1', 188.06856034970164),
 ('la2', 21.213083101234524),
 ('lb1', 94.10717616654374),
 ('lb2', 0.0),
 ('lb3', 6.2207984090565),
 ('lb4', 3.3964315566384187),
 ('lb5', 0.0),
 ('lg1', 0.0),
 ('lg2', 0.0),
 ('lg3', 0.0),
 ('lg4', 0.0),
 ('ll', 11.809765990232954),
 ('ln', 4.8441078404731766),
 ('ma1', 0.0),
 ('ma2', 0.0),
 ('mb', 0.0),
 ('mg', 0.0)]
property bind_energy

Binding energy, XrayLibWrap

Binding energy is a measure of the energy required to free electrons from their atomic orbits. shell is string type and defined as “K”, “L1”. unit in KeV

property cs

Fluorescence cross section function, function

Returns a function of energy which returns the elemental cross section in cm2/g

The signature of the function is

x_section = func(enery)

where energy in in keV and x_section is in cm2/g

property csb

Fluorescence cross section function, function

Returns a function of energy which returns the elemental cross section in barns/atom

The signature of the function is

x_section = func(enery)

where energy in in keV and x_section is in barns/atom

property emission_line

Emission line information, XrayLibWrap

Emission line can be used as a unique characteristic for qualitative identification of the element. line is string type and defined as ‘Ka1’, ‘Kb1’. unit in KeV

property fluor_yield

fluorescence quantum yield, XrayLibWrap

The fluorescence quantum yield gives the efficiency of the fluorescence process, and is defined as the ratio of the number of photons emitted to the number of photons absorbed. shell is string type and defined as “K”, “L1”.

property jump_factor

Jump Factor, XrayLibWrap

Absorption jump factor is defined as the fraction of the total absorption that is associated with a given shell rather than for any other shell. shell is string type and defined as “K”, “L1”.

line_near(self, energy, delta_e, incident_energy)

Find possible emission lines given the element.

Parameters
energyfloat

Energy value to search for

delta_efloat

Define search range (energy - delta_e, energy + delta_e)

incident_energyfloat

incident energy of x-ray in KeV

Returns
dict

all possible emission lines

Find elements which have an emission line near an energy

This function returns a dict keyed on element type of all elements that have an emission line with in delta_e of line_e at the given x-ray energy.

Parameters
line_efloat

energy value to search for in KeV

delta_efloat

difference compared to energy in KeV

incident_energyfloat

incident x-ray energy in KeV

element_listlist, optional

List of elements to restrict search to. If no list is present, search on all elements. Element abbreviations can be any mix of upper and lower case, e.g., Hg, hG, hg, HG

Returns
lines_dictdict

element and associate emission lines

skbeam.fluorescence.snip_method(spectrum, e_off, e_lin, e_quad, xmin=0, xmax=4096, epsilon=2.96, width=0.5, decrease_factor=1.4142135623730951, spectral_binning=None, con_val=None, iter_num=None, width_threshold=0.5)

use snip algorithm to obtain background

Parameters
spectrumarray

intensity spectrum

e_offfloat

energy calibration, such as e_off + e_lin * energy + e_quad * energy^2

e_linfloat

energy calibration, such as e_off + e_lin * energy + e_quad * energy^2

e_quadfloat

energy calibration, such as e_off + e_lin * energy + e_quad * energy^2

xminfloat, optional

smallest index to define the range

xmaxfloat, optional

largest index to define the range

epsilonfloat, optional

energy to create a hole-electron pair for Ge 2.96, for Si 3.61 at 300K needs to double check this value

widthint, optional

window size to adjust how much to shift background

decrease_factorfloat, optional

gradually decrease of window size, default as sqrt(2)

spectral_binningfloat, optional

bin the data into different size

con_valint, optional

size of scipy.signal.boxcar to convolve the spectrum.

Default value is controlled by the keys con_val_no_bin and con_val_bin in the defaults dictionary, depending on if spectral_binning is used or not

iter_numint, optional

Number of iterations.

Default value is controlled by the keys iter_num_no_bin and iter_num_bin in the defaults dictionary, depending on if spectral_binning is used or not

width_thresholdfloat, optional

stop point of the algorithm

Returns
backgroundarray

output results with peak removed

References

1

C.G. Ryan etc, “SNIP, a statistics-sensitive background treatment for the quantitative analysis of PIXE spectra in geoscience applications”, Nuclear Instruments and Methods in Physics Research Section B, vol. 34, 1998.