brainunit.has_same_unit#
- brainunit.has_same_unit(obj1, obj2)#
Check whether two objects have the same unit.
Unlike have_same_dim, this function also checks that the scale matches (e.g.
mVandVhave the same dimension but different units).- 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.
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