Skip to content

Instantly share code, notes, and snippets.

View tmiethlinger's full-sized avatar

Thomas Miethlinger tmiethlinger

  • HZDR
  • Dresden, Germany
View GitHub Profile
@tmiethlinger
tmiethlinger / ekin.py
Last active March 12, 2022 11:59
Relativistic kinetic energy from Smilei output
def ekin(p_r, m_r = 1, to_MeV = True):
""" compute relativistic kinetic energy 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.
to_MeV : bool, optional
computes energy in MeV if true, otherwise in E_r (reduced energy units).
@tmiethlinger
tmiethlinger / gamma.py
Last active March 12, 2022 11:59
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
-------