Skip to content

Conversation

@carlidel
Copy link

@carlidel carlidel commented Apr 17, 2025

  • Introduced NormalizedParticles class to handle transformations between physical and normalized coordinates efficiently.
  • Implemented norm_to_phys and phys_to_norm methods for converting particle data.
  • Updated TwissTable to include methods for obtaining normalized coordinates based on the new HybridClass.
  • Modified get_normalized_coordinates method to support both direct and context-based evaluations.
  • Added tests for NormalizedParticles in xtrack/tests/test_twiss.py

Description

NormalizedParticles enables the conversion to and from Twiss normalized coordinates directly on a xobjects context. This HybridClass can then be used for specific applications where a user may want to perform multiple coordinate conversions without breaking GPU parallelism (e.g. chaos indicators evaluations via ghost particle tracking, where re-normalization on normalized coordinates is required).

Future developments may consider the extension of this object as a beam element, in order to avoid the need to break a tracking action.

Checklist

Mandatory:

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

Optional:

  • [ x ] The code I wrote follows good style practices (see PEP 8 and PEP 20).
  • I have updated the docs in relation to my changes, if applicable
  • [ x ] I have tested also GPU contexts

- Introduced NormalizedParticles class to handle transformations between physical and normalized coordinates efficiently.
- Implemented norm_to_phys and phys_to_norm methods for converting particle data.
- Updated TwissTable to include methods for obtaining normalized coordinates based
on the new HybridClass.
- Modified get_normalized_coordinates method to support both direct and context-based evaluations.
- Added tests for NormalizedParticles in
xtracl/tests/test_twiss.py
@carlidel
Copy link
Author

Sorry for the delay... I tried to adapt the class from Xnlbd in order to make it more compliant to the Twiss notation in Xtrack. Let me know if any improvements are needed!

Thanks for the support!

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.

1 participant