saiunit.has_same_unit#
- saiunit.has_same_unit(obj1, obj2)#
Check whether two objects have the same unit.
Compares the underlying units mathematically (
dim,scale,base,factor) — alias spellings and display-name differences are ignored. For strict identity-level equality useUnit.__eq__directly.- Parameters:
- Returns:
same –
Trueif obj1 and obj2 have the same unit.- Return type:
See also
have_same_dimCheck whether two objects share the same dimension.
is_unit_equal_mathSame-math comparison for Unit objects directly.
Examples
>>> import saiunit as u >>> u.has_same_unit(1.0 * u.mV, 2.0 * u.mV) True >>> u.has_same_unit(1.0 * u.mV, 2.0 * u.volt) False >>> u.has_same_unit(1.0, 2.0) True