Skip to content

Commit

Permalink
update snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Jan 23, 2025
1 parent 852e283 commit 4e28ee7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 24 deletions.
3 changes: 0 additions & 3 deletions docs/snippets/INDEX.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 5 additions & 9 deletions docs/snippets/all/archetypes/points3d_send_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
],
)
6 changes: 3 additions & 3 deletions docs/snippets/all/archetypes/scalar_send_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
8 changes: 4 additions & 4 deletions docs/snippets/all/howto/any_batch_value_send_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
],
Expand Down
6 changes: 3 additions & 3 deletions docs/snippets/all/howto/any_values_send_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
2 changes: 0 additions & 2 deletions docs/snippets/snippets.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4e28ee7

Please sign in to comment.