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
cb293447
Unverified
Commit
cb293447
authored
Feb 07, 2022
by
Sander Roet
Committed by
GitHub
Feb 07, 2022
Browse files
resolve scipy 1.8.0 io.netcdf deprecation warning (#3451)
parent
129cece9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
wrappers/python/openmm/app/internal/amber_file_parser.py
wrappers/python/openmm/app/internal/amber_file_parser.py
+8
-3
wrappers/python/tests/TestAmberInpcrdFile.py
wrappers/python/tests/TestAmberInpcrdFile.py
+8
-4
No files found.
wrappers/python/openmm/app/internal/amber_file_parser.py
View file @
cb293447
...
@@ -1433,10 +1433,15 @@ class AmberNetcdfRestart(object):
...
@@ -1433,10 +1433,15 @@ class AmberNetcdfRestart(object):
>>> coordinates = f.coordinates
>>> coordinates = f.coordinates
"""
"""
def
__init__
(
self
,
filename
,
asNumpy
=
False
):
def
__init__
(
self
,
filename
,
asNumpy
=
False
):
try
:
from
scipy.io
import
NetCDFFile
except
ImportError
:
# scipy < 1.8.0
try
:
try
:
from
scipy.io.netcdf
import
NetCDFFile
from
scipy.io.netcdf
import
NetCDFFile
except
ImportError
:
except
ImportError
:
raise
ImportError
(
'scipy is necessary to parse NetCDF restarts'
)
raise
ImportError
(
'scipy is necessary to parse NetCDF '
'restarts'
)
self
.
filename
=
filename
self
.
filename
=
filename
self
.
velocities
=
self
.
boxVectors
=
self
.
time
=
None
self
.
velocities
=
self
.
boxVectors
=
self
.
time
=
None
...
...
wrappers/python/tests/TestAmberInpcrdFile.py
View file @
cb293447
...
@@ -5,12 +5,16 @@ from openmm import *
...
@@ -5,12 +5,16 @@ from openmm import *
from
openmm.unit
import
*
from
openmm.unit
import
*
import
openmm.app.element
as
elem
import
openmm.app.element
as
elem
try
:
try
:
from
scipy.io
import
NetCDFFile
SCIPY_IMPORT_FAILED
=
False
except
ImportError
:
try
:
# scipy < 1.8.0
from
scipy.io
import
netcdf
from
scipy.io
import
netcdf
SCIPY_IMPORT_FAILED
=
False
SCIPY_IMPORT_FAILED
=
False
except
:
except
:
SCIPY_IMPORT_FAILED
=
True
SCIPY_IMPORT_FAILED
=
True
def
compareByElement
(
array1
,
array2
,
cmp
):
def
compareByElement
(
array1
,
array2
,
cmp
):
for
x
,
y
in
zip
(
array1
,
array2
):
for
x
,
y
in
zip
(
array1
,
array2
):
cmp
(
x
,
y
)
cmp
(
x
,
y
)
...
...
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