Skip to content

Commit b5624cf

Browse files
committed
absportion doc checkpoint
1 parent 64ad577 commit b5624cf

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

docs/source/examples/examples.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ Landing page for diffpy.utils examples.
1212
resample_example
1313
parsers_example
1414
tools_example
15+
mu_calc_examples
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
.. _mu calc Example:
2+
3+
:tocdepth: -1
4+
5+
Lab-collected PDF Correction Examples
6+
######################################
7+
8+
These examples will demonstrate how to correct X-ray diffraction data
9+
to compute pair distribution functions (PDFs) from lab-collected X-ray
10+
diffraction experiments.
11+
12+
When calculating PDFs using ``diffpy.pdfgetx``,
13+
a key assumption is that the X-ray absorption is negligible.
14+
This is frequently the case for high-energy X-rays.
15+
However, this must be corrected for when using low energy
16+
X-rays, such as those from a laboratory source.
17+
To correct for X-ray absorption, the X-ray absorption coefficient, μ,
18+
must be known.
19+
20+
.. admonition:: Correction methods for X-ray absorption
21+
22+
Correcting your diffraction data can be done in **three
23+
different ways** using ``diffpy.utils``.
24+
25+
1. **Using a known μ value**: If the X-ray absorption coefficient μ
26+
is already known for your sample, supply this value along with the capillary diameter
27+
to directly correct the diffraction data.
28+
2. **Using a "z-scan" measurement**: Perform a z-scan measurement
29+
on the sample to measure X-ray absorption and extract
30+
the corresponding μ value, which is then used to correct the data.
31+
3. **Using tabulated values**: Find μ using tabulated absorption coefficients based on the sample
32+
composition, density, and X-ray energy, and use this value to apply the
33+
absorption correction.
34+
35+
Using a known μ value
36+
---------------------
37+
38+
example here
39+
40+
Using a "z-scan" measurement
41+
----------------------------
42+
43+
Example here
44+
45+
Using tabulated values
46+
----------------------------
47+
48+
The function to calculate μ from tabulated values is located
49+
in the ``diffpy.utils.tools`` module. So first, import the function,
50+
51+
.. code-block:: python
52+
53+
from diffpy.utils.tools import compute_mu_using_xraydb
54+
55+
To calculate μ, you need to know the sample composition, and X-ray energy, and sample mass density (g/cm\ :sup:`3`).
56+
57+
.. code-block:: python
58+
59+
composition = "Fe2O3"
60+
energy_keV = 17.45 # Mo K-alpha energy
61+
sample_mass_density = 5.24 # g/cm^3
62+
63+
Now calculate μ using the ``compute_mu_using_xraydb`` function.
64+
65+
.. code-block:: python
66+
67+
mu_density = compute_mu_using_xraydb(composition, energy_keV, sample_mass_density=sample_mass_density)
68+
print(f"Calculated mu from sample_mass_density: {mu_density} cm^-1")

0 commit comments

Comments
 (0)