Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
f7a7f4ea
Commit
f7a7f4ea
authored
Dec 07, 2014
by
Jason Swails
Browse files
Fix the mean() and std() methods on container Quantities when those containers
are NOT numpy arrays.
parent
b9a19a0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
wrappers/python/simtk/unit/quantity.py
wrappers/python/simtk/unit/quantity.py
+3
-2
No files found.
wrappers/python/simtk/unit/quantity.py
View file @
f7a7f4ea
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment