-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Currently an instance of the Twiss class is linked a given Lattice object. If the Lattice object changes so will the Twiss object.
This can be counter-intuitive if one wants to save some reference values before optimizing a given lattice and can lead to mistakes:
twiss = ap.Twiss(lattice)
ref_beta_x = twiss.beta_x
# do the opitmization
beta_x = twiss.beta_xNow ref_beta_x is bound to the same underlying numpy.ndarray as beta_x. This might be error prone.
One solution to that would be to always allocate a new numpy.ndarray when calculating th twiss parameter instead of reusing the old one. Test how large the overhead would be!
Metadata
Metadata
Assignees
Labels
No labels