Skip to content

Betatron Phase Advance Calculation for 2D Phase Space - #179

Merged
shishlo merged 8 commits into
PyORBIT-Collaboration:mainfrom
shishlo:phase_advance
Nov 19, 2026
Merged

shishlo merged 8 commits into
PyORBIT-Collaboration:mainfrom
shishlo:phase_advance

Conversation

@shishlo

@shishlo shishlo commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

A betatron phase advance calculation between two points in a linac lattice was added for X,Y,Z directions. The calculations are performed inside the LinacTrMatrixGenNode "track" method. An approach uses the transport matrix between to nodes and Twiss parameters. The test of the betatron phase advance calculation using the transport matrix has been compared with an integration beta-functions method in examples PyORBIT3/tree/phase_advance/examples/SNS_Linac/pyorbit3_transport_matrix_gen : sns_linac_phase_adv_test_hebt1.py and sns_linac_tr_matrices_generation.py. All is done for the 2D phase space.

shishlo and others added 6 commits November 12, 2026 11:06
…d to the transport matrix package. It is implemented as a transport matrix approach. For this we still need the Twiss parameters for start and end points.
…on phase advances. Scripts compare betatron phase advances calculated from beta function integration and transport matrices.
…-DTL sections. Examples demonstrate comparison between two methods of phase advance calculations: by integrating Twiss beta-functions and by using transport matrices.
@shishlo shishlo self-assigned this Nov 16, 2026
@austin-hoover

Copy link
Copy Markdown
Contributor

I think it would be helpful to add a smaller test, maybe for a drift, quad or FODO cell, that raises an error if the numerically integrated phase advance does not match the transfer matrix result within some tolerance.

…racking. The combined accuracy of phase advances in X,Y,Z direction should be better than 1 deg after 41 meters tracking through HEBT1.The user can modify the script with adding space charge or HEBT2 sequence. In this case results for two methods would be different.
@shishlo

shishlo commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Thank you, Austin! Good idea about the test! I added one for script tracking bunch through HEBT1.

@azukov

azukov commented Nov 17, 2026

Copy link
Copy Markdown
Member

@woodtp Can you please convert Andrei's test to pytest for examples/SNS_Linac/pyorbit3_transport_matrix_gen/sns_linac_phase_adv_test_hebt1.py ?

@austin-hoover austin-hoover left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Checked that phase advance formula is correct.

@austin-hoover

Copy link
Copy Markdown
Contributor

Another suggestion is to check that all transfer matrix elements are zero or sufficiently small outside the 2 x 2 blocks before calculating the phase advances.

@woodtp

woodtp commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@woodtp Can you please convert Andrei's test to pytest for examples/SNS_Linac/pyorbit3_transport_matrix_gen/sns_linac_phase_adv_test_hebt1.py ?

I distilled the example into an integration test and placed it under tests/py/orbit/py_linac/lattice. The new test runs and passes CI validation:

tests/py/orbit/py_linac/lattice/test_linac_hebt1_phase_advance.py::test_hebt1_phase_advance_from_transport_matrices PASSED [ 31%]

@shishlo
shishlo merged commit 1f7fce3 into PyORBIT-Collaboration:main Nov 19, 2026
7 checks passed
@shishlo
shishlo deleted the phase_advance branch November 19, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants