-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip observables contained in particle groups #4615
Changes from 13 commits
f9c6ca1
078d168
c5d2db2
bbf4f20
bccda1c
5376223
b22869f
e9b4353
e86e475
7d5eb1c
19035f5
87b23d7
1cfedf4
de7e7ba
757f850
1d1b3df
f52b644
3ae0f26
225a7aa
6faa14d
e074e6b
86749e3
2c1a4e8
66b9ecb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,12 @@ | |
from MDAnalysis.coordinates.H5MD import HAS_H5PY | ||
if HAS_H5PY: | ||
import h5py | ||
from MDAnalysis.coordinates.H5MD import H5MDReader | ||
from MDAnalysis.exceptions import NoDataError | ||
from MDAnalysisTests import make_Universe | ||
from MDAnalysisTests.datafiles import (H5MD_xvf, TPR_xvf, TRR_xvf, | ||
COORDINATES_TOPOLOGY, | ||
COORDINATES_H5MD) | ||
COORDINATES_H5MD, H5MD_energy) | ||
from MDAnalysisTests.coordinates.base import (MultiframeReaderTest, | ||
BaseReference, BaseWriterTest, | ||
assert_timestep_almost_equal) | ||
|
@@ -894,3 +895,21 @@ def test_writer_no_h5py(self, Writer, outfile): | |
u.atoms.n_atoms) as W: | ||
for ts in u.trajectory: | ||
W.write(universe) | ||
|
||
@pytest.mark.skipif(not HAS_H5PY, reason="h5py not installed") | ||
class TestH5MDReaderWithObservables(object): | ||
"""Read H5MD file with 'observables/atoms/energy'.""" | ||
|
||
prec = 3 | ||
ext = 'h5md' | ||
|
||
|
||
def test_read_h5md_issue4598(self): | ||
"""Read a H5MD file with observables. | ||
|
||
The reader will ignore the 'observables/atoms/energy'. | ||
""" | ||
try: | ||
_ = H5MDReader(H5MD_energy, convert_units=True) | ||
except KeyError: | ||
pytest.fail("Could not read H5MD file with observables.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can just have
See also comment about warnings, we should catch suggested warning. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,7 @@ | |
"GRO_sameresid_diffresname", # Case where two residues share the same resid | ||
"PDB_xvf", "TPR_xvf", "TRR_xvf", # Gromacs coords/veloc/forces (cobrotoxin, OPLS-AA, Gromacs 4.5.5 tpr) | ||
"H5MD_xvf", # TPR_xvf + TRR_xvf converted to h5md format | ||
"H5MD_energy", # H5MD trajectory with observables/atoms/energy | ||
"XVG_BZ2", # Compressed xvg file about cobrotoxin | ||
"PDB_xlserial", | ||
"TPR400", "TPR402", "TPR403", "TPR404", "TPR405", "TPR406", "TPR407", | ||
|
@@ -372,6 +373,7 @@ | |
TPR_xvf = (_data_ref / 'cobrotoxin.tpr').as_posix() | ||
TRR_xvf = (_data_ref / 'cobrotoxin.trr').as_posix() | ||
H5MD_xvf = (_data_ref / 'cobrotoxin.h5md').as_posix() | ||
H5MD_energy = (_data_ref / 'cu.h5').as_posix() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it the convention for other There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can rename the file to Edit: I haven't seen a recommendation for the |
||
XVG_BZ2 = (_data_ref / 'cobrotoxin_protein_forces.xvg.bz2').as_posix() | ||
|
||
XPDB_small = (_data_ref / '5digitResid.pdb').as_posix() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undo blank line change.