-
-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
When beams have very small px and py, the method bunch_data(...) can try to take the square root of negative numbers. You get some warnings and pz comes out as NaN.
/Users/chris/miniforge3/envs/my_env/lib/python3.11/site-packages/pytao/tao_ctypes/extra_commands.py:57: RuntimeWarning: invalid value encountered in sqrt
dat['pz'] = np.sqrt((dat['pz'] + 1)**2 - dat['px']**2 - dat['py']**2) * p0c
Maybe clipping inside of the square root would fix this?
dat['pz'] = np.sqrt(np.max(0.0, (dat['pz'] + 1)**2 - dat['px']**2 - dat['py']**2)) * p0c
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels