toptica.lasersdk.decop module
- class toptica.lasersdk.decop.Command(name: str, description: str, input_type: StreamType | None, output_type: StreamType | None, execlevel: UserLevel | None, params: list[tuple[str, str]], return_type: str | None)
Bases:
objectA command in the DeCoP system model.
- Parameters:
name (str) – The name of the command.
input_type (StreamType) – The type of the input stream.
output_type (StreamType) – The type of the output stream.
execlevel (UserLevel) – The required user level to execute the command.
params (list[tuple[str, str]]) – The list of parameter names and types of the command.
return_type (str) – The type of the return value.
- exception toptica.lasersdk.decop.DecopError
Bases:
ExceptionA generic DeCoP error.
- exception toptica.lasersdk.decop.DecopValueError(value: str, expected_type: type | None = None)
Bases:
DecopErrorA DeCoP value conversion error.
- class toptica.lasersdk.decop.Module(name: str)
Bases:
objectA module in a DeCoP system model.
- name
The name of the module.
- Type:
str
- class toptica.lasersdk.decop.ParamMode(*values)
Bases:
EnumAn access mode of a parameter in a DeCoP system model.
- READONLY = 1
- READSET = 4
- READWRITE = 3
- WRITEONLY = 2
- class toptica.lasersdk.decop.Parameter(name: str, typestr: str, description: str, mode: ParamMode | None, readlevel: UserLevel | None, writelevel: UserLevel | None)
Bases:
objectA parameter in a DeCoP system model.
- class toptica.lasersdk.decop.StreamType(*values)
Bases:
EnumA stream-type of a command in a DeCoP system model.
- BASE64 = 2
- TEXT = 1
- class toptica.lasersdk.decop.SubscriptionValue(value: bool | int | float | str | bytes | bytearray | tuple[Any, ...] | DecopError)
Bases:
objectWrapper type for either the value of a subscription or any exception that may have been raised.
- Parameters:
value (DecopType | DecopError) – The value from the subscription or an exception that may have occurred.
- get() bool | int | float | str | bytes | bytearray | tuple[Any, ...]
Returns the value from the subscription or re-raises any exception that may have occurred.
- Returns:
The value from the subscription.
- Return type:
DecopType
- Raises:
DecopError – The exception that has been raised while handling the subscription value.
- property value: bool | int | float | str | bytes | bytearray | tuple[Any, ...] | DecopError
The value or exception of a subscription.
- Type:
DecopType | DecopError
- class toptica.lasersdk.decop.SystemModel
Bases:
objectA DeCoP system model.
- build_from_file(filename: str) None
Loads a DeCoP system model from an XML file.
- Parameters:
filename (str) – The name of the XML file with the DeCoP system model.
- build_from_string(xml_str: str) None
Loads a DeCoP system model form a string.
- Parameters:
xml_str (str) – A string containing the XML description of the DeCoP system model.
- class toptica.lasersdk.decop.Typedef(name: str, is_atomic: bool)
Bases:
objectA typedef in a DeCoP system model.
- Parameters:
name (str) – The name of the typedef.
is_atomic (bool) – True if the typedef is atomic, False otherwise.
- class toptica.lasersdk.decop.UserLevel(*values)
Bases:
IntEnumA user level of a parameter in a DeCoP system model.
- INTERNAL = 0
- MAINTENANCE = 2
- NORMAL = 3
- READONLY = 4
- SERVICE = 1
- toptica.lasersdk.decop.access_mode(access_mode_str: str | None) ParamMode | None
Converts a string with a parameter access mode to the corresponding type.
- Parameters:
access_mode_str (str | None) – The string with the parameter access mode.
- Returns:
The type of the parameter access mode.
- Return type:
ParamMode | None
- toptica.lasersdk.decop.decode_value(result: str, expected_type: type[bool | int | float | str | bytes | bytearray | tuple[Any, ...]]) bool | int | float | str | bytes | bytearray | tuple[Any, ...]
Converts a DeCoP parameter string to a Python value.
- Parameters:
result (str) – The string returned by the command line.
expected_type (DecopTypeList) – The expected type of the result.
- Returns:
The value of the command line result.
- Return type:
DecopType
- Raises:
DecopError – If the command line returned an error message
DecopValueError – If the command line result couldn’t be converted to the expected type.
- toptica.lasersdk.decop.decode_value_inferred(param_str: str) bool | int | float | str | bytes | bytearray | tuple[Any, ...]
Tries to convert a DeCoP parameter string to a Python type by inferring its data type.
- Parameters:
param_str (str) – The string containing the parameter value.
- Returns:
The value of the parameter string.
- Return type:
DecopType
- Raises:
DecopError – If the parameter string contains an error message.
DecopValueError – If the data type of the parameter string couldn’t be inferred.
- toptica.lasersdk.decop.encode_value(value: bool | int | float | str | bytes | bytearray | tuple[Any, ...]) str
Encodes a value to a string.
- Parameters:
value (DecopType) – The value of the parameter.
- Returns:
The encoded value.
- Return type:
str
- toptica.lasersdk.decop.parse_monitoring_line(line: str) tuple[datetime, str, str | DecopError]
Parses a monitoring line message.
- Parameters:
line (str) – A monitoring line message.
- Returns:
A tuple containing the timestamp, parameter name and value/exception.
- Return type:
DecopMonitoringLine
- toptica.lasersdk.decop.stream_type(stream_type_str: str | None) StreamType | None
Converts a string with a command stream type to the corresponding type.
- Parameters:
stream_type_str (str | None) – The string with the command stream type.
- Returns:
The type of the command stream type.
- Return type:
StreamType | None
- toptica.lasersdk.decop.user_level(user_level_str: str | None) UserLevel | None
Converts a string with a parameter user level to the corresponding type.
- Parameters:
user_level_str (str | None) – The string with the parameter user level.
- Returns:
The type of the parameter user level.
- Return type:
UserLevel | None