stats.py 文件源码

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

项目:intel-manager-for-lustre 作者: intel-hpdd 项目源码 文件源码
def select(self, id, start, stop, rate=False, maxlen=float('inf'), fixed=0):
        """Return points for a series within inclusive interval of most granular samples.
        Optionally derive the rate of change of points.
        Optionally limit number of points by increasing sample resolution.
        Optionally return fixed intervals with padding and arbitrary resolution.
        """
        minstep = total_seconds(stop - start) / maxlen
        for index, model in enumerate(self):
            if start >= model.start(id) and model.step >= minstep:
                break
        points = model.select(id, dt__gte=start, dt__lt=stop)
        points = list(points if index else model.reduce(points))
        if rate:
            points = map(operator.sub, points[1:], points[:-1])
        if fixed:
            step = (stop - start) / fixed
            intervals = [Point(start + step * index, 0.0, 0) for index in range(fixed)]
            for point in points:
                intervals[int(total_seconds(point.dt - start) / total_seconds(step))] += point
            points = intervals
        return points
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号