Using X-ray fluorescence information in scikit-beam

Inline plot


In [1]:
%matplotlib inline

Import Element library


In [2]:
from skbeam.core.constants import XrfElement

Initiate Element object


In [3]:
e = XrfElement('Cu')

Output a given emission line


In [4]:
e.emission_line['ka1']


Out[4]:
8.0478

Output all the emission lines


In [5]:
e.emission_line.all


Out[5]:
[('ka1', 8.0478),
 ('ka2', 8.0279),
 ('kb1', 8.9053),
 ('kb2', 0.0),
 ('la1', 0.9295),
 ('la2', 0.9295),
 ('lb1', 0.9494),
 ('lb2', 0.0),
 ('lb3', 1.0225),
 ('lb4', 1.0225),
 ('lb5', 0.0),
 ('lg1', 0.0),
 ('lg2', 0.0),
 ('lg3', 0.0),
 ('lg4', 0.0),
 ('ll', 0.8113),
 ('ln', 0.8312),
 ('ma1', 0.0),
 ('ma2', 0.0),
 ('mb', 0.0),
 ('mg', 0.0)]

Output all the fluorescence cross sections at given incident energy


In [6]:
e.cs(12).all


Out[6]:
[('ka1', 30.030405278743867),
 ('ka2', 15.412719199476097),
 ('kb1', 4.027206006188117),
 ('kb2', 0.0),
 ('la1', 0.9194796566487551),
 ('la2', 0.10387051305203576),
 ('lb1', 0.30381941280541175),
 ('lb2', 0.0),
 ('lb3', 0.030617983946130203),
 ('lb4', 0.016638012494036403),
 ('lb5', 0.0),
 ('lg1', 0.0),
 ('lg2', 0.0),
 ('lg3', 0.0),
 ('lg4', 0.0),
 ('ll', 0.06365586522249897),
 ('ln', 0.01729831325409558),
 ('ma1', 0.0),
 ('ma2', 0.0),
 ('mb', 0.0),
 ('mg', 0.0)]

Import functions to plot emission lines, and spectrum


In [7]:
%matplotlib notebook
from demo_xrf_spectrum import (get_line, get_spectrum)
import matplotlib.pyplot as plt


/home/edill/mc/envs/beam35/lib/python3.5/site-packages/IPython/html.py:14: ShimWarning: The `IPython.html` package has been deprecated. You should import from `notebook` instead. `IPython.html.widgets` has moved to `ipywidgets`.
  "`IPython.html.widgets` has moved to `ipywidgets`.", ShimWarning)

Plot spectrum for element Cu


In [8]:
fig, ax = plt.subplots()
get_line(ax, 'Cu', 12)



In [9]:
fig, ax = plt.subplots()
get_spectrum(ax, 'Cu', 12)


Plot spectrum for element Gd


In [10]:
fig, ax = plt.subplots()
get_line(ax, 'Gd', 12)



In [11]:
fig, ax = plt.subplots()
get_spectrum(ax, 'Gd', 12)



In [12]:
import skbeam

In [13]:
skbeam.__version__


Out[13]:
'0.0.6+41.g8aa4712'

In [ ]: