Skip to content

Instantly share code, notes, and snippets.

@tmiethlinger
Last active March 12, 2022 11:59
Show Gist options
  • Save tmiethlinger/8bda645284ae8fbda1ef975c8357dc8b to your computer and use it in GitHub Desktop.
Save tmiethlinger/8bda645284ae8fbda1ef975c8357dc8b to your computer and use it in GitHub Desktop.
Lorentz factor from Smilei output
def gamma(p_r, m_r = 1):
""" compute Lorentz factor from Smilei momentum and mass
Parameters
----------
p_r : float
particle momentum in reduced units.
m_r : float, optional
particle mass in reduced units, default value is hydrogen mass.
Returns
-------
gamma
Lorentz factor, float.
"""
return np.sqrt(1 + (p_r / m_r)**2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment