diff --git a/src/python/impactx/impactx_pybind/__init__.pyi b/src/python/impactx/impactx_pybind/__init__.pyi index b6587969b..2d0df0e6d 100644 --- a/src/python/impactx/impactx_pybind/__init__.pyi +++ b/src/python/impactx/impactx_pybind/__init__.pyi @@ -683,6 +683,7 @@ def push( | elements.ExactDrift | elements.ExactSbend | elements.Kicker + | elements.Marker | elements.Multipole | elements.NonlinearLens | elements.Programmable diff --git a/src/python/impactx/impactx_pybind/elements.pyi b/src/python/impactx/impactx_pybind/elements.pyi index dd3427062..86ae8b3c8 100644 --- a/src/python/impactx/impactx_pybind/elements.pyi +++ b/src/python/impactx/impactx_pybind/elements.pyi @@ -26,7 +26,9 @@ __all__ = [ "ExactSbend", "Kicker", "KnownElementsList", + "Marker", "Multipole", + "Named", "NonlinearLens", "PRot", "Programmable", @@ -70,7 +72,7 @@ class Alignment: @rotation.setter def rotation(self, arg1: float) -> None: ... -class Aperture(Thin, Alignment): +class Aperture(Named, Thin, Alignment): def __init__( self, xmax: float, @@ -79,6 +81,7 @@ class Aperture(Thin, Alignment): dx: float = 0, dy: float = 0, rotation: float = 0, + name: str | None = None, ) -> None: """ A short collimator element applying a transverse aperture boundary. @@ -168,9 +171,15 @@ class BeamMonitor(Thin): @tn.setter def tn(self, arg1: float) -> None: ... -class Buncher(Thin, Alignment): +class Buncher(Named, Thin, Alignment): def __init__( - self, V: float, k: float, dx: float = 0, dy: float = 0, rotation: float = 0 + self, + V: float, + k: float, + dx: float = 0, + dy: float = 0, + rotation: float = 0, + name: str | None = None, ) -> None: """ A short linear RF cavity element at zero-crossing for bunching. @@ -197,7 +206,7 @@ class Buncher(Thin, Alignment): @k.setter def k(self, arg1: float) -> None: ... -class CFbend(Thick, Alignment): +class CFbend(Named, Thick, Alignment): def __init__( self, ds: float, @@ -207,6 +216,7 @@ class CFbend(Thick, Alignment): dy: float = 0, rotation: float = 0, nslice: int = 1, + name: str | None = None, ) -> None: """ An ideal combined function bend (sector bend with quadrupole component). @@ -233,7 +243,7 @@ class CFbend(Thick, Alignment): @rc.setter def rc(self, arg1: float) -> None: ... -class ChrAcc(Thick, Alignment): +class ChrAcc(Named, Thick, Alignment): def __init__( self, ds: float, @@ -243,6 +253,7 @@ class ChrAcc(Thick, Alignment): dy: float = 0, rotation: float = 0, nslice: int = 1, + name: str | None = None, ) -> None: """ A region of Uniform Acceleration, with chromatic effects included. @@ -269,7 +280,7 @@ class ChrAcc(Thick, Alignment): @ez.setter def ez(self, arg1: float) -> None: ... -class ChrDrift(Thick, Alignment): +class ChrDrift(Named, Thick, Alignment): def __init__( self, ds: float, @@ -277,6 +288,7 @@ class ChrDrift(Thick, Alignment): dy: float = 0, rotation: float = 0, nslice: int = 1, + name: str | None = None, ) -> None: """ A Drift with chromatic effects included. @@ -289,7 +301,7 @@ class ChrDrift(Thick, Alignment): Push first the reference particle, then all other particles. """ -class ChrPlasmaLens(Thick, Alignment): +class ChrPlasmaLens(Named, Thick, Alignment): def __init__( self, ds: float, @@ -299,6 +311,7 @@ class ChrPlasmaLens(Thick, Alignment): dy: float = 0, rotation: float = 0, nslice: int = 1, + name: str | None = None, ) -> None: """ An active Plasma Lens with chromatic effects included. @@ -325,7 +338,7 @@ class ChrPlasmaLens(Thick, Alignment): @unit.setter def unit(self, arg1: int) -> None: ... -class ChrQuad(Thick, Alignment): +class ChrQuad(Named, Thick, Alignment): def __init__( self, ds: float, @@ -335,6 +348,7 @@ class ChrQuad(Thick, Alignment): dy: float = 0, rotation: float = 0, nslice: int = 1, + name: str | None = None, ) -> None: """ A Quadrupole magnet with chromatic effects included. @@ -361,7 +375,7 @@ class ChrQuad(Thick, Alignment): @unit.setter def unit(self, arg1: int) -> None: ... -class ConstF(Thick, Alignment): +class ConstF(Named, Thick, Alignment): def __init__( self, ds: float, @@ -372,6 +386,7 @@ class ConstF(Thick, Alignment): dy: float = 0, rotation: float = 0, nslice: int = 1, + name: str | None = None, ) -> None: """ A linear Constant Focusing element. @@ -405,7 +420,7 @@ class ConstF(Thick, Alignment): @ky.setter def ky(self, arg1: float) -> None: ... -class DipEdge(Thin, Alignment): +class DipEdge(Named, Thin, Alignment): def __init__( self, psi: float, @@ -415,6 +430,7 @@ class DipEdge(Thin, Alignment): dx: float = 0, dy: float = 0, rotation: float = 0, + name: str | None = None, ) -> None: """ Edge focusing associated with bend entry or exit. @@ -455,7 +471,7 @@ class DipEdge(Thin, Alignment): @rc.setter def rc(self, arg1: float) -> None: ... -class Drift(Thick, Alignment): +class Drift(Named, Thick, Alignment): def __init__( self, ds: float, @@ -463,6 +479,7 @@ class Drift(Thick, Alignment): dy: float = 0, rotation: float = 0, nslice: int = 1, + name: str | None = None, ) -> None: """ A drift. @@ -488,7 +505,7 @@ class Empty(Thin): Push first the reference particle, then all other particles. """ -class ExactDrift(Thick, Alignment): +class ExactDrift(Named, Thick, Alignment): def __init__( self, ds: float, @@ -496,6 +513,7 @@ class ExactDrift(Thick, Alignment): dy: float = 0, rotation: float = 0, nslice: int = 1, + name: str | None = None, ) -> None: """ A Drift using the exact nonlinear map. @@ -508,7 +526,7 @@ class ExactDrift(Thick, Alignment): Push first the reference particle, then all other particles. """ -class ExactSbend(Thick, Alignment): +class ExactSbend(Named, Thick, Alignment): def __init__( self, ds: float, @@ -518,6 +536,7 @@ class ExactSbend(Thick, Alignment): dy: float = 0, rotation: float = 0, nslice: int = 1, + name: str | None = None, ) -> None: """ An ideal sector bend using the exact nonlinear map. When B = 0, the reference bending radius is defined by r0 = length / (angle in rad), corresponding to a magnetic field of B = rigidity / r0; otherwise the reference bending radius is defined by r0 = rigidity / B. @@ -544,7 +563,7 @@ class ExactSbend(Thick, Alignment): @phi.setter def phi(self, arg1: float) -> None: ... -class Kicker(Thin, Alignment): +class Kicker(Named, Thin, Alignment): def __init__( self, xkick: float, @@ -553,6 +572,7 @@ class Kicker(Thin, Alignment): dx: float = 0, dy: float = 0, rotation: float = 0, + name: str | None = None, ) -> None: """ A thin transverse kicker element. Kicks are for unit "dimensionless" or in "T-m". @@ -600,6 +620,7 @@ class KnownElementsList: | ExactDrift | ExactSbend | Kicker + | Marker | Multipole | NonlinearLens | Programmable @@ -634,6 +655,7 @@ class KnownElementsList: | ExactDrift | ExactSbend | Kicker + | Marker | Multipole | NonlinearLens | Programmable @@ -669,6 +691,7 @@ class KnownElementsList: | ExactDrift | ExactSbend | Kicker + | Marker | Multipole | NonlinearLens | Programmable @@ -706,7 +729,20 @@ class KnownElementsList: Return and remove the last element of the list. """ -class Multipole(Thin, Alignment): +class Marker(Named, Thin): + def __init__(self, arg0: str) -> None: + """ + This named element does nothing. + """ + def __repr__(self) -> str: ... + def push( + self, pc: impactx.impactx_pybind.ImpactXParticleContainer, step: int = 0 + ) -> None: + """ + Push first the reference particle, then all other particles. + """ + +class Multipole(Named, Thin, Alignment): def __init__( self, multipole: int, @@ -715,6 +751,7 @@ class Multipole(Thin, Alignment): dx: float = 0, dy: float = 0, rotation: float = 0, + name: str | None = None, ) -> None: """ A general thin multipole element. @@ -748,7 +785,18 @@ class Multipole(Thin, Alignment): @multipole.setter def multipole(self, arg1: float) -> None: ... -class NonlinearLens(Thin, Alignment): +class Named: + @property + def has_name(self) -> bool: ... + @property + def name(self) -> str: + """ + segment length in m + """ + @name.setter + def name(self, arg1: str) -> None: ... + +class NonlinearLens(Named, Thin, Alignment): def __init__( self, knll: float, @@ -756,6 +804,7 @@ class NonlinearLens(Thin, Alignment): dx: float = 0, dy: float = 0, rotation: float = 0, + name: str | None = None, ) -> None: """ Single short segment of the nonlinear magnetic insert element. @@ -782,8 +831,8 @@ class NonlinearLens(Thin, Alignment): @knll.setter def knll(self, arg1: float) -> None: ... -class PRot(Thin): - def __init__(self, phi_in: float, phi_out: float) -> None: +class PRot(Named, Thin): + def __init__(self, phi_in: float, phi_out: float, name: str | None = None) -> None: """ An exact pole-face rotation in the x-z plane. Both angles are in degrees. """ @@ -809,10 +858,12 @@ class PRot(Thin): @phi_out.setter def phi_out(self, arg1: float) -> None: ... -class Programmable: +class Programmable(Named): ds: float nslice: int - def __init__(self, ds: float = 0.0, nslice: int = 1) -> None: + def __init__( + self, ds: float = 0.0, nslice: int = 1, name: str | None = None + ) -> None: """ A programmable beam optics element. """ @@ -865,7 +916,7 @@ class Programmable: @threadsafe.setter def threadsafe(self, arg1: bool) -> None: ... -class Quad(Thick, Alignment): +class Quad(Named, Thick, Alignment): def __init__( self, ds: float, @@ -874,6 +925,7 @@ class Quad(Thick, Alignment): dy: float = 0, rotation: float = 0, nslice: int = 1, + name: str | None = None, ) -> None: """ A Quadrupole magnet. @@ -893,7 +945,7 @@ class Quad(Thick, Alignment): @k.setter def k(self, arg1: float) -> None: ... -class RFCavity(Thick, Alignment): +class RFCavity(Named, Thick, Alignment): def __init__( self, ds: float, @@ -907,6 +959,7 @@ class RFCavity(Thick, Alignment): rotation: float = 0, mapsteps: int = 1, nslice: int = 1, + name: str | None = None, ) -> None: """ An RF cavity. @@ -947,7 +1000,7 @@ class RFCavity(Thick, Alignment): @phase.setter def phase(self, arg1: float) -> None: ... -class Sbend(Thick, Alignment): +class Sbend(Named, Thick, Alignment): def __init__( self, ds: float, @@ -956,6 +1009,7 @@ class Sbend(Thick, Alignment): dy: float = 0, rotation: float = 0, nslice: int = 1, + name: str | None = None, ) -> None: """ An ideal sector bend. @@ -975,7 +1029,7 @@ class Sbend(Thick, Alignment): @rc.setter def rc(self, arg1: float) -> None: ... -class ShortRF(Thin, Alignment): +class ShortRF(Named, Thin, Alignment): def __init__( self, V: float, @@ -984,6 +1038,7 @@ class ShortRF(Thin, Alignment): dx: float = 0, dy: float = 0, rotation: float = 0, + name: str | None = None, ) -> None: """ A short RF cavity element. @@ -1017,7 +1072,7 @@ class ShortRF(Thin, Alignment): @phase.setter def phase(self, arg1: float) -> None: ... -class SoftQuadrupole(Thick, Alignment): +class SoftQuadrupole(Named, Thick, Alignment): def __init__( self, ds: float, @@ -1029,6 +1084,7 @@ class SoftQuadrupole(Thick, Alignment): rotation: float = 0, mapsteps: int = 1, nslice: int = 1, + name: str | None = None, ) -> None: """ A soft-edge quadrupole. @@ -1055,7 +1111,7 @@ class SoftQuadrupole(Thick, Alignment): @mapsteps.setter def mapsteps(self, arg1: int) -> None: ... -class SoftSolenoid(Thick, Alignment): +class SoftSolenoid(Named, Thick, Alignment): def __init__( self, ds: float, @@ -1068,6 +1124,7 @@ class SoftSolenoid(Thick, Alignment): rotation: float = 0, mapsteps: int = 1, nslice: int = 1, + name: str | None = None, ) -> None: """ A soft-edge solenoid. @@ -1101,7 +1158,7 @@ class SoftSolenoid(Thick, Alignment): @unit.setter def unit(self, arg1: float) -> None: ... -class Sol(Thick, Alignment): +class Sol(Named, Thick, Alignment): def __init__( self, ds: float, @@ -1110,6 +1167,7 @@ class Sol(Thick, Alignment): dy: float = 0, rotation: float = 0, nslice: int = 1, + name: str | None = None, ) -> None: """ An ideal hard-edge Solenoid magnet. @@ -1129,7 +1187,7 @@ class Sol(Thick, Alignment): @ks.setter def ks(self, arg1: float) -> None: ... -class TaperedPL(Thin, Alignment): +class TaperedPL(Named, Thin, Alignment): def __init__( self, k: float, @@ -1138,6 +1196,7 @@ class TaperedPL(Thin, Alignment): dx: float = 0, dy: float = 0, rotation: float = 0, + name: str | None = None, ) -> None: """ A thin nonlinear plasma lens with transverse (horizontal) taper @@ -1213,9 +1272,15 @@ class Thin: number of slices used for the application of space charge """ -class ThinDipole(Thin, Alignment): +class ThinDipole(Named, Thin, Alignment): def __init__( - self, theta: float, rc: float, dx: float = 0, dy: float = 0, rotation: float = 0 + self, + theta: float, + rc: float, + dx: float = 0, + dy: float = 0, + rotation: float = 0, + name: str | None = None, ) -> None: """ A thin kick model of a dipole bend.