TimeIntervalStamp
TimeIntervalStamp(start, end)
An interval defined by start and end TimeStamps.
Provides facilities for zipping corresponding (start, end) pairs across all related timelines.
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
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
| timeline_id |
str |
The timeline to get interval for. |
required |
Returns
|
'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
| timeline_id |
str |
The timeline to get duration for. |
required |
Returns
|
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
| timeline_id |
str |
The timeline to get interval for. |
required |
Returns
|
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
| unit |
'TimeUnit' |
The target unit. |
required |
Returns
|
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
| 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
|
dict[str, tuple[float, float]] |
Dict mapping timeline_id/unit to (start, end) tuple. |