Skip to content

[WIP] Parse kicker when reading Elegant files #389

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
20 changes: 20 additions & 0 deletions cheetah/converters/elegant.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,26 @@ def convert_element(
frequency=torch.tensor(parsed["frequency"], **factory_kwargs),
name=name,
)
elif parsed["element_type"] == "kicker":
validate_understood_properties(
["element_type", "hkick", "vkick"],
parsed
)
return cheetah.Segment(
elements=[
cheetah.HorizontalCorrector(
length=torch.tensor(parsed.get("l", 0.0)/2, **factory_kwargs),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I arbitrarily put the Horizontal Corrector first, and gave it half the length. Not sure if this is the right approach.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be done differently once #203 is merged.

angle=torch.tensor(parsed["hkick"], **factory_kwargs),
name=name + "_hkick",
),
cheetah.VerticalCorrector(
length=torch.tensor(parsed.get("l", 0.0)/2, **factory_kwargs),
angle=torch.tensor(parsed["vkick"], **factory_kwargs),
name=name + "_vkick",
),
],
name=name + "_segment",
)
elif parsed["element_type"] in ["sben", "csbend"]:
validate_understood_properties(
["element_type", "l", "angle", "k1", "e1", "e2", "tilt", "group"],
Expand Down
Loading