LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
|
Virtual trajectory composed of multiple Trajectory objects This class can combine multiple loos.pyloos.Trajectory objects into one big "virtual" trajectory. More...
Public Member Functions | |
__init__ (self, *trajs, **kwargs) | |
append (self, *traj) | |
stride (self, n) | |
skip (self, n) | |
allStride (self, n) | |
allSkip (self, n) | |
setSubset (self, selection) | |
frame (self) | |
index (self) | |
frameLocation (self, i) | |
Returns information about the ith frame in the VirtualTrajectory The tuple returned has the following format: | |
frameBoundaries (self) | |
__len__ (self) | |
__getitem__ (self, i) | |
__iter__ (self) | |
reset (self) | |
__next__ (self) | |
Protected Member Functions | |
_initFrameList (self) | |
_getSlice (self, s) | |
Protected Attributes | |
_skip | |
_stride | |
_nframes | |
_iterator | |
_trajectories | |
_index | |
_framelist | |
_trajlist | |
_stale | |
Virtual trajectory composed of multiple Trajectory objects This class can combine multiple loos.pyloos.Trajectory objects into one big "virtual" trajectory.
Any skips or strides set in the contained trajectories will be honored. In addition, a skip and a stride for the whole meta-trajectory are available. These can be set via keyword arguments when creating a VirtualTrajectory,
Keyword | Description |
---|---|
skip=n | Skip the first n-frames of the virtual trajectory |
stride=n | Step through the virtual trajectory n frames at a time |
iterator=i | Use the python iterator object i to select frames from the virtual trajectory |
There is no requirement that the subsets used for all trajectories must be the same. Ideally, the frame (subset) that is returned should be compatible (e.g. same atoms in the same order), but the models used for each trajectory (and the corresponding subset selection) can vary. Why would you want to do this? Imagine combining three different GPCRs where the subsets are the common trans-membrane C-alphas. This makes processing all of the ensembles together easier.
Since each contained trajectory can have a different set of shared atoms it updates, care must be taken when pre-selecting atoms.
Examples:
Adding another trajectory in with its own stride and skip
Same as above but stride through the combined trajectory
Combines multiple loos.pyloos.Trajectory objects into one big virtual trajectory >>> vtraj = loos.pyloos.VirtualTrajectory(traj1, traj2, traj3) Keyword arguments: skip = # of frames to skip at start of composite traj stride = # of frames to step through in the composite traj iterator = Python iterator used to pick frames from the composite traj See the Doxygen documentation for more details.
loos.pyloos.trajectories.VirtualTrajectory.__getitem__ | ( | self, | |
i ) |
Return the ith frame in the composite trajectory. Supports Python slicing. Negative indices are relative to the end of the composite trajectory.
Reimplemented in loos.pyloos.trajectories.AlignedVirtualTrajectory.
loos.pyloos.trajectories.VirtualTrajectory.__len__ | ( | self | ) |
Total number of frames
loos.pyloos.trajectories.VirtualTrajectory.allSkip | ( | self, | |
n ) |
Sets the skip of all contained trajectories
loos.pyloos.trajectories.VirtualTrajectory.allStride | ( | self, | |
n ) |
Sets the stride of all contained trajectories
loos.pyloos.trajectories.VirtualTrajectory.append | ( | self, | |
* | traj ) |
Add a trajectory to the end of the virtual trajectory. Resets the iterator state
Reimplemented in loos.pyloos.trajectories.AlignedVirtualTrajectory.
loos.pyloos.trajectories.VirtualTrajectory.frame | ( | self | ) |
Return the current frame/model. If the iterator is past the end of the trajectory list, return the last valid frame.
loos.pyloos.trajectories.VirtualTrajectory.frameBoundaries | ( | self | ) |
Return a list containing the index of the first frame associated with each traj >>> b = vt.frameBoundaries() len(b) will be the number of trajectories in vt + 1. -> can slice the data from the nth traj from an array with b[n]:b[n+1]
loos.pyloos.trajectories.VirtualTrajectory.frameLocation | ( | self, | |
i ) |
Returns information about the ith frame in the VirtualTrajectory The tuple returned has the following format:
Consider the following,
frame-index
is the index into the corresponding trajectory object. For example, frameLocation(50) would have a frame-index of 0 because vt[50] would return the first frame from t2.traj-index
is the index into the list of managed trajectories for the frame. In the above example, the traj-index will be 1.trajectory
is the actual loos.pyloos.Trajectory object that contains the frame.real-frame-within-trajectory
is the same as calling trajectory.frameNumber(frame-index).Instead of the t1
above, imagine it was setup this way,
Now, vt.frameLocation(0)
will return (0, 0, t1, 25)
, and vt.frameLocation(25)
will return (25, 1, t2, 0)
Python documentation:
Return info about where a frame comes from. >>> (frame-index, traj-index, trajectory, real-frame-within-trajectory) = vtraj.frameLocation(i)
loos.pyloos.trajectories.VirtualTrajectory.index | ( | self | ) |
Return index into composite trajectory for current frame
loos.pyloos.trajectories.VirtualTrajectory.setSubset | ( | self, | |
selection ) |
Set the subset selection for all managed trajectories
loos.pyloos.trajectories.VirtualTrajectory.skip | ( | self, | |
n ) |
Set the skip of the combined trajectory
loos.pyloos.trajectories.VirtualTrajectory.stride | ( | self, | |
n ) |
Set the stride of the combined trajectory