Skip to content

Commit

Permalink
fix: fix count of frames in trajectory
Browse files Browse the repository at this point in the history
  • Loading branch information
jag1g13 committed Oct 22, 2020
1 parent e1186eb commit d02cd34
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions pycgtool/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,9 @@ def natoms(self) -> int:
return self._topology.n_atoms

@property
def numframes(self) -> int:
"""Number of frames in the frame trajectory."""
# The MDTraj trajectory has the topology file as frame 0
return self._trajectory.n_frames - 1
def n_frames(self) -> int:
"""Number of frames in the trajectory."""
return self._trajectory.n_frames

def add_residue(self,
name,
Expand Down
2 changes: 1 addition & 1 deletion test/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_frame_output_gro(self):

def test_frame_read_xtc_numframes(self):
frame = Frame('test/data/water.gro', 'test/data/water.xtc')
self.assertEqual(10, frame.numframes)
self.assertEqual(11, frame.n_frames)

def test_frame_read_xtc(self):
frame = Frame('test/data/water.gro', 'test/data/water.xtc')
Expand Down

0 comments on commit d02cd34

Please sign in to comment.