Skip to content

Conversation

@babreufig
Copy link
Contributor

@babreufig babreufig commented Nov 5, 2025

Description

Implements MAD-NG TPSA Action to use MAD-NG tracked damaps to acquire optical parameters.

This pull request requires at least MAD-NG version 1.1.8. There is a discrepancy in the chromaticity calculation between MAD-NG version 1.1.7 and 1.1.8, where the phix is by a factor 2 smaller in the new version. This seems to be a different convention(?). Needs a follow-up because this affects Ax/Bx/Ay/By functions which are then different between Xsuite and MAD-NG. For reference: MethodicalAcceleratorDesign/MAD-NG@5c87e03

Given the revert from the chromaticity bug, this pull request should be shipped with MAD-NG version 1.1.9!

Important: Depends on xsuite/xdeps#106

  • Supports ranged settings with initial conditions
  • Supports full-lattice settings with and without initial conditions
  • Supports Beta functions, Alpha functions, Dispersions and Phase Advances as Targets
  • Phase Advances uses faster Twiss and TPSA as well
  • Interchangability between Xsuite ('betx', 'bety') and MAD-NG ('beta11_ng', 'beta22_ng') target names
  • Orbit targets supported (x, px, ...)
  • Changed twiss function to put coupling and chromaticities as optional flags
  • Support R-Matrix matching
  • Conversion between zeta/t and delta/pt

Mandatory:

  • I have added tests to cover my changes
  • All the tests are passing, including my new ones
  • I described my changes in this PR description

@babreufig babreufig changed the title WIP: Feature/madng jacobians WIP: TPSA in Xsuite Matching (Interface to MAD-NG) Nov 19, 2025
@babreufig babreufig marked this pull request as draft November 19, 2025 13:33
@babreufig
Copy link
Contributor Author

babreufig commented Nov 24, 2025

Functionality is ready. Needs follow-up because new MAD-NG version breaks two tests that rely on calculating chromaticities, as phix/phiy in MAD-NG 1.1.8 changed by a factor 2. This can be found in this commit (MethodicalAcceleratorDesign/MAD-NG@5c87e03) @giadarol

@babreufig babreufig marked this pull request as ready for review November 25, 2025 07:34
@babreufig babreufig changed the title WIP: TPSA in Xsuite Matching (Interface to MAD-NG) TPSA in Xsuite Matching (Interface to MAD-NG) Nov 25, 2025
Copy link
Collaborator

@szymonlopaciuk szymonlopaciuk left a comment

Choose a reason for hiding this comment

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

Good job, it's quite well structured and readable!

Some requests/comments/questions/suggestions for your consideration.

Copy link
Collaborator

@szymonlopaciuk szymonlopaciuk left a comment

Choose a reason for hiding this comment

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

Good for me, just the little comment.

@babreufig
Copy link
Contributor Author

New MAD-NG Version has been released, the related tests pass now! We could now pin the new version and this is then mergeable @szymonlopaciuk

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.

2 participants