Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in Beamline when using out_initial=True #38

Merged
merged 2 commits into from
Sep 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions wake_t/beamline_elements/beamline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from copy import copy

from wake_t.diagnostics import OpenPMDDiagnostics


Expand Down Expand Up @@ -43,11 +41,14 @@ def track(self, bunch, out_initial=True, opmd_diag=False, diag_dir=None):

"""
bunch_list = []
if out_initial:
bunch_list.append(copy(bunch))
if type(opmd_diag) is not OpenPMDDiagnostics and opmd_diag:
opmd_diag = OpenPMDDiagnostics(write_dir=diag_dir)
for element in self.elements:
for i, element in enumerate(self.elements):
bunch_list.extend(
element.track(bunch, out_initial=False, opmd_diag=opmd_diag))
element.track(
bunch,
out_initial=out_initial and i == 0,
opmd_diag=opmd_diag
)
)
return bunch_list