TimeIntervalStamp

TimeIntervalStamp(intervals, source_id, source=None, is_interpolated=False)

A synchronized collection of canonical typed timeline intervals.

Parameters

Name Type Description Default
intervals dict[str, Interval] Timeline-ID to interval mapping. required
source_id str Timeline identity defining the interval axis. required
source TimeStampSource | None Optional object providing conversion maps. None
is_interpolated bool Whether any endpoint was estimated. False

Attributes

Name Description
axis Return the typed interval on the source axis.
duration Return the typed duration on the source axis.
end Return a derived instant stamp of all interval ends.
present_timelines Return stored timeline IDs in deterministic insertion order.
start Return a derived instant stamp of all interval starts.

Methods

Name Description
get_duration_for Return one stored interval duration with timeline identity.
get_interval Return one stored interval by timeline identity.
get_interval_in Convert both endpoints of one stored interval to a target unit.
get_intervals Return selected stored intervals in requested order.

get_duration_for

TimeIntervalStamp.get_duration_for(timeline_id)

Return one stored interval duration with timeline identity.

Parameters

Name Type Description Default
timeline_id str Stored timeline identity. required

Returns

Name Type Description
IdDuration The canonical typed ID duration.

get_interval

TimeIntervalStamp.get_interval(timeline_id)

Return one stored interval by timeline identity.

Parameters

Name Type Description Default
timeline_id str Stored timeline identity. required

Returns

Name Type Description
Interval The canonical typed interval.

Raises

Name Type Description
KeyError If the timeline is absent.

get_interval_in

TimeIntervalStamp.get_interval_in(unit, *, timeline_id=None)

Convert both endpoints of one stored interval to a target unit.

Parameters

Name Type Description Default
unit TimeUnit Requested target unit. required
timeline_id str | None Optional stored axis to select explicitly. None

Returns

Name Type Description
Interval A typed interval in the target unit.

get_intervals

TimeIntervalStamp.get_intervals(timeline_ids=None)

Return selected stored intervals in requested order.

Parameters

Name Type Description Default
timeline_ids KeyCollection | None Timeline IDs, or None for every stored interval. None

Returns

Name Type Description
dict[str, Interval] A new ordered interval dictionary.