Implement experimental PALS converter interfacing with the pals-python project - #644
Draft
cr-xu wants to merge 2 commits into
Draft
Implement experimental PALS converter interfacing with the pals-python project#644cr-xu wants to merge 2 commits into
PALS converter interfacing with the pals-python project#644cr-xu wants to merge 2 commits into
Conversation
PALS converter interfacing with the pals-python project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds PALS lattice conversion support for Cheetah interfacing with the pals-python project.
Essentially it builds a two-directional mapping between
pals-pythonobjects and Cheetah objects.Description
cheetah.converters.palswith conversion to/from PALS objects and lattice files.Segmentconvenience methods:Segment.from_pals(...)segment.to_pals(...)Segment.from_pals_file(...)segment.to_pals_file(...)This is still an experimental implementation as the PALS and pals-python are both evolving.
To handle the extra fields:
PALS fields that Cheetah does not model directly are preserved in
element.pals_extras._extract_extras(...)stores unconsumed PALS fields/groups during PALS -> Cheetah conversion._merge_group(...)and_split_pals_extras(...)re-emit preserved data during Cheetah -> PALS conversion, so that the round-trip is possible.cheetah.Markerwith the full PALS payload stored inpals_extras, plus anUnknownElementWarning.NotImplementedError.Tests
Added PALS conversion tests for:
SegmentPALS helper methodsVerified with:
pytest tests/test_pals_conversion.pypytest tests/test_pals_conversion.py tests/test_lattice_json.py tests/test_bmad_conversion.pypytest --ignore=tests/test_3d_visualization.pyMotivation and Context
Types of changes
Checklist
flake8(required).pytesttests pass (required).pyteston a machine with a CUDA GPU and made sure all tests pass (required).Note: We are using a maximum length of 88 characters per line.