laura.models package
Submodules
laura.models.RF module
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
- 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’