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
83255aa8
Commit
83255aa8
authored
Jun 19, 2015
by
Jason Swails
Browse files
Add test for numpy units and update user's guide docs.
parent
4ae68749
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
docs-source/usersguide/library.rst
docs-source/usersguide/library.rst
+1
-1
wrappers/python/tests/TestUnits.py
wrappers/python/tests/TestUnits.py
+4
-3
No files found.
docs-source/usersguide/library.rst
View file @
83255aa8
...
...
@@ -2865,7 +2865,7 @@ in and out.
[[10.0, 20.0, 30.0], [40.0, 50.0, 60.0]]
>>> import numpy
>>> a =
Quantity(
numpy.array([1,2,3])
,
centimeter
)
>>> a = numpy.array([1,2,3])
*
centimeter
>>> print(a)
[1 2 3] cm
>>> print(a/millimeter)
...
...
wrappers/python/tests/TestUnits.py
View file @
83255aa8
...
...
@@ -638,6 +638,7 @@ class TestUnits(QuantityTestCase):
self
.
assertEqual
(
str
(
u
.
meters
*
u
.
meters
),
'meter**2'
)
self
.
assertEqual
(
str
(
u
.
meter
*
u
.
meter
),
'meter**2'
)
@
unittest
.
skipIf
(
np
is
None
,
'Skipping numpy units tests'
)
class
TestNumpyUnits
(
QuantityTestCase
):
def
testNumpyQuantity
(
self
):
...
...
@@ -686,6 +687,6 @@ class TestNumpyUnits(QuantityTestCase):
b
=
a
.
reshape
((
5
,
2
))
self
.
assertTrue
(
u
.
is_quantity
(
b
))
if
np
is
None
:
# Support lack of numpy
del
TestNumpyUnits
def
testMultiplication
(
self
)
:
""" Tests that units override numpy.ndarray multiplication """
self
.
assertIsInstance
(
np
.
arange
(
10
)
*
u
.
angstroms
,
u
.
Quantity
)
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