Removed delayed reader.
This commit is contained in:
parent
ef125c2a89
commit
578d3638a4
@ -39,7 +39,7 @@ class WrongTopologyError(Exception):
|
|||||||
def open_with_mdanalysis(
|
def open_with_mdanalysis(
|
||||||
topology, trajectory, cached=False, index_file=None, charges=None, masses=None
|
topology, trajectory, cached=False, index_file=None, charges=None, masses=None
|
||||||
):
|
):
|
||||||
"""Open a the topology and trajectory with mdanalysis."""
|
"""Open the topology and trajectory with mdanalysis."""
|
||||||
uni = mdanalysis.Universe(topology, trajectory, convert_units=False)
|
uni = mdanalysis.Universe(topology, trajectory, convert_units=False)
|
||||||
if cached is not False:
|
if cached is not False:
|
||||||
if cached is True:
|
if cached is True:
|
||||||
@ -373,28 +373,3 @@ class CachedReader(BaseReader):
|
|||||||
|
|
||||||
def __getitem__(self, item):
|
def __getitem__(self, item):
|
||||||
return self._get_item(item)
|
return self._get_item(item)
|
||||||
|
|
||||||
|
|
||||||
class DelayedReader(BaseReader):
|
|
||||||
@property
|
|
||||||
def filename(self):
|
|
||||||
if self.rd is not None:
|
|
||||||
return self.rd.filename
|
|
||||||
else:
|
|
||||||
return self._filename
|
|
||||||
|
|
||||||
def __init__(self, filename, reindex=False, ignore_index_timestamps=False):
|
|
||||||
super().__init__(filename, reindex=False, ignore_index_timestamps=False)
|
|
||||||
self.natoms = len(self.rd[0].coordinates)
|
|
||||||
self.cache = self.rd.cache
|
|
||||||
self._filename = self.rd.filename
|
|
||||||
self.rd = None
|
|
||||||
|
|
||||||
def __len__(self):
|
|
||||||
return len(self.cache)
|
|
||||||
|
|
||||||
def _get_item(self, frame):
|
|
||||||
return read_xtcframe_delayed(self.filename, self.cache[frame], self.natoms)
|
|
||||||
|
|
||||||
def __getitem__(self, frame):
|
|
||||||
return self._get_item(frame)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user