Skip to content

Commit

Permalink
Merge pull request #908 from MDAnalysis/issue-902-rewinds
Browse files Browse the repository at this point in the history
unify rewind behavior of Readers, fix #902
  • Loading branch information
kain88-de authored Jul 22, 2016
2 parents 9a632a9 + af677cd commit 3f934d7
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 24 deletions.
6 changes: 0 additions & 6 deletions package/MDAnalysis/coordinates/GMS.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,6 @@ def _read_next_timestep(self, ts=None):

raise EOFError

def rewind(self):
"""reposition on first frame"""
self._reopen()
# the next method is inherited from the Reader Class and calls _read_next_timestep
self.next()

def _reopen(self):
self.close()
self.open_trajectory()
Expand Down
3 changes: 0 additions & 3 deletions package/MDAnalysis/coordinates/PDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,6 @@ def Writer(self, filename, **kwargs):
kwargs.setdefault('multiframe', self.n_frames > 1)
return PDBWriter(filename, **kwargs)

def rewind(self):
self._read_frame(0)

def _reopen(self):
# Pretend the current TS is -1 (in 0 based) so "next" is the
# 0th frame
Expand Down
5 changes: 0 additions & 5 deletions package/MDAnalysis/coordinates/TRJ.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,6 @@ def close(self):
self.trjfile.close()
self.trjfile = None

def rewind(self):
"""Reposition at the beginning of the trajectory"""
self._reopen()
next(self)


class NCDFReader(base.Reader):
"""Reader for `AMBER NETCDF format`_ (version 1.0).
Expand Down
4 changes: 0 additions & 4 deletions package/MDAnalysis/coordinates/XDR.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ def _read_offsets(self, store=False):
except Exception as e:
warnings.warn("Couldn't save offsets because: {}".format(e))

def rewind(self):
"""Read the first frame again"""
self._read_frame(0)

@property
def n_frames(self):
"""number of frames in trajectory"""
Expand Down
6 changes: 0 additions & 6 deletions package/MDAnalysis/coordinates/XYZ.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,6 @@ def _read_next_timestep(self, ts=None):
except (ValueError, IndexError) as err:
raise EOFError(err)

def rewind(self):
"""reposition on first frame"""
self._reopen()
# the next method calls _read_next_timestep
self.next()

def _reopen(self):
self.close()
self.open_trajectory()
Expand Down

0 comments on commit 3f934d7

Please sign in to comment.