saiunit.have_same_dim

Contents

saiunit.have_same_dim#

saiunit.have_same_dim(obj1, obj2)[source]#

Test if two values have the same dimensions.

Parameters:
  • obj1 ({Quantity, Unit, array-like, number}) – The first value.

  • obj2 ({Quantity, Unit, array-like, number}) – The second value.

Returns:

sameTrue if obj1 and obj2 have the same dimensions.

Return type:

bool

See also

has_same_unit

Check whether two objects share the same unit.

Examples

>>> import saiunit as u
>>> u.have_same_dim(1.0 * u.mV, 2.0 * u.volt)
True
>>> u.have_same_dim(1.0 * u.mV, 2.0 * u.second)
False
>>> u.have_same_dim(1.0, 2.0)
True