tspy.stream_multi_time_series module¶
main entry-point for creation of StreamMultiTimeSeries
-
tspy.stream_multi_time_series.
queue
(key_observation_queue, granularity=None, start_time=None)¶ create a stream-multi-time-series from a queue of observations
- Parameters
- key_observation_queuequeue.Queue
queue of tuples of type (key,
Observation
)- granularitydatetime.timedelta, optional
the granularity for use in time-series
TRS
(default is None if no start_time, otherwise 1ms)- start_timedatetime, optional
the starting date-time of the time-series (default is None if no granularity, otherwise 1970-01-01 UTC)
- Returns
StreamMultiTimeSeries
a new stream-multi-time-series
Examples
create a simple queue
>>> import queue >>> observation_queue = queue.Queue()
create a simple stream-multi-time-series from a queue
>>> import tspy >>> sts = tspy.stream_multi_time_series.queue(observation_queue)
-
tspy.stream_multi_time_series.
reader
(stream_reader, granularity=None, start_time=None)¶ create a stream-multi-time-series from a stream-multi-time-series-reader
- Parameters
- stream_time_series_reader
PullStreamMultiTimeSeriesReader
orPushStreamMultiTimeSeriesReader
a user-implemented stream-multi-time-series-reader
- granularitydatetime.timedelta, optional
the granularity for use in time-series
TRS
(default is None if no start_time, otherwise 1ms)- start_timedatetime, optional
the starting date-time of the time-series (default is None if no granularity, otherwise 1970-01-01 UTC)
- stream_time_series_reader
- Returns
StreamMultiTimeSeries
a new stream-multi-time-series
-
tspy.stream_multi_time_series.
text_file
(path, map_func, granularity=None, start_time=None)¶ create a stream-multi-time-series from a text file
- Parameters
- pathstring
path to file
- map_funcfunc
function from a single line of a file to a tuple of (key,
Observation
) or None- granularitydatetime.timedelta, optional
the granularity for use in time-series
TRS
(default is None if no start_time, otherwise 1ms)- start_timedatetime, optional
the starting date-time of the time-series (default is None if no granularity, otherwise 1970-01-01 UTC)
- Returns
StreamMultiTimeSeries
a new stream-multi-time-series