tspy.stream_time_series module

main entry-point for creation of StreamTimeSeries

tspy.stream_time_series.queue(observation_queue, granularity=None, start_time=None)

create a stream-time-series from a queue of observations

Parameters
observation_queuequeue.Queue

queue of 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
StreamTimeSeries

a new stream-time-series

Examples

create a simple queue

>>> import queue
>>> observation_queue = queue.Queue()

create a simple stream-time-series from a queue

>>> import tspy
>>> sts = tspy.stream_time_series.queue(observation_queue)
tspy.stream_time_series.reader(stream_time_series_reader, granularity=None, start_time=None)

create a stream-time-series from a stream-time-series-reader

Parameters
stream_time_series_readerPullStreamTimeSeriesReader or PushStreamTimeSeriesReader

a user-implemented stream-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)

Returns
StreamTimeSeries

a new stream-time-series

tspy.stream_time_series.text_file(path, map_func, granularity=None, start_time=None)

create a stream-time-series from a text file

Parameters
pathstring

path to file

map_funcfunc

function from a single line of a file to an 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
StreamTimeSeries

a new stream-time-series