Skip to content

Improve the workflow with the Twiss object #71

@felix-andreas

Description

@felix-andreas

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_x

Now 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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions