API Reference v9.1.0
UnitTableclass
Module: zaber_motion
Helper for working with units of measure.
To use this type, add from zaber_motion import UnitTable to the top of your source code.
Index
Methods
s
UnitTable.convert_from_native_units(conversion, value, to_unit)Converts a value from native units to the specified unit given unit conversion descriptor.
Arguments
| Name | Type | Description |
|---|---|---|
| conversion | UnitConversionDescriptor | The unit conversion data retrieved from device or axis. |
| value | float | The value to be converted. |
| to_unit | UnitsAndLiterals | The unit which the value is being converted to. |
Return Value
float The converted value. Throws ConversionFailedException if unit is incompatible.s
UnitTable.convert_from_native_units_batch(conversion, values, to_unit)Converts values from native units to the specified unit given unit conversion descriptor.
Arguments
| Name | Type | Description |
|---|---|---|
| conversion | UnitConversionDescriptor | The unit conversion data retrieved from device or axis. |
| values | List[float] | The value to be converted. |
| to_unit | UnitsAndLiterals | The unit which the value is being converted to. |
Return Value
List[float] The converted values. Throws ConversionFailedException if unit is incompatible.s
UnitTable.convert_to_native_units(conversion, value, from_unit)Converts a value from one unit to native units given unit conversion descriptor.
Arguments
| Name | Type | Description |
|---|---|---|
| conversion | UnitConversionDescriptor | The unit conversion data retrieved from device or axis. |
| value | float | The value to be converted. |
| from_unit | UnitsAndLiterals | The unit which the value is being converted from. |
Return Value
float The converted value. Throws ConversionFailedException if unit is incompatible.s
UnitTable.convert_to_native_units_batch(conversion, values, from_unit)Converts values from one unit to native units given unit conversion descriptor.
Arguments
| Name | Type | Description |
|---|---|---|
| conversion | UnitConversionDescriptor | The unit conversion data retrieved from device or axis. |
| values | List[float] | The value to be converted. |
| from_unit | UnitsAndLiterals | The unit which the value is being converted from. |
Return Value
List[float] The converted values. Throws ConversionFailedException if unit is incompatible.s
UnitTable.convert_units(value, from_unit, to_unit)Converts a value from one unit to a different unit of the same dimension. Note that this function does not support native unit conversions.
Arguments
| Name | Type | Description |
|---|---|---|
| value | float | The value to be converted. |
| from_unit | UnitsAndLiterals | The unit which the value is being converted from. |
| to_unit | UnitsAndLiterals | The unit which the value is being converted to. |
Return Value
float The converted value. Throws ConversionFailedException if unit is incompatible.s
UnitTable.get_symbol(unit)Gets the standard symbol associated with a given unit.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | UnitsAndLiterals | Unit of measure. |
Return Value
str Symbols corresponding to the given unit. Throws NoValueForKey if no symbol is defined.s
UnitTable.get_unit(symbol)Gets the unit enum value associated with a standard symbol. Note not all units can be retrieved this way.
Arguments
| Name | Type | Description |
|---|---|---|
| symbol | str | Symbol to look up. |
Return Value
UnitsAndLiterals The unit enum value with the given symbols. Throws NoValueForKey if the symbol is not supported for lookup.