tspy.data_structures.observations.TSBuilder module

class tspy.data_structures.observations.TSBuilder.TSBuilder(tsc, j_ts_builder)

Bases: object

a mutable builder for creating an ObservationCollection

Methods

add(observation)

adds an observation to the builder

add_all(observations)

add all observations in an observation-collection to this builder

clear()

clear the observations in this builder

is_empty()

checks if there is any observation

result([granularity, start_time])

get an observation-collection from the observations in this builder

add(observation)

adds an observation to the builder

Parameters
observationObservation

the observation to add

Returns
TSBuilder

this TSBuilder

add_all(observations)

add all observations in an observation-collection to this builder

Parameters
observationsObservationCollection

the observations to add

Returns
TSBuilder

this TSBuilder

clear()

clear the observations in this builder

Returns
TSBuilder

this TSBuilder

is_empty()

checks if there is any observation

Returns
bool

True if no observations exist in this builder, otherwise false

result(granularity=None, start_time=None)

get an observation-collection from the observations in this builder

Parameters
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
ObservationCollection

a new observation-collection