examples/notebook/notebook/partial_updates.ipynb
This example demonstrates how to perform partial updates on individual components. To learn more about this concept check this doc page.
from __future__ import annotations
import numpy as np
import rerun as rr
rng = np.random.default_rng(42)
n = 1000
positions = rng.uniform(0, 10, size=[n, 3])
rr.init("partial_updates")
rr.set_time("t", sequence=0)
rr.log("points", rr.Points3D(positions, radii=0.1))
rr.notebook_show()
The previously logged positions are still used
for i in range(10):
rr.set_time("t", sequence=i)
colors_slide_x = n * [(255, 0, 0)] * (positions < i)
rr.log("points", rr.Points3D.from_fields(colors=colors_slide_x))
Like before, but passes columnar data with a single SDK call
times = np.arange(0, 10)
all_colors_slide_z = np.vstack([n * [(0, 0, 255)] * (positions < t) for t in times])
rr.send_columns(
"points",
[rr.TimeColumn("t", sequence=times)],
rr.Points3D.columns(colors=all_colors_slide_z).partition([n] * 10),
)