LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
|
Python-based wrapper for LOOS Trajectories This class turns a loos Trajectory into something more python-like. More...
Public Member Functions | |
__init__ (self, fname, model, **kwargs) | |
Instantiate a Trajectory object. | |
stride (self, n) | |
skip (self, n) | |
fileName (self) | |
setSubset (self, selection) | |
__iter__ (self) | |
__len__ (self) | |
reset (self) | |
__next__ (self) | |
nextFrame (self) | |
trajectory (self) | |
model (self) | |
readFrame (self, i) | |
frame (self) | |
realIndex (self) | |
index (self) | |
frameNumber (self, i) | |
__getitem__ (self, i) | |
Protected Member Functions | |
_initFrameList (self) | |
_getSlice (self, s) | |
Protected Attributes | |
_skip | |
_stride | |
_iterator | |
_subset | |
_model | |
_fname | |
_traj | |
_stale | |
_framelist | |
_index | |
Python-based wrapper for LOOS Trajectories This class turns a loos Trajectory into something more python-like.
Behind the scenes, it wraps a loos::AtomicGroup and a loos::Trajectory. The behavior of the trajectory can be controlled through passed keywords,
Keyword | Description |
---|---|
skip=n | Skip the first n-frames of the wrapped trajectory |
stride=n | Step through the wrapped trajectory n-frames at a time |
iterator=i | Use the python iterator object i to select frames from the wrapped trajectory |
subset=s | Use 's' to select a subset of the model to use for each frame |
Remember that all atoms are shared. If you want to decouple the trajectory from other groups, pass it a copy of the model.
examples:
The same thing but skipping the first 50 frames and taking every other frame
Only use frames 19-39 (i.e. the 20th through 40th frames)
An alternative way of only iterating over a subset...
Decouple the model stored in the trajectory,
Python-based wrapper for LOOS Trajectories >>> model = loos.createSystem('foo.pdb') >>> traj = loos.pyloos.Trajectory('foo.dcd', model) keyword args: skip = # of frames to skip from start stride = # of frames to step through iterator = Python iterator used to pick frame (overrides skip and stride) subset = Selection used to pick subset for each frame See the Doxygen documentation for more details.
loos.pyloos.trajectories.Trajectory.__getitem__ | ( | self, | |
i ) |
Handle array indexing and slicing. Negative indices are relative to the end of the trajectory
loos.pyloos.trajectories.Trajectory.__len__ | ( | self | ) |
Number of frames in the trajectory
loos.pyloos.trajectories.Trajectory.fileName | ( | self | ) |
Return the filename that this Trajectory represents
loos.pyloos.trajectories.Trajectory.frame | ( | self | ) |
Return the current frame (subset)
loos.pyloos.trajectories.Trajectory.frameNumber | ( | self, | |
i ) |
Returns the real frame numbers corresponding to the passed indices. Can accept either an integer or a list of integers. For example: >>> t = loos.pyloos.Trajectory('foo.dcd', model, skip=50) >>> t.frameNumber(0) 50 >>> t.frameNumber(range(0,2)) [50, 51]
loos.pyloos.trajectories.Trajectory.index | ( | self | ) |
The state of the iterator
loos.pyloos.trajectories.Trajectory.model | ( | self | ) |
Return the current model
loos.pyloos.trajectories.Trajectory.nextFrame | ( | self | ) |
Return the next frame in the trajectory, or False. Intended for use in a while loop: while traj.nextFrame(): do_something
loos.pyloos.trajectories.Trajectory.readFrame | ( | self, | |
i ) |
Read a frame and update the model
loos.pyloos.trajectories.Trajectory.realIndex | ( | self | ) |
The 'real' frame in the trajectory for this index
loos.pyloos.trajectories.Trajectory.reset | ( | self | ) |
Reset the iterator
loos.pyloos.trajectories.Trajectory.setSubset | ( | self, | |
selection ) |
Set the subset used when iterating over a trajectory. The selection is a LOOS selection string.
loos.pyloos.trajectories.Trajectory.skip | ( | self, | |
n ) |
Skip this number of frames at the start of the trajectory
loos.pyloos.trajectories.Trajectory.stride | ( | self, | |
n ) |
Step through the trajectory by this number of frames
loos.pyloos.trajectories.Trajectory.trajectory | ( | self | ) |
Access the wrapped loos.Trajectory