當前位置: 首頁>>代碼示例>>Python>>正文


Python datalib.TimeSeries類代碼示例

本文整理匯總了Python中graphite_api.render.datalib.TimeSeries的典型用法代碼示例。如果您正苦於以下問題:Python TimeSeries類的具體用法?Python TimeSeries怎麽用?Python TimeSeries使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TimeSeries類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_holt_winters

    def test_holt_winters(self):
        timespan = 3600 * 24 * 8  # 8 days
        stop = int(time.time())
        step = 100
        series = TimeSeries('foo.bar',
                            stop - timespan,
                            stop,
                            step,
                            [x**1.5 for x in range(0, timespan, step)])
        series[10] = None
        series.pathExpression = 'foo.bar'
        self.write_series(series, [(100, timespan)])

        ctx = {
            'startTime': parseATTime('-1d'),
        }
        analysis = functions.holtWintersForecast(ctx, [series])
        self.assertEqual(len(analysis), 1)

        analysis = functions.holtWintersConfidenceBands(ctx, [series])
        self.assertEqual(len(analysis), 2)

        analysis = functions.holtWintersConfidenceArea(ctx, [series])
        self.assertEqual(len(analysis), 2)

        analysis = functions.holtWintersAberration(ctx, [series])
        self.assertEqual(len(analysis), 1)
開發者ID:robochat,項目名稱:graphite-api,代碼行數:27,代碼來源:test_functions.py

示例2: test_TimeSeries_consolidate

 def test_TimeSeries_consolidate(self):
     values = range(0, 100)
     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)
開發者ID:VinnyQ,項目名稱:graphite-api,代碼行數:7,代碼來源:test_render_datalib.py

示例3: test_TimeSeries_iterate_valuesPerPoint_2_invalid

 def test_TimeSeries_iterate_valuesPerPoint_2_invalid(self):
     values = range(0, 100)
     series = TimeSeries("collectd.test-db.load.value",
                         0, 5, 1, values, consolidate='bogus')
     self.assertEqual(series.valuesPerPoint, 1)
     series.consolidate(2)
     self.assertEqual(series.valuesPerPoint, 2)
     with self.assertRaises(Exception):
         list(series)
開發者ID:VinnyQ,項目名稱:graphite-api,代碼行數:9,代碼來源:test_render_datalib.py

示例4: test_TimeSeries_equal_list_color_bad2

 def test_TimeSeries_equal_list_color_bad2(self):
     values = range(0, 100)
     series1 = TimeSeries("collectd.test-db.load.value",
                          0, len(values), 1, values)
     series2 = TimeSeries("collectd.test-db.load.value",
                          0, len(values), 1, values)
     series1.color = 'white'
     with self.assertRaises(AssertionError):
         self.assertEqual(series1, series2)
開發者ID:brutasse,項目名稱:graphite-api,代碼行數:9,代碼來源:test_render_datalib.py

示例5: test_TimeSeries_equal_list_color

 def test_TimeSeries_equal_list_color(self):
     values = range(0, 100)
     series1 = TimeSeries("collectd.test-db.load.value",
                          0, len(values), 1, values)
     series1.color = 'white'
     series2 = TimeSeries("collectd.test-db.load.value",
                          0, len(values), 1, values)
     series2.color = 'white'
     self.assertEqual(series1, series2)
開發者ID:brutasse,項目名稱:graphite-api,代碼行數:9,代碼來源:test_render_datalib.py

示例6: test_TimeSeries_iterate_valuesPerPoint_2_min

 def test_TimeSeries_iterate_valuesPerPoint_2_min(self):
     values = range(0, 100)
     series = TimeSeries("collectd.test-db.load.value",
                         0, 5, 1, values, consolidate='min')
     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(0, 100, 2)) + [None])
     self.assertEqual(list(series), list(expected))
開發者ID:VinnyQ,項目名稱:graphite-api,代碼行數:10,代碼來源:test_render_datalib.py

示例7: test_TimeSeries_iterate_valuesPerPoint_2_none_values

 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])
     self.assertEqual(list(series), list(expected))
開發者ID:VinnyQ,項目名稱:graphite-api,代碼行數:10,代碼來源:test_render_datalib.py

示例8: _generate_series_list

    def _generate_series_list(self):
        seriesList = []
        config = [range(101), range(101), [1] + [None] * 100]

        for i, c in enumerate(config):
            name = "collectd.test-db{0}.load.value".format(i + 1)
            series = TimeSeries(name, 0, 101, 1, c)
            series.pathExpression = name
            seriesList.append(series)
        return seriesList
開發者ID:icecrime,項目名稱:graphite-api,代碼行數:10,代碼來源:test_functions.py

示例9: test_TimeSeries_iterate_valuesPerPoint_2_avg

 def test_TimeSeries_iterate_valuesPerPoint_2_avg(self):
     values = range(0, 100)
     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,
                           list(map(lambda x: x+0.5, range(0, 100, 2))) +
                           [None])
     self.assertEqual(list(series), list(expected))
開發者ID:VinnyQ,項目名稱:graphite-api,代碼行數:11,代碼來源:test_render_datalib.py

示例10: _generate_series_list

    def _generate_series_list(self, config=(range(101), range(2, 103), [1] * 2 + [None] * 90 + [1] * 2 + [None] * 7)):
        seriesList = []

        now = int(time.time())

        for i, c in enumerate(config):
            name = "collectd.test-db{0}.load.value".format(i + 1)
            series = TimeSeries(name, now - 101, now, 1, c)
            series.pathExpression = name
            seriesList.append(series)
        return seriesList
開發者ID:heliodor,項目名稱:graphite-api,代碼行數:11,代碼來源:test_functions.py

示例11: test_time_stack

    def test_time_stack(self):
        timespan = 3600 * 24 * 8  # 8 days
        stop = int(time.time())
        step = 100
        series = TimeSeries("foo.bar", stop - timespan, stop, step, [x ** 1.5 for x in range(0, timespan, step)])
        series[10] = None
        series.pathExpression = "foo.bar"
        self.write_series(series, [(100, timespan)])

        ctx = {"startTime": parseATTime("-1d"), "endTime": parseATTime("now")}
        stack = functions.timeStack(ctx, [series], "1d", 0, 7)
        self.assertEqual(len(stack), 7)

        stack = functions.timeStack(ctx, [series], "-1d", 0, 7)
        self.assertEqual(len(stack), 7)
開發者ID:heliodor,項目名稱:graphite-api,代碼行數:15,代碼來源:test_functions.py

示例12: test_time_stack

    def test_time_stack(self):
        timespan = 3600 * 24 * 8  # 8 days
        stop = int(time.time())
        step = 100
        series = TimeSeries('foo.bar',
                            stop - timespan,
                            stop,
                            step,
                            [x**1.5 for x in range(0, timespan, step)])
        series[10] = None
        series.pathExpression = 'foo.bar'
        self.write_series(series, [(100, timespan)])

        ctx = {'startTime': parseATTime('-1d'),
               'endTime': parseATTime('now')}
        stack = functions.timeStack(ctx, [series], '1d', 0, 7)
        self.assertEqual(len(stack), 7)

        stack = functions.timeStack(ctx, [series], '-1d', 0, 7)
        self.assertEqual(len(stack), 7)
開發者ID:robochat,項目名稱:graphite-api,代碼行數:20,代碼來源:test_functions.py

示例13: test_null_zero_sum

    def test_null_zero_sum(self):
        s = TimeSeries("s", 0, 1, 1, [None])
        s.pathExpression = 's'
        [series] = functions.sumSeries({}, [s])
        self.assertEqual(list(series), [None])

        s = TimeSeries("s", 0, 1, 1, [None, 1])
        s.pathExpression = 's'
        t = TimeSeries("s", 0, 1, 1, [None, None])
        t.pathExpression = 't'
        [series] = functions.sumSeries({}, [s, t])
        self.assertEqual(list(series), [None, 1])
開發者ID:robochat,項目名稱:graphite-api,代碼行數:12,代碼來源:test_functions.py


注:本文中的graphite_api.render.datalib.TimeSeries類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。