stream_graph.ABC.TimeSet

class stream_graph.ABC.TimeSet[source][source]

TimeSet Object API Specification.

A TimeSet can be abstractly be defined as a set of intervals (ts, tf).

Attributes
discrete

Designate if the TimeSet is on discrete Time.

instantaneous

Defines if the Time Set is instantaneous.

size

Returns the size of the TimeSet.

Methods

copy(self[, deep])

Returns a deep or shallow copy of the current TimeSet.

discretize(self[, bins, bin_size])

Returns a discrete version of the current TimeSet.

abstract __and__(self, ts)[source][source]

Implementation of the & operator for a TimeSet object.

Parameters
nsTimeSet
Returns
outTimeSet

Returns the intersection of intervals.

abstract __bool__(self)[source][source]

Implementation of the bool casting of a TimeSet object.

Parameters
None.
Returns
outBool

Return True if an object is both initialized and contains information.

__class__[source]

alias of abc.ABCMeta

abstract __contains__(self, t)[source][source]

Implementation of the in operator for TimeSet.

Parameters
ltuple or Real

If tuple: (ts, tf). If Real t.

Returns
containsBool

Returns true if time t the (ts, tf) is contained inside the TimeSet.

__delattr__(self, name, /)

Implement delattr(self, name).

__dir__()

default dir() implementation

__eq__(self, value, /)

Return self==value.

__format__()

default object formatter

__ge__(self, value, /)

Return self>=value.

__getattribute__(self, name, /)

Return getattr(self, name).

__gt__(self, value, /)

Return self>value.

__hash__(self, /)

Return hash(self).

__init__(self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

abstract __iter__(self)[source][source]

Implementation of the iter function for a TimeSet object.

Parameters
None
Returns
outIterator of tuple

Each tuple is of the form (ts, tf).

__le__(self, value, /)

Return self<=value.

__lt__(self, value, /)

Return self<value.

__ne__(self, value, /)

Return self!=value.

__new__(*args, **kwargs)

Create and return a new object. See help(type) for accurate signature.

abstract __or__(self, ts)[source][source]

Implementation of the | operator for a TimeSet object.

Parameters
nsTimeSet
Returns
outTimeSet

Returns the union of intervals.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__(self, /)

Return repr(self).

__setattr__(self, name, value, /)

Implement setattr(self, name, value).

__sizeof__()

size of object in memory, in bytes

abstract __sub__(self, ts)[source][source]

Implementation of the - operator for a TimeSet object.

Parameters
nsTimeSet
Returns
outTimeSet

Returns the difference of intervals.

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

copy(self, deep=True)[source][source]

Returns a deep or shallow copy of the current TimeSet.

Parameters
deepBool
Returns
timeset_copyTimeSet

Returns a deep or shallow copy of the current TimeSet.

abstract property discrete

Designate if the TimeSet is on discrete Time.

Parameters
None. Property.
Returns
discreteBool

True if the time is discrete. Returns None if empty.

discretize(self, bins=None, bin_size=None)[source][source]

Returns a discrete version of the current TimeSet.

Parameters
binsIterable or None.

If None, step should be provided. If Iterable it should contain n+1 elements that declare the start and the end of all (continuous) bins.

bin_sizeInt or datetime

If bins is provided this argument is ommited. Else declare the size of each bin.

Returns
timeset_discreteTimeSet

Returns a discrete version of the TimeSet.

binslist

A list of the created bins.

property instantaneous

Defines if the Time Set is instantaneous.

abstract property size

Returns the size of the TimeSet.

Parameters
None. Property.
Returns
sizeReal

The total amount of time inside the TimeSet.