impactx icon indicating copy to clipboard operation
impactx copied to clipboard

Python: Element Groups & Lattice Manipulation

Open ax3l opened this issue 8 months ago • 1 comments

At least on the Python side, it will be beneficial to have support to arbitrarily group elements to select and manipulate (ramp/scale up/down currents, deactivate, etc.).

Helper: Select By Type

We could add helper functions to select elements in a list & KnownElementsList by type (i.e., in filter()).

Allowing Arbitrary Runtime Attributes

One way to simplify user-defined selections would be to allow users to add arbitrary runtime attributes to every element. This can be used to add "tags"/"keywords" or any type of book keeping information.

This means we just need to add py::dynamic_attr() as we do in the Programmable element.

A downside of doing this generally is that typos, like quad1.k_typo = 12, will not raise errors. That said, this is the default behavior in Python anyway, we just disable it right now for all of our elements besides the Programmable one.

Other needs

We can take a look again at other codes, e.g., PyAT and Cheetah (IIRC?) have sensible Python selectors for lattice manipulation.

ax3l avatar Mar 10 '25 18:03 ax3l

Maybe a bit duply with #1088

ax3l avatar Oct 13 '25 17:10 ax3l