跳转至

foundryts.functions.points

foundryts.functions.points(*list_of_points, name='point-set')

Creates a set of user-defined points that act as a time series and are not written by a sync.

This is useful for creating a reference time series for operations like interpolation or DSL formulas. This is also a helpful utility for getting familiar with FoundryTS without setting up a test time series.

  • Parameters:
  • *list_of_points (Tuple *[*TimestampType , float ] | Tuple *[*TimestampType , str ]) – Tuples of timestamp and the point value at that timestamp as a non-keyword position arg.
  • name (str , optional) – Alias for the point set which will be used as the time series ID for all downstream operations.
  • Returns: A point-set which acts like a time series for all downstream operations.
  • Return type: FunctionNode

Dataframe schema

Column name Type Description
timestamp pandas.Timestamp Timestamp of the point
value Union[float, str] Value of the point

:::callout{theme="success" title="See Also"} series() :::

:::callout{theme="warning" title="Note"} All point values should have the same type. :::

Examples

>>> numeric_series = F.points(
...     (0, 0.0), (100, 100.0), (140, 140.0), (200, 200.0), name="numeric"
... )
>>> numeric_series.to_pandas()
                      timestamp  value
0 1970-01-01 00:00:00.000000000    0.0
1 1970-01-01 00:00:00.000000100  100.0
2 1970-01-01 00:00:00.000000140  140.0
3 1970-01-01 00:00:00.000000200  200.0
>>> enum_series = F.points(
...     (100, "ON"),
...     (120, "ON"),
...     (130, "OFF"),
...     (150, "ON"),
...     (160, "OFF"),
...     name="enum",
... )
>>> enum_series.to_pandas()
                      timestamp value
0 1970-01-01 00:00:00.000000100    ON
1 1970-01-01 00:00:00.000000120    ON
2 1970-01-01 00:00:00.000000130   OFF
3 1970-01-01 00:00:00.000000150    ON
4 1970-01-01 00:00:00.000000160   OFF

中文翻译

foundryts.functions.points

foundryts.functions.points(*list_of_points, name='point-set')

创建一组用户定义的数据点(points),这些数据点作为时间序列(time series)使用,且不由同步操作写入。

这对于创建用于插值或 DSL 公式等操作的参考时间序列非常有用。 这也是在不设置测试时间序列的情况下熟悉 FoundryTS 的一个实用工具。

  • 参数:
  • *list_of_points (元组 *[*TimestampType , float ] | 元组 *[*TimestampType , str ]) – 时间戳及该时间戳对应的数据点值组成的元组,作为非关键字位置参数传入。
  • name (str , 可选) – 数据点集的别名,将用作所有下游操作的时间序列 ID。
  • 返回: 一个数据点集,对所有下游操作而言其行为与时间序列相同。
  • 返回类型: FunctionNode

数据框模式(Dataframe schema)

列名 类型 描述
timestamp pandas.Timestamp 数据点的时间戳
value Union[float, str] 数据点的值

:::callout{theme="success" title="另请参阅"} series() :::

:::callout{theme="warning" title="注意"} 所有数据点的值应具有相同的类型。 :::

示例

>>> numeric_series = F.points(
...     (0, 0.0), (100, 100.0), (140, 140.0), (200, 200.0), name="numeric"
... )
>>> numeric_series.to_pandas()
                      timestamp  value
0 1970-01-01 00:00:00.000000000    0.0
1 1970-01-01 00:00:00.000000100  100.0
2 1970-01-01 00:00:00.000000140  140.0
3 1970-01-01 00:00:00.000000200  200.0
>>> enum_series = F.points(
...     (100, "ON"),
...     (120, "ON"),
...     (130, "OFF"),
...     (150, "ON"),
...     (160, "OFF"),
...     name="enum",
... )
>>> enum_series.to_pandas()
                      timestamp value
0 1970-01-01 00:00:00.000000100    ON
1 1970-01-01 00:00:00.000000120    ON
2 1970-01-01 00:00:00.000000130   OFF
3 1970-01-01 00:00:00.000000150    ON
4 1970-01-01 00:00:00.000000160   OFF