mbtrack2.tracking.aperture module

This module defines aperture elements for tracking.

class Aperture[source]

Bases: Element

Base class for aperture elements. It is not intended to be used directly. Instead, use one of the subclasses: CircularAperture, ElipticalAperture, RectangularAperture, or LongitudinalAperture.

__init__()[source]
abstract determine_alive(bunch: Bunch) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]

Determine which particles are alive based on the aperture. This method should be overridden in subclasses.

Parameters

bunchBunch or Beam object

The bunch of particles to check.

Returns

List[bool]

A list of booleans indicating whether each particle is alive.

track(bunch: Bunch | Beam)[source]

Track a Beam or Bunch object through this Element.

Parameters

beam : Beam or Bunch object

_abc_impl = <_abc._abc_data object>
class CircularAperture(radius: float, delete_particles: bool = False)[source]

Bases: Aperture

Circular aperture element. The particles which are outside of the circle are ‘lost’ and not used in the tracking any more.

Parameters

radiusfloat

radius of the circle in [m]

delete_particlesbool, optional

If False, they are just marked as ‘not alive’ and not used in the tracking. If True, the particles outside of the aperture are deleted. Use with caution, if True most Monitors will not work. Default is False.

__init__(radius: float, delete_particles: bool = False)[source]
determine_alive(bunch: Bunch) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]

Determine which particles are alive based on the circular aperture.

Parameters

bunchBunch or Beam object

The bunch of particles to check.

Returns

List[bool]

A list of booleans indicating whether each particle is alive.

_abc_impl = <_abc._abc_data object>
class ElipticalAperture(X_radius: float, Y_radius: float, delete_particles: bool = False)[source]

Bases: Aperture

Eliptical aperture element. The particles which are outside of the elipse are ‘lost’ and not used in the tracking any more.

Parameters

X_radiusfloat

horizontal radius of the elipse in [m]

Y_radiusfloat

vertical radius of the elipse in [m]

delete_particlesbool, optional

If False, they are just marked as ‘not alive’ and not used in the tracking. If True, the particles outside of the aperture are deleted. Use with caution, if True most Monitors will not work. Default is False.

__init__(X_radius: float, Y_radius: float, delete_particles: bool = False)[source]
determine_alive(bunch: Bunch) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]

Determine which particles are alive based on the elliptical aperture.

Parameters

bunchBunch or Beam object

The bunch of particles to check.

Returns

List[bool]

A list of booleans indicating whether each particle is alive.

_abc_impl = <_abc._abc_data object>
class RectangularAperture(X_right: float, Y_top: float, X_left: float | None = None, Y_bottom: float | None = None, delete_particles: bool = False)[source]

Bases: Aperture

Rectangular aperture element. The particles which are outside of the rectangle are ‘lost’ and not used in the tracking any more.

Parameters

X_rightfloat

right horizontal aperture of the rectangle in [m]

Y_topfloat

top vertical aperture of the rectangle in [m]

X_leftfloat, optional

left horizontal aperture of the rectangle in [m]

Y_bottomfloat, optional

bottom vertical aperture of the rectangle in [m]

delete_particlesbool, optional

If False, they are just marked as ‘not alive’ and not used in the tracking. If True, the particles outside of the aperture are deleted. Use with caution, if True most Monitors will not work. Default is False.

__init__(X_right: float, Y_top: float, X_left: float | None = None, Y_bottom: float | None = None, delete_particles: bool = False)[source]
determine_alive(bunch: Bunch) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]

Determine which particles are alive based on the rectangular aperture.

Parameters

bunchBunch or Beam object

The bunch of particles to check.

Returns

NDArray[bool]

A list of booleans indicating whether each particle is alive.

_abc_impl = <_abc._abc_data object>
class LongitudinalAperture(tau_up: float, tau_low: float | None = None, delete_particles: bool = False)[source]

Bases: Aperture

Longitudinal aperture element. The particles which are outside of the longitudinal bounds are ‘lost’ and not used in the tracking any more.

Parameters

ring : Synchrotron object tau_up : float

Upper longitudinal bound in [s].

tau_lowfloat, optional

Lower longitudinal bound in [s].

delete_particlesbool, optional

If False, they are just marked as ‘not alive’ and not used in the tracking. If True, the particles outside of the aperture are deleted. Use with caution, if True most Monitors will not work. Default is False.

__init__(tau_up: float, tau_low: float | None = None, delete_particles: bool = False)[source]
determine_alive(bunch: Bunch) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]

Determine which particles are alive based on the longitudinal aperture.

Parameters

bunchBunch or Beam object

The bunch of particles to check.

Returns

List[bool]

A list of booleans indicating whether each particle is alive.

_abc_impl = <_abc._abc_data object>