Skip to content

temporian.EventSet.tick #

tick(
    interval: Duration,
    align: bool = True,
    after_last: bool = True,
    before_first: bool = False,
) -> EventSetOrNode

Generates timestamps at regular intervals in the range of a guide EventSet.

Example with align
>>> a = tp.event_set(timestamps=[5, 9, 16])
>>> b = a.tick(interval=tp.duration.seconds(3), align=True)
>>> b
indexes: ...
        timestamps: [ 6. 9. 12. 15. 18.]
...
Example without align
>>> a = tp.event_set(timestamps=[5, 9, 16])
>>> b = a.tick(interval=tp.duration.seconds(3), align=False)
>>> b
indexes: ...
        timestamps: [ 5. 8. 11. 14. 17.]
...
Example with before_first
>>> a = tp.event_set(timestamps=[5, 9, 16])
>>> b = a.tick(interval=tp.duration.seconds(3), align=True, before_first=True)
>>> b
indexes: ...
        timestamps: [ 3. 6. 9. 12. 15. 18.]
...
Example without after_last
>>> a = tp.event_set(timestamps=[5, 9, 16])
>>> b = a.tick(interval=tp.duration.seconds(3), align=True, after_last=False)
>>> b
indexes: ...
        timestamps: [ 6. 9. 12. 15.]
...

Args: interval: Tick interval. align: If false, the first tick is generated at the first timestamp (similar to EventSet.begin()). If true (default), ticks are generated on timestamps that are multiple of interval. after_last: If True, a tick after the last timestamp is included. before_first: If True, a tick before the first timestamp is included.

Returns:

Type Description
EventSetOrNode

A feature-less EventSet with regular timestamps.