rangechange.py 文件源码

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

项目:supremm 作者: ubccr 项目源码 文件源码
def normalise_data(self, timestamp, data):
        """ Convert the data if needed """

        if self._passthrough:
            return

        i = 0
        for datum in data:

            if self.needsfixup[i] is None:
                i += 1
                continue

            if len(datum) == 0:
                # Ignore entries with no data - this typically occurs when the
                # plugin requests multiple metrics and the metrics do not all appear
                # at every timestep
                i += 1
                continue

            if self.accumulator[i] is None:
                self.accumulator[i] = numpy.array(datum)
                self.last[i] = numpy.array(datum)
            else:
                self.accumulator[i] += (datum - self.last[i]) % numpy.uint64(1L << self.needsfixup[i]['range'])
                numpy.copyto(self.last[i], datum)
                numpy.copyto(datum, self.accumulator[i])

            i += 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号