zaber-motion 7.14.0__py3-none-win_amd64.whl → 8.0.0__py3-none-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. zaber_motion/__init__.py +1 -0
  2. zaber_motion/ascii/__init__.py +0 -1
  3. zaber_motion/ascii/axis.py +29 -0
  4. zaber_motion/ascii/axis_settings.py +27 -0
  5. zaber_motion/ascii/device.py +28 -0
  6. zaber_motion/ascii/device_settings.py +26 -0
  7. zaber_motion/ascii/lockstep.py +0 -45
  8. zaber_motion/ascii/pvt_sequence.py +0 -181
  9. zaber_motion/ascii/servo_tuner.py +28 -104
  10. zaber_motion/ascii/stream.py +0 -275
  11. zaber_motion/binary/connection.py +17 -4
  12. zaber_motion/dto/__init__.py +1 -0
  13. zaber_motion/dto/ascii/__init__.py +0 -1
  14. zaber_motion/dto/ascii/response.py +4 -1
  15. zaber_motion/dto/ascii/simple_tuning.py +18 -17
  16. zaber_motion/dto/ascii/unknown_response_event.py +4 -1
  17. zaber_motion/dto/requests/__init__.py +2 -0
  18. zaber_motion/dto/requests/channel_on.py +13 -1
  19. zaber_motion/dto/requests/get_command_unit_conversion_response.py +54 -0
  20. zaber_motion/dto/requests/set_simple_tuning.py +31 -31
  21. zaber_motion/dto/requests/unit_convert_native_request.py +91 -0
  22. zaber_motion/dto/unit_conversion_descriptor.py +93 -0
  23. zaber_motion/library.py +1 -1
  24. zaber_motion/microscopy/illuminator.py +24 -0
  25. zaber_motion/microscopy/illuminator_channel.py +15 -2
  26. zaber_motion/microscopy/objective_changer.py +1 -69
  27. zaber_motion/unit_table.py +114 -0
  28. zaber_motion/version.py +1 -1
  29. {zaber_motion-7.14.0.dist-info → zaber_motion-8.0.0.dist-info}/METADATA +1 -1
  30. {zaber_motion-7.14.0.dist-info → zaber_motion-8.0.0.dist-info}/RECORD +34 -32
  31. zaber_motion_bindings/zaber-motion-core-windows-amd64.dll +0 -0
  32. zaber_motion/dto/ascii/lockstep_axes.py +0 -108
  33. {zaber_motion-7.14.0.dist-info → zaber_motion-8.0.0.dist-info}/LICENSE.txt +0 -0
  34. {zaber_motion-7.14.0.dist-info → zaber_motion-8.0.0.dist-info}/WHEEL +0 -0
  35. {zaber_motion-7.14.0.dist-info → zaber_motion-8.0.0.dist-info}/top_level.txt +0 -0
@@ -12,7 +12,6 @@ from .stream_buffer import StreamBuffer
12
12
  from ..dto.ascii.stream_mode import StreamMode
13
13
  from ..dto.ascii.stream_axis_definition import StreamAxisDefinition
14
14
  from .stream_io import StreamIo
15
- from ..dto.ascii.digital_output_action import DigitalOutputAction
16
15
 
17
16
  if TYPE_CHECKING:
18
17
  from .device import Device
@@ -1906,277 +1905,3 @@ class Stream:
1906
1905
  request,
1907
1906
  dto.StreamModeResponse.from_binary)
1908
1907
  return response.stream_mode
1909
-
1910
- def wait_digital_input(
1911
- self,
1912
- channel_number: int,
1913
- value: bool
1914
- ) -> None:
1915
- """
1916
- Deprecated: Use Stream.Io.WaitDigitalInput instead.
1917
-
1918
- Wait for a digital input channel to reach a given value.
1919
-
1920
- Args:
1921
- channel_number: The number of the digital input channel.
1922
- Channel numbers are numbered from one.
1923
- value: The value that the stream should wait for.
1924
- """
1925
- request = dto.StreamWaitDigitalInputRequest(
1926
- interface_id=self.device.connection.interface_id,
1927
- device=self.device.device_address,
1928
- stream_id=self.stream_id,
1929
- channel_number=channel_number,
1930
- value=value,
1931
- )
1932
- call("device/stream_wait_digital_input", request)
1933
-
1934
- async def wait_digital_input_async(
1935
- self,
1936
- channel_number: int,
1937
- value: bool
1938
- ) -> None:
1939
- """
1940
- Deprecated: Use Stream.Io.WaitDigitalInput instead.
1941
-
1942
- Wait for a digital input channel to reach a given value.
1943
-
1944
- Args:
1945
- channel_number: The number of the digital input channel.
1946
- Channel numbers are numbered from one.
1947
- value: The value that the stream should wait for.
1948
- """
1949
- request = dto.StreamWaitDigitalInputRequest(
1950
- interface_id=self.device.connection.interface_id,
1951
- device=self.device.device_address,
1952
- stream_id=self.stream_id,
1953
- channel_number=channel_number,
1954
- value=value,
1955
- )
1956
- await call_async("device/stream_wait_digital_input", request)
1957
-
1958
- def wait_analog_input(
1959
- self,
1960
- channel_number: int,
1961
- condition: str,
1962
- value: float
1963
- ) -> None:
1964
- """
1965
- Deprecated: Use Stream.Io.WaitAnalogInput instead.
1966
-
1967
- Wait for the value of a analog input channel to reach a condition concerning a given value.
1968
-
1969
- Args:
1970
- channel_number: The number of the analog input channel.
1971
- Channel numbers are numbered from one.
1972
- condition: A condition (e.g. <, <=, ==, !=).
1973
- value: The value that the condition concerns, in Volts.
1974
- """
1975
- request = dto.StreamWaitAnalogInputRequest(
1976
- interface_id=self.device.connection.interface_id,
1977
- device=self.device.device_address,
1978
- stream_id=self.stream_id,
1979
- channel_number=channel_number,
1980
- condition=condition,
1981
- value=value,
1982
- )
1983
- call("device/stream_wait_analog_input", request)
1984
-
1985
- async def wait_analog_input_async(
1986
- self,
1987
- channel_number: int,
1988
- condition: str,
1989
- value: float
1990
- ) -> None:
1991
- """
1992
- Deprecated: Use Stream.Io.WaitAnalogInput instead.
1993
-
1994
- Wait for the value of a analog input channel to reach a condition concerning a given value.
1995
-
1996
- Args:
1997
- channel_number: The number of the analog input channel.
1998
- Channel numbers are numbered from one.
1999
- condition: A condition (e.g. <, <=, ==, !=).
2000
- value: The value that the condition concerns, in Volts.
2001
- """
2002
- request = dto.StreamWaitAnalogInputRequest(
2003
- interface_id=self.device.connection.interface_id,
2004
- device=self.device.device_address,
2005
- stream_id=self.stream_id,
2006
- channel_number=channel_number,
2007
- condition=condition,
2008
- value=value,
2009
- )
2010
- await call_async("device/stream_wait_analog_input", request)
2011
-
2012
- def set_digital_output(
2013
- self,
2014
- channel_number: int,
2015
- value: DigitalOutputAction
2016
- ) -> None:
2017
- """
2018
- Deprecated: Use Stream.Io.SetDigitalOutput instead.
2019
-
2020
- Sets value for the specified digital output channel.
2021
-
2022
- Args:
2023
- channel_number: Channel number starting at 1.
2024
- value: The type of action to perform on the channel.
2025
- """
2026
- request = dto.StreamSetDigitalOutputRequest(
2027
- interface_id=self.device.connection.interface_id,
2028
- device=self.device.device_address,
2029
- stream_id=self.stream_id,
2030
- channel_number=channel_number,
2031
- value=value,
2032
- )
2033
- call("device/stream_set_digital_output", request)
2034
-
2035
- async def set_digital_output_async(
2036
- self,
2037
- channel_number: int,
2038
- value: DigitalOutputAction
2039
- ) -> None:
2040
- """
2041
- Deprecated: Use Stream.Io.SetDigitalOutput instead.
2042
-
2043
- Sets value for the specified digital output channel.
2044
-
2045
- Args:
2046
- channel_number: Channel number starting at 1.
2047
- value: The type of action to perform on the channel.
2048
- """
2049
- request = dto.StreamSetDigitalOutputRequest(
2050
- interface_id=self.device.connection.interface_id,
2051
- device=self.device.device_address,
2052
- stream_id=self.stream_id,
2053
- channel_number=channel_number,
2054
- value=value,
2055
- )
2056
- await call_async("device/stream_set_digital_output", request)
2057
-
2058
- def set_all_digital_outputs(
2059
- self,
2060
- values: List[DigitalOutputAction]
2061
- ) -> None:
2062
- """
2063
- Deprecated: Use Stream.Io.SetAllDigitalOutputs instead.
2064
-
2065
- Sets values for all digital output channels.
2066
-
2067
- Args:
2068
- values: The type of action to perform on the channel.
2069
- """
2070
- request = dto.StreamSetAllDigitalOutputsRequest(
2071
- interface_id=self.device.connection.interface_id,
2072
- device=self.device.device_address,
2073
- stream_id=self.stream_id,
2074
- values=values,
2075
- )
2076
- call("device/stream_set_all_digital_outputs", request)
2077
-
2078
- async def set_all_digital_outputs_async(
2079
- self,
2080
- values: List[DigitalOutputAction]
2081
- ) -> None:
2082
- """
2083
- Deprecated: Use Stream.Io.SetAllDigitalOutputs instead.
2084
-
2085
- Sets values for all digital output channels.
2086
-
2087
- Args:
2088
- values: The type of action to perform on the channel.
2089
- """
2090
- request = dto.StreamSetAllDigitalOutputsRequest(
2091
- interface_id=self.device.connection.interface_id,
2092
- device=self.device.device_address,
2093
- stream_id=self.stream_id,
2094
- values=values,
2095
- )
2096
- await call_async("device/stream_set_all_digital_outputs", request)
2097
-
2098
- def set_analog_output(
2099
- self,
2100
- channel_number: int,
2101
- value: float
2102
- ) -> None:
2103
- """
2104
- Deprecated: Use Stream.Io.setAnalogOutput instead.
2105
-
2106
- Sets value for the specified analog output channel.
2107
-
2108
- Args:
2109
- channel_number: Channel number starting at 1.
2110
- value: Value to set the output channel voltage to.
2111
- """
2112
- request = dto.StreamSetAnalogOutputRequest(
2113
- interface_id=self.device.connection.interface_id,
2114
- device=self.device.device_address,
2115
- stream_id=self.stream_id,
2116
- channel_number=channel_number,
2117
- value=value,
2118
- )
2119
- call("device/stream_set_analog_output", request)
2120
-
2121
- async def set_analog_output_async(
2122
- self,
2123
- channel_number: int,
2124
- value: float
2125
- ) -> None:
2126
- """
2127
- Deprecated: Use Stream.Io.setAnalogOutput instead.
2128
-
2129
- Sets value for the specified analog output channel.
2130
-
2131
- Args:
2132
- channel_number: Channel number starting at 1.
2133
- value: Value to set the output channel voltage to.
2134
- """
2135
- request = dto.StreamSetAnalogOutputRequest(
2136
- interface_id=self.device.connection.interface_id,
2137
- device=self.device.device_address,
2138
- stream_id=self.stream_id,
2139
- channel_number=channel_number,
2140
- value=value,
2141
- )
2142
- await call_async("device/stream_set_analog_output", request)
2143
-
2144
- def set_all_analog_outputs(
2145
- self,
2146
- values: List[float]
2147
- ) -> None:
2148
- """
2149
- Deprecated: Use Stream.Io.setAllAnalogOutputs instead.
2150
-
2151
- Sets values for all analog output channels.
2152
-
2153
- Args:
2154
- values: Voltage values to set the output channels to.
2155
- """
2156
- request = dto.StreamSetAllAnalogOutputsRequest(
2157
- interface_id=self.device.connection.interface_id,
2158
- device=self.device.device_address,
2159
- stream_id=self.stream_id,
2160
- values=values,
2161
- )
2162
- call("device/stream_set_all_analog_outputs", request)
2163
-
2164
- async def set_all_analog_outputs_async(
2165
- self,
2166
- values: List[float]
2167
- ) -> None:
2168
- """
2169
- Deprecated: Use Stream.Io.setAllAnalogOutputs instead.
2170
-
2171
- Sets values for all analog output channels.
2172
-
2173
- Args:
2174
- values: Voltage values to set the output channels to.
2175
- """
2176
- request = dto.StreamSetAllAnalogOutputsRequest(
2177
- interface_id=self.device.connection.interface_id,
2178
- device=self.device.device_address,
2179
- stream_id=self.stream_id,
2180
- values=values,
2181
- )
2182
- await call_async("device/stream_set_all_analog_outputs", request)
@@ -59,6 +59,19 @@ class Connection:
59
59
  Default baud rate for serial connections.
60
60
  """
61
61
 
62
+ TCP_PORT_CHAIN = 55550
63
+ """
64
+ Commands sent over this port are forwarded to the device chain.
65
+ The bandwidth may be limited as the commands are forwarded over a serial connection.
66
+ """
67
+
68
+ TCP_PORT_DEVICE_ONLY = 55551
69
+ """
70
+ Commands send over this port are processed only by the device
71
+ and not forwarded to the rest of the chain.
72
+ Using this port typically makes the communication faster.
73
+ """
74
+
62
75
  @property
63
76
  def interface_id(self) -> int:
64
77
  """
@@ -137,7 +150,7 @@ class Connection:
137
150
  @staticmethod
138
151
  def open_tcp(
139
152
  host_name: str,
140
- port: int,
153
+ port: int = TCP_PORT_CHAIN,
141
154
  use_message_ids: bool = False
142
155
  ) -> 'Connection':
143
156
  """
@@ -145,7 +158,7 @@ class Connection:
145
158
 
146
159
  Args:
147
160
  host_name: Hostname or IP address.
148
- port: Port number.
161
+ port: Optional port number (defaults to 55550).
149
162
  use_message_ids: Enable use of message IDs (defaults to disabled).
150
163
  All your devices must be pre-configured to match.
151
164
 
@@ -167,7 +180,7 @@ class Connection:
167
180
  @staticmethod
168
181
  def open_tcp_async(
169
182
  host_name: str,
170
- port: int,
183
+ port: int = TCP_PORT_CHAIN,
171
184
  use_message_ids: bool = False
172
185
  ) -> 'AsyncBinaryConnectionOpener':
173
186
  """
@@ -175,7 +188,7 @@ class Connection:
175
188
 
176
189
  Args:
177
190
  host_name: Hostname or IP address.
178
- port: Port number.
191
+ port: Optional port number (defaults to 55550).
179
192
  use_message_ids: Enable use of message IDs (defaults to disabled).
180
193
  All your devices must be pre-configured to match.
181
194
 
@@ -9,3 +9,4 @@ from .log_output_mode import LogOutputMode as LogOutputMode
9
9
  from .measurement import Measurement as Measurement
10
10
  from .named_parameter import NamedParameter as NamedParameter
11
11
  from .rotation_direction import RotationDirection as RotationDirection
12
+ from .unit_conversion_descriptor import UnitConversionDescriptor as UnitConversionDescriptor
@@ -15,7 +15,6 @@ from .get_setting import GetSetting as GetSetting
15
15
  from .get_setting_result import GetSettingResult as GetSettingResult
16
16
  from .io_port_label import IoPortLabel as IoPortLabel
17
17
  from .io_port_type import IoPortType as IoPortType
18
- from .lockstep_axes import LockstepAxes as LockstepAxes
19
18
  from .measurement_sequence import MeasurementSequence as MeasurementSequence
20
19
  from .message_type import MessageType as MessageType
21
20
  from .optional_measurement_sequence import OptionalMeasurementSequence as OptionalMeasurementSequence
@@ -26,16 +26,19 @@ class Response:
26
26
  reply_flag: str
27
27
  """
28
28
  The reply flag indicates if the request was accepted (OK) or rejected (RJ).
29
+ Does not apply to info messages.
29
30
  """
30
31
 
31
32
  status: str
32
33
  """
33
34
  The device status contains BUSY when the axis is moving and IDLE otherwise.
35
+ Does not apply to info messages.
34
36
  """
35
37
 
36
38
  warning_flag: str
37
39
  """
38
40
  The warning flag contains the highest priority warning currently active for the device or axis.
41
+ Does not apply to info messages.
39
42
  """
40
43
 
41
44
  data: str
@@ -45,7 +48,7 @@ class Response:
45
48
 
46
49
  message_type: MessageType
47
50
  """
48
- Type of the reply received.
51
+ Type of the response received (only Reply or Info).
49
52
  """
50
53
 
51
54
  @staticmethod
@@ -25,9 +25,10 @@ class SimpleTuning:
25
25
  If this paramset has been tuned using the simple tuning method, whether or not it's currently in use.
26
26
  """
27
27
 
28
- load_mass: float
28
+ load_inertia: float
29
29
  """
30
- The mass of the load in kg, excluding the mass of the carriage.
30
+ The inertia of the load in kg (for linear devices) or kg⋅m² (for rotary devices),
31
+ excluding the inertia of the carriage.
31
32
  """
32
33
 
33
34
  tuning_params: List[ServoTuningParam]
@@ -35,9 +36,9 @@ class SimpleTuning:
35
36
  The parameters used by simple tuning.
36
37
  """
37
38
 
38
- carriage_mass: Optional[float] = None
39
+ carriage_inertia: Optional[float] = None
39
40
  """
40
- The mass of the carriage in kg.
41
+ The inertia of the carriage in kg (for linear devices) or kg⋅m² (for rotary devices).
41
42
  """
42
43
 
43
44
  motor_inertia: Optional[float] = None
@@ -50,9 +51,9 @@ class SimpleTuning:
50
51
  return SimpleTuning(
51
52
  is_used=False,
52
53
  is_set=False,
53
- carriage_mass=None,
54
+ carriage_inertia=None,
54
55
  motor_inertia=None,
55
- load_mass=0,
56
+ load_inertia=0,
56
57
  tuning_params=[],
57
58
  )
58
59
 
@@ -71,9 +72,9 @@ class SimpleTuning:
71
72
  return {
72
73
  'isUsed': bool(self.is_used),
73
74
  'isSet': bool(self.is_set),
74
- 'carriageMass': float(self.carriage_mass) if self.carriage_mass is not None else None,
75
+ 'carriageInertia': float(self.carriage_inertia) if self.carriage_inertia is not None else None,
75
76
  'motorInertia': float(self.motor_inertia) if self.motor_inertia is not None else None,
76
- 'loadMass': float(self.load_mass),
77
+ 'loadInertia': float(self.load_inertia),
77
78
  'tuningParams': [item.to_dict() for item in self.tuning_params] if self.tuning_params is not None else [],
78
79
  }
79
80
 
@@ -82,27 +83,27 @@ class SimpleTuning:
82
83
  return SimpleTuning(
83
84
  is_used=data.get('isUsed'), # type: ignore
84
85
  is_set=data.get('isSet'), # type: ignore
85
- carriage_mass=data.get('carriageMass'), # type: ignore
86
+ carriage_inertia=data.get('carriageInertia'), # type: ignore
86
87
  motor_inertia=data.get('motorInertia'), # type: ignore
87
- load_mass=data.get('loadMass'), # type: ignore
88
+ load_inertia=data.get('loadInertia'), # type: ignore
88
89
  tuning_params=[ServoTuningParam.from_dict(item) for item in data.get('tuningParams')], # type: ignore
89
90
  )
90
91
 
91
92
  def validate(self) -> None:
92
93
  """" Validates the properties of the instance. """
93
- if self.carriage_mass is not None:
94
- if not isinstance(self.carriage_mass, (int, float, decimal.Decimal)):
95
- raise ValueError(f'Property "CarriageMass" of "SimpleTuning" is not a number.')
94
+ if self.carriage_inertia is not None:
95
+ if not isinstance(self.carriage_inertia, (int, float, decimal.Decimal)):
96
+ raise ValueError(f'Property "CarriageInertia" of "SimpleTuning" is not a number.')
96
97
 
97
98
  if self.motor_inertia is not None:
98
99
  if not isinstance(self.motor_inertia, (int, float, decimal.Decimal)):
99
100
  raise ValueError(f'Property "MotorInertia" of "SimpleTuning" is not a number.')
100
101
 
101
- if self.load_mass is None:
102
- raise ValueError(f'Property "LoadMass" of "SimpleTuning" is None.')
102
+ if self.load_inertia is None:
103
+ raise ValueError(f'Property "LoadInertia" of "SimpleTuning" is None.')
103
104
 
104
- if not isinstance(self.load_mass, (int, float, decimal.Decimal)):
105
- raise ValueError(f'Property "LoadMass" of "SimpleTuning" is not a number.')
105
+ if not isinstance(self.load_inertia, (int, float, decimal.Decimal)):
106
+ raise ValueError(f'Property "LoadInertia" of "SimpleTuning" is not a number.')
106
107
 
107
108
  if self.tuning_params is not None:
108
109
  if not isinstance(self.tuning_params, Iterable):
@@ -26,16 +26,19 @@ class UnknownResponseEvent:
26
26
  reply_flag: str
27
27
  """
28
28
  The reply flag indicates if the request was accepted (OK) or rejected (RJ).
29
+ Does not apply to info messages.
29
30
  """
30
31
 
31
32
  status: str
32
33
  """
33
34
  The device status contains BUSY when the axis is moving and IDLE otherwise.
35
+ Does not apply to info messages.
34
36
  """
35
37
 
36
38
  warning_flag: str
37
39
  """
38
40
  The warning flag contains the highest priority warning currently active for the device or axis.
41
+ Does not apply to info messages.
39
42
  """
40
43
 
41
44
  data: str
@@ -45,7 +48,7 @@ class UnknownResponseEvent:
45
48
 
46
49
  message_type: MessageType
47
50
  """
48
- Type of the reply received.
51
+ Type of the response received (only Reply or Info).
49
52
  """
50
53
 
51
54
  @staticmethod
@@ -96,6 +96,7 @@ from .generic_command_request import GenericCommandRequest as GenericCommandRequ
96
96
  from .generic_command_response_collection import GenericCommandResponseCollection as GenericCommandResponseCollection
97
97
  from .get_all_io_port_labels_response import GetAllIoPortLabelsResponse as GetAllIoPortLabelsResponse
98
98
  from .get_axis_setting_results import GetAxisSettingResults as GetAxisSettingResults
99
+ from .get_command_unit_conversion_response import GetCommandUnitConversionResponse as GetCommandUnitConversionResponse
99
100
  from .get_io_port_label_request import GetIoPortLabelRequest as GetIoPortLabelRequest
100
101
  from .get_setting_results import GetSettingResults as GetSettingResults
101
102
  from .get_simple_tuning_param_definition_response import GetSimpleTuningParamDefinitionResponse as GetSimpleTuningParamDefinitionResponse
@@ -242,6 +243,7 @@ from .trigger_on_fire_set_request import TriggerOnFireSetRequest as TriggerOnFir
242
243
  from .trigger_on_fire_set_to_setting_request import TriggerOnFireSetToSettingRequest as TriggerOnFireSetToSettingRequest
243
244
  from .trigger_set_label_request import TriggerSetLabelRequest as TriggerSetLabelRequest
244
245
  from .trigger_states import TriggerStates as TriggerStates
246
+ from .unit_convert_native_request import UnitConvertNativeRequest as UnitConvertNativeRequest
245
247
  from .unit_convert_unit_request import UnitConvertUnitRequest as UnitConvertUnitRequest
246
248
  from .unit_get_enum_request import UnitGetEnumRequest as UnitGetEnumRequest
247
249
  from .unit_get_enum_response import UnitGetEnumResponse as UnitGetEnumResponse
@@ -1,9 +1,10 @@
1
1
  # This file is generated. Do not modify by hand.
2
2
  # pylint: disable=line-too-long, unused-argument, f-string-without-interpolation, too-many-branches, too-many-statements, unnecessary-pass
3
3
  from dataclasses import dataclass
4
- from typing import Any, Dict
4
+ from typing import Any, Dict, Optional
5
5
  import decimal
6
6
  import zaber_bson
7
+ from ..measurement import Measurement
7
8
 
8
9
 
9
10
  @dataclass
@@ -17,6 +18,8 @@ class ChannelOn:
17
18
 
18
19
  on: bool = False
19
20
 
21
+ duration: Optional[Measurement] = None
22
+
20
23
  @staticmethod
21
24
  def zero_values() -> 'ChannelOn':
22
25
  return ChannelOn(
@@ -24,6 +27,7 @@ class ChannelOn:
24
27
  device=0,
25
28
  axis=0,
26
29
  on=False,
30
+ duration=None,
27
31
  )
28
32
 
29
33
  @staticmethod
@@ -43,6 +47,7 @@ class ChannelOn:
43
47
  'device': int(self.device),
44
48
  'axis': int(self.axis),
45
49
  'on': bool(self.on),
50
+ 'duration': self.duration.to_dict() if self.duration is not None else None,
46
51
  }
47
52
 
48
53
  @staticmethod
@@ -52,6 +57,7 @@ class ChannelOn:
52
57
  device=data.get('device'), # type: ignore
53
58
  axis=data.get('axis'), # type: ignore
54
59
  on=data.get('on'), # type: ignore
60
+ duration=Measurement.from_dict(data.get('duration')) if data.get('duration') is not None else None, # type: ignore
55
61
  )
56
62
 
57
63
  def validate(self) -> None:
@@ -82,3 +88,9 @@ class ChannelOn:
82
88
 
83
89
  if int(self.axis) != self.axis:
84
90
  raise ValueError(f'Property "Axis" of "ChannelOn" is not integer value.')
91
+
92
+ if self.duration is not None:
93
+ if not isinstance(self.duration, Measurement):
94
+ raise ValueError(f'Property "Duration" of "ChannelOn" is not an instance of "Measurement".')
95
+
96
+ self.duration.validate()
@@ -0,0 +1,54 @@
1
+ # This file is generated. Do not modify by hand.
2
+ # pylint: disable=line-too-long, unused-argument, f-string-without-interpolation, too-many-branches, too-many-statements, unnecessary-pass
3
+ from dataclasses import dataclass, field
4
+ from typing import Any, Dict, List, Optional
5
+ from collections.abc import Iterable
6
+ import zaber_bson
7
+ from ..unit_conversion_descriptor import UnitConversionDescriptor
8
+
9
+
10
+ @dataclass
11
+ class GetCommandUnitConversionResponse:
12
+
13
+ value: List[Optional[UnitConversionDescriptor]] = field(default_factory=list)
14
+
15
+ @staticmethod
16
+ def zero_values() -> 'GetCommandUnitConversionResponse':
17
+ return GetCommandUnitConversionResponse(
18
+ value=[],
19
+ )
20
+
21
+ @staticmethod
22
+ def from_binary(data_bytes: bytes) -> 'GetCommandUnitConversionResponse':
23
+ """" Deserialize a binary representation of this class. """
24
+ data = zaber_bson.loads(data_bytes) # type: Dict[str, Any]
25
+ return GetCommandUnitConversionResponse.from_dict(data)
26
+
27
+ def to_binary(self) -> bytes:
28
+ """" Serialize this class to a binary representation. """
29
+ self.validate()
30
+ return zaber_bson.dumps(self.to_dict()) # type: ignore
31
+
32
+ def to_dict(self) -> Dict[str, Any]:
33
+ return {
34
+ 'value': [item.to_dict() if item is not None else None for item in self.value] if self.value is not None else [],
35
+ }
36
+
37
+ @staticmethod
38
+ def from_dict(data: Dict[str, Any]) -> 'GetCommandUnitConversionResponse':
39
+ return GetCommandUnitConversionResponse(
40
+ value=[UnitConversionDescriptor.from_dict(item) if item is not None else None for item in data.get('value')], # type: ignore
41
+ )
42
+
43
+ def validate(self) -> None:
44
+ """" Validates the properties of the instance. """
45
+ if self.value is not None:
46
+ if not isinstance(self.value, Iterable):
47
+ raise ValueError('Property "Value" of "GetCommandUnitConversionResponse" is not iterable.')
48
+
49
+ for i, value_item in enumerate(self.value):
50
+ if value_item is not None:
51
+ if not isinstance(value_item, UnitConversionDescriptor):
52
+ raise ValueError(f'Item {i} in property "Value" of "GetCommandUnitConversionResponse" is not an instance of "UnitConversionDescriptor".')
53
+
54
+ value_item.validate()