# This module provides a number of utility functions for
# X-ray fluorescence (XRF)
# Author: Mark Rivers
# Created: Sept. 16, 2002
- Returns the atomic number of an element, given its atomic symbol
The atomic symbol of the element whose atomic number is being
requested. This is a 1 or 2 character string, e.g. 'H', 'Si',
etc. It is case insensitive and leading or trailing blanks
This function returns the atomic number of the input element. If an
invalid atomic symbol is input then the function returns 0.
- This function returns the atomic symbol of an element, given its atomic
The atomic number of the element whose atomic symbol is being
This function returns the atomic symbol of the input element as a
string. If Z is an invalid atomic number then the function returns
- Increments the file extension if it is numeric. It preserves the number of
characters in the extension.
- Returns the energy in keV for a particular gamma emmission line.
A string of the form 'Isotope Line', where Isotope is a
the symbol for a radioactive isotope, and Line is an index of the form
g1, g2, ... gn.
Both Isotope and Line are case insensitive. There must be a space
between Isotope and Line.
Examples of Gamma_Line:
'Cd109 g1' - 88 keV line of Cd-109
'co57 g2' - 122 keV line of Co-57
This function returns the gamma energy of the specified line.
If the input is invalid, e.g. non-existent isotope or line, then the
function returns 0.
This function only knows about a few isotopes at present. It is
intended for use with common radioactive check sources. It is easy to
add additional isotopes and gamma lines to this function as needed.
The current library is:
'CO57 G1' = 14.413
'CO57 G2' = 122.0614
'CO57 G3' = 136.4743
'CD109 G1'= 88.04
energy = lookup_gamma_line('Co57 g1') ; Look up 14 keV line of Co-57
- This function returns the energy in keV for a particular x-ray
A string of the form 'Element Line', where Element is an
atomic symbol, and Line is an acronym for a fluorescence line.
Both Element and Line are case insensitive. There must be a space
between Element and Line.
The valid lines are
ka - K-alpha (weighted average of ka1 and ka2)
ka1 - K-alpha 1
ka2 - K-alpha 2
kb - K-beta (weighted average of kb1 and kb2)
kb1 - K-beta 1
kb2 - K-beta 2
la1 - L-alpha 1
lb1 - L-beta 1
lb2 - L-beta 2
lg1 - L-gamma 1
lg2 - L-gamma 2
lg3 - L-gamma 3
lg4 - L-gamma 4
ll - L-eta
Examples of XRF_Line:
'Fe Ka' - Fe k-alpha
'sr kb2' - Sr K-beta 2
'pb lg2' - Pb L-gamma 2
This function returns the fluoresence energy of the specified line.
If the input is invalid, e.g. non-existent element or line, then the
function returns None
This function uses the environment variable XRF_PEAK_LIBRARY to locate
the file containing the database of XRF lines. This environment
variable must be defined to use this function. On Unix systems
this is typically done with a command like
On Windows NT systems this is typically done with the
Settings/Control Panel/System/Environment control.
If lookup_xrf_line() encounters an error in resolving the environment
variable or in reading the file it raises an XrfError exception.
The first time this function is called it reads in the table from the
file pointed to by the environment variable. On all calls it looks
up the element using function atomic_number() and searches for the
specified line in the table. It returns 0. if the element or line
energy = lookup_xrf_line('Fe Ka') ; Look up iron k-alpha line
energy = lookup_xrf_line('Pb lb1') ; Look up lead l-beta 1 line
||__file__ = './Xrf.pyc'|
__name__ = 'Xrf'
atomic_symbols = ('H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca', ...)
gamma_dict = None
xrf_dict = None