diff --git a/labrad/units.py b/labrad/units.py index 053564a0..3eee95f0 100644 --- a/labrad/units.py +++ b/labrad/units.py @@ -282,6 +282,8 @@ def _convert_units(self, other): (float, complex, array), and unit is their common unit. """ if isinstance(other, WithUnit): + if other.unit is self.unit: + return self._value, other._value, self.unit if self.isCompatible(other): if self.unit.conversionFactorTo(other.unit) > 1: unit = other.unit @@ -415,6 +417,8 @@ def _base_value(self): def __getitem__(self, unit): """Return value of physical quantity expressed in new units.""" + if unit is self.unit: + return self._value if unit == self.unit: return self._value factor, offset = self.unit.conversionTupleTo(unit)