Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 12, 2024
1 parent 110e07b commit 1412a5a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions examples/aperture/analysis_aperture_pepperpot.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import openpmd_api as io
from scipy.stats import moment


def get_moments(beam):
"""Calculate standard deviations of beam position & momenta
and emittance values
Expand Down Expand Up @@ -83,12 +84,12 @@ def get_moments(beam):
# kept particles, shifted to the fundamental domain
xshifted = abs(final["position_x"]) + xmax
yshifted = abs(final["position_y"]) + ymax
u = np.fmod(xshifted,repeat_x) - xmax
v = np.fmod(yshifted,repeat_y) - ymax
u = np.fmod(xshifted, repeat_x) - xmax
v = np.fmod(yshifted, repeat_y) - ymax

# difference from maximum aperture
dx = abs(u) - xmax
dy = abs(v) - ymax
dy = abs(v) - ymax

print()
print(f" fundamental x_max={u.max()}")
Expand All @@ -102,12 +103,12 @@ def get_moments(beam):
# lost particles, shifted to the fundamental domain
xshifted = abs(particles_lost["position_x"]) - xmax
yshifted = abs(particles_lost["position_y"]) - ymax
u = np.fmod(xshifted,repeat_x) - xmax
v = np.fmod(yshifted,repeat_y) - ymax
u = np.fmod(xshifted, repeat_x) - xmax
v = np.fmod(yshifted, repeat_y) - ymax

# difference from maximum aperture
dx = abs(u) - xmax
dy = abs(v) - ymax
dy = abs(v) - ymax

print()
print(f" fundamental x_max={u.max()}")
Expand Down

0 comments on commit 1412a5a

Please sign in to comment.