Skip to content

Ensure positive phase advance - #152

Open
austin-hoover wants to merge 2 commits into
PyORBIT-Collaboration:mainfrom
austin-hoover:matrix-lattice-delta-phi
Open

austin-hoover wants to merge 2 commits into
PyORBIT-Collaboration:mainfrom
austin-hoover:matrix-lattice-delta-phi

Conversation

@austin-hoover

Copy link
Copy Markdown
Contributor

The calculation of the phase advance in MATRIX_Lattice.trackTwissData is:

delta_phi = math.atan(mt.get(ind0, ind1) / (beta_0 * mt.get(ind0, ind0) - alpha_0 * mt.get(ind0, ind1)))

If the phase advance is greater than $pi / 2$, delta_phi will be negative and we need to add $\pi$ to make it positive. We could use atan2 but I just added an if statement below.

@austin-hoover austin-hoover changed the title Ensure phase advance is always positive in MATRIX_Lattice.trackTwissData Ensure positive phase advance Sep 15, 2026
@austin-hoover austin-hoover self-assigned this Sep 16, 2026
@austin-hoover austin-hoover added the bug Something isn't working label Sep 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant