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.

Methods

s

convert_from_native_units()

UnitTable.convert_from_native_units(conversion, value, to_unit)
Converts a value from native units to the specified unit given unit conversion descriptor.
Arguments
NameTypeDescription
conversionUnitConversionDescriptorThe unit conversion data retrieved from device or axis.
valuefloatThe value to be converted.
to_unitUnitsAndLiteralsThe unit which the value is being converted to.
Return Value
float The converted value. Throws ConversionFailedException if unit is incompatible.
s

convert_from_native_units_batch()

UnitTable.convert_from_native_units_batch(conversion, values, to_unit)
Converts values from native units to the specified unit given unit conversion descriptor.
Arguments
NameTypeDescription
conversionUnitConversionDescriptorThe unit conversion data retrieved from device or axis.
valuesList[float]The value to be converted.
to_unitUnitsAndLiteralsThe unit which the value is being converted to.
Return Value
List[float] The converted values. Throws ConversionFailedException if unit is incompatible.
s

convert_to_native_units()

UnitTable.convert_to_native_units(conversion, value, from_unit)
Converts a value from one unit to native units given unit conversion descriptor.
Arguments
NameTypeDescription
conversionUnitConversionDescriptorThe unit conversion data retrieved from device or axis.
valuefloatThe value to be converted.
from_unitUnitsAndLiteralsThe unit which the value is being converted from.
Return Value
float The converted value. Throws ConversionFailedException if unit is incompatible.
s

convert_to_native_units_batch()

UnitTable.convert_to_native_units_batch(conversion, values, from_unit)
Converts values from one unit to native units given unit conversion descriptor.
Arguments
NameTypeDescription
conversionUnitConversionDescriptorThe unit conversion data retrieved from device or axis.
valuesList[float]The value to be converted.
from_unitUnitsAndLiteralsThe unit which the value is being converted from.
Return Value
List[float] The converted values. Throws ConversionFailedException if unit is incompatible.
s

convert_units()

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
NameTypeDescription
valuefloatThe value to be converted.
from_unitUnitsAndLiteralsThe unit which the value is being converted from.
to_unitUnitsAndLiteralsThe unit which the value is being converted to.
Return Value
float The converted value. Throws ConversionFailedException if unit is incompatible.
s

get_symbol()

UnitTable.get_symbol(unit)
Gets the standard symbol associated with a given unit.
Arguments
NameTypeDescription
unitUnitsAndLiteralsUnit of measure.
Return Value
str Symbols corresponding to the given unit. Throws NoValueForKey if no symbol is defined.
s

get_unit()

UnitTable.get_unit(symbol)
Gets the unit enum value associated with a standard symbol. Note not all units can be retrieved this way.
Arguments
NameTypeDescription
symbolstrSymbol to look up.
Return Value
UnitsAndLiterals The unit enum value with the given symbols. Throws NoValueForKey if the symbol is not supported for lookup.