Skip to content

Ensure positive phase advance - #152

Merged
austin-hoover merged 5 commits into
PyORBIT-Collaboration:mainfrom
austin-hoover:matrix-lattice-delta-phi
Oct 9, 2026
Merged

austin-hoover merged 5 commits into
PyORBIT-Collaboration:mainfrom
austin-hoover:matrix-lattice-delta-phi

Conversation

@austin-hoover

@austin-hoover austin-hoover commented Sep 15, 2026 •

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)))

This PR uses atan2 to avoid negative phase advance.

@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
@austin-hoover

Copy link
Copy Markdown
Contributor Author

sns_ring_tunes.zip

Here is SNS ring example:

MAD-X tunes:
nux = 6.710221079
nuy = 6.732402635

Old PyORBIT output:
nux = 6.210221077829862
nuy = 6.732402637896412

New PyORBIT output:
nux = 6.710221077829864
nuy = 6.732402637896412

@austin-hoover
austin-hoover merged commit de816bc into PyORBIT-Collaboration:main Oct 9, 2026
6 checks passed
@austin-hoover
austin-hoover deleted the matrix-lattice-delta-phi branch October 11, 2026 15:54
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