Package schrodinger :: Package application :: Package desmond :: Package packages :: Module traj :: Class Source
[hide private]
[frames] | no frames]

Class Source

object --+
         |
        Source
Known Subclasses:

Instance Methods [hide private]
 
__init__(self, reader, name='sometraj')
C{reader} specifies where to retrieve a trajectory frame when it's needed but currently NOT in the memory (in other words, it's not cached by this source).
 
__str__(self)
str(x)
 
_retrieve_frame(self, index)
 
retrieve_frame(self, index)
Retrieves the index-th frame from the source.
 
clear_cache(self)
 
used_space(self)
 
nframes(self)
Returns the total number of frames in this trajectory source.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]
  Pool = {}
Properties [hide private]
  name
  id

Inherited from object: __class__

Method Details [hide private]

__init__(self, reader, name='sometraj')
(Constructor)

 

C{reader} specifies where to retrieve a trajectory frame when it's
needed but currently NOT in the memory (in other words, it's not cached
by this source). A reader could potentially be a file reader, a string
reader, a socket reader, a database dealer, etc., as long as it
satisfies the duck-typing requirements (see below). And interestingly,
the probably simplest reader is another ``trajectory'' (i.e., a list of
L{Frame} objects) in memory.

Duck typing for ``readers''.
- Random access
  C{reader[index]} should return the C{index}-th frame. Here C{index}
  is zero-based, of Python style (i.e., -1 means the last frame, etc.).
- C{len} support
  C{len(reader)} should return the total number of frames.

If a reader doesn't support the duck typing as specified above, a
subclass can be created to bypass the typing issue. See L{DtrSource}
below as an example.

Overrides: object.__init__

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)

retrieve_frame(self, index)

 

Retrieves the index-th frame from the source. index is zero-based. This method assumes the source allows random access to frames.

@raise IndexError, if index is out of range.


Property Details [hide private]

name

Get Method:
unreachable.name(self)

id

Get Method:
unreachable.id(self)