laura.models package
Submodules
laura.models.RF module
- class ChannelNames(*args, **kwargs)[source]
Bases:
create_model- Parameters:
args (
Any)kwargs (
Any)
- class LLRFChannelIndex(*args, **kwargs)[source]
Bases:
ModelBase- Parameters:
args (
Any)kwargs (
Any)
-
phase:
int
-
power:
int
- class LLRFChannelsBase(*args, **kwargs)[source]
Bases:
ModelBase- Parameters:
args (
Any)kwargs (
Any)
- classmethod from_CATAP(fields)[source]
- Parameters:
fields (
dict)- Return type:
TypeVar(T, bound= BaseModel)
-
labels:
List[str] = []
- property phases
- class LLRFTiming(*args, **kwargs)[source]
Bases:
ModelBase- Parameters:
args (
Any)kwargs (
Any)
-
end:
Union[float,int]
-
start:
Union[float,int]
- class Low_Level_RF_Element(*args, **kwargs)[source]
Bases:
IgnoreExtra- Parameters:
args (
Any)kwargs (
Any)
-
channel_names:
ChannelNames
-
crest_phase:
float
- classmethod from_CATAP(fields)[source]
- Parameters:
fields (
dict)- Return type:
TypeVar(T, bound= BaseModel)
-
one_record:
LLRFChannelsBase
-
timings:
LLRFTimings
- class PIDElement(*args, **kwargs)[source]
Bases:
IgnoreExtraLLRF info model.
- Parameters:
args (
Any)kwargs (
Any)
-
disable:
str
-
enable:
str
-
forward_channel:
int
-
phase_range:
Union[str,list,PIDPhaseRange]
-
phase_weight_range:
Union[str,list,PIDWeightRange]
-
probe_channel:
int
- validate_phase_range()
- validate_phase_weight_range()
- class PIDPhaseRange(*args, **kwargs)[source]
Bases:
IgnoreExtra- Parameters:
args (
Any)kwargs (
Any)
-
max:
Union[float,int]
-
min:
Union[float,int]
- class PIDWeightRange(*args, **kwargs)[source]
Bases:
PIDPhaseRange- Parameters:
args (
Any)kwargs (
Any)
- class RFCavityElement(*args, **kwargs)[source]
Bases:
IgnoreExtraRF Cavity model.
- Parameters:
args (
Any)kwargs (
Any)
-
attenuation_constant:
float= 0 Attenuation constant associated with the cavity.
-
cell_length:
float= 0.0333333333333333 Length of cavity cell [m].
-
coupling_cell_length:
float|None= 0.0 Length of coupling cell [m].
-
crest:
float= 0 Crest phase [deg] – crest is zero.
-
design_gamma:
Optional[float] = None Design relativistic Lorentz factor for particles in the cavity.
-
design_power:
float= 25000000 Design power of the cavity [W]. #TODO max/min/other?
-
frequency:
float= 2998500000.0 RF frequency [Hz].
-
gradient_calibration:
Optional[List[float]] = None Gradient calibration for the cavity (if provided in config file)
-
mode_denominator:
float|None= None Denominator of travelling wave mode. #TODO combine with numerator to make it the actual mode?
-
mode_numerator:
float|None= None Numerator of travelling wave mode.
-
n_cells:
Union[int,float] = 1 Number of cavity cells.
-
phase:
float= 0.0 Off-crest phase [deg].
-
power_calibration:
Optional[List[float]] = None Power calibration for the cavity (if provided in config file)
-
shunt_impedance:
Optional[float] = None Shunt impedance.
-
structure_Type:
str= 'StandingWave' Type of RF structure #TODO make this literal.
- class RFDeflectingCavityElement(*args, **kwargs)[source]
Bases:
IgnoreExtraRF deflecting cavity model.
- Parameters:
args (
Any)kwargs (
Any)
-
cell_length:
float= 0.0333333333333333 Cavity cell length [m].
-
coupling_cell_length:
float|None= 0.0 Length of coupling cell [m].
-
crest:
float= 0 Crest phase [deg] – crest is zero.
-
design_gamma:
Optional[float] = None Design relativistic Lorentz factor for particles in the cavity.
-
design_power:
float= 25000000 Design power of the cavity [W]. #TODO max/min/other?
-
frequency:
float= 2998500000.0 RF frequency [Hz].
-
n_cells:
Union[int,float] = 1 Number of cavity cells.
-
phase:
float= 0.0 Off-crest phase [deg].
- class RFHeartbeatElement(*args, **kwargs)[source]
Bases:
IgnoreExtra- Parameters:
args (
Any)kwargs (
Any)
- class RFModulatorElement(*args, **kwargs)[source]
Bases:
IgnoreExtra- Parameters:
args (
Any)kwargs (
Any)
- class RFProtectionElement(*args, **kwargs)[source]
Bases:
IgnoreExtra- Parameters:
args (
Any)kwargs (
Any)
-
prot_type:
str
- class Trace(*args, **kwargs)[source]
Bases:
IgnoreExtra- Parameters:
args (
Any)kwargs (
Any)
- class WakefieldElement(*args, **kwargs)[source]
Bases:
IgnoreExtraWakefield element model.
- Parameters:
args (
Any)kwargs (
Any)
-
cell_length:
float= 0.0333333333333333 Length of cavity cell (if the wakefield is associated with a cavity; if not, just make this the length of the wakefield element.
-
coupling_cell_length:
float|None= 0.0
-
n_cells:
Union[int,float] = 1 Number of cavity cells (if the wakefield is associated with a cavity; if not, just make this 1.
laura.models._functions module
laura.models.baseModels module
- class Aliases(*args, **kwargs)[source]
Bases:
objectList- Parameters:
args (
Any)kwargs (
Any)
-
aliases:
list= []
- class DeviceList(*args, **kwargs)[source]
Bases:
objectList- Parameters:
args (
Any)kwargs (
Any)
-
devices:
list= []
- class IgnoreExtra(*args, **kwargs)[source]
Bases:
ModelBaseBase Model that ignores extra fields.
- Parameters:
args (
Any)kwargs (
Any)
- _create_field(fields, fieldname, fieldinputs)[source]
- Parameters:
fields (
dict)fieldname (
str)fieldinputs (
List[str])
- Return type:
None
- _create_field_class(fields, fieldname, fieldclass)[source]
- Parameters:
fields (
dict)fieldname (
str)fieldclass (
List[str])
- Return type:
None
- class ModelBase(*args, **kwargs)[source]
Bases:
BaseModelBase Model that ignores extra fields.
- Parameters:
args (
Any)kwargs (
Any)
- class NumpyModel(*args, **kwargs)[source]
Bases:
ModelBaseModel using numpy arrays.
- Parameters:
args (
Any)kwargs (
Any)
- property array: ndarray
- classmethod from_list(vec)[source]
- Parameters:
vec (
List[Union[float,int]])- Return type:
TypeVar(T, bound= BaseModel)
- classmethod from_values(*values)[source]
- Parameters:
values (
Union[float,int])- Return type:
TypeVar(T, bound= BaseModel)
- ser_model(handler, info)
- Parameters:
info (
SerializationInfo)
- class NumpyVectorModel(*args, **kwargs)[source]
Bases:
NumpyModelvector model using numpy arrays.
- Parameters:
args (
Any)kwargs (
Any)
- convert_numpy_types(v)[source]
Recursively convert numpy types in a data structure to native Python types.
- Parameters:
v (Any) – The input data structure which may contain numpy types.
- Returns:
The data structure with numpy types converted to native Python types.
- Return type:
Any
- class objectList(*args, **kwargs)[source]
Bases:
IgnoreExtra- Parameters:
args (
Any)kwargs (
Any)
laura.models.control module
- class ControlVariable[source]
Bases:
BaseModelModel representing a control variable in a system.
Example on updating element attributes based on control variables: ```python from laura.models.element import Element from laura.models.control import ControlVariable, ControlsInformation # Define control variables cv1 = ControlVariable(
identifier=”k1l_control”, dtype=float, protocol=”some_protocol”, units=”1/m”, description=”Control for k1l”, read_only=False, value=0.1, target=”magnetic.k1l”, expression={“op”: “mul”, “args”: [“k1l_control”, “magnetic.length”]},
) controls_info = ControlsInformation(variables={“k1l_control”: cv1}) # Create an element with magnetic attributes element = Element(
name=”Quad1”, magnetic={“k1l”: 0.0, “k2l”: 0.0}, controls=controls_info,
) # Apply control variables to the element controls_info.apply(element) print(element.magnetic.k1l) # Should reflect the updated value based on the control variable ```
-
_SERIALIZE_DEFAULTS:
dict= {'description': 'Default Description', 'read_only': True, 'type': 'statistical', 'units': 'Arb. Units'}
-
description:
str= 'Default Description' Description of the control variable.
- dtype
Data type of the control variable (e.g., int, float, str).
alias of
float
-
expression:
dict|None= None Expression defining how to compute the value to set at the target.
-
identifier:
str Unique identifier for the control variable.
-
protocol:
str Protocol or method used to interact with the control variable.
-
read_only:
bool= True Indicates if the variable is read-only.
- serialize()
-
states:
Optional[Dict] = None Possible state mapping enums.
-
target:
str|None= None Target attribute path in the system to apply the control variable.
-
type:
Literal['scalar','binary','state','string','waveform','statistical'] = 'statistical' Type of control variable.
-
units:
str= 'Arb. Units' Units of measurement for the control variable.
- validate_dtype(v)
Convert from string to type if necessary.
- Return type:
Type
-
value:
float|int|str|list|None= None Current value of the control variable.
-
_SERIALIZE_DEFAULTS:
- class ControlsInformation(*args, **kwargs)[source]
Bases:
BaseModelModel representing a collection of control variables.
- Parameters:
args (
Any)kwargs (
Any)
- validate_variables(v)
Ensure all values are ControlVariable instances.
- Return type:
Dict[str,ControlVariable]
-
variables:
Dict[str,ControlVariable] Dictionary mapping variable names to ~laura.models.control.ControlVariable instances.
- class MirrorControlsInformation(*args, **kwargs)[source]
Bases:
ControlsInformationModel representing a collection of control variables pertaining to mirrors.
- Parameters:
args (
Any)kwargs (
Any)
-
default_step:
float= 0.005 Default step size for mirror movement
-
down_sense:
int= 1 Down sense for mirror movement
-
left_sense:
int= 1 Left sense for mirror movement
-
right_sense:
int= -1 Right sense for mirror movement
-
step_max:
float= 0.05 Maximum step size for mirror movement
-
up_sense:
int= -1 Up sense for mirror movement
- class ScreenControlsInformation(*args, **kwargs)[source]
Bases:
ControlsInformationModel representing a collection of control variables pertaining to screens.
- Parameters:
args (
Any)kwargs (
Any)
-
devices:
dict List of screen device enums
-
horizontal_devices:
dict|None= None List of horizontal screen device enums
-
movement_type:
str Screen motion type
-
vertical_devices:
dict|None= None List of vertical screen device enums
- class ShutterControlsInformation(*args, **kwargs)[source]
Bases:
ControlsInformationModel representing a collection of control variables pertaining to shutters.
- Parameters:
args (
Any)kwargs (
Any)
-
shutter_type:
str Type of shutter, i.e. ‘LASER’, ‘BEAM’
laura.models.degauss module
- class DegaussableElement(*args, **kwargs)[source]
Bases:
IgnoreExtraModel for elements that can be degaussed.
- Parameters:
args (
Any)kwargs (
Any)
- validate_degauss_values()
laura.models.diagnostic module
- class Beam_Arrival_Monitor_Diagnostic(*args, **kwargs)[source]
Bases:
DiagnosticElementBAM Diagnostic model.
- Parameters:
args (
Any)kwargs (
Any)
- class Beam_Position_Monitor_Diagnostic(*args, **kwargs)[source]
Bases:
DiagnosticElementBPM Diagnostic model.
- Parameters:
args (
Any)kwargs (
Any)
- class Bunch_Length_Monitor_Diagnostic(*args, **kwargs)[source]
Bases:
DiagnosticElementBLM Diagnostic model.
- Parameters:
args (
Any)kwargs (
Any)
- class Camera_Diagnostic(*args, **kwargs)[source]
Bases:
DiagnosticElementCamera Diagnostic model.
- Parameters:
args (
Any)kwargs (
Any)
- classmethod from_CATAP(fields)[source]
- Parameters:
fields (
dict)- Return type:
TypeVar(T, bound= BaseModel)
-
has_led:
bool= True Flag to indicate if the camera has an LED light source.
-
ioc:
Optional[List[str]] = None List of cameras on the EPICS IOC associated with this camera.
-
rotation:
Union[float,int] = 0 Camera rotation in degrees.
-
screen_name:
str|None= None Name of the screen the camera is attached to.
- class Camera_Mask(*args, **kwargs)[source]
Bases:
IgnoreExtraClass defining the camera analysis mask parameters.
- Parameters:
args (
Any)kwargs (
Any)
- classmethod from_CATAP(fields)[source]
- Parameters:
fields (
dict)- Return type:
TypeVar(T, bound= BaseModel)
-
maximum:
List[Union[float,int]] = [300, 300] Maximum mask radius in pixels.
-
middle:
List[Union[float,int]] = [1280, 1080] Center of the mask in pixels.
-
radius:
List[Union[float,int]] = [1240, 1040] Mask radius in pixels.
- class Camera_Pixel_Results_Indices(*args, **kwargs)[source]
Bases:
IgnoreExtraClass defining the names of analysis results for the camera pixel data
- Parameters:
args (
Any)kwargs (
Any)
- class Camera_Pixel_Results_Names(*args, **kwargs)[source]
Bases:
IgnoreExtraClass defining the names of the analysis results for the camera data in SI units (or mm)
- Parameters:
args (
Any)kwargs (
Any)
- class Camera_Sensor(*args, **kwargs)[source]
Bases:
IgnoreExtraCamera Sensor model. Contains information about the number of pixels, scale factors, bit depth, etc.
- Parameters:
args (
Any)kwargs (
Any)
-
bit_depth:
int= 16 Camera bit depth.
- classmethod from_CATAP(fields)[source]
- Parameters:
fields (
dict)- Return type:
TypeVar(T, bound= BaseModel)
-
maximum:
List[Union[float,int]] = [2400, 2000] Maximum pixel positions in x and y directions.
-
mechanical_middle:
List[Union[float,int]] = [1000, 1000] Mechanical center of the camera in x and y
-
middle:
List[Union[float,int]] = [0, 0] Center definitions for the camera.
-
minimum:
List[Union[float,int]] = [150, 150] Minimum pixel positions in x and y directions.
-
operating_middle:
List[Union[float,int]] = [1000, 1000] Operating center positions in x and y
-
x_pixels_to_mm:
float= 0.0134 Pixel to millimeter conversion factors.
-
y_pixels_to_mm:
float= 0.0134 Pixel to millimeter conversion factors.
- class Charge_Diagnostic(*args, **kwargs)[source]
Bases:
DiagnosticElementCharge Diagnostic model.
- Parameters:
args (
Any)kwargs (
Any)
- class DiagnosticElement(*args, **kwargs)[source]
Bases:
IgnoreExtraBase class for diagnostic elements.
- Parameters:
args (
Any)kwargs (
Any)
- Manta_Camera_Sensor()[source]
A specific instantiation of ~laura.models.diagnostic.Camera_Sensor for Manta cameras.
- PCO_Camera_Sensor()[source]
A specific instantiation of ~laura.models.diagnostic.Camera_Sensor for PCO cameras.
- class Screen_Diagnostic(*args, **kwargs)[source]
Bases:
DiagnosticElementScreen Diagnostic model.
- Parameters:
args (
Any)kwargs (
Any)
-
camera_name:
str= '' Name of the camera attached to the screen.
-
has_camera:
bool= True Flag to indicate if the screen has a camera attached.
- validate_devices()
laura.models.electrical module
- class ElectricalElement(*args, **kwargs)[source]
Bases:
IgnoreExtraElectrical info model.
- Parameters:
args (
Any)kwargs (
Any)
laura.models.element module
LAURA Element Module
The main class for representing accelerator elements in LAURA.
- class Aperture(*args, **kwargs)[source]
Bases:
PhysicalBaseElementAperture element.
- hardware_type
The hardware type of the aperture.
- Type:
str
- hardware_model
The hardware model of the aperture.
- Type:
str
- aperture
The simulation
- Type:
- attributes of the aperture.
- Parameters:
args (
Any)kwargs (
Any)
- class Beam_Arrival_Monitor(*args, **kwargs)[source]
Bases:
DiagnosticBAM element.
- hardware_type
The hardware type of the diagnostic.
- Type:
str
- hardware_model
The specific hardware model of the diagnostic.
- Type:
str
- diagnostic
(
Beam_Arrival_Monitor_Diagnostic): The diagnostic
- attributes of the BAM.
- Parameters:
args (
Any)kwargs (
Any)
- class Beam_Position_Monitor(*args, **kwargs)[source]
Bases:
DiagnosticBPM element.
- hardware_type
The hardware type of the diagnostic.
- Type:
str
- hardware_model
The specific hardware model of the diagnostic (i.e. Stripline, Cavity).
- Type:
str
- diagnostic
(
Beam_Position_Monitor_Diagnostic): The diagnostic
- attributes of the BPM.
- Parameters:
args (
Any)kwargs (
Any)
- class Bunch_Length_Monitor(*args, **kwargs)[source]
Bases:
DiagnosticBLM element.
- hardware_type
The hardware type of the diagnostic.
- Type:
str
- hardware_model
The specific hardware model of the diagnostic.
- Type:
str
- diagnostic
(
Bunch_Length_Monitor_Diagnostic): The diagnostic
- attributes of the BLM.
- Parameters:
args (
Any)kwargs (
Any)
- class Camera(*args, **kwargs)[source]
Bases:
DiagnosticCamera element.
- hardware_type
The hardware type of the diagnostic.
- Type:
str
- hardware_model
The specific hardware model of the diagnostic.
- Type:
str
- diagnostic
(
Camera_Diagnostic): The diagnostic
- attributes of the Camera.
- Parameters:
args (
Any)kwargs (
Any)
- class ChargeDiagnostic(*args, **kwargs)[source]
Bases:
DiagnosticGeneric charge diagnostic element.
- hardware_type
The hardware type of the diagnostic.
- Type:
str
- diagnostic
(
Charge_Diagnostic): The diagnostic
- attributes of the diagnostic.
- Parameters:
args (
Any)kwargs (
Any)
- class Collimator(*args, **kwargs)[source]
Bases:
ApertureCollimator element.
- hardware_type
The hardware type of the collimator.
- Type:
str
- hardware_model
The hardware model of the collimator.
- Type:
str
- Parameters:
args (
Any)kwargs (
Any)
- class Combined_Corrector[source]
Bases:
DipoleHorizontal corrector element.
- hardware_type
The hardware type of the corrector.
- Type:
str
- Horizontal_Corrector
The horizontal corrector.
- Type:
str
- Vertical_Corrector
The vertical corrector.
- Type:
str
- class Diagnostic(*args, **kwargs)[source]
Bases:
PhysicalBaseElementBase class for representing diagnostics.
- hardware_type
The hardware type of the diagnostic.
- Type:
str
- hardware_class
The hardware class of the diagnostic.
- Type:
str
- simulation
(
DiagnosticSimulationElement): The simulation
- attributes of the diagnostic
- Type:
including its output_filename
- Parameters:
args (
Any)kwargs (
Any)
- class Dipole[source]
Bases:
MagnetDipole element.
- hardware_type
The hardware type of the dipole.
- Type:
str
- magnetic
The magnetic attributes of the dipole.
- Type:
- class Drift(*args, **kwargs)[source]
Bases:
PhysicalBaseElementDrift element.
- hardware_type
The hardware type of the marker.
- Type:
str
- simulation
The simulation
- Type:
- attributes of the drift.
- Parameters:
args (
Any)kwargs (
Any)
- class Element(*args, **kwargs)[source]
Bases:
baseElementStandard class for representing elements.
- simulation
SimulationElement: The simulation attributes of the element.
- electrical
ElectricalElement: The electrical attributes of the element.
- manufacturer
Manufacturer: The manufacturer attributes of the element.
- controls
ControlsInformation| None: The control system attributes of the element.
- reference
ReferenceElement| None: Reference information for the element.
- Parameters:
args (
Any)kwargs (
Any)
-
controls:
ControlsInformation|None= None Control system attributes of the element.
-
reference:
ReferenceElement|None= None Additional reference information for the element.
- class Faraday_Cup_Monitor(*args, **kwargs)[source]
Bases:
ChargeDiagnosticFCM charge diagnostic element.
- hardware_type
The hardware type of the diagnostic.
- Type:
str
- Parameters:
args (
Any)kwargs (
Any)
- class Horizontal_Corrector[source]
Bases:
DipoleHorizontal corrector element.
- hardware_type
The hardware type of the corrector.
- Type:
str
- class Integrated_Current_Transformer(*args, **kwargs)[source]
Bases:
ChargeDiagnosticICT charge diagnostic element.
- hardware_type
The hardware type of the diagnostic.
- Type:
str
- Parameters:
args (
Any)kwargs (
Any)
- class Laser(*args, **kwargs)[source]
Bases:
PhysicalBaseElementLaser element.
- hardware_type
The hardware type of the laser.
- Type:
str
- hardware_model
The hardware model of the laser.
- Type:
str
- laser
The laser attributes of the laser.
- Type:
- Parameters:
args (
Any)kwargs (
Any)
- class LaserAttenuator(*args, **kwargs)[source]
Bases:
ElementLaser attenuator element.
- hardware_type
The hardware type of the attenuator.
- Type:
str
- Parameters:
args (
Any)kwargs (
Any)
-
maximum:
float= 0.0 Maximum attenuation of the laser attenuator (in degrees).
-
minimum:
float= 0.0 Minimum attenuation of the laser attenuator (in degrees).
- class LaserEnergyMeter(*args, **kwargs)[source]
Bases:
ElementLaser energy meter element.
- hardware_type
The hardware type of the laser energy meter.
- Type:
str
- hardware_model
The hardware model of the laser energy meter.
- Type:
str
- laser
The laser-related attributes of the
- Type:
- energy meter.
- Parameters:
args (
Any)kwargs (
Any)
- class LaserHalfWavePlate(*args, **kwargs)[source]
Bases:
ElementLaser half-wave plate element.
- hardware_type
The hardware type of the HWP.
- Type:
str
- hardware_model
The hardware model of the HWP.
- Type:
str
- laser
The laser-related attributes of the
- HWP.
- Parameters:
args (
Any)kwargs (
Any)
- class LaserMirror(*args, **kwargs)[source]
Bases:
ElementLaser mirror element.
- hardware_type
The hardware type of the mirror.
- Type:
str
- hardware_model
The hardware model of the mirror.
- Type:
str
- controls
The control-related attributes of the
- Type:
MirrorControlsInformation
- mirror.
- Parameters:
args (
Any)kwargs (
Any)
-
controls:
MirrorControlsInformation|None= None Laser mirror control attributes of the element.
- class Lighting(*args, **kwargs)[source]
Bases:
ElementLighting element.
- hardware_type
The hardware type of the element.
- Type:
str
- hardware_model
The hardware model of the element.
- Type:
str
- lights
The lighting element.
- Type:
- Parameters:
args (
Any)kwargs (
Any)
- class Low_Level_RF(*args, **kwargs)[source]
Bases:
ElementLow-level RF element.
- hardware_type
The hardware type of the element.
- Type:
str
- hardware_model
The hardware model of the element.
- Type:
str
- LLRF
The LLRF element.
- Type:
- Parameters:
args (
Any)kwargs (
Any)
- class Magnet(*args, **kwargs)[source]
Bases:
PhysicalBaseElementBase class for representing magnets.
- degauss
DegaussableElement: The degaussing attributes of the magnet.
- simulation
MagnetSimulationElement: The simulation attributes of the magnet.
- magnetic
MagneticElement| None: The magnetic attributes of the magnet.
- Parameters:
args (
Any)kwargs (
Any)
-
degauss:
DegaussableElement|None= None Degaussing attributes of the magnet.
- property end_angle: float
End angle of the magnet
-
magnetic:
MagneticElement|None= None Magnetic attributes of the magnet.
- class Marker(*args, **kwargs)[source]
Bases:
PhysicalBaseElementMarker element.
- hardware_type
The hardware type of the marker.
- Type:
str
- hardware_model
The hardware model of the marker.
- Type:
str
- simulation
The simulation
- attributes of the marker.
- Parameters:
args (
Any)kwargs (
Any)
- class NonLinearLens(*args, **kwargs)[source]
Bases:
MagnetNon-linear lens element.
- hardware_type
The hardware type of the NLL.
- Type:
str
- magnetic
The magnetic attributes of the NLL.
- Type:
- Parameters:
args (
Any)kwargs (
Any)
- class Octupole(*args, **kwargs)[source]
Bases:
MagnetOctupole element.
- hardware_type
The hardware type of the octupole.
- Type:
str
- magnetic
The magnetic attributes of the octupole.
- Type:
- Parameters:
args (
Any)kwargs (
Any)
- class PID(*args, **kwargs)[source]
Bases:
ElementProportional-integral-derivative feedback element.
- hardware_type
The hardware type of the element.
- Type:
str
- hardware_model
The hardware model of the element.
- Type:
str
- PID
The PID element.
- Type:
- Parameters:
args (
Any)kwargs (
Any)
- class PhysicalBaseElement(*args, **kwargs)[source]
Bases:
ElementElement with a physical attribute; see
PhysicalElement.- physical
PhysicalElement: The physical attributes of the element.
- Parameters:
args (
Any)kwargs (
Any)
- property bend_angle: Rotation
Bending angle of the element. #TODO this probably doesn’t do what it should.
- Returns:
:class:`~laura.models.physical.Rotation`
- Return type:
The rotation attribute of the element.
- property end_angle: Rotation
Final global rotation angle of the element #TODO this probably doesn’t do what it should.
- class Plasma(*args, **kwargs)[source]
Bases:
PhysicalBaseElementPlasma element.
- hardware_type
The hardware type of the element.
- Type:
str
- simulation
The simulation
- Type:
- attributes of the plasma.
- plasma
The plasma attributes of the plasma.
- Type:
PlasmaElement
- laser
The laser assosicated with the plasma
- Type:
LaserElementor None
- Parameters:
args (
Any)kwargs (
Any)
-
laser:
LaserElement|None= None Laser attached to the plasma element.
- class Quadrupole(*args, **kwargs)[source]
Bases:
MagnetQuadrupole element.
- hardware_type
The hardware type of the quadrupole.
- Type:
str
- magnetic
The magnetic attributes of the quadrupole.
- Type:
- Parameters:
args (
Any)kwargs (
Any)
- class RFCavity(*args, **kwargs)[source]
Bases:
PhysicalBaseElementRFCavity element.
- hardware_type
The hardware type of the RF cavity.
- Type:
str
- hardware_model
The specific hardware model of the RF cavity.
- Type:
str
- cavity
The RF cavity attributes of the element.
- Type:
- simulation
(
RFCavitySimulationElement): The simulation
- attributes of the RF cavity.
- Parameters:
args (
Any)kwargs (
Any)
- class RFDeflectingCavity(*args, **kwargs)[source]
Bases:
RFCavityRF Deflecting Cavity element.
- hardware_type
The hardware type of the RF cavity.
- Type:
str
- hardware_model
The specific hardware model of the RF cavity.
- Type:
str
- cavity
The RF cavity attributes of the element.
- simulation
(
RFCavitySimulationElement): The simulation
- attributes of the RF cavity.
- Parameters:
args (
Any)kwargs (
Any)
- class RFHeartbeat(*args, **kwargs)[source]
Bases:
ElementRF Heartbeat element.
- hardware_type
The hardware type of the RF heartbeat system.
- Type:
str
- heartbeat
The RF heartbeat attributes of the element.
- Type:
- Parameters:
args (
Any)kwargs (
Any)
- class RFModulator(*args, **kwargs)[source]
Bases:
ElementRF Modulator element.
- hardware_type
The hardware type of the RF modulator.
- Type:
str
- hardware_model
The specific hardware model of the RF modulator.
- Type:
str
- modulator
The RF modulator attributes of the element.
- Type:
- Parameters:
args (
Any)kwargs (
Any)
- class RFProtection(*args, **kwargs)[source]
Bases:
ElementRF Protection element.
- hardware_type
The hardware type of the RF protection system.
- Type:
str
- hardware_model
The specific hardware model of the RF protection system.
- Type:
str
- modulator
The RF protection attributes of the element.
- Type:
- Parameters:
args (
Any)kwargs (
Any)
- class Screen(*args, **kwargs)[source]
Bases:
DiagnosticScreen element.
- hardware_type
The hardware type of the diagnostic.
- Type:
str
- hardware_model
The specific hardware model of the diagnostic.
- Type:
str
- diagnostic
(
Screen_Diagnostic): The diagnostic
- attributes of the Screen.
- Parameters:
args (
Any)kwargs (
Any)
-
controls:
ScreenControlsInformation|None= None Control system attributes of the element.
- class Sextupole(*args, **kwargs)[source]
Bases:
MagnetSextupole element.
- hardware_type
The hardware type of the sextupole.
- Type:
str
- magnetic
The magnetic attributes of the sextupole.
- Type:
- Parameters:
args (
Any)kwargs (
Any)
- class Shutter(*args, **kwargs)[source]
Bases:
PhysicalBaseElementShutter element.
- hardware_type
The hardware type of the shutter.
- Type:
str
- shutter
The shutter attributes of the element.
- Type:
- Parameters:
args (
Any)kwargs (
Any)
-
controls:
ShutterControlsInformation|None= None Shutter control attributes of the element.
- class Solenoid(*args, **kwargs)[source]
Bases:
MagnetSolenoid element.
- hardware_type
The hardware type of the solenoid.
- Type:
str
- magnetic
The magnetic attributes of the solenoid.
- Type:
- Parameters:
args (
Any)kwargs (
Any)
- class Stage(*args, **kwargs)[source]
Bases:
PhysicalBaseElementMoveable stage element.
- hardware_type
The hardware type of the stage.
- Type:
str
- hardware_model
The hardware model of the stage.
- Type:
str
- Parameters:
args (
Any)kwargs (
Any)
- class TwissMatch(*args, **kwargs)[source]
Bases:
PhysicalBaseElementTwiss matching element. Used for changing the Twiss parameters of the beam.
- hardware_type
The hardware type of the element.
- Type:
str
- hardware_class
The hardware class of the element.
- Type:
str
- simulation
The simulation attributes of the matching element.
- Parameters:
args (
Any)kwargs (
Any)
- class VacuumGauge(*args, **kwargs)[source]
Bases:
PhysicalBaseElementVacuum gauge element.
- hardware_type
The hardware type of the gauge.
- Type:
str
- hardware_model
The hardware model of the gauge.
- Type:
str
- Parameters:
args (
Any)kwargs (
Any)
- class Valve(*args, **kwargs)[source]
Bases:
PhysicalBaseElementVacuum valve element.
- hardware_type
The hardware type of the valve.
- Type:
str
- valve
The valve attributes of the element.
- Type:
- Parameters:
args (
Any)kwargs (
Any)
- class Vertical_Corrector[source]
Bases:
DipoleVertical corrector element.
- hardware_type
The hardware type of the corrector.
- Type:
str
- class Wakefield(*args, **kwargs)[source]
Bases:
PhysicalBaseElementWakefield element.
- hardware_type
The hardware type of the wakefield.
- Type:
str
- hardware_model
The specific hardware model of the wakefield.
- Type:
str
- cavity
(
WakefieldElement): The wakefield cavity attributes of the element.
- simulation
(
WakefieldSimulationElement): The simulation
- attributes of the wakefield cavity.
- Parameters:
args (
Any)kwargs (
Any)
- class Wall_Current_Monitor(*args, **kwargs)[source]
Bases:
ChargeDiagnosticWCM charge diagnostic element.
- hardware_type
The hardware type of the diagnostic.
- Type:
str
- Parameters:
args (
Any)kwargs (
Any)
- class Wiggler(*args, **kwargs)[source]
Bases:
MagnetWiggler element.
- hardware_type
The hardware type of the wiggler.
- Type:
str
- magnetic
The magnetic attributes of the wiggler.
- Type:
- laser
The laser associated with the wiggler.
- Type:
Laser_Magnetor None
- Parameters:
args (
Any)kwargs (
Any)
-
laser:
LaserElement|None= None Laser attached to the wiggler.
- class baseElement(*args, **kwargs)[source]
Bases:
IgnoreExtraBase-level element class. All LAURA elements derive from this.
- name
The name of the element.
- Type:
str
- hardware_class
The hardware class of the element.
- Type:
str
- hardware_type
The hardware type of the element.
- Type:
str
- hardware_model
The hardware model of the element.
- Type:
str
- machine_area
The machine area of the element.
- Type:
str
- virtual_name
The virtual name of the element.
- Type:
str
- subelement
Whether the element is a subelement.
- Type:
bool | str
- Parameters:
args (
Any)kwargs (
Any)
-
CASCADING_RULES:
Dict= {}
- property YAML_filename: str
- classmethod _find_field_paths(attr_name, current_model, current_path=())[source]
Recursively searches for an attribute name within the model’s structure and returns a list of its full access paths.
- Parameters:
attr_name (
str)current_model (
Type[BaseModel])current_path (
Tuple[str,...])
- Return type:
List[Tuple[str,...]]
- _get_nested_attribute(path)[source]
Accesses a nested attribute using its path.
- Parameters:
path (
Tuple[str,...])- Return type:
Any
- _handle_cascading_updates(path, value)[source]
Handle cascading attribute updates across nested models.
- Parameters:
path (
Tuple[str,...])value (
Any)
- Return type:
None
- _resolve_attribute_path(attr_name)[source]
Helper to get the full path(s) for a given attribute name.
- Parameters:
attr_name (
str)- Return type:
List[Tuple[str,...]]
- _set_nested_attribute(path, value)[source]
Sets a nested attribute using its path.
- Parameters:
path (
Tuple[str,...])value (
Any)
- flat()[source]
Dump the entire element model as a flat dictionary, with sub-models separated by “_”.
For example, if an element has element.electrical.maxI this will be keyed in the dictionary as eletrical_maxI: value
- Return type:
Dict[str,Any]- Returns:
Dict[str, Any]: Flattened dictionary representing the element.
- classmethod from_CATAP(fields)[source]
- Parameters:
fields (
dict)- Return type:
TypeVar(T, bound= BaseModel)
-
hardware_class:
str Hardware class of the element.
- property hardware_info: Dict[str, str]
Retrieve the hardware_class and hardware_type of the object as a dict
- Returns:
Dict[str, str]
- Return type:
{“class”: hardware_class, “type”: hardware_type}
-
hardware_type:
str Hardware type of the element.
- is_subelement()[source]
Flag to indicate whether the element is a subelement of another, such as a solenoid surrounding an RF cavity or a BPM embedded inside a magnet. This precludes it from being included when calculating the full length of a beamline.
- Return type:
bool- Returns:
bool: True if the element is a subelement.
-
machine_area:
str Machine are of the element.
-
name:
str Name of the element.
- property no_controls: str
- property subdirectory: str
-
subelement:
bool|str= False Flag to indicate whether the element is a subelement of another (i.e. whether they overlap in physical space).
- validate_alias()
- validate_name()
-
virtual_name:
str= '' Name of the element in the virtual control system.
- flatten(dictionary, parent_key='', separator='_')[source]
Flatten a nested dictionary – used for expanding the nested BaseModel structure.
- Parameters:
dictionary (Dict) – The dictionary to flatten.
parent_key (str, optional) – The base key to use for the flattened keys. Defaults to “”.
separator (str, optional) – The separator to use between keys. Defaults to “_”.
- Returns:
The flattened dictionary.
- Return type:
Dict
laura.models.elementList module
- class BaseLatticeModel(*args, **kwargs)[source]
Bases:
ModelBaseBase-level description for defining lattices. Allows dynamic extensibility via append, remove functions.
This class should not be used for creating lattices from scratch; rather, use laura.models.elementList.SectionLattice, laura.models.elementList.MachineLayout.
- Parameters:
args (
Any)kwargs (
Any)
-
_basename:
str
-
master_lattice:
str|None= None Top-level directory containing lattice files.
-
name:
str Name of lattice model.
- class ElementList(*args, **kwargs)[source]
Bases:
ModelBaseA container for an unordered dictionary of
baseElement.- Parameters:
args (
Any)kwargs (
Any)
-
elements:
Dict[str,Union[baseElement,dict,None]]
- index(element)[source]
- Parameters:
element (
Union[str,baseElement])
- property names: list
- class MachineLayout(*args, **kwargs)[source]
Bases:
BaseLatticeModelA machine layout, consisting of a dictionary of lattice sections. This class could represent a full beam path, for example.
- Parameters:
args (
Any)kwargs (
Any)
-
_basename:
str= 'sections'
- _get_all_element_names()[source]
List of all element names defined in the layout.
- Returns:
Names of all elements.
- Return type:
List[str]
- _get_all_elements()[source]
List of all elements defined in the layout
- Returns:
List of all elements.
- Return type:
List[baseElement]
- _get_element_names(lattice)[source]
Return the name for each LatticeElement object in a list defining a lattice
- Parameters:
lattice (
list) – List of LatticeElement objects representing machine hardwarelattice
- Return type:
list- Returns:
List of strings defining the names of the machine elements
- _lookup_index(name)[source]
Look up the index of an element in a given lattice
- Parameters:
name (
str) – Name of the element to search forname
- Return type:
int- Returns:
List index of the item within that beam path
- static _match_field_or_alias()[source]
Check if a field’s value or its alias matches the filter list.
- property elements: List[str]
List of all element names.
- Returns:
List of all element names.
- Return type:
List[str]
- elements_between(end=None, start=None, element_type=None, element_model=None, element_class=None)[source]
Returns a list of all lattice elements (of a specified type) between any two points along the accelerator (inclusive). Elements are ordered according to their longitudinal position along the beam path.
- Parameters:
end (str) – Name of the element defining the end of the search region
start (str) – Name of the element defining the start of the search region
element_type (str | list | None) – Filter by element type; if list, gather multiple types; if None, gather all.
element_model (str | list | None) – Filter by element model; if list, gather multiple models; if None, gather all.
element_class (
Union[str,list,None]) – Filter by element hardware class; if list, gather multiple classes; if None, gather all.
- Returns:
Filtered names of elements.
- Return type:
List[str]
- get_all_elements(element_type=None, element_model=None, element_class=None)[source]
Get all elements in the lattice, or filter them by type/model/class # TODO function name implies this returns elements rather than names; rename?
- Parameters:
element_type (str | list | None) – Filter by element type; if list, gather multiple types; if None, gather all.
element_model (str | list | None) – Filter by element model; if list, gather multiple models; if None, gather all.
element_class (
Union[str,list,None]) – Filter by element hardware class; if list, gather multiple classes; if None, gather all.
- Returns:
Filtered names of elements.
- Return type:
List[str]
- get_element(name)[source]
Return the LatticeElement object corresponding to a given machine element
- Parameters:
name (
str) – Name of the element to look upname
- Return type:
- Returns:
baseElementinstance for that element
-
master_lattice:
str|None= None Directory containing lattice files.
-
sections:
Dict[str,SectionLattice] Dictionary of
SectionLattice, keyed by name.
- class MachineModel(*args, **kwargs)[source]
Bases:
ModelBaseThe full model of the accelerator. It describes all
MachineLayoutandSectionLatticethat particles can follow. These layouts and sections are also defined as Dict[str, list] and Dict[str, list], and the full dictionary containing all elements is also accessible.- Parameters:
args (
Any)kwargs (
Any)
-
_default_path:
str= None
-
_layouts:
List[str] = None
-
_section_definitions:
Dict= {}
- property default_path: str
-
elements:
Dict[str,baseElement] = {} Dictionary containing all elements defined in the machine model.
- elements_between(end=None, start=None, element_type=None, element_model=None, element_class=None, path=None)[source]
Returns a list of all lattice elements (of a specified type) between any two points along the accelerator (inclusive). Elements are ordered according to their longitudinal position along the beam path.
- Parameters:
end (str) – Name of the element defining the end of the search region
start (str) – Name of the element defining the start of the search region
element_type (str | list | None) – Filter by element type; if list, gather multiple types; if None, gather all.
element_model (str | list | None) – Filter by element model; if list, gather multiple models; if None, gather all.
element_class (
Union[str,list,None]) – Filter by element hardware class; if list, gather multiple classes; if None, gather all.path (str) – Optional beam path, i.e. name of
MachineLayout.
- Returns:
Filtered names of elements.
- Return type:
List[str]
- get_all_elements(element_type=None, element_model=None, element_class=None)[source]
Get all elements in the lattice, or filter them by type/model/class # TODO function name implies this returns elements rather than names; rename?
- Parameters:
element_type (str | list | None) – Filter by element type; if list, gather multiple types; if None, gather all.
element_model (str | list | None) – Filter by element model; if list, gather multiple models; if None, gather all.
element_class (
Union[str,list,None]) – Filter by element hardware class; if list, gather multiple classes; if None, gather all.
- Returns:
Filtered names of elements.
- Return type:
List[str]
- get_element(name)[source]
Return the LatticeElement object corresponding to a given machine element
- Parameters:
name (
str) – Name of the element to look upname
- Return type:
- Returns:
LatticeElement instance for that element
-
lattices:
Dict[str,MachineLayout] = {} Dictionary containing
MachineLayout, keyed by name. #TODO rationalise either this name lattices or the class name MachineLayout.
-
layout:
Union[str,Dict,None] = None Dictionary containing layout names and the names of the sections of which they are composed.
-
master_lattice:
str|None= None Directory containing lattice YAML files.
-
section:
Union[str,Dict[str,Dict],None] = None Dictionary containing section names and the elements that compose it.
-
sections:
Dict[str,SectionLattice] = {} Dictionary containing
SectionLattice, keyed by name.
- validate_layout()
- validate_section()
- class SectionLattice(*args, **kwargs)[source]
Bases:
BaseLatticeModelA section of a lattice, consisting of a list of elements and their order along the beam path.
- Parameters:
args (
Any)kwargs (
Any)
-
_basename:
str= 'elements'
- _get_all_elements()[source]
Get a list of all the elements in order.
- Returns:
Ordered list of elements.
- Return type:
List
- createDrifts(csr_enable=True, lsc_enable=True, lsc_bins=20)[source]
Insert drifts into a sequence of ‘elements’
- Parameters:
csr_enable (
bool)lsc_enable (
bool)lsc_bins (
PositiveInt)
- get_s_values(as_dict=False, at_entrance=False, starting_s=0)[source]
Get the S values for the elements in the lattice. This method calculates the cumulative length of the elements in the lattice, starting from the entrance or the first element, depending on the at_entrance parameter. It returns a list or dict of S values, which represent the positions of the elements along the lattice.
- Parameters:
as_dict (bool, optional) – If True, returns a dictionary with element names as keys and their S values as values.
at_entrance (bool, optional) – If True, calculates S values starting from the entrance of the lattice. If False, calculates S values starting from the first element.
starting_s (float, optional) – Initial s position
- Returns:
A list or dictionary of S values for the elements in the lattice. If as_dict is True, returns a dictionary with element names as keys and their S values as values. If as_dict is False, returns a list of S values.
- Return type:
list | dict
- property names: List
List of element names.
- Returns:
List of element names.
- Return type:
List
-
order:
List[str] Ordered list of element names.
- validate_elements()
laura.models.exceptions module
laura.models.laser module
- class LaserElement(*args, **kwargs)[source]
Bases:
IgnoreExtraLaser info model.
- Parameters:
args (
Any)kwargs (
Any)
- property amplitude: float
((e*lambda0)/(pi*m_e*c**2*w0)) * np.sqrt( E/(pi*epsilon_0*c*tau_FWHM) )
- Returns:
Laser amplitude (dimensionless)
- Return type:
float
- Raises:
ValueError – If any of the requires parameters are not set or non-positive
- Type:
Laser amplitude
- property angular_frequency: float
2*pi*c/lambda0
- Returns:
Laser angular frequency [rad/s]
- Return type:
float
- Raises:
ValueError – If wavelength is not set or non-positive
- Type:
Laser angular frequency
-
cep_phase:
float= 0 CEP phase [radians]
-
flatness:
int= 6 Flatness parameter, if profile_type is ‘flattened-gaussian’. Default: N=6; somewhat close to an 8th order super-gaussian.
-
focal_position:
float= 0.0 Focal position of the laser pulse [m], optional
-
initial_position:
float= 0 Initial position of the laser pulse [m]
-
laguerre_polynomial_order_p:
int= 0 Order of Laguerre-Gaussian polynomial mode, if profile_type is ‘laguerre-gaussian’
-
polarization:
Optional[Literal['linear','circular','elliptical']] = None ‘linear’, ‘circular’, ‘elliptical’
- Type:
Laser polarization
-
profile_type:
Literal['gaussian','laguerre-gaussian','flattened-gaussian','file'] = 'gaussian' ‘gaussian’, ‘laguerre-gaussian’, ‘flattened-gaussian’, ‘file’
- Type:
Laser profile type [str]
- class LaserEnergyMeterElement(*args, **kwargs)[source]
Bases:
IgnoreExtraLaser energy meter model.
- Parameters:
args (
Any)kwargs (
Any)
- class LaserHalfWavePlateElement(*args, **kwargs)[source]
Bases:
IgnoreExtraLaser half-wave plate model.
- Parameters:
args (
Any)kwargs (
Any)
- class LaserMirrorElement(*args, **kwargs)[source]
Bases:
IgnoreExtraLaser info model.
- Parameters:
args (
Any)kwargs (
Any)
- classmethod from_CATAP(fields)[source]
- Parameters:
fields (
dict)- Return type:
TypeVar(T, bound= BaseModel)
-
horizontal_channel:
Optional[int] = None
-
sense:
LaserMirrorSense
-
vertical_channel:
Optional[int] = None
- class LaserMirrorSense(*args, **kwargs)[source]
Bases:
IgnoreExtraLaser mirror sense model.
- Parameters:
args (
Any)kwargs (
Any)
laura.models.lighting module
- class LightingElement(*args, **kwargs)[source]
Bases:
IgnoreExtraLighting info model.
- Parameters:
args (
Any)kwargs (
Any)
laura.models.magnetic module
- class Dipole_Magnet(**data)[source]
Bases:
MagneticElementDipole magnet with magnetic order 0.
- Parameters:
data (
Any)
- property angle: float
- currentToAngle(current, momentum)[source]
Convert current to bend angle in degrees.
- Parameters:
current (
float)momentum (
float)
- Return type:
float
- field_strength(momentum)[source]
Get the dipole magnetic field strength.
- Parameters:
momentum (float) – The momentum of the particle beam (in eV/c).
- Returns:
The dipole magnetic field strength.
- Return type:
float
- property rho: float
Get the dipole bend radius – l / theta.
- Returns
float: The dipole bend radius
- class FieldIntegral(*args, **kwargs)[source]
Bases:
BaseModelField integral coefficients model.
- Parameters:
args (
Any)kwargs (
Any)
-
coefficients:
List[Union[float,int]] = [0] Integrated field coefficients.
- currentToK(current, energy)[source]
Convert the current in the magnet to the normalized strength (K value). The method calculates the normalized strength (K value) of the magnetic field based on the provided current and energy. It uses the field integral coefficients to compute the integrated field strength and applies a scaling factor based on the speed of light and the beam energy.
- Parameters:
current (float) – The current flowing through the magnet (in amperes).
energy (float) – The energy of the particle beam (in MeV).
- Returns:
The normalized strength (K value) of the magnetic field.
- Return type:
float
- class LinearSaturationFit(*args, **kwargs)[source]
Bases:
BaseModelLinear + saturation fit coefficients model.
- Parameters:
args (
Any)kwargs (
Any)
-
I0:
float= 0
-
I_max:
NonNegativeFloat= 0
- KLToCurrent(KL, momentum)[source]
Convert the normalized strength (K value) of the magnetic field to the corresponding current.
This method calculates the current required to produce a given normalized strength (K value) of the magnetic field, based on the magnet’s linear and saturation fit coefficients. It accounts for both linear and nonlinear (saturation) behavior of the magnet.
- Parameters:
KL (float) – The normalized strength (K value) of the magnetic field. OR
dict – A dictionary containing the K value and its gradient.
momentum (float) – The momentum of the particle beam (in MeV/c).
- Returns:
The current (in amperes) required to produce the given K value.
- Return type:
float
- KToCurrent(K, momentum)[source]
Convert the normalized strength (K value) of the magnetic field to the corresponding current. This method calculates the current required to produce a given normalized strength (K value) of the magnetic field, based on the magnet’s linear and saturation fit coefficients. It accounts for both linear and nonlinear (saturation) behavior of the magnet.
- Parameters:
K (float) – The normalized strength (K value) of the magnetic field. OR
dict – A dictionary containing the K value and its gradient.
momentum (float) – The momentum of the particle beam (in MeV/c).
- Returns:
The current (in amperes) required to produce the given K value.
- Return type:
float
-
L:
NonNegativeFloat= 0
-
_COEFF_KEYS:
ClassVar[list] = ['m', 'I_max', 'f', 'a', 'I0', 'd', 'L']
-
a:
float= 0
- property coefficients: List[float | int]
- currentToK(current, momentum=None)[source]
Convert the current in the magnet to the normalized strength (K value).
The method calculates the normalized strength (K value) of the magnetic field based on the provided current and momentum. It uses the field integral coefficients to compute the integrated field strength and applies a scaling factor based on the speed of light and the beam momentum.
- Parameters:
current (float) – The current flowing through the magnet (in amperes).
momentum (float) – The momentum of the particle beam (in MeV/c).
- Returns:
- A dictionary containing the K value, KL value, gradient, and integrated strength.
The K value is the normalized strength of the magnetic field, KL is the K value multiplied by the length of the magnet, gradient is the magnetic field gradient, and integrated strength is the integrated field strength.
- Return type:
dict
-
d:
float= 0
-
f:
float= 0
- classmethod from_string(v)[source]
- Parameters:
v (
Union[str,List])- Return type:
TypeVar(T, bound= BaseModel)
-
m:
float= 0
- class MagneticElement(**data)[source]
Bases:
IgnoreExtraMagnetic info model.
- Parameters:
data (
Any)
- Kn(order=None)[source]
Get the normalized strength (Kn) of the multipole for a given order.
- Parameters:
order (int, optional) – The order of the multipole. Defaults to None, which uses self.order.
- Returns:
The normalized strength (Kn) of the multipole.
- Return type:
Union[int, float]
- KnL(order=None)[source]
Get the integrated strength (KnL) of the multipole for a given order.
- Parameters:
order (int, optional) – The order of the multipole. Defaults to None, which uses self.order.
- Returns:
The integrated strength (KnL) of the multipole.
- Return type:
Union[int, float]
-
field_integral_coefficients:
FieldIntegral|None= None Field integral coefficients.
- get_gradient(momentum)[source]
Get the magnetic field gradient for the multipole.
- Parameters:
momentum (float) – The momentum of the particle beam (in MeV/c).
- Returns:
The magnetic field gradient.
- Return type:
float
-
gradient:
float|None= None Magnetic gradient.
- property half_gap: float
- property kl: int | float
-
linear_saturation_coefficients:
LinearSaturationFit|None= None Linear saturation fit coefficients.
-
settle_time:
float|None= None Maximum time to wait for the magnet current to settle [s]. #TODO move to electrical?
-
skew:
bool= False Flag to indicate if the multipole is skew.
- validate_field_integral_coefficients()
- class Multipole(*args, **kwargs)[source]
Bases:
BaseModelSingle order magnetic multipole model.
- Parameters:
args (
Any)kwargs (
Any)
-
normal:
float= 0.0 Normal component of the multipole strength.
-
order:
NonNegativeInt= 0 Multipole order (0=dipole, 1=quadrupole, etc.).
-
radius:
float= 0.0 Reference radius for the multipole strength.
-
skew:
float= 0.0 Skew component of the multipole strength.
- class Multipoles(*args, **kwargs)[source]
Bases:
create_modelMagnetic multipoles model.
- Parameters:
args (
Any)kwargs (
Any)
- normal(order)[source]
Get the normal component of the multipole strength for a given order.
- Parameters:
order (int) – The order of the multipole (0=dipole, 1=quadrupole, etc.).
- Returns:
The normal component of the multipole strength.
- Return type:
Union[int, float]
- ser_model()
- Return type:
Dict[str,Any]
- class NonLinearLens_Magnet(**data)[source]
Bases:
IgnoreExtraNon-linear lens magnet. See MAD-X manual and PAC2011 article
- Parameters:
data (
Any)
- class Octupole_Magnet(**data)[source]
Bases:
MagneticElementOctupole magnet with magnetic order 3.
- Parameters:
data (
Any)
- property k3l: float
- class Quadrupole_Magnet(**data)[source]
Bases:
MagneticElementQuadrupole with magnetic order 1.
- Parameters:
data (
Any)
- property k1l: float
- class Sextupole_Magnet(**data)[source]
Bases:
MagneticElementSextupole magnet with magnetic order 2.
- Parameters:
data (
Any)
- property k2l: float
- class SolenoidFields(*args, **kwargs)[source]
Bases:
create_modelMagnetic multipoles model.
- Parameters:
args (
Any)kwargs (
Any)
- ser_model()
- Return type:
Dict[str,Any]
- class Solenoid_Magnet(**data)[source]
Bases:
IgnoreExtraSolenoid magnet including higher order fields.
- Parameters:
data (
Any)
- property field_amplitude: int | float
- property ks: int | float
- validate_field_integral_coefficients()
- class Wiggler_Magnet(**data)[source]
Bases:
IgnoreExtraUndulator magnet.
- Parameters:
data (
Any)
-
helical:
bool= False Flag to indicate if the wiggler is helical; False implies planar.
- property normalized_strength: float
Getter for the normalised undulator strength \(a_w\)
- Returns:
strength/ \(\sqrt{2}\)- Return type:
float
- property poles: int
Number of poles, twice
num_periods.- Returns:
Number of poles
- Return type:
int
laura.models.manufacturer module
laura.models.physical module
- class ElementError(*args, **kwargs)[source]
Bases:
IgnoreExtraPosition/Rotation error model.
- Parameters:
args (
Any)kwargs (
Any)
- validate_position()
- validate_rotation()
- class ElementSurvey(*args, **kwargs)[source]
Bases:
ElementError- Parameters:
args (
Any)kwargs (
Any)
- class PhysicalElement(*args, **kwargs)[source]
Bases:
IgnoreExtraPhysical info model.
- Parameters:
args (
Any)kwargs (
Any)
- property _physical_angle: float
- _rotation_matrix_cache = None
-
length:
float= 0.0 Length of the element.
-
maximum_position:
float|None= None Maximum position of the element
-
minimum_position:
float|None= None Minimum position of the element
-
physical_angle:
float= 0.0
- rotated_position(vec=[0, 0, 0])[source]
Get the rotated position of the element based on matrix multiplication with rotation_matrix.
- Parameters:
vec (List[float]) – Vector by which to rotate the element
- Returns:
Rotated vector.
- Return type:
np.ndarray
- property rotation_matrix: ndarray
- validate_middle()
- validate_rotation()
- class Position(*args, **kwargs)[source]
Bases:
NumpyVectorModelPosition model. Cartesian co-ordinates are used.
- Parameters:
args (
Any)kwargs (
Any)
- dot(other)[source]
- Parameters:
other (
Union[List,Type[TypeVar(T, bound= BaseModel)]])- Return type:
float
- vector_angle(other, direction)[source]
- Parameters:
other (
Union[List,Type[TypeVar(T, bound= BaseModel)]])direction (
List)
- Return type:
float
-
x:
float= 0.0 Horizontal position [m].
-
y:
float= 0.0 Vertical position [m].
-
z:
float= 0.0 Longitudinal position [m].
- class Rotation(*args, **kwargs)[source]
Bases:
NumpyVectorModelRotation model.
- Parameters:
args (
Any)kwargs (
Any)
-
phi:
confloat= 0.0 Rotation about the horizontal axis [rad].
-
psi:
confloat= 0.0 Rotation about the vertical axis [rad].
-
theta:
confloat= 0.0 Rotation about the longitudinal axis [rad].
laura.models.shutter module
- class ShutterElement(*args, **kwargs)[source]
Bases:
IgnoreExtraLaser info model.
- Parameters:
args (
Any)kwargs (
Any)
- validate_interlocks()
- class ValveElement(*args, **kwargs)[source]
Bases:
IgnoreExtraValve info model.
- Parameters:
args (
Any)kwargs (
Any)
laura.models.simulation module
- class ApertureElement(*args, **kwargs)[source]
Bases:
IgnoreExtraPhysical info model.
- Parameters:
args (
Any)kwargs (
Any)
-
horizontal_size:
float= 0.0 Horizontal aperture size [m]
-
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= 0.0 Vertical aperture size [m]
- class DiagnosticSimulationElement(*args, **kwargs)[source]
Bases:
SimulationElement- Parameters:
args (
Any)kwargs (
Any)
-
output_filename:
str|None= None Output filename for the diagnostic
- class DriftSimulationElement(*args, **kwargs)[source]
Bases:
SimulationElementDrift simulation element model.
- Parameters:
args (
Any)kwargs (
Any)
-
csr_enable:
bool= True Enable CSR drift calculations
-
csrdz:
PositiveFloat= 0.01 Step size for CSR calculations
-
lsc_bins:
PositiveInt= 20 Number of bins for LSC calculations
-
lsc_enable:
bool= True Enable LSC drift calculations
-
lsc_high_frequency_cutoff_end:
float|None= None Spatial frequency at which smoothing filter is 0. See Elegant manual LSC drift
-
lsc_high_frequency_cutoff_start:
float|None= None Spatial frequency at which smoothing filter begins. If not positive, no frequency filter smoothing is done. See Elegant manual LSC drift
-
lsc_interpolate:
int= 1 Flag to allow for interpolation of computed longitudinal space charge wake. See Elegant manual LSC drift
-
lsc_low_frequency_cutoff_end:
float|None= None Lowest spatial frequency at which low-frequency cutoff filter is 1. See Elegant manual LSC drift
-
lsc_low_frequency_cutoff_start:
float|None= None Highest spatial frequency at which low-frequency cutoff filter is zero. See Elegant manual LSC drift
-
use_stupakov:
int= 1 Use Stupakov formula; see Elegant manual LSC drift
- class MagnetSimulationElement(*args, **kwargs)[source]
Bases:
SimulationElementMagnet simulation element model.
- Parameters:
args (
Any)kwargs (
Any)
-
csr_bins:
int= 100 Number of CSR bins
-
csr_enable:
bool= True Flag to indicate whether CSR is enabled
-
deltaL:
float= 0.0 Delta length
-
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
-
field_amplitude:
float= 0.0
-
integration_order:
int= 4 Runge-Kutta integration order
-
isr_enable:
bool= True Flag to indicate whether ISR is enabled
-
n_kicks:
int= 4 Number of kicks for tracking through the quad
-
n_slices:
int= 4 Number of kicks for tracking through the quad
-
nonlinear:
int= 1 Flag to indicate whether to perform nonlinear calculations
-
smooth:
int|float|None= 2 Number of points to smooth the field map [ASTRA only]
-
smoothing_half_width:
int= 1 Half-width for smoothing
-
sr_enable:
bool= True Flag to enable SR calculations
- class PlasmaSimulationElement(*args, **kwargs)[source]
Bases:
SimulationElementPlasma simulation element model.
- Parameters:
args (
Any)kwargs (
Any)
-
bunch_pusher:
Literal['rk4','boris'] = 'boris' Pusher used to evolve particles in time in the plasma [Wake-T]; possible values: ‘rk4’, ‘boris’; see Wake-T pusher
-
dt_bunch:
Union[float,Literal['auto']] = 'auto' The time step for evolving the particle bunches. If ‘auto’, set to dt=T/(10*2*pi) with T the plasma period.
-
dz_fields:
float|None= None Determines how often the plasma wakefields should be updated; max_longitudinal_position-min_longitudinal_position by default
-
max_longitudinal_position:
float= 0 Maximum longitudinal position [metres] up to which plasma wakefield will be calculated. Converted to boosted co-ordinates for Wake-T during simulation setup.
-
min_longitudinal_position:
float= 0 Minimum longitudinal position [metres] up to which plasma wakefield will be calculated. Converted to boosted co-ordinates for Wake-T during simulation setup.
-
n_longitudinal:
int= 0 Number of grid points in the longitudinal direction
-
n_out:
int= 1 Number of times to dump the particle distribution during the plasma stage.
-
n_radial:
int= 0 Number of grid points in the radial direction
-
plasma_particles_per_cell:
int= 2 Number of plasma particles per cell; 2 by default
-
plasma_pusher:
Literal['rk4','boris'] = 'boris' Pusher used to evolve the plasma in time [Wake-T]; possible values: ‘rk4’, ‘boris’; see Wake-T pusher
-
r_max:
float= 0 Radial extent of the simulation box [meters]
-
r_max_plasma:
float|None= None Maximum radial extension of the plasma column; set to r_max if None
-
required_attrs:
Dict= {'common': ['length'], 'quasistatic_2d': ['density', 'r_max', 'n_longitudinal', 'n_radial', 'min_longitudinal_position', 'max_longitudinal_position']}
-
wakefield_model:
Optional[Literal['quasistatic_2d']] = None Wakefield model (Wake-T); possible values: ‘blowout’, ‘custom_blowout’, ‘focusing_blowout’, ‘cold_fluid_1d’ and ‘quasistatic_2d’; if None, no wakefields are computed. # TODO add more of these and check which we support
- class RFCavitySimulationElement(*args, **kwargs)[source]
Bases:
SimulationElementRF cavity simulation element model.
- Parameters:
args (
Any)kwargs (
Any)
-
body_focus_model:
str= 'SRS' Cavity focusing model
-
change_p0:
int= 1 Flag to indicate whether cavity is changing momentum
-
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
-
field_amplitude:
float= 0 Cavity field amplitude
-
field_file_name:
str|None= None Cavity field file name
-
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_kicks:
int= 0 Number of cavity kicks to apply
-
smooth:
int|None= None Smoothing parameter
-
smooth_current_bins:
int= 1 Flag to indicate whether to smooth the current histogram
-
t_column:
str|None= None t column in wake file
-
trwakefile:
str|None= None Name of transverse wake file
-
wakefile:
str|None= None Name of wake file
-
wx_column:
str|None= None Wx column in wake file
-
wy_column:
str|None= None Wy column in wake file
-
wz_column:
str|None= None Wz column in wake file
-
z_column:
str|None= None z column in wake file
-
zwakefile:
str|None= None Name of longitudinal wake file
- class SimulationElement(*args, **kwargs)[source]
Bases:
IgnoreExtraSimulation element model.
- Parameters:
args (
Any)kwargs (
Any)
-
field_definition:
Any= None String pointing to field definition
-
field_reference_position:
Optional[Literal['start','middle','end']] = None Reference position for field file
-
scale_field:
int|float|bool= False Flag indicating whether to scale the field from the field file
-
wakefield_definition:
Any= None String pointing to wakefield definition
- class TwissMatchSimulationElement(*args, **kwargs)[source]
Bases:
IgnoreExtra- Parameters:
args (
Any)kwargs (
Any)
-
alpha_x:
float Horizontal alpha
-
alpha_y:
float Vertical alpha
-
beta_x:
float Horizontal beta
-
beta_y:
float Vertical beta
-
eta_x:
float= 0.0 Horizontal dispersion
-
eta_xp:
float= 0.0 Horizontal dispersion derivative
-
eta_y:
float= 0.0 Vertical dispersion
-
eta_yp:
float= 0.0 Vertical dispersion derivative
-
from_beam:
bool= True If True, compute transformation from tracked beam properties instead of Twiss parameters
- class WakefieldSimulationElement(*args, **kwargs)[source]
Bases:
SimulationElementWakefield simulation element model.
- Parameters:
args (
Any)kwargs (
Any)
-
allow_long_beam:
bool= True Flag to indicate whether beams longer than the wakefield are allowed.
-
bunched_beam:
bool= False Flag to indicate whether a bunched beam is to be used.
-
change_momentum:
bool= True Flag to indicate whether the wakefield can change the central momentum of the bunch.
-
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.
-
factor:
float= 1 Wake scaling factor. #TODO check if redundant based on scale_kick?
-
interpolate:
bool= True Flag to indicate whether to interpolate points in wake file.
-
interpolation_method:
int= 2 0 = rectangular, 1 = triangular, 2 = Gaussian.
- Type:
Interpolation method for ASTRA
-
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 Factor by which to scale wake kicks.
-
smooth:
float= 0.25 Smoothing parameter for Gaussian interpolation.
-
subbins:
int= 10 Sub binning parameter.
-
t_column:
str|None= None t column in wake file
-
wx_column:
str|None= None Wx column in wake file
-
wy_column:
str|None= None Wy column in wake file
-
wz_column:
str|None= None Wz column in wake file
-
z_column:
str|None= None z column in wake file