Skip to content

Commit

Permalink
Never direct users towards using rr.log_components (rerun-io#8151)
Browse files Browse the repository at this point in the history
`rr.log_components` is a clunky implementation detail, at best. Users
should be directed towards `rr.log`, always.
  • Loading branch information
teh-cmc authored Nov 14, 2024
1 parent 00309df commit 376e8fe
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 38 deletions.
6 changes: 3 additions & 3 deletions crates/store/re_query/tests/latest_at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,19 +337,19 @@ fn invalidation() {
// # Expected: points=[[1,2,3]] colors=[]
//
// rr.set_time(2)
// rr.log_components("points", rr.components.MyColor(0xFF0000))
// rr.log("points", rr.components.MyColor(0xFF0000))
//
// # Do second query here: LatestAt(+inf)
// # Expected: points=[[1,2,3]] colors=[0xFF0000]
//
// rr.set_time(3)
// rr.log_components("points", rr.components.MyColor(0x0000FF))
// rr.log("points", rr.components.MyColor(0x0000FF))
//
// # Do third query here: LatestAt(+inf)
// # Expected: points=[[1,2,3]] colors=[0x0000FF]
//
// rr.set_time(3)
// rr.log_components("points", rr.components.MyColor(0x00FF00))
// rr.log("points", rr.components.MyColor(0x00FF00))
//
// # Do fourth query here: LatestAt(+inf)
// # Expected: points=[[1,2,3]] colors=[0x00FF00]
Expand Down
6 changes: 3 additions & 3 deletions crates/store/re_query/tests/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,19 +656,19 @@ fn invalidation() {
// # Expected: points=[[1,2,3]] colors=[]
//
// rr.set_time(2)
// rr.log_components("points", rr.components.MyColor(0xFF0000))
// rr.log("points", rr.components.MyColor(0xFF0000))
//
// # Do second query here: LatestAt(+inf)
// # Expected: points=[[1,2,3]] colors=[0xFF0000]
//
// rr.set_time(3)
// rr.log_components("points", rr.components.MyColor(0x0000FF))
// rr.log("points", rr.components.MyColor(0x0000FF))
//
// # Do third query here: LatestAt(+inf)
// # Expected: points=[[1,2,3]] colors=[0x0000FF]
//
// rr.set_time(3)
// rr.log_components("points", rr.components.MyColor(0x00FF00))
// rr.log("points", rr.components.MyColor(0x00FF00))
//
// # Do fourth query here: LatestAt(+inf)
// # Expected: points=[[1,2,3]] colors=[0x00FF00]
Expand Down
2 changes: 1 addition & 1 deletion docs/content/getting-started/data-out/analyze-and-send.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Next, let's send the same data as `Text` component:

```python
target_entity = "/video/detector/faces/0/bbox"
rr.log_components(target_entity, [rr.components.ShowLabels(True)], static=True)
rr.log(target_entity, [rr.components.ShowLabels(True)], static=True)
rr.send_columns(
target_entity,
times=[rr.TimeSequenceColumn("frame_nr", df["frame_nr"])],
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/all/archetypes/mesh3d_partial_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
factors = np.abs(np.sin(np.arange(1, 300, dtype=np.float32) * 0.04))
for i, factor in enumerate(factors):
rr.set_time_sequence("frame", i)
rr.log_components("triangle", [Position3DBatch(vertex_positions * factor)])
rr.log("triangle", [Position3DBatch(vertex_positions * factor)])
4 changes: 2 additions & 2 deletions docs/snippets/all/concepts/different_data_per_timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
# Log a red color on one timeline.
rr.reset_time() # Clears all set timeline info.
rr.set_time_seconds("red timeline", 1.0)
rr.log_components("points", [rr.components.Color(0xFF0000FF)])
rr.log("points", [rr.components.Color(0xFF0000FF)])

# And a blue color on the other.
rr.reset_time() # Clears all set timeline info.
rr.set_time_sequence("blue timeline", 1)
rr.log_components("points", [rr.components.Color(0x0000FFFF)])
rr.log("points", [rr.components.Color(0x0000FFFF)])


# Set view bounds:
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/all/tutorials/data_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

# log a `Label` component to the face bounding box entity
target_entity = "/video/detector/faces/0/bbox"
rr.log_components(target_entity, [rr.components.ShowLabels(True)], static=True)
rr.log(target_entity, [rr.components.ShowLabels(True)], static=True)
rr.send_columns(
target_entity,
times=[rr.TimeSequenceColumn("frame_nr", df["frame_nr"])],
Expand Down
4 changes: 2 additions & 2 deletions examples/python/drone_lidar/drone_lidar.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def log_lidar_data() -> None:
[rr.components.Position3DBatch(positions).partition(partitions)],
)

rr.log_components(
rr.log(
"/lidar",
[
# TODO(#6889): indicator component no longer needed not needed when we have tagged components
Expand All @@ -139,7 +139,7 @@ def log_drone_trajectory() -> None:
[rr.components.Position3DBatch(positions)],
)

rr.log_components(
rr.log(
"/drone",
[
# TODO(#6889): indicator component no longer needed not needed when we have tagged components
Expand Down
6 changes: 3 additions & 3 deletions examples/python/incremental_logging/incremental_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# Only log colors and radii once.
rr.set_time_sequence("frame_nr", 0)
rr.log_components("points", [colors, radii])
rr.log("points", [colors, radii])
rng = default_rng(12345)
Expand All @@ -51,9 +51,9 @@

# Only log colors and radii once.
rr.set_time_sequence("frame_nr", 0)
rr.log_components("points", [colors, radii])
rr.log("points", [colors, radii])
# Logging as static would also work.
# rr.log_components("points", [colors, radii], static=True)
# rr.log("points", [colors, radii], static=True)

rng = default_rng(12345)

Expand Down
2 changes: 1 addition & 1 deletion examples/python/openstreetmap_data/openstreetmap_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def log_way(way: dict[str, Any]) -> None:
def log_data(data: dict[str, Any]) -> None:
try:
copyright_text = data["osm3s"]["copyright"]
rr.log_components("copyright", [rr.components.Text(copyright_text)], static=True)
rr.log("copyright", [rr.components.Text(copyright_text)], static=True)
except KeyError:
pass

Expand Down
1 change: 0 additions & 1 deletion rerun_py/docs/gen_common_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ class Section:
"get_recording_id",
"get_thread_local_data_recording",
"is_enabled",
"log_components",
"new_recording",
"set_global_data_recording",
"set_thread_local_data_recording",
Expand Down
2 changes: 0 additions & 2 deletions rerun_py/rerun_sdk/rerun/_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ def log(
)
```
See also: [`rerun.log_components`][].
Parameters
----------
entity_path:
Expand Down
2 changes: 1 addition & 1 deletion rerun_py/rerun_sdk/rerun/recording_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class RecordingStream:
- Time-related functions:
[`rerun.set_time_seconds`][], [`rerun.set_time_sequence`][], …
- Log-related functions:
[`rerun.log`][], [`rerun.log_components`][],
[`rerun.log`][], …
For an exhaustive list, see `help(rerun.RecordingStream)`.
Expand Down
8 changes: 4 additions & 4 deletions tests/python/chunk_zoo/chunk_zoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ def specimen_archetype_with_latest_at_semantics():
)

set_frame_time(0)
rr.log_components("/archetype_chunk_with_latest_at_semantics", [rr.Points2D.indicator()])
rr.log("/archetype_chunk_with_latest_at_semantics", [rr.Points2D.indicator()])

set_frame_time(5)
rr.log_components("/archetype_chunk_with_latest_at_semantics", [rrc.RadiusBatch(2)])
rr.log("/archetype_chunk_with_latest_at_semantics", [rrc.RadiusBatch(2)])


def specimen_archetype_with_clamp_join_semantics_two_chunks():
Expand Down Expand Up @@ -161,7 +161,7 @@ def specimen_many_rows_with_mismatched_instance_count():
rrc.ColorBatch(colors).partition(colors_partitions),
],
)
rr.log_components("/many_rows_with_mismatched_instance_count", [rr.Points2D.indicator()], static=True)
rr.log("/many_rows_with_mismatched_instance_count", [rr.Points2D.indicator()], static=True)


# TODO(ab): add variants (unordered, overlapping timestamps, etc.)
Expand Down Expand Up @@ -195,7 +195,7 @@ def specimen_archetype_chunk_with_clear():
)

set_frame_time(0)
rr.log_components("/archetype_chunk_with_clear", [rr.Points2D.indicator(), rrc.RadiusBatch(2)])
rr.log("/archetype_chunk_with_clear", [rr.Points2D.indicator(), rrc.RadiusBatch(2)])

set_frame_time(5)
rr.log("/archetype_chunk_with_clear", rr.Clear(recursive=False))
Expand Down
6 changes: 3 additions & 3 deletions tests/python/release_checklist/check_all_components_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def log_some_space_views() -> None:
), f"Some components are missing from the `ALL_COMPONENTS` dictionary: {missing_components}"

# log all components as len=1 batches
rr.log_components(
rr.log(
"all_components_single",
[
getattr(rr.components, component_name)(test_case.single())
Expand All @@ -255,7 +255,7 @@ def log_some_space_views() -> None:
)

# log all components as batches (except those for which it doesn't make sense)
rr.log_components(
rr.log(
"all_components_batches",
[
getattr(rr.components, component_name)(test_case.batch())
Expand All @@ -271,7 +271,7 @@ def log_some_space_views() -> None:
continue

for i, alternative in enumerate(alternatives):
rr.log_components(
rr.log(
f"all_components_alternative_{i}",
[getattr(rr.components, component_name)(alternative)],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ def log_points() -> None:
"expected",
rr.TextDocument(FRAME_43, media_type=rr.MediaType.MARKDOWN),
)
rr.log_components("points", [rr.components.RadiusBatch(-20)])
rr.log("points", [rr.components.RadiusBatch(-20)])

rr.set_time_sequence("frame", 44)
rr.log(
"expected",
rr.TextDocument(FRAME_44, media_type=rr.MediaType.MARKDOWN),
)
rr.log_components("points", [rr.components.ColorBatch([0, 0, 255])])
rr.log("points", [rr.components.ColorBatch([0, 0, 255])])

rr.set_time_sequence("frame", 45)
rr.log(
Expand All @@ -111,8 +111,8 @@ def log_points() -> None:
rr.TextDocument(FRAME_46, media_type=rr.MediaType.MARKDOWN),
)
rr.log("points", rr.Points3D([[0, 0, 0], [1, 1, 1]]))
rr.log_components("points", [rr.components.RadiusBatch(-30)])
rr.log_components("points", [rr.components.ColorBatch([0, 255, 0])])
rr.log("points", [rr.components.RadiusBatch(-30)])
rr.log("points", [rr.components.ColorBatch([0, 255, 0])])
rr.log("points", rr.Points3D([[0, 0, 1], [1, 1, 0]]))


Expand Down
12 changes: 6 additions & 6 deletions tests/python/release_checklist/check_range_partial_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,20 @@ def log_points() -> None:
rr.log("points", rr.Points3D([[0, 0, 0], [1, 1, 1]], colors=[255, 0, 0]))

rr.set_time_sequence("frame", 43)
rr.log_components("points", [rr.components.RadiusBatch(-20)])
rr.log("points", [rr.components.RadiusBatch(-20)])

rr.set_time_sequence("frame", 44)
rr.log_components("points", [rr.components.ColorBatch([0, 0, 255])])
rr.log("points", [rr.components.ColorBatch([0, 0, 255])])

rr.set_time_sequence("frame", 45)
rr.log("points", rr.Points3D([[0, 0, 1], [1, 1, 0]]))
rr.log_components("points", [rr.components.RadiusBatch(-40)])
rr.log("points", [rr.components.RadiusBatch(-40)])

rr.set_time_sequence("frame", 46)
rr.log_components("points", [rr.components.RadiusBatch(-40)])
rr.log("points", [rr.components.RadiusBatch(-40)])
rr.log("points", rr.Points3D([[0, 2, 0], [1, 2, 1]]))
rr.log_components("points", [rr.components.RadiusBatch(-30)])
rr.log_components("points", [rr.components.ColorBatch([0, 255, 0])])
rr.log("points", [rr.components.RadiusBatch(-30)])
rr.log("points", [rr.components.ColorBatch([0, 255, 0])])
rr.log("points", rr.Points3D([[0, 0, 2], [2, 2, 0]]))


Expand Down

0 comments on commit 376e8fe

Please sign in to comment.