TimeIntervalStamp

TimeIntervalStamp(start, end)

An interval defined by start and end TimeStamps.

Provides facilities for zipping corresponding (start, end) pairs across all related timelines.

Attributes

Name Type Description
start TimeStamp TimeStamp at interval start.
end TimeStamp TimeStamp at interval end.

Examples

>>> interval = timeline.get_interval_stamp(0.0, 10.0)
>>> interval.duration  # On axis timeline
10.0
>>> interval.get_interval("child:1")  # (start, end) tuple
(0.0, 7.5)
>>> interval.get_duration("child:1")
7.5
>>> # Get all intervals at once
>>> interval.zip_intervals()
{'tl:1': (0.0, 10.0), 'child:1': (0.0, 7.5)}

Methods

Name Description
get_coordinate_interval Get (start, end) as proper Coordinate objects.
get_duration Get duration on a specific timeline.
get_interval Get (start, end) pair for a specific timeline.
get_unit_interval Get (start, end) pair for a specific unit.
zip_intervals Get all (start, end) pairs across timelines.

get_coordinate_interval

TimeIntervalStamp.get_coordinate_interval(timeline_id)

Get (start, end) as proper Coordinate objects.

Unlike get_interval() which returns floats, this returns Coordinates with the correct TimeUnit attached.

Parameters

Name Type Description Default
timeline_id str The timeline to get interval for. required

Returns

Name Type Description
'tuple[Coordinate, Coordinate] | None' Tuple of (start, end) Coordinates, or None if not reachable.

Examples

>>> interval = timeline.get_interval_stamp(10.0, 50.0)
>>> start, end = interval.get_coordinate_interval("child:1")
>>> start.unit
<TimeUnit.seconds: 'seconds'>

get_duration

TimeIntervalStamp.get_duration(timeline_id)

Get duration on a specific timeline.

Parameters

Name Type Description Default
timeline_id str The timeline to get duration for. required

Returns

Name Type Description
float | None Duration (end - start), or None if timeline not reachable.

get_interval

TimeIntervalStamp.get_interval(timeline_id)

Get (start, end) pair for a specific timeline.

Parameters

Name Type Description Default
timeline_id str The timeline to get interval for. required

Returns

Name Type Description
tuple[float, float] | None Tuple of (start, end) coordinates, or None if timeline not reachable.

get_unit_interval

TimeIntervalStamp.get_unit_interval(unit)

Get (start, end) pair for a specific unit.

Parameters

Name Type Description Default
unit 'TimeUnit' The target unit. required

Returns

Name Type Description
tuple[float, float] | None Tuple of (start, end) in the target unit, or None if no C-Map.

zip_intervals

TimeIntervalStamp.zip_intervals(timeline_ids=None, include_units=None)

Get all (start, end) pairs across timelines.

Parameters

Name Type Description Default
timeline_ids list[str] | None Specific timelines to include (None = all). None
include_units list['TimeUnit'] | None C-Map units to include as well. None

Returns

Name Type Description
dict[str, tuple[float, float]] Dict mapping timeline_id/unit to (start, end) tuple.