tanat.visualization.sequence.type.timeline package#
Submodules#
tanat.visualization.sequence.type.timeline.builder module#
TimelineVizBuilder: timeline visualizer for a SequencePool or individual Sequence.
- class tanat.visualization.sequence.type.timeline.builder.TimelineVizBuilder(settings: Any | None = None, *, allow_large: bool = False)[source]#
Bases:
BaseSequenceVizBuilderBuilds timeline charts from a SequencePool or an individual Sequence.
Typical usage via
SequenceVisualizer:SequenceVisualizer.timeline() \ .title("Status over time") \ .draw(pool, entity_feature="status") \ .show()
- SETTINGS_CLASS[source]#
alias of
TimelineSettings
- marker(*, alpha: float | None = None, edge_color: str | None = None, size: float | None = None, bar_height: float | None = None, shape: str | None = None) TimelineVizBuilder[source]#
Configure marker visual properties. Chainable.
- Parameters:
alpha – Opacity (0–1).
edge_color – Marker border color.
Nonemeans no border.size – Scatter point size (event sequence only).
bar_height – Height fraction of each row slot, 0–1 (interval/state pools only).
shape – Matplotlib marker string, e.g.
"o","s","^"(event sequence only).
- x_axis(*, show: bool | None = None, label: str | None = None, rotation: int | None = None, limit_min: float | None = None, limit_max: float | None = None, autofmt_xdate: bool | None = None) TimelineVizBuilder[source]#
Configure the time (x) axis. Chainable.
- Parameters:
show – Hide the axis entirely when
False.label – Axis label text.
rotation – Tick label rotation in degrees.
limit_min – Left bound (zooms into a time window).
limit_max – Right bound (zooms into a time window).
autofmt_xdate – Auto-rotate date tick labels (useful for dense datetime scales).
- y_axis(*, show: bool | None = None, label: str | None = None) TimelineVizBuilder[source]#
Configure the sequence / category (y) axis. Chainable.
rotationandlimit_min/limit_maxare intentionally not exposed: y-positions are integer ranks managed internally, so rotating string labels or constraining numeric limits is not meaningful here.- Parameters:
show – Hide the axis entirely when
False(useful when y-axis labels are too dense to read).label – Axis label text.
tanat.visualization.sequence.type.timeline.data module#
Pure Polars data-preparation functions for the timeline builder.
- tanat.visualization.sequence.type.timeline.data.assign_y_positions(lf: LazyFrame, mode: Literal['category', 'id']) LazyFrame[source]#
Add
__Y_POSITION__(0-based integer) based on mode."id"-> dense rank on__ID__."category"-> dense rank on__LABEL__.
- Parameters:
lf – Input LazyFrame (must contain
__ID__and__LABEL__).mode – Grouping mode.
- Returns:
LazyFrame with an additional
__Y_POSITION__integer column.
- tanat.visualization.sequence.type.timeline.data.build_y_tick_map(df: DataFrame, mode: Literal['category', 'id']) dict[int, str][source]#
Return
{y_position: tick_label}for y-axis formatting."id"->{pos: str(id_value)}."category"->{pos: label_string}.
- Parameters:
df – Collected DataFrame (must contain
__Y_POSITION__,__ID__, and__LABEL__).mode – Grouping mode used for y-position assignment.
- Returns:
Mapping from integer y position to its tick label string.
- tanat.visualization.sequence.type.timeline.data.rename_time_index_columns(lf: LazyFrame, time_cols: list[str]) LazyFrame[source]#
Rename pool time index columns to internal standard names.
1 column -> renamed to
__TIME__(event pool).2 columns -> first renamed to
__TIME__, second to__END__(interval/state).
- Parameters:
lf – Input LazyFrame.
time_cols – List of time index column names (1 or 2 elements).
- Returns:
LazyFrame with time index columns renamed to
__TIME__(and__END__).
tanat.visualization.sequence.type.timeline.settings module#
Timeline settings.
- class tanat.visualization.sequence.type.timeline.settings.TimelineAesthetics(*, group_by: GroupBy = 'id', time_mode: TimeMode = 'absolute', display_unit: DisplayUnit | None = None)[source]#
Bases:
objectVisual aesthetics for the timeline.
- group_by[source]#
Row organisation.
"id"(default) for one row per sequence ID, or"category"for one row per unique label value.- Type:
Literal[‘category’, ‘id’]
- time_mode[source]#
"absolute"(default) displays real timestamps on the x-axis."relative"aligns all sequences to their per-ID T0 reference date; the x-axis shows a numeric offset from T0. Requiresset_t0()to have been called (or uses the lazy default ofposition=0).- Type:
Literal[‘absolute’, ‘relative’]
- display_unit[source]#
Target unit for the x-axis when
time_mode="relative"and the pool is datetime-based. One of"days"(default),"hours","minutes", or"seconds". Ignored for timestep pools (aUserWarningis emitted if explicitly set).- Type:
Literal[‘days’, ‘hours’, ‘minutes’, ‘seconds’] | None
- class tanat.visualization.sequence.type.timeline.settings.TimelineMarkerSettings(*, size: float = 4.0, bar_height: float = 0.6, alpha: float = 0.75, edge_color: str | None = None, shape: str = 'o')[source]#
Bases:
objectMarker visual properties for the timeline.
- shape[source]#
Any matplotlib marker string (e.g. “o”, “s”, “^”). Validated by matplotlib at render time.
- Type:
str
- class tanat.visualization.sequence.type.timeline.settings.TimelineSettings(*, title: TitleSettings = <factory>, colors: str | dict | list | None = None, figsize: tuple[float, float]=(10.0, 5.0), grid: GridSettings = <factory>, x_axis: XAxisSettings = <factory>, y_axis: YAxisSettings = <factory>, legend: LegendSettings = <factory>, facet: FacetSettings = <factory>, aesthetics: TimelineAesthetics = <factory>, null_handling: NullHandling = <factory>, marker: TimelineMarkerSettings = <factory>)[source]#
Bases:
BaseVizSettingsFull settings for the timeline builder.
- aesthetics: TimelineAesthetics[source]#
- marker: TimelineMarkerSettings[source]#
- model_dump(*, mode='python', **dump_kwargs)[source]#
Dump settings to a dict via Pydantic serialization.
- null_handling: NullHandling[source]#
- x_axis: XAxisSettings[source]#
- y_axis: YAxisSettings[source]#
Module contents#
Timeline package.
- class tanat.visualization.sequence.type.timeline.TimelineAesthetics(*, group_by: GroupBy = 'id', time_mode: TimeMode = 'absolute', display_unit: DisplayUnit | None = None)[source]#
Bases:
objectVisual aesthetics for the timeline.
- group_by[source]#
Row organisation.
"id"(default) for one row per sequence ID, or"category"for one row per unique label value.- Type:
Literal[‘category’, ‘id’]
- time_mode[source]#
"absolute"(default) displays real timestamps on the x-axis."relative"aligns all sequences to their per-ID T0 reference date; the x-axis shows a numeric offset from T0. Requiresset_t0()to have been called (or uses the lazy default ofposition=0).- Type:
Literal[‘absolute’, ‘relative’]
- display_unit[source]#
Target unit for the x-axis when
time_mode="relative"and the pool is datetime-based. One of"days"(default),"hours","minutes", or"seconds". Ignored for timestep pools (aUserWarningis emitted if explicitly set).- Type:
Literal[‘days’, ‘hours’, ‘minutes’, ‘seconds’] | None
- class tanat.visualization.sequence.type.timeline.TimelineMarkerSettings(*, size: float = 4.0, bar_height: float = 0.6, alpha: float = 0.75, edge_color: str | None = None, shape: str = 'o')[source]#
Bases:
objectMarker visual properties for the timeline.
- shape[source]#
Any matplotlib marker string (e.g. “o”, “s”, “^”). Validated by matplotlib at render time.
- Type:
str
- class tanat.visualization.sequence.type.timeline.TimelineSettings(*, title: TitleSettings = <factory>, colors: str | dict | list | None = None, figsize: tuple[float, float]=(10.0, 5.0), grid: GridSettings = <factory>, x_axis: XAxisSettings = <factory>, y_axis: YAxisSettings = <factory>, legend: LegendSettings = <factory>, facet: FacetSettings = <factory>, aesthetics: TimelineAesthetics = <factory>, null_handling: NullHandling = <factory>, marker: TimelineMarkerSettings = <factory>)[source]#
Bases:
BaseVizSettingsFull settings for the timeline builder.
- aesthetics: TimelineAesthetics[source]#
- marker: TimelineMarkerSettings[source]#
- model_dump(*, mode='python', **dump_kwargs)[source]#
Dump settings to a dict via Pydantic serialization.
- null_handling: NullHandling[source]#
- x_axis: XAxisSettings[source]#
- y_axis: YAxisSettings[source]#
- class tanat.visualization.sequence.type.timeline.TimelineVizBuilder(settings: Any | None = None, *, allow_large: bool = False)[source]#
Bases:
BaseSequenceVizBuilderBuilds timeline charts from a SequencePool or an individual Sequence.
Typical usage via
SequenceVisualizer:SequenceVisualizer.timeline() \ .title("Status over time") \ .draw(pool, entity_feature="status") \ .show()
- SETTINGS_CLASS[source]#
alias of
TimelineSettings
- marker(*, alpha: float | None = None, edge_color: str | None = None, size: float | None = None, bar_height: float | None = None, shape: str | None = None) TimelineVizBuilder[source]#
Configure marker visual properties. Chainable.
- Parameters:
alpha – Opacity (0–1).
edge_color – Marker border color.
Nonemeans no border.size – Scatter point size (event sequence only).
bar_height – Height fraction of each row slot, 0–1 (interval/state pools only).
shape – Matplotlib marker string, e.g.
"o","s","^"(event sequence only).
- x_axis(*, show: bool | None = None, label: str | None = None, rotation: int | None = None, limit_min: float | None = None, limit_max: float | None = None, autofmt_xdate: bool | None = None) TimelineVizBuilder[source]#
Configure the time (x) axis. Chainable.
- Parameters:
show – Hide the axis entirely when
False.label – Axis label text.
rotation – Tick label rotation in degrees.
limit_min – Left bound (zooms into a time window).
limit_max – Right bound (zooms into a time window).
autofmt_xdate – Auto-rotate date tick labels (useful for dense datetime scales).
- y_axis(*, show: bool | None = None, label: str | None = None) TimelineVizBuilder[source]#
Configure the sequence / category (y) axis. Chainable.
rotationandlimit_min/limit_maxare intentionally not exposed: y-positions are integer ranks managed internally, so rotating string labels or constraining numeric limits is not meaningful here.- Parameters:
show – Hide the axis entirely when
False(useful when y-axis labels are too dense to read).label – Axis label text.