From 4e28ee7d3b662f38a7a41e9352edc70c770ae3a7 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Thu, 23 Jan 2025 16:56:12 +0100 Subject: [PATCH] update snippets --- docs/snippets/INDEX.md | 3 --- .../all/archetypes/points3d_send_columns.py | 14 +++++--------- .../snippets/all/archetypes/scalar_send_columns.py | 6 +++--- .../all/howto/any_batch_value_send_columns.py | 8 ++++---- docs/snippets/all/howto/any_values_send_columns.py | 6 +++--- docs/snippets/snippets.toml | 2 -- 6 files changed, 15 insertions(+), 24 deletions(-) diff --git a/docs/snippets/INDEX.md b/docs/snippets/INDEX.md index cb57647e7f304..73583a94719c1 100644 --- a/docs/snippets/INDEX.md +++ b/docs/snippets/INDEX.md @@ -211,7 +211,6 @@ _All snippets, organized by the [`Component`](https://rerun.io/docs/reference/ty | **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes⁠/⁠segmentation_image_simple` | Create and log a segmentation image | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.cpp) | | **[`ClassId`](https://rerun.io/docs/reference/types/components/class_id)** | `archetypes⁠/⁠points3d_partial_updates_legacy` | Demonstrates usage of the new partial updates APIs | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.cpp) | | **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `archetypes⁠/⁠points3d_partial_updates_legacy` | Demonstrates usage of the new partial updates APIs | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.cpp) | -| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `archetypes⁠/⁠points3d_send_columns` | Use the `send_columns` API to send several point clouds over time in a single call | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.cpp) | | **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts⁠/⁠different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.cpp) | | **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts⁠/⁠viscomp-component-default` | Add a component default | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-component-default.py) | | | | **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts⁠/⁠viscomp-component-override` | Override a component | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-component-override.py) | | | @@ -234,7 +233,6 @@ _All snippets, organized by the [`Component`](https://rerun.io/docs/reference/ty | **[`Plane3D`](https://rerun.io/docs/reference/types/components/plane3d)** | `views⁠/⁠spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial3d.py) | | | | **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `archetypes⁠/⁠mesh3d_partial_updates` | Log a simple colored triangle, then update its vertices' positions each frame | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_partial_updates.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_partial_updates.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_partial_updates.cpp) | | **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `archetypes⁠/⁠points3d_partial_updates_legacy` | Demonstrates usage of the new partial updates APIs | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.cpp) | -| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `archetypes⁠/⁠points3d_send_columns` | Use the `send_columns` API to send several point clouds over time in a single call | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.cpp) | | **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `descriptors⁠/⁠descr_builtin_component` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_builtin_component.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_builtin_component.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_builtin_component.cpp) | | **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `descriptors⁠/⁠descr_custom_archetype` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_archetype.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_archetype.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_archetype.cpp) | | **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `descriptors⁠/⁠descr_custom_component` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_component.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_component.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_component.cpp) | @@ -245,7 +243,6 @@ _All snippets, organized by the [`Component`](https://rerun.io/docs/reference/ty | **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes⁠/⁠geo_line_strings_simple` | Log a simple geospatial line string | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_line_strings_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_line_strings_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_line_strings_simple.cpp) | | **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes⁠/⁠geo_points_simple` | Log some very simple geospatial point | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_points_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_points_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_points_simple.cpp) | | **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes⁠/⁠points3d_partial_updates_legacy` | Demonstrates usage of the new partial updates APIs | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.cpp) | -| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes⁠/⁠points3d_send_columns` | Use the `send_columns` API to send several point clouds over time in a single call | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.cpp) | | **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `concepts⁠/⁠different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.cpp) | | **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `views⁠/⁠map` | Use a blueprint to customize a map view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/map.py) | | | | **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes⁠/⁠capsules3d_batch` | Log a batch of capsules | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/capsules3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/capsules3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/capsules3d_batch.cpp) | diff --git a/docs/snippets/all/archetypes/points3d_send_columns.py b/docs/snippets/all/archetypes/points3d_send_columns.py index 2117c22c2e2df..2b2b3cb4cce37 100644 --- a/docs/snippets/all/archetypes/points3d_send_columns.py +++ b/docs/snippets/all/archetypes/points3d_send_columns.py @@ -18,20 +18,16 @@ [1.0, -1.0, 1.0], [2.0, -2.0, 2.0], [3.0, -1.0, 3.0], [2.0, 0.0, 4.0], ] # fmt: on -positions_arr = np.concatenate(positions) # At each timestep, all points in the cloud share the same but changing color and radius. colors = [0xFF0000FF, 0x00FF00FF, 0x0000FFFF, 0xFFFF00FF, 0x00FFFFFF] radii = [0.05, 0.01, 0.2, 0.1, 0.3] -# TODO(#8752): use tagged columnar APIs -rr.send_columns( +rr.send_columns_v2( "points", - times=[rr.TimeSecondsColumn("time", times)], - components=[ - rr.Points3D.indicator(), - rr.components.Position3DBatch(positions_arr).partition([2, 4, 4, 3, 4]), - rr.components.ColorBatch(colors), - rr.components.RadiusBatch(radii), + indexes=[rr.TimeSecondsColumn("time", times)], + columns=[ + *rr.Points3D.columns(positions=positions, _lengths=[2, 4, 4, 3, 4]), + *rr.Points3D.columns(colors=colors, radii=radii), ], ) diff --git a/docs/snippets/all/archetypes/scalar_send_columns.py b/docs/snippets/all/archetypes/scalar_send_columns.py index ec2f51e9e0f08..0f1e789fe9eba 100644 --- a/docs/snippets/all/archetypes/scalar_send_columns.py +++ b/docs/snippets/all/archetypes/scalar_send_columns.py @@ -10,8 +10,8 @@ times = np.arange(0, 64) scalars = np.sin(times / 10.0) -rr.send_columns( +rr.send_columns_v2( "scalars", - times=[rr.TimeSequenceColumn("step", times)], - components=[rr.components.ScalarBatch(scalars)], + indexes=[rr.TimeSequenceColumn("step", times)], + columns=rr.Scalar.columns(scalar=scalars), ) diff --git a/docs/snippets/all/howto/any_batch_value_send_columns.py b/docs/snippets/all/howto/any_batch_value_send_columns.py index 5719eac824064..89ee5b98c4b2e 100644 --- a/docs/snippets/all/howto/any_batch_value_send_columns.py +++ b/docs/snippets/all/howto/any_batch_value_send_columns.py @@ -12,12 +12,12 @@ one_per_timestamp = np.sin(timestamps / 10.0) ten_per_timestamp = np.cos(np.arange(0, N * 10) / 100.0) -rr.send_columns( +rr.send_columns_v2( "/", - times=[rr.TimeSequenceColumn("step", timestamps)], - components=[ + indexes=[rr.TimeSequenceColumn("step", timestamps)], + columns=[ # log one value per timestamp - rr.AnyBatchValue("custom_component_single", one_per_timestamp), + rr.AnyBatchValue("custom_component_single", one_per_timestamp).partition(), # log ten values per timestamp rr.AnyBatchValue("custom_component_multi", ten_per_timestamp).partition([10] * N), ], diff --git a/docs/snippets/all/howto/any_values_send_columns.py b/docs/snippets/all/howto/any_values_send_columns.py index 5be47bc1ae82b..6b0e9ae93b71d 100644 --- a/docs/snippets/all/howto/any_values_send_columns.py +++ b/docs/snippets/all/howto/any_values_send_columns.py @@ -15,8 +15,8 @@ cos=np.cos(timestamps / 10.0), ) -rr.send_columns( +rr.send_columns_v2( "/", - times=[rr.TimeSequenceColumn("step", timestamps)], - components=values.as_component_batches(), + indexes=[rr.TimeSequenceColumn("step", timestamps)], + columns=values.partition(), ) diff --git a/docs/snippets/snippets.toml b/docs/snippets/snippets.toml index 996d778e0a93a..542c7683794a6 100644 --- a/docs/snippets/snippets.toml +++ b/docs/snippets/snippets.toml @@ -237,7 +237,6 @@ quick_start = [ # These examples don't have exactly the same implementation. "rust", ] "archetypes/points3d_send_columns" = [ - "py", # TODO(#8752): needs tagged columnar APIs "cpp", # TODO(#8754): needs tagged columnar APIs ] "archetypes/points3d_random" = [ # TODO(#3206): examples use different RNGs @@ -249,7 +248,6 @@ quick_start = [ # These examples don't have exactly the same implementation. "cpp", ] "archetypes/scalar_send_columns" = [ - "py", # TODO(#8752): needs tagged columnar APIs "cpp", # TODO(#8754): needs tagged columnar APIs ] "archetypes/tensor_simple" = [ # TODO(#3206): examples use different RNGs