Commit 4340498f authored by peastman's avatar peastman
Browse files

Merge pull request #750 from swails/fix_unit

Fix small bug in `simtk.unit` related to mutable sequences.
parents 11e5dc73 f8a101d7
......@@ -356,7 +356,7 @@ class Quantity(object):
if unit.is_dimensionless():
assert unit is dimensionless # should have been set earlier in this method
if is_quantity(result):
result = result._value
result = copy.deepcopy(result._value)
return result
def __mul__(self, other):
......@@ -506,7 +506,7 @@ class Quantity(object):
except AttributeError:
if args or kwargs:
raise TypeError('Unsupported arguments for Quantity.mean')
mean = self.sum() / len(self._value)
mean = (self.sum() / len(self._value))._value
return Quantity(mean, self.unit)
def std(self, *args, **kwargs):
......@@ -526,7 +526,8 @@ class Quantity(object):
except AttributeError:
if args or kwargs:
raise TypeError('Unsupported arguments for Quantity.std')
mean = self.mean()
mean = self.mean()._value
var = 0
for val in self._value:
res = mean - val
var += res * res
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment