{ "cells": [ { "cell_type": "markdown", "id": "463c12b8", "metadata": {}, "source": [ " **[pyTEMlib](0_pyTEMlib.ipynb)** \n", "\n", "
\n", "\n", "[](https://raw.githubusercontent.com/pycroscopy/pyTEMlib/main/notebooks/Introduction/3_Usefull_Equations.ipynb)\n", "\n", "[![OpenInColab](https://colab.research.google.com/assets/colab-badge.svg)](\n", " https://colab.research.google.com/github/pycroscopy/pyTEMlib/blob/main/notebooks/Introduction/3_Usefull_Equations.ipynb)\n", "\n", "\n", " **[pyTEMlib](0_pyTEMlib.ipynb)**, a **pycroscopy** library \n", "\n", "# Important Formulas\n", "\n", " **[pyTEMlib](https://pycroscopy.github.io/pyTEMlib/about.html)**\n", "\n", "a [pycroscopy](https://pycroscopy.github.io/pycroscopy/about.html) ecosystem package\n", "\n", "\n", "Notebook by \n", "\n", "Gerd Duscher and Darel Pates\n", "\n", "Materials Science & Engineering
\n", "Joint Institute of Advanced Materials
\n", "The University of Tennessee, Knoxville\n", "\n", "\n", "Collection of usefull Formulas" ] }, { "cell_type": "code", "execution_count": 1, "id": "b468443b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'0.2025.12.0'" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%matplotlib widget\n", "import matplotlib.pylab as plt\n", "import numpy as np\n", "import scipy \n", "\n", "import pyTEMlib\n", "pyTEMlib.__version__" ] }, { "cell_type": "markdown", "id": "53861b3c", "metadata": {}, "source": [ "The formula for relativistic corrected wavelength is:\n", "$\\lambda = \\frac{h}{\\sqrt{2m_e E_{kin} *(1+\\frac{E_{kin}}{2 m_e c^2})}}$\n", "\n", "with\n", "- h: Planck constant\n", "- m_e: rest mass of electron \n", "- $E_{kin}$: kinetic energy of electron (after acceleration)\n", "- c: speed of light" ] }, { "cell_type": "code", "execution_count": 2, "id": "35a6b103", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "wavelength is 4.87 pm for 60 keV\n" ] } ], "source": [ "# --- Input ----\n", "e0 = 60000 # acceleration voltage in eV\n", "# ---------------\n", "\n", "def get_wavelength(e0: float) -> float:\n", " \"\"\"get deBroglie wavelength of electron accelerated by energy e0 (in eV) \n", "\n", " Parameters\n", " ----------\n", " e0 : float\n", " acceleration voltage in eV\n", " Returns\n", " -------\n", " float\n", " wavelength in meters\n", " \n", " \"\"\"\n", " e_kin = scipy.constants.e * e0\n", " m_e = scipy.constants.m_e\n", " c = scipy.constants.c\n", " h = scipy.constants.h\n", " return h / np.sqrt(2 * m_e * e_kin * (1 + e_kin / (2 * m_e * c**2)))\n", "\n", "h = get_wavelength(e0) \n", "print(f\"wavelength is {h*1e12:.2f} pm for {e0/1000:.0f} keV\")" ] }, { "cell_type": "code", "execution_count": 3, "id": "e8dfa007", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Help on function get_wavelength in module __main__:\n", "\n", "get_wavelength(e0: float) -> float\n", " get deBroglie wavelength of electron accelerated by energy e0 (in eV)\n", "\n", " Parameters\n", " ----------\n", " e0 : float\n", " acceleration voltage in eV\n", " Returns\n", " -------\n", " float\n", " wavelength in meters\n", "\n" ] } ], "source": [ "help (get_wavelength)" ] }, { "cell_type": "markdown", "id": "cf486301", "metadata": {}, "source": [ "## Depth of Focus\n", "\n", "The depth of focus is \n", "$$ f_{depth} \\approx \\frac{\\lambda}{\\alpha^2} $$\n", "- wavelength of the electron $\\lambda$\n", "- convergence angle $\\alpha$" ] }, { "cell_type": "code", "execution_count": null, "id": "e8781db2", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Depth of focus is 25.08 nm for convergence angle 10.0 mrad at 200 keV\n" ] } ], "source": [ "# --- Input ----\n", "e0 = 200000 # acceleration voltage in eV\n", "convergence_angle = 10 / 1000 # convergence angle in radians\n", "# ---------------\n", "\n", "def depth_of_focus(acceleration_voltage: float, convergence_angle: float) -> float:\n", " \"\"\"calculate depth of focus\n", "\n", " Parameters\n", " ----------\n", " acceleration_voltage : float\n", " acceleration voltage in eV\n", " convergence_angle : float\n", " convergence angle in radians\n", "\n", " Returns\n", " -------\n", " float\n", " depth of focus in meters\n", " \"\"\"\n", "\n", " wavelength = get_wavelength(acceleration_voltage)\n", " return wavelength / convergence_angle**2\n", "\n", "focus_depth = depth_of_focus(e0, convergence_angle) \n", "print(f\"Depth of focus is {focus_depth*1e9:.2f} nm for convergence angle {convergence_angle*1000:.1f} mrad at {e0/1000:.0f} keV\")" ] }, { "cell_type": "markdown", "id": "a139c61a", "metadata": {}, "source": [ "## Particle Flux and Current\n", "\n", "It is important todetermine the order of magitude of how many electrons are hitting the sample.\n", "\n", "The defition of an Ampere:\n", "$$A = \\frac{C}{s}$$\n", "\n", "That definition is enough to calculate the number of electrons per time unit (flux)." ] }, { "cell_type": "code", "execution_count": 30, "id": "28ab9e1b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of electrons per second for 150.0 pA is 9.36e+08 electrons / second\n", "\n", " at 150.0 pAan electron will hit the sample every 1.07 ns \n" ] } ], "source": [ "# ------- Input ----\n", "current = 150e-12 # current in Ampere\n", "# ---------------\n", "\n", "\n", "def current_to_number_of_electrons(current: float) -> float:\n", " \"\"\"convert current in Ampere to number of electrons per second\n", "\n", " Parameters\n", " ----------\n", " current : float\n", " current in Ampere\n", "\n", " Returns\n", " -------\n", " float\n", " number of electrons per second\n", " \"\"\"\n", " return current / scipy.constants.elementary_charge\n", "\n", "number_of_electrons = current_to_number_of_electrons(current)\n", "\n", "print(f\"Number of electrons per second for {current*1e12:.1f} pA is {number_of_electrons:.2e} electrons / second\")\n", "\n", "print(f'\\n at {current*1e12:.1f} pAan electron will hit the sample every {scipy.constants.elementary_charge/current * 1e9:.2f} ns ')" ] }, { "cell_type": "markdown", "id": "ee2010fa", "metadata": {}, "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.5" } }, "nbformat": 4, "nbformat_minor": 5 }