def trajectory_lengths(self, stride=1, skip=0):
r""" Returns the length of each trajectory.
Parameters
----------
stride : int
return value is the number of frames of the trajectories when
running through them with a step size of `stride`.
skip : int
skip parameter
Returns
-------
array(dtype=int) : containing length of each trajectory
"""
n = self.number_of_trajectories()
if isinstance(stride, np.ndarray):
return np.fromiter((self.trajectory_length(itraj, stride)
for itraj in range(n)),
dtype=int, count=n)
else:
return np.fromiter(((l - skip - 1) // stride + 1 for l in self._lengths),
dtype=int, count=n)
评论列表
文章目录