Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Cheetah particle coordinate to Canonical variables #163

Merged
merged 23 commits into from
Jul 15, 2024

Conversation

cr-xu
Copy link
Member

@cr-xu cr-xu commented May 23, 2024

Description

Rename coordinate s to tau

To avoid confusion and make space for the variable s denoting the position of reference particle along a beamline,
the 5-th component of the particle phase space coordinate is renamed to tau.

Rename xp, yp to px, py to be consistent with other codes

Remove trailing s in retrieving phase space coordinates from ParticleBeam

Change the documentations to explicitly state that Cheetah is using the canonical phase space coordinates $(x,px,y,py,\tau,\delta)$

  • $px = P_x / P_0$
  • $\tau = c\Delta t$, bunch head has negative $\tau$
  • $\delta = \frac{\Delta E}{P_0 c}$ is the relative energy deviation from the reference particle

This is merely a documentation change at this point becasue all the calculations are valid. The conversions from/to ASTRA and OCELOT are indeed done in the correct way.

There is now a new page documenting the coordinate system in readthedocs: https://cheetah-accelerator--163.org.readthedocs.build/en/163/coordinate_system.html

Also: Fixes #162 and other places where dtype is listed as parameter but not actually used.

Motivation and Context

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)

Checklist

  • I have updated the changelog accordingly (required).
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.
  • I have reformatted the code and checked that formatting passes (required).
  • I have have fixed all issues found by flake8 (required).
  • I have ensured that all pytest tests pass (required).
  • I have run pytest on a machine with a CUDA GPU and made sure all tests pass (required).
  • I have checked that the documentation builds (required).

Note: We are using a maximum length of 88 characters per line

@cr-xu cr-xu linked an issue May 23, 2024 that may be closed by this pull request
@jank324 jank324 added documentation Improvements or additions to documentation enhancement New feature or request labels May 23, 2024
cr-xu added 2 commits May 24, 2024 11:02
Update docstrings accordingly
Update tests
Add convenient properties `energies` and `momenta` in `ParticleBeam` class
Add convenient property `p0c` in `Beam` class
@cr-xu cr-xu marked this pull request as ready for review May 24, 2024 09:19
@cr-xu cr-xu requested a review from jank324 May 24, 2024 09:19
@jank324 jank324 mentioned this pull request Jun 25, 2024
14 tasks
@cr-xu cr-xu marked this pull request as draft July 1, 2024 08:02
@cr-xu cr-xu marked this pull request as ready for review July 1, 2024 13:53
@roussel-ryan
Copy link
Contributor

A question and a comment, Q: the beam coordinate properties all have "s" appended to their names ie. "xs", "xps", is it possible to remove the "s"? Comment: instead of using Tau I would suggest using "z" instead to abide by Bmad convention https://www.classe.cornell.edu/bmad/manual.html. We can discuss during our meeting tomorrow

@cr-xu
Copy link
Member Author

cr-xu commented Jul 2, 2024

@jank324
Copy link
Member

jank324 commented Jul 2, 2024

  • Tye original motivation for the trailing s was a convention from functional programming, where a single element would be x and a collection of multiple x would be xs. As a computer scientist, I like this, but we should of course make sure it doesn't cause confusion, for example with the longitudinal s (?)
  • I'm not sure about tau vs z. But I am sure that at this point I definitely am confused. 😄

@jank324
Copy link
Member

jank324 commented Jul 11, 2024

@cr-xu that last commit means this is now properly ready for review and merging, right?

@cr-xu
Copy link
Member Author

cr-xu commented Jul 11, 2024

@cr-xu that last commit means this is now properly ready for review and merging, right?

I was just resolving merge conflicts. Now it should be ready for review.

jank324 and others added 2 commits July 14, 2024 23:31
@jank324 jank324 merged commit 5a25d22 into master Jul 15, 2024
11 checks passed
@jank324 jank324 deleted the 159-clarify-phase-space-coordinates branch July 15, 2024 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting dtype in ParameterBeam.from_twiss() not fully implemented. Change coordinate system
3 participants