Created
September 7, 2020 11:14
-
-
Save thomasaarholt/39e4e51fe44c6f2655855d912cf8842d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy.constants import electron_mass, elementary_charge, c, hbar, h | |
def relativistic_wavelength(kV=300): | |
"Returns relativistic wavelength in meters" | |
V = 1e3 * kV | |
top = h * c | |
bottom = np.sqrt( | |
elementary_charge * V * (2 * electron_mass * c ** 2 + elementary_charge * V) | |
) | |
wavelength = top / bottom | |
return wavelength | |
def invnm_to_mrad(k, kV=300): | |
"""Converts reciprocal nm units to mrad units | |
""" | |
wavelength = relativistic_wavelength(kV) | |
k = k * 1 / (1e-9) | |
theta = np.arctan(k * wavelength) | |
return theta * 1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment