saiunit.unit_scale_align_to_first

saiunit.unit_scale_align_to_first#

saiunit.unit_scale_align_to_first(*args)#

Align the units of all arguments to the unit of the first argument.

All values are re-expressed in the unit of args[0].

Parameters:

*args (Quantity or array-like) – The values to align. All values must share the same dimension.

Returns:

aligned – The values with units aligned to the first one.

Return type:

list[saiunit.Quantity]

Raises:

DimensionMismatchError – If any argument has a different dimension than the first.

Examples

>>> import saiunit as u
>>> aligned = u.unit_scale_align_to_first(1 * u.mV, 2 * u.volt)
>>> aligned[0].unit == aligned[1].unit
True