本文整理汇总了Python中graphite.render.datalib.TimeSeries.xFilesFactor方法的典型用法代码示例。如果您正苦于以下问题:Python TimeSeries.xFilesFactor方法的具体用法?Python TimeSeries.xFilesFactor怎么用?Python TimeSeries.xFilesFactor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graphite.render.datalib.TimeSeries
的用法示例。
在下文中一共展示了TimeSeries.xFilesFactor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_TimeSeries_iterate_valuesPerPoint_2_none_values
# 需要导入模块: from graphite.render.datalib import TimeSeries [as 别名]
# 或者: from graphite.render.datalib.TimeSeries import xFilesFactor [as 别名]
def test_TimeSeries_iterate_valuesPerPoint_2_none_values(self):
values = [None, None, None, None, None]
series = TimeSeries("collectd.test-db.load.value", 0, len(values)/2, 1, values)
self.assertEqual(series.valuesPerPoint, 1)
series.consolidate(2)
self.assertEqual(series.valuesPerPoint, 2)
expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, [None, None, None])
values = [None, None, None, None, None, 1, 2, 3, 4]
series = TimeSeries("collectd.test-db.load.value", 0, len(values)/2, 1, values, xFilesFactor=0.1)
self.assertEqual(series.valuesPerPoint, 1)
self.assertEqual(series.xFilesFactor, 0.1)
series.consolidate(2)
self.assertEqual(series.valuesPerPoint, 2)
expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, [None, None, 1, 2.5, 4])
self.assertEqual(list(series), list(expected))
series.xFilesFactor = 0.5
self.assertEqual(list(series), list(expected))
series.xFilesFactor = 0.500001
expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, [None, None, None, 2.5, None])
self.assertEqual(list(series), list(expected))
series.xFilesFactor = 1
self.assertEqual(list(series), list(expected))
示例2: test_TimeSeries_iterate_valuesPerPoint_2_sum
# 需要导入模块: from graphite.render.datalib import TimeSeries [as 别名]
# 或者: from graphite.render.datalib.TimeSeries import xFilesFactor [as 别名]
def test_TimeSeries_iterate_valuesPerPoint_2_sum(self):
values = list(range(0,100))
series = TimeSeries("collectd.test-db.load.value", 0, 5, 1, values, consolidate='sum')
self.assertEqual(series.valuesPerPoint, 1)
series.consolidate(2)
self.assertEqual(series.valuesPerPoint, 2)
expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, list(range(1,200,4)))
self.assertEqual(list(series), list(expected))
series.consolidate(3)
self.assertEqual(series.valuesPerPoint, 3)
expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, list(range(3,300,9)) + [99])
self.assertEqual(list(series), list(expected))
series.xFilesFactor = 0.4
expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, list(range(3,300,9)) + [None])
self.assertEqual(list(series), list(expected))