datasource.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:coordinates 作者: markovmodel 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号