SimulationFramework.Elements package
Submodules
SimulationFramework.Elements.apcontour module
- class apcontour(*args, **kwargs)[source]
Bases:
frameworkElementClass defining a contour.
- Parameters:
args (
Any)kwargs (
Any)
-
filename:
str= '' Name of file containing contour data
-
resolution:
float= 0.001 z resolution of finding intersection
-
xcolumn:
str= '' Name of column containing x data
-
ycolumn:
str= '' Name of column containing y data
SimulationFramework.Elements.aperture module
- class aperture(*args, **kwargs)[source]
Bases:
frameworkElementClass defining an aperture or collimator.
- Parameters:
args (
Any)kwargs (
Any)
-
horizontal_size:
float|None= None Horizontal size of aperture
-
negative_extent:
float|None= None Longitudinal start position of an aperture
-
number_of_elements:
int|None= None Number of aperture elements
-
positive_extent:
float|None= None Longitudinal end position of an aperture
-
radius:
float|None= None Radius of aperture
-
shape:
Optional[Literal['elliptical','planar','circular','rectangular','scraper']] = None Aperture shape
-
vertical_size:
float|None= None Vertical size of aperture
SimulationFramework.Elements.beam_arrival_monitor module
SimulationFramework.Elements.beam_position_monitor module
SimulationFramework.Elements.bellows module
SimulationFramework.Elements.bunch_length_monitor module
SimulationFramework.Elements.cavity module
- class cavity(*args, **kwargs)[source]
Bases:
frameworkElementClass defining an RF cavity.
- Parameters:
args (
Any)kwargs (
Any)
-
Structure_Type:
Optional[Literal['StandingWave','TravellingWave']] = None Cavity structure type
-
body_focus_model:
str= 'SRS' Cavity focusing model
-
cavity_type:
str|None= None Type of cavity
-
cell_length:
float= 0.0 Length of cavity cell
-
change_p0:
int= 1 Flag to indicate whether cavity is changing momentum
-
coupling_cell_length:
float= 0.0 Length of cavity coupling cells
-
crest:
float|None= 0.0 Crest phase
-
current_bins:
int= 0 Number of current bins
-
end1_focus:
int= 1 Apply entrance focusing
-
end2_focus:
int= 1 Apply exit focusing
-
ez_peak:
float|None= None Peak longitudinal electric field
-
ezcolumn:
str= '"Ez"' Column for longitudinal electric field data in field file
-
field_amplitude:
float= 0.0 Cavity field amplitude [V]
-
field_reference_position:
Literal['start','middle','end'] = 'start' Reference position for field
-
field_type:
str|None= None Type of field
-
frequency:
float|None= None Cavity frequency
- get_cells()[source]
Get the number of cavity cells.
- Returns:
The number of cavity cells, or None if not defined.
- Return type:
int or None
-
interpolate_current_bins:
int= 1 Flag to indicate whether to interpolate during current histogram
-
lsc_bins:
int= 100 Number of longitudinal space charge bins
-
n_cells:
int | float= None Number of cavity cells
-
n_kicks:
int= 0 Number of cavity kicks to apply
-
phase:
float|None= 0.0 Off-crest phase
- set_wakefield_column_names(wakefield_file_name)[source]
Set the column names for the wakefield file, based on `wakefield_definition.
- Parameters:
wakefield_file_name (str) – Name of the wakefield file
- Return type:
None
-
smooth:
int|None= None Smoothing parameter
-
smooth_current_bins:
int= 1 Flag to indicate whether to smooth the current histogram
-
tcolumn:
str= '"t"' Column for time data in field file
-
trwakefile:
str|None= None Name of transverse wake file
- validate_frequency()
-
wakefieldcolumstring:
str= '"z", "Wx", "Wy", "Wz"' Full names of wake file columns
-
wakefile:
str|None= None Name of wake file
-
wxcolumn:
str= '"Wx"' Column for horizontal wakefield data in field file
-
wycolumn:
str= '"Wy"' Column for vertical wakefield data in field file
-
wzcolumn:
str= '"Wz"' Column for longitudinal wakefield data in field file
-
zcolumn:
str= '"z"' Column for longitudinal position data in field file
-
zwakefile:
str|None= None Name of longitudinal wake file
SimulationFramework.Elements.center module
- class center(*args, **kwargs)[source]
Bases:
frameworkElementClass defining a centering element
- Parameters:
args (
Any)kwargs (
Any)
SimulationFramework.Elements.charge module
- class charge(*args, **kwargs)[source]
Bases:
frameworkElementClass defining a charge element.
- Parameters:
args (
Any)kwargs (
Any)
-
total:
float|None= None Bunch charge [C]
SimulationFramework.Elements.cleaner module
- class cleaner(objecttype='scatter', *args, **kwargs)[source]
Bases:
frameworkElementCleans the beam by removing outlier particles.
- Parameters:
objecttype (
str)
SimulationFramework.Elements.collimator module
SimulationFramework.Elements.dipole module
- class dipole(*args, **kwargs)[source]
Bases:
frameworkElementClass defining a dipole magnet.
- Parameters:
args (
Any)kwargs (
Any)
- property TD_middle: ndarray
-
angle:
float= 0.0 Bend angle
- property arc_middle: ndarray
Get the middle position of the dipole based on the arc path.
- Returns:
The position [x,y,z] of the middle of the dipole
- Return type:
np.ndarray
- property astra_end: ndarray
Get the end position of the dipole for ASTRA
- Returns:
The position [x,y,z] of the end of the dipole
- Return type:
np.ndarray
- check_value(estr, default=0)[source]
Check that the parameter provided is valid for the dipole. See
checkValue().- Parameters:
estr (str) – Element parameter
default (Any) – Default value for the parameter
- Returns:
Value or default value for element
- Return type:
Any
- property corners: list[ndarray]
Get the corner positions of the dipole for ASTRA.
- Returns:
Dipole corner positions
- Return type:
np.ndarray
-
csr_bins:
int= 100 Number of CSR bins
-
csr_enable:
int= 1 Flag to indicate whether CSR is enabled
-
deltaL:
float= 0 Delta length
- property e1: float
Get the dipole entrance edge angle.
- Returns:
The dipole entrance edge angle.
- Return type:
float
- property e2
Get the dipole exit edge angle.
- Returns:
The dipole exit edge angle.
- Return type:
float
-
edge1_effects:
int= 1 Flag to indicate whether entrance edge effects are included
-
edge2_effects:
int= 1 Flag to indicate whether exit edge effects are included
-
edge_field_integral:
float= 0.5 Edge field integral for fringes
-
edge_order:
int= 2 Matrix order for edges
-
entrance_edge_angle:
float|str= 0.0 Entrance edge angle
-
exit_edge_angle:
float|str= 0.0 Exit edge angle
-
gap:
float= 0.0001 Dipole gap
- gpt_ccs(ccs)[source]
Get the GPT coordinate system for the element.
- Parameters:
ccs (str) – The GPT coordinate system.
- Returns:
The GPT coordinate system
- Return type:
str
- gpt_coordinates(position, rotation)[source]
Get the string representation of the dipole coordinates for GPT
- Parameters:
position (np.ndarray or list) – Dipole position
rotation (np.ndarray or list) – Dipole rotation
- Returns:
String representation of the dipole coordinates for GPT
- Return type:
str
-
half_gap:
float= 0.016 Dipole half gap
-
integration_order:
int= 4 Runge-Kutta integration order
- property intersect
- property intersection: ndarray
-
isr_enable:
bool= True Flag to indicate whether ISR is enabled
- property line_middle: ndarray
Get the middle position of the dipole based on the dipole geometry.
- Returns:
The position [x,y,z] of the middle of the dipole
- Return type:
np.ndarray
-
n_kicks:
int= 8 Number of kicks within the dipole
-
nonlinear:
int= 1 Flag to indicate whether to perform nonlinear calculations
-
plane:
Literal['horizontal','vertical'] = 'horizontal' Bending plane
- property position_end: ndarray
Get the end position of the dipole
- Returns:
The position [x,y,z] of the end of the dipole
- Return type:
np.ndarray
- property position_start: ndarray
Get the start position of the dipole
- Returns:
The position [x,y,z] of the start of the dipole
- Return type:
np.ndarray
- property rho: float
Get the dipole bend radius – l / theta.
- Returns:
The dipole bend radius
- Return type:
float
-
smoothing_half_width:
int= 1 Half-width for smoothing
-
sr_enable:
bool= True Flag to enable SR calculations
-
strength:
float= 0.0 Dipole strength
-
width:
float= 0.2 Dipole width
SimulationFramework.Elements.drift module
- class drift(*args, **kwargs)[source]
Bases:
frameworkElementClass defining a drift object [deprecated?].
- Parameters:
args (
Any)kwargs (
Any)
SimulationFramework.Elements.faraday_cup module
- class faraday_cup(*args, **kwargs)[source]
Bases:
wall_current_monitorClass defining a faraday cup element.
- Parameters:
args (
Any)kwargs (
Any)
SimulationFramework.Elements.fel_modulator module
- class fel_modulator(*args, **kwargs)[source]
Bases:
frameworkElementClass defining a modulator undulator.
- Parameters:
args (
Any)kwargs (
Any)
-
gradient:
float|None= None Gradient of magnetic field
-
helical:
bool= False Flag to indicate whether a helical undulator is used
-
horizontal_mode_number:
int|None= None Horizontal mode number
-
method:
str|None= None Tracking method
-
n_steps:
int|None= None Number of steps for tracking
-
peak_field:
float= 0.0 Peak magnetic field
-
peak_power:
float= 0.0 Laser peak power
-
periods:
int|None= None Number of periods in the modulator
-
phase:
float= 0.0 Laser phase
-
time_offset:
float= 0.0 Time offset between laser pulse and particle beam
-
vertical_mode_number:
int|None= None Vertical mode number
-
wavelength:
float= 0.0 Wavelength of laser
SimulationFramework.Elements.global_error module
- class global_error(*args: Any, **kwargs: Any)[source]
Bases:
frameworkElementClass defining a global error element.
SimulationFramework.Elements.gpt_ccs module
SimulationFramework.Elements.integrated_current_transformer module
- class integrated_current_transformer(*args, **kwargs)[source]
Bases:
wall_current_monitorClass defining an ICT element.
- Parameters:
args (
Any)kwargs (
Any)
SimulationFramework.Elements.kicker module
- class kicker(*args, **kwargs)[source]
Bases:
dipoleClass defining a kicker magnet.
- Parameters:
args (
Any)kwargs (
Any)
-
Horizontal_PV:
str|None= None EPICS process variable name for the horizontal corrector
-
Vertical_PV:
str|None= None EPICS process variable name for the vertical corrector
- gpt_ccs(ccs)[source]
Get the GPT coordinate system for the element.
- Parameters:
ccs (str) – The GPT coordinate system.
- Returns:
The GPT coordinate system
- Return type:
str
-
horizontal_kick:
float= 0.0 Horizontal kick in radians
-
vertical_kick:
float= 0.0 Vertical kick in radians
- property z_rot
Returns the global z-rotation of the element.
- Returns:
The global z-rotation of the element.
- Return type:
float
SimulationFramework.Elements.marker module
SimulationFramework.Elements.monitor module
SimulationFramework.Elements.octupole module
- class octupole(*args, **kwargs)[source]
Bases:
frameworkElementClass defining an octupole element.
- Parameters:
args (
Any)kwargs (
Any)
- property dk3: float
Normalised octupole strength error
- Returns:
Octupole strength error
- Return type:
float
- k3(k3)
Setter for octupole strength
- Parameters:
k3 (float) – Octupole strength
- Return type:
None
-
k3l:
float= 0.0 Octupole strength
-
n_kicks:
int= 20 Number of kicks to apply
-
strength_errors:
list= [0] Strength errors
SimulationFramework.Elements.quadrupole module
- class quadrupole(*args, **kwargs)[source]
Bases:
frameworkElementClass defining a quadrupole magnet
- Parameters:
args (
Any)kwargs (
Any)
-
bore:
float|None= None Bore radius of the quadrupole
- property dk1: float
Quadrupole strength error
- Returns:
Quadrupole strength error
- Return type:
float
-
field_reference_position:
str= 'middle' Reference position for quadrupole field file
-
fringe_field_coefficient:
float= 0.0 Quad fringe field coefficient
-
gradient:
float= 0.0 Magnetic field gradient
- k1(k1)
Set the quadrupole K1
- Parameters:
k1 (float) – Quadrupole K1
- Return type:
None
-
k1l:
float= 0.0 Quadrupole strength
-
multipoles:
List[float] = [0] Multipole elements in the quad
-
n_kicks:
int= 4 Number of kicks for tracking through the quad
-
scale_field:
bool= False Flag indicating whether to scale the field from the field file
-
smooth:
int|float= 2 Number of points to smooth the field map [ASTRA only]
-
strength_errors:
list= [0] Quadrupole strength errors
SimulationFramework.Elements.rcollimator module
SimulationFramework.Elements.rf_deflecting_cavity module
SimulationFramework.Elements.scatter module
- class scatter(*args, **kwargs)[source]
Bases:
frameworkElement- Parameters:
args (
Any)kwargs (
Any)
-
horizontal_momentum_scatter:
float|None= None
-
horizontal_scatter:
float|None= None
-
probability:
float|None= None
-
relative_momentum_scatter:
float|None= None
-
vertical_momentum_scatter:
float|None= None
-
vertical_scatter:
float|None= None
SimulationFramework.Elements.screen module
- class screen(*args, **kwargs)[source]
Bases:
frameworkElementClass defining a screen element
- Parameters:
args (
Any)kwargs (
Any)
- astra_to_hdf5(lattice, cathode=False, mult=100)[source]
Convert the ASTRA beam file name to HDF5 format and write the beam file.
- Parameters:
lattice (str) – Lattice name
cathode (bool) – True if beam was emitted from a cathode
mult (int) – Multiplication factor for ASTRA-type filenames
- Return type:
None
- find_ASTRA_filename(lattice, master_run_no, mult)[source]
Determine the ASTRA filename for the screen object.
- Parameters:
lattice (str) – The name of the lattice
master_run_no (int) – The run number
mult (int) – Multiplication factor for ASTRA-type output
- Returns:
The ASTRA filename for the screen object, or None if the file does not exist.
- Return type:
str or None
- gdf_to_hdf5(gptbeamfilename, cathode=False, gdf=None)[source]
Convert the GDF beam file to HDF5 format and write the beam file.
- Parameters:
gptbeamfilename (str) – Name of GPT beam file
cathode (bool) – True if beam was emitted from a cathode
gdf (gdfbeam or None) – GDF beam object
- Return type:
None
-
output_filename:
str|None= None Output filename for the screen
SimulationFramework.Elements.sextupole module
- class sextupole(*args, **kwargs)[source]
Bases:
frameworkElementClass defining a sextupole element
- Parameters:
args (
Any)kwargs (
Any)
- property dk2: float
Normalised sextupole strength error
- Returns:
Sextupole strength error
- Return type:
float
- k2(k2)
Setter for sextupole strength
- Parameters:
k3 (float) – Sextupole strength
k2 (
float)
- Return type:
None
-
k2l:
float= 0.0 Sextupole strength
-
n_kicks:
int= 20 Number of kicks for sextupole tracking
-
strength_errors:
list= [0] Sextupole strength errors
SimulationFramework.Elements.shutter module
SimulationFramework.Elements.solenoid module
- class solenoid(*args, **kwargs)[source]
Bases:
frameworkElementClass defining a solenoid element.
- Parameters:
args (
Any)kwargs (
Any)
-
array_names:
list[str] |None= None Names for the solenoid field file array
-
default_array_names:
list[str] = ['Z', 'Bz'] Default names for the solenoid field file array
-
field_amplitude:
float= 0.0 Solenoid peak field amplitude
-
field_scale:
float= 1.0 Field scaling factor
-
field_type:
str= '1DMagnetoStatic' Solenoid field type
-
scale_field:
bool= True Scale the field according to field_scale
-
smooth:
float= 10.0 Smoothing parameter
SimulationFramework.Elements.valve module
SimulationFramework.Elements.wakefield module
- class wakefield(*args: Any, **kwargs: Any)[source]
Bases:
cavityClass defining a wakefield element
-
cells:
int|None= 1 Number of cells (if wake originated from a cavity)
-
coupling_cell_length:
float= 0.0 Cavity coupling cell length
-
equal_grid:
float= 0.66 If 1.0 an equidistant grid is set up, if 0.0 a grid with equal charge per grid cell is employed. Values between 1.0 and 0.0 result in intermediate binning based on a linear combination of the two methods.
-
fringe_field_coefficient:
float|None= None Fringe field coefficient for cavity
-
inputfile:
str= None Wake file name for setting in ELEGANT.
-
interpolation_method:
int= 2 0 = rectangular, 1 = triangular, 2 = Gaussian.
- Type:
Interpolation method for ASTRA
-
n_cells:
int|float|None= 1 Number of cells (if wake originated from a cavity)
-
scale_field_ex:
float= 0.0 x-component of the longitudinal direction vector.
-
scale_field_ey:
float= 0.0 y-component of the longitudinal direction vector.
-
scale_field_ez:
float= 1.0 z-component of the longitudinal direction vector.
-
scale_field_hx:
float= 1.0 x-component of the horizontal direction vector.
-
scale_field_hy:
float= 0.0 y-component of the horizontal direction vector.
-
scale_field_hz:
float= 0.0 z-component of the horizontal direction vector.
-
scale_kick:
float= 1.0 Wake kick scaling factor
- set_column_names(file_name)[source]
Set wakefield column names based on the field_definition.
- Parameters:
file_name (str) – Name of wakefield file
- Returns:
Wake type
- Return type:
str
-
smooth:
float= 0.25 Smoothing parameter for Gaussian interpolation.
-
subbins:
int= 10 Sub binning parameter.
-
tcolumn:
str= '"t"' Time column name
-
waketype:
str= 'Taylor_Method_F' Type of wakefield, see ASTRA manual
-
wcolumn:
str= '"Wz"' Longitudinal wake column name
-
wxcolumn:
str= '"Wx"' String representing the horizontal wake in the wake file
-
wycolumn:
str= '"Wy"' String representing the vertical wake in the wake file
-
wzcolumn:
str= '"Wz"' String representing the longitudinal wake in the wake file
-
x_offset:
float= 0.0 Horizontal offset
-
y_offset:
float= 0.0 Vertical offset
-
zcolumn:
str= '"z"' String representing the z position in the wake file
-
cells:
SimulationFramework.Elements.wall_current_monitor module
- class wall_current_monitor(*args, **kwargs)[source]
Bases:
frameworkElementClass defining a wall current monitor element
- Parameters:
args (
Any)kwargs (
Any)