Skip to content

Time axes

timenet_connectors.time_axes source

Map source timestamps to a declared Record origin without resampling values.

axis_for_offsets source

axis_for_offsets(
    offsets: ndarray, *, period_us: Fraction | None = None
) -> RegularAxis | IrregularAxis

Represent exact offsets compactly without filling gaps.

An optional published period prevents a gapped sequence from becoming a slower regular signal. Without one, only a constant positive observed step implies regularity.

Returns:

Type Description
RegularAxis | IrregularAxis

A shifted regular axis or an axis that retains every explicit offset.

Raises:

Type Description
TimeFFormatError

If the source offsets are invalid.

offsets_from_origin source

offsets_from_origin(
    timestamps_us: ndarray, origin_us: int
) -> ndarray

Subtract an explicit origin from whole-microsecond source timestamps.

The caller establishes alignment and chooses the origin. This function does not infer either fact. Input order is preserved, including interleaved tag groups.

Returns:

Type Description
ndarray

Integer offsets in the same shape and order as the source timestamps.

Raises:

Type Description
TimeFFormatError

If timestamps are not a non-empty integer vector or offsets overflow.