desy-ml / cheetah

Fast and differentiable particle accelerator optics simulation for reinforcement learning and optimisation applications.
https://cheetah-accelerator.readthedocs.io
GNU General Public License v3.0
32 stars 13 forks source link

Refactoring of `electron_mass_eV` #179

Closed jank324 closed 3 months ago

jank324 commented 3 months ago

These are the same. This can be refactored in quite a few files. I prefer electron_mass_eV as a name and the way it is defined.

rest_energy = torch.tensor(
    constants.electron_mass
    * constants.speed_of_light**2
    / constants.elementary_charge  # electron mass
)
electron_mass_eV = torch.tensor(
    physical_constants["electron mass energy equivalent in MeV"][0] * 1e6
)