desy-ml / cheetah

Fast and differentiable particle accelerator optics simulation for reinforcement learning and optimisation applications.
https://cheetah-accelerator.readthedocs.io
GNU General Public License v3.0
28 stars 13 forks source link

Confusing variable naming in magnet misalignment #14

Closed cr-xu closed 1 year ago

cr-xu commented 1 year ago

The calculation is correct but code/ variable naming is misleading.

$R_\text{entry}$ should be acted on the incoming beam first, and shift the incoming beam to -misalignments w.r.t. the quads-frame.

Suggestion: The names and definitions of R_entry and R_exit should be switched so that the transfer matrix multiplication makes more sense:

$$ \begin{split} p\text{out} &= R\text{TM} p\text{in} \ &= R\text{exit} R\text{Q} R\text{entry} p_\text{in} \end{split}$$

c.f. line270-298