piol.elements module

Inheritance diagram

Inheritance diagram of piol.elements

API reference

class piol.elements.AcceptanceCollimator(alpha_x, beta_x, epsilon_x, alpha_y, beta_y, epsilon_y, name='AcceptanceCollimator', description='')[source]

Bases: piol.element.Element

Collimator for modelling a system acceptance

Collimates particles outside an elliptical (x,x’) or (y,y’) phase spaces. The acceptance is defined using epsilon value (geometrical product of half axes, area of ellipse is pi*epsilon) and Twiss parameters alpha and beta. The ellipse is defined with gamma*x^2 + 2*alpha*x*x’ + beta*x’^2 = epsilon, where beta*gamma - alpha^2 = 1. Gamma is calculated internally.

Parameters
  • alpha_x (float) – Twiss parameter alpha of acceptance ellipse on (x,x’) plane

  • beta_x (float) – Twiss parameter beta of acceptance ellipse on (x,x’) plane

  • epsilon_x (float) – Geometrical emittance value of acceptance ellipse on (x,x’) plane

  • alpha_y (float) – Twiss parameter alpha of acceptance ellipse on (y,y’) plane

  • beta_y (float) – Twiss parameter beta of acceptance ellipse on (y,y’) plane

  • epsilon_y (float) – Geometrical emittance value of acceptance ellipse on (y,y’) plane

plot(view, s)[source]

Plot the element

Plots a representation of the element using the plotter interface in a cross section view. Defaults to plotting nothing.

Parameters
  • ax (Axis) – Axis instance to plot on

  • view (str) – String describing which viewpoint to draw on. Must be known to the Plotter.

  • s (float) – Starting distance along the optical axis for element start.

printDebug(indent='')[source]

Print debugging information for element.

transfer(driver)[source]

Transfers the particles saved in the driver through the element.

Parameters

driver (Driver) – Driver of the system

class piol.elements.Collimator(size, name='Collimator', description='')[source]

Bases: piol.element.Element

Collimator element

Can be used to make two kinds of collimator. Ones with round apertures (size is a single number, the radius) or rectangular collimators (size is tuple with half-sizes in x and y). Cuts the beam in the physical dimensions.

Parameters

size (float or tuple) – Size of collimator

height(dimension=None)[source]

Calculate the height of the element.

Returns

float

Return type

Height of the element.

plot(ax, view, s)[source]

Plot the element

Plots a representation of the element using the plotter interface in a cross section view. Defaults to plotting nothing.

Parameters
  • ax (Axis) – Axis instance to plot on

  • view (str) – String describing which viewpoint to draw on. Must be known to the Plotter.

  • s (float) – Starting distance along the optical axis for element start.

printDebug(indent='')[source]

Print debugging information for element.

transfer(driver)[source]

Transfers the particles saved in the driver through the element.

Parameters

driver (Driver) – Driver of the system

class piol.elements.Drift(dl, name='Drift length', description='', collimator=None, thickness=None)[source]

Bases: piol.elements.TMElement

Drift element

Transports the beam through a length without electromagnetic interactions.

Parameters

dl (float) – Drift length of the element in m.

build()[source]

Builds element.

length()[source]

Calculate the length of the element.

Returns

float

Return type

Length of the element.

plot(ax, view, s)[source]

Plot the element

Plots a representation of the element using the plotter interface in a cross section view. Defaults to plotting nothing.

Parameters
  • ax (Axis) – Axis instance to plot on

  • view (str) – String describing which viewpoint to draw on. Must be known to the Plotter.

  • s (float) – Starting distance along the optical axis for element start.

transfer(driver)[source]

Transfers the particles saved in the driver through the element.

Parameters

driver (Driver) – Driver of the system

class piol.elements.GapLens(Leff, N, D, name='Gap lens', description='')[source]

Bases: piol.elements.TMElement

Gap lens element

Implements the first order approximation of a nonrelativistic cylindrical gap lens, also known as the immersion lens. The gap lens accelerates the beam from kinetic energy T1 to kinetic energy T2 in gap with effective length Leff.

Typically effective length is approximated as Leff = L + D, where L is the physical gap length and D is the lens tube diameter.

Reference F. Hinterberger, “Ion optics with electrostatic lenses”, in Proc. of the Specialised CAS Course on Small Accelerators, Zeegse, The Netherlands, 24 May - 2 Jun 2005, pp. 27-44 (CERN-2006-012).

Parameters
  • Leff (float) – Effective gap length

  • N (float) – Relative energy change T2/T1

  • D (float) – Diameter of aperture

build()[source]

Builds element.

length()[source]

Calculate the length of the element.

Returns

float

Return type

Length of the element.

plot(ax, view, s)[source]

Plot the element

Plots a representation of the element using the plotter interface in a cross section view. Defaults to plotting nothing.

Parameters
  • ax (Axis) – Axis instance to plot on

  • view (str) – String describing which viewpoint to draw on. Must be known to the Plotter.

  • s (float) – Starting distance along the optical axis for element start.

class piol.elements.Kick(coord, value, height=1, name='Kick', description='')[source]

Bases: piol.elements.TMElement

A thin kick element

Adds a constant to a single property of particles. Can be used to model, for example, the effect of alignment errors.

Parameters
  • coord (str) – What particle property is modified.

  • value (float) – What value of addition is made.

  • height (float) – Height of elements used in plotting.

length()[source]

Calculate the length of the element.

Returns

float

Return type

Length of the element.

plot(ax, view, s)[source]

Plot the element

Plots a representation of the element using the plotter interface in a cross section view. Defaults to plotting nothing.

Parameters
  • ax (Axis) – Axis instance to plot on

  • view (str) – String describing which viewpoint to draw on. Must be known to the Plotter.

  • s (float) – Starting distance along the optical axis for element start.

rebuild()[source]

Rebuilds element if any of its parameters have been modified.

Defaults to doing nothing.

class piol.elements.Rotation(angle, name='Rotation', description='')[source]

Bases: piol.elements.TMElement

Rotation element

An element that rotates the beam by a given angle around the optical axis.

Parameters

angle (float) – Angle for the rotation in degrees in counter clockwise direction.

build()[source]

Builds element.

class piol.elements.RotationWrapper(angle, subelement, name='RotationWrapper', description='')[source]

Bases: piol.elements.TMElement

Wrapper for an element to rotate it.

Parameters
  • angle (float) – Angle for the rotation in degrees in counter clockwise direction.

  • subelement (obj:Element) – Element to rotate

  • name (str) – Name given to the element

  • description (str) – Description of the element, currently not used.

build()[source]

Builds element.

field(kind)[source]

Return the field strength within the element.

Parameters

kind ({'magnetic' , 'electric'}) – String to select field type.

Returns

Field strength within the element.

Return type

float

getTransferMatrix()[source]

Returns full transfer matrix of the rotated system.

length()[source]

Calculate the length of the element.

Returns

float

Return type

Length of the element.

plot(ax, view, s)[source]

Plot the element

Plots a representation of the element using the plotter interface in a cross section view. Defaults to plotting nothing.

Parameters
  • ax (Axis) – Axis instance to plot on

  • view (str) – String describing which viewpoint to draw on. Must be known to the Plotter.

  • s (float) – Starting distance along the optical axis for element start.

processTrajectory(driver, plesToSave, ds, dr, dx, dy)[source]

Process the particles and profile plane information before saving those.

This is called by driver. This method is implemented only in elements which are wrapping other elements and are for example rotating the elements it is containing. By default this method just returns all the arguments in the same order.

rebuild()[source]

Rebuilds element if any of its parameters have been modified.

Defaults to doing nothing.

setParameter(parameter, newvalue)[source]

Modifies given parameter.

transfer(driver)[source]

Transfers the particles saved in the driver through the element.

Parameters

driver (Driver) – Driver of the system

class piol.elements.TMElement(refple=None, name='', description='')[source]

Bases: piol.element.Element

Base class for all elements using transfer matrix formalism.

Parameters
  • refple (ReferenceParticle) – Reference particle for which the element is to be designed.

  • name (str) – Name given to the element.

  • description (str) – Description of the element, currently not used.

transfer(driver)[source]

Transfers the particles saved in the driver through the element.

Parameters

driver (Driver) – Driver of the system