Skip to content
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

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions package/MDAnalysis/coordinates/H5MD.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
:members:

"""
import logging

import numpy as np
import MDAnalysis as mda
Expand All @@ -230,6 +231,8 @@
else:
HAS_H5PY = True

logger = logging.getLogger(__name__)


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undo blank line change.

class H5MDReader(base.ReaderBase):
r"""Reader for the H5MD format.
Expand Down Expand Up @@ -675,8 +678,12 @@

if 'observables' in self._file:
for key in self._file['observables'].keys():
self.ts.data[key] = self._file['observables'][key][
'value'][self._frame]
try:
self.ts.data[key] = self._file['observables'][key][
'value'][self._frame]
except KeyError:
logger.warning(f"Unable to read '{key}' from 'observables'")

Check warning on line 685 in package/MDAnalysis/coordinates/H5MD.py

View check run for this annotation

Codecov / codecov/patch

package/MDAnalysis/coordinates/H5MD.py#L684-L685

Added lines #L684 - L685 were not covered by tests


# pulls 'time' and 'step' out of first available parent group
for name, value in self._has.items():
Expand Down
Loading