Closed cr-xu closed 9 months ago
So, the idea with these two was the following:
is_active
can be used to determine (and if some cases set) whether an Element is in use. That is for magnets, is_active
should automatically tell you whether their strength is currently anything other than 0.0. For screens for example, is_active
should tell you whether the screen is moved into the beam path. Here, you can actually set is_active
to True
and False
to move the screen in and out, respectively.
is_skippable
on the other hand is used for the computational optimisation in that it tells Cheetah whether the transfer map of the element may be combined with others, i.e. it is possible to skip calling the element's __call__
function. Non-skippable elements may be Elements that add/remove particles from the beam (e.g. apertures), need to read properties of the beam at their position (Screens or BPMs) or do something other than transfer map multiplication. I guess this last point is the most general.
Both is_active
and is_skippable
are sometimes equivalent, for example in the case of a Screen or a BPM. An active screen both blocks the beam and needs to read it. An active BPM needs to read the beam. Therefore, turning them off when you don't need them allows Cheetah to run faster.
Actually for correctors they are not equivalent ... for screens they are.
Conclusion
We should document this in the Element
class for everyone to know how both properties must be implemented. Each Element subclass should also document their specific behaviour regarding both properties.
What is exactly the difference between
is_skippable
andis_active
? Sometimes (like for correctors) theis_skippable
is directly deduced from theis_active
property, is this redundant? @jank324