diff --git a/examples/Jupyter/MonochromatorCalibrationErrors.ipynb b/examples/Jupyter/MonochromatorCalibrationErrors.ipynb index 79f28255f..942363968 100644 --- a/examples/Jupyter/MonochromatorCalibrationErrors.ipynb +++ b/examples/Jupyter/MonochromatorCalibrationErrors.ipynb @@ -2,56 +2,41 @@ "cells": [ { "cell_type": "markdown", - "id": "2980d153", + "id": "c2e0135b-da8a-42cb-bf44-a7891a5fa7e4", "metadata": {}, "source": [ "# Mono Calibration and EXAFS Results\n", "\n", "This notebook explores the effect of energy miscalibration on EXAFS results.\n", "\n", - "EXAFS measurements need a well-calibrated energy, typically coming from a double-cystal monochromator. While EXAFS can be measured in modes without a double-crystal monochromator, that is sort of unusual, and we are not discussing that situation here. A double-cystal monochromator uses Bragg's Law to relate the monochromator angle $\\theta$ to X-ray energy $E$ with\n", + "EXAFS measurements need well-calibrated energies, typically coming from a double-crystal monochromator. While EXAFS can be measured in modes without a double-crystal monochromator, that is sort of unusual, and out of the scope of the discussion here. \n", "\n", - " $\\lambda = \\frac{hc}{E} = 2d\\sin(\\theta) $\n", - "\n", - "With $h$ being Planck's constant, $c$ the speed of light, and $d$ the lattice spacing of the monochromator crystal. With $d$ in Angstroms and $E$ in eV, $hc \\approx 12398.419$ eV A. The crystal $d$ values for Si, Ge, and C (the most common crystals used0 are typically very well known, but there may be thermally-induced changes. The values of $d$ and an angular offset ($\\theta_0$ may need to be adjusted to calibrate a monochromator.\n", - "This is typically done by scanning across a known (or at least reproducible) energies, say the $K$-edges of metal foils, and adjusting $d$ or $\\theta_0$ until the energy is correct. \n", + "A double-crystal monochromator uses Bragg's Law to relate the monochromator angle $\\theta$ to X-ray energy $E$ with\n", "\n", + " $\\lambda = \\frac{hc}{E} = 2d\\sin(\\theta) $\n", "\n", - "Most commonly, the XANES of some metal foil is measured and the maximumn of the first derivative is set to the tabulated edge energy for the metal. This method will give a bit of a variation as \n", - "the energy resolution changes. These days, most good XAFS beamlines have high enough energy \n", - "resolution that this is not much of a problem, but it can be a problem for older data. It should \n", - "also be said that those tabulated values are not always accurate to better than 1 or 2 eV. In fact, \n", - "rather than use the tabulated values such as at https://xraydb.xrayabsorption.org/ the values from Kraft et al Review of Scientific Instruments 67, p681 (1996): (https://doi.org/10.1063/1.1146657) should be used, as they were carefully measured with a single, very high-resolution and consistently calibrated monochromator.\n", + "With $h$ being Planck's constant, $c$ the speed of light, and $d$ the lattice spacing of the monochromator crystal. With $d$ in Angstroms and $E$ in eV, $hc \\approx 12398.419$ eV A. The crystal $d$ values for Si, Ge, and C (the most common crystals used) are typically very well known, but there may be thermally induced changes. That is, both the values of $d$ and an angular offset, $\\theta_0$, may need to be adjusted to calibrate a monochromator. This is typically done by scanning across known (or at least reproducible) energies, say the $K$-edges of metal foils, and adjusting $d$ or $\\theta_0$ until the energy is correct. \n", "\n", + "Most commonly, the XANES of some metal foil is measured and the maximum of the first derivative is set to the tabulated edge energy for the metal. This method will give a bit of a variation as the energy resolution changes. These days, most good XAFS beamlines have high enough energy resolution that this is not much of a problem, but it can be a problem for older data sets. It should also be said that those tabulated values are not always accurate to better than 1 or 2 eV. In fact, rather than use the tabulated values such as at https://xraydb.xrayabsorption.org/ the values from Kraft et al Review of Scientific Instruments 67, p681 (1996): (https://doi.org/10.1063/1.1146657) should be used, as they were carefully measured with a single, very high-resolution and consistently calibrated monochromator.\n", "\n", - "Ideally, a well-calibrated monochromator would have a single d-spacing and angular offset that \n", - "stays calibrated across the edges of many edges. That is, if the energy needs to be recalibrated\n", - "at every edge, the energy will be drifting between those edges, and the reason for any need to\n", - "recalibrate should be investigated. If the beamline is well collimated and the angle of the beam \n", - "incident on the monochomator is stable, it is certainly possible to have a monochromator set up t\n", - "that stays calibrated for weeks and over an energy range of 10 keV or more. \n", "\n", + "Ideally, a well-calibrated monochromator would have a single d-spacing (so, good thermal stability) and angular offset that stays calibrated across the edges of many edges. If the energy needs to be recalibrated very frequently or for each edge, then the energy will be drifting between those edges, and the reason for any need to recalibrate should be investigated. If the beamline is well collimated and the angle of the beam incident on the monochromator is stable, it is certainly possible to have a monochromator set up so that stays calibrated for weeks and over an energy range of 10 keV or more. This can be more complicated when a collimating (or any other) mirror is placed before the monochromator, as then very high stability of that mirror is also needed.\n", "\n", - "For any XAS analysis, the energy scale is critical. Because of the variations above in calibrating \n", - "energy, small energy shifts between beamlines or even runs at the same beamline but different months \n", - "are not uncommon. If the shift is relatively small, say 1 to 5 eV at 10 keV, simply adding a constant \n", - "energy offset is satisfactory.\n", + "For any XAS analysis, the energy scale is critical. Because of the variations above in calibrating energy, small energy shifts between beamlines or even runs at the same beamline but different months are not uncommon. If the shift is relatively small, say 1 to 5 eV at 10 keV, simply adding a constant energy offset is satisfactory.\n", " \n", - "You may hear people say that poor calibration leads to large errors in XAFS results or even leads \n", - "\"the wrong results\". You should know that when people say things are Wrong is describing scientific\n", - "measurements and analysis, they are almost certainly wrong. \n", + "You may hear people say that poor calibration leads to large errors in EXAFS results or even leads to \"the wrong results\". You should know that when people describe scientific measurements and analysis as Wrong, they are almost certainly wrong. Measurements have precision and accuracy, and science always allows for improvements in measurement and analysis.\n", "\n", - "Here, we'll look at these effects\n" + "Here, we'll look at these effects. From this, we can conclude that any claims that poor calibration leads to large errors in EXAFS results are inaccurate.\n" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 5, "id": "7c518804", "metadata": {}, "outputs": [], "source": [ - "# we start with some imports of python functions we will need to read, \n", + "# We start with some imports of Python functions we will need to read, \n", "# modify, and fit xafs data:\n", "\n", "import time, os, requests\n", @@ -65,7 +50,6 @@ " feffit_dataset, feffit, feffit_report)\n", "from larch.plot.plotly_xafsplots import plot, multi_plot\n", "\n", - "\n", "PLANCK_HC = 1.e10 * consts.Planck * consts.c / consts.e\n", "RAD2DEG = 180.0/np.pi\n", "DEG2RAD = np.pi/180.0" @@ -73,7 +57,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 6, "id": "9905f684", "metadata": {}, "outputs": [ @@ -117,7 +101,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 7, "id": "2aedfd2a", "metadata": {}, "outputs": [ @@ -128,35 +112,6 @@ "Using a d spacing 3.135253 Ang\n" ] }, - { - "data": { - "text/html": [ - " \n", - " " - ] - }, - "metadata": {}, - "output_type": "display_data" - }, { "data": { "application/vnd.plotly.v1+json": { @@ -171,7 +126,7 @@ }, "name": "angle", "type": "scatter", - "uid": "43c3cde9-6aaa-49b4-87ed-a0764967908c", + "uid": "593e71fc-4f3c-47be-ac88-5e44a160b283", "x": [ 8786.204, 8796.258, @@ -2232,29 +2187,41 @@ }, "width": 650, "xaxis": { + "autorange": true, "color": "#004", "gridcolor": "#D8D8D8", + "range": [ + 8786.204, + 11362.47 + ], "showgrid": true, "title": { "text": "Energy (eV)" }, + "type": "linear", "zerolinecolor": "#DDD" }, "yaxis": { + "autorange": true, "color": "#004", "gridcolor": "#D8D8D8", + "range": [ + 9.85567296889682, + 13.171085625953529 + ], "showgrid": true, "title": { "text": "$\\theta$" }, + "type": "linear", "zerolinecolor": "#DDD" } } }, "text/html": [ - "