Skip to content

Commit

Permalink
Merge pull request #75 from Becksteinlab/develop
Browse files Browse the repository at this point in the history
Release 0.3.1 prep
  • Loading branch information
ljwoods2 authored Dec 16, 2024
2 parents 529d1fa + 29a1bce commit adb567b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/gh-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ name: GH Actions CI
pull_request:
branches:
- main
- develop
schedule:
# Weekly tests at midnight on Sundays run on main by default:
# Scheduled workflows run on the latest commit on the default or base branch.
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ The rules for this file:
* YYYY-MM-DD date format (following ISO 8601)
* accompany each entry with github issue/PR number (Issue #xyz)
-->
## [0.3.1]

## Authors
- ljwoods2

### Fixed
- Fixed ZARRH5MDWriter bug which caused writer to fail unexpectedly on
writing scalar ts.data attributes

### Changed
- Relicense to MIT (Issue #74)

## [0.3.0] 2024-10-24

## Authors
Expand Down
14 changes: 7 additions & 7 deletions zarrtraj/ZARR.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,12 +1085,12 @@ def __init__(
if not HAS_ZARR:
raise RuntimeError("Please install zarr")
if n_atoms == 0:
raise ValueError("H5MDWriter: no atoms in output trajectory")
raise ValueError("ZARRH5MDWriter: no atoms in output trajectory")

self.n_atoms = n_atoms
if n_frames is not None and n_frames <= 0:
raise ValueError(
"H5MDWriter: Please provide a positive value for 'n_frames' kwarg"
"ZARRH5MDWriter: Please provide a positive value for 'n_frames' kwarg"
)
self.n_frames = n_frames
self.storage_options = storage_options
Expand Down Expand Up @@ -1163,7 +1163,7 @@ def _write_next_frame(self, ag):

if ts.n_atoms != self.n_atoms:
raise IOError(
"H5MDWriter: Timestep does not have"
"ZARRH5MDWriter: Timestep does not have"
" the correct number of atoms"
)

Expand Down Expand Up @@ -1364,8 +1364,8 @@ def _allocate_buffers(self, ts):
self._obsv = self._file["observables/trajectory"]
self._obsv.require_group(obsv)
self._elements[obsv] = H5MDElementBuffer(
ts.data[obsv].shape,
ts.data[obsv].dtype,
np.asarray(ts.data[obsv]).shape,
np.asarray(ts.data[obsv]).dtype,
self.n_frames,
self._obsv[obsv],
t_unit=self.units["time"],
Expand Down Expand Up @@ -1489,13 +1489,13 @@ def close(self):
# issue a warning if counter is less or more than n_frames
if self._counter < self.n_frames:
warnings.warn(
f"H5MDWriter: `n_frames` kwarg set to {self.n_frames} but "
f"ZARRH5MDWriter: `n_frames` kwarg set to {self.n_frames} but "
f"only {self._counter} frame(s) were written to the trajectory.",
RuntimeWarning,
)
if self._counter >= self.n_frames:
warnings.warn(
f"H5MDWriter: `n_frames` kwarg set to {self.n_frames} but "
f"ZARRH5MDWriter: `n_frames` kwarg set to {self.n_frames} but "
f"{self._counter} frame(s) were written to the trajectory.",
RuntimeWarning,
)
Expand Down

0 comments on commit adb567b

Please sign in to comment.