Implement envelope tracker#112
Merged
azukov merged 188 commits intoJun 30, 2026
Merged
Conversation
This will be used to set the correct particle mass and energy.
This method applies the linear transformation S -> M S M^T.
… into env-tracker
Replace these with identity matrix
Contributor
Author
Added method `track_ring` to EnvelopeTracker. It will pre-calculate the transfer matrices in the ring and mark the locations of space charge kicks. If tracking without space charge, it will compute and apply the one-turn matrix. Otherwise it will step through each element. This assumes there is no change of the synchronous particle energy and that all nodes in the lattice are static.
woodtp
reviewed
Jun 29, 2026
|
|
||
| parser.add_argument("--nparts", type=int, default=10_000) | ||
| parser.add_argument("--turns", type=int, default=25) | ||
| parser.add_argument("--sc", type=int, default=0) |
Contributor
There was a problem hiding this comment.
Doesn't really matter, but just an FYI: instead of storing an int, if you want an on/off switch you can do something like
parser.add_argument("--sc", action="store_true")Which will toggle space charge by just calling the script with that flag
script.py --sc
Contributor
Author
|
Notes from meeting:
|
Separate files: - envelopy.py has Envelope class definition. - track.py has EnvelopeTracker class definition. - matrix.py has functions to get transfer matrices from AccNode
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.




This PR implements an envelope/centroid tracker (Issue #51). We track the centroid$\mathbf{\mu} = \langle \mathbf{x} \rangle$ and covariance matrix $\mathbf{\Sigma} = \langle (\mathbf{x} - \mathbf{\mu}) (\mathbf{x} - \mathbf{\mu})^T \rangle$ , where $\mathbf{x} = [x, x', y, y', z, \Delta E ]^T$ is the 6D phase space vector.
Evolution equations:
Accelerator nodes and child nodes are mapped to transfer matrices at the Python level. An error is raised if the node is not recognized. Space charge is handled by assuming a uniform charge density within an ellipsoid in the$x$ -$y$-$z$ plane (for 3D space charge) or within an ellipse in the $x$ -$y$ plane (for 2D space charge).