Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add columnar APIs to the Python docs #7183

Merged
merged 3 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions rerun_py/docs/gen_common_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ class Section:
"reset_time",
],
),
Section(
title="Columnar API",
func_list=[
"send_columns",
],
class_list=[
"TimeNanosColumn",
"TimeSecondsColumn",
"TimeSequenceColumn",
],
),
################################################################################
# These sections don't have tables, but generate pages containing all the archetypes, components, datatypes
Section(
Expand Down
12 changes: 6 additions & 6 deletions rerun_py/rerun_sdk/rerun/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
log_file_from_path as log_file_from_path,
new_entity_path as new_entity_path,
)
from ._send_columns import (
TimeNanosColumn as TimeNanosColumn,
TimeSecondsColumn as TimeSecondsColumn,
TimeSequenceColumn as TimeSequenceColumn,
send_columns as send_columns,
)
from .any_value import (
AnyValues as AnyValues,
)
Expand Down Expand Up @@ -139,12 +145,6 @@
script_setup as script_setup,
script_teardown as script_teardown,
)
from .send_columns import (
TimeNanosColumn as TimeNanosColumn,
TimeSecondsColumn as TimeSecondsColumn,
TimeSequenceColumn as TimeSequenceColumn,
send_columns as send_columns,
)
from .sinks import (
connect as connect,
disconnect as disconnect,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,26 @@ class TimeSequenceColumn(TimeColumnLike):
"""
A column of time values that are represented as an integer sequence.

Equivalent to `rr.set_time_sequence`.
Columnar equivalent to [`rerun.set_time_sequence`][rerun.set_time_sequence].
"""

def __init__(self, timeline: str, times: Iterable[int]):
"""
Create a column of integer sequence time values.

Parameters
----------
timeline:
The name of the timeline.
times:
An iterable of integer time values.

"""
self.timeline = timeline
self.times = times

def timeline_name(self) -> str:
"""Returns the name of the timeline."""
return self.timeline

def as_arrow_array(self) -> pa.Array:
Expand All @@ -43,16 +55,28 @@ def as_arrow_array(self) -> pa.Array:

class TimeSecondsColumn(TimeColumnLike):
"""
A column of time values that are represented as an floating point seconds.
A column of time values that are represented as floating point seconds.

Equivalent to `rr.set_time_seconds`.
Columnar equivalent to [`rerun.set_time_seconds`][rerun.set_time_seconds].
"""

def __init__(self, timeline: str, times: Iterable[float]):
"""
Create a column of floating point seconds time values.

Parameters
----------
timeline:
The name of the timeline.
times:
An iterable of floating point second time values.

"""
self.timeline = timeline
self.times = times

def timeline_name(self) -> str:
"""Returns the name of the timeline."""
return self.timeline

def as_arrow_array(self) -> pa.Array:
Expand All @@ -61,16 +85,28 @@ def as_arrow_array(self) -> pa.Array:

class TimeNanosColumn(TimeColumnLike):
"""
A column of time values that are represented as an integer nanoseconds.
A column of time values that are represented as integer nanoseconds.

Equivalent to `rr.set_time_nanos`.
Columnar equivalent to [`rerun.set_time_nanos`][rerun.set_time_nanos].
"""

def __init__(self, timeline: str, times: Iterable[int]):
"""
Create a column of integer nanoseconds time values.

Parameters
----------
timeline:
The name of the timeline.
times:
An iterable of integer nanosecond time values.

"""
self.timeline = timeline
self.times = times

def timeline_name(self) -> str:
"""Returns the name of the timeline."""
return self.timeline

def as_arrow_array(self) -> pa.Array:
Expand All @@ -89,7 +125,7 @@ def send_columns(
strict: bool | None = None,
) -> None:
r"""
Directly log a columns of data to Rerun.
Send columnar data to Rerun.

Unlike the regular `log` API, which is row-oriented, this API lets you submit the data
in a columnar form. Each `TimeColumnLike` and `ComponentColumnLike` object represents a column
Expand Down
Loading