Skip to content

Python API: Rename sequence time parameter to seq #9192

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ rr.connect() # Connect to a remote viewer
# rr.save("recording.rrd") # Stream all logs to disk

# Associate subsequent data with 42 on the “frame” timeline
rr.set_index("frame", sequence=42)
rr.set_index("frame", seq=42)

# Log colored 3D points to the entity at `path/to/points`
rr.log("path/to/points", rr.Points3D(positions, colors=colors))
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types_core/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ crate::delegate_arrow_tuid!(ChunkId as "rerun.controls.ChunkId"); // Used in the
///
/// In pseudo-code:
/// ```text
/// rr.set_index("frame", sequence=10)
/// rr.set_index("frame", seq=10)
///
/// rr.log("my_entity", point1, row_id=#1)
/// rr.log("my_entity", point2, row_id=#0)
Expand Down
2 changes: 1 addition & 1 deletion docs/content/concepts/chunks.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ But if you're handing a bunch of rows of data over to Rerun, how does it end up
#### How are these rows turned into columns?

Before logging data, you can use the `rr.set_time_` APIs to update the SDK's time context with timestamps for custom timelines.
For example, `rr.set_index("frame", sequence=42)` will set the "frame" timeline's current value to 42 in the time context.
For example, `rr.set_index("frame", seq=42)` will set the "frame" timeline's current value to 42 in the time context.

When you later call `rr.log`, the SDK will generate a row id and values for the built-in timelines `log_time` and `log_tick`.
It will also grab the current values for any custom timelines from the time context.
Expand Down
4 changes: 2 additions & 2 deletions docs/content/getting-started/data-out/analyze-and-send.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Here is how to send the data as a scalar:
```python
rr.send_columns(
"/jaw_open_state",
indexes=[rr.IndexColumn("frame_nr", sequence=df["frame_nr"])],
indexes=[rr.IndexColumn("frame_nr", seq=df["frame_nr"])],
columns=rr.Scalar.columns(scalar=df["jawOpenState"]),
)
```
Expand All @@ -60,7 +60,7 @@ target_entity = "/video/detector/faces/0/bbox"
rr.log(target_entity, rr.Boxes2D.update_fields(show_labels=True), static=True)
rr.send_columns(
target_entity,
indexes=[rr.IndexColumn("frame_nr", sequence=df["frame_nr"])],
indexes=[rr.IndexColumn("frame_nr", seq=df["frame_nr"])],
columns=rr.Boxes2D.columns(labels=np.where(df["jawOpenState"], "OPEN", "CLOSE")),
)
```
Expand Down
2 changes: 1 addition & 1 deletion docs/content/howto/integrations/embed-notebooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ STEPS = 100
twists = math.pi * np.sin(np.linspace(0, math.tau, STEPS)) / 4
for t in range(STEPS):
sleep(0.05) # delay to simulate a long-running computation
rr.set_index("step", sequence=t)
rr.set_index("step", seq=t)
cube = build_color_grid(10, 10, 10, twist=twists[t])
rr.log("cube", rr.Points3D(cube.positions, colors=cube.colors, radii=0.5))
```
Expand Down
6 changes: 3 additions & 3 deletions docs/content/howto/logging/clears.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ For example, if you have an object tracking application, your code might look so
for frame in sensors.read():
# Associate the following logs with `frame == frame.id`
rr.set_index("frame", sequence=frame.id)
rr.set_index("frame", seq=frame.id)
# Do the actual tracking update
tracker.update(frame)
if tracker.is_lost:
Expand All @@ -33,7 +33,7 @@ In some cases, the best approach may be to rethink how you log data to better ex
for frame in sensors.read():
# Associate the following logs with `frame = frame.id`
rr.set_index("frame", sequence=frame.id)
rr.set_index("frame", seq=frame.id)
# Log every image that comes in
rr.log("input/image", rr.Image(frame.image))
if frame.id % 10 == 0:
Expand Down Expand Up @@ -63,7 +63,7 @@ class Detector:
for frame in sensors.read():
# Associate the following logs with `frame = frame.id`
rr.set_index("frame", sequence=frame.id)
rr.set_index("frame", seq=frame.id)
# Log every image that comes in
rr.log("input/image", rr.Image(frame.image))
if frame.id % 10 == 0:
Expand Down
4 changes: 2 additions & 2 deletions docs/content/reference/migration/migration-0-17.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ For example, setting color and enabling the `SeriesPoint` visualizer was previou
rr.log("data", rr.SeriesPoint(color=[255, 255, 0]), static=True)

for t in range(1000):
rr.set_index("frame_nr", sequence=t)
rr.set_time_sequence("frame_nr", t)
rr.log("data",rr.Scalar(get_data(t))),

rr.send_blueprint(
Expand All @@ -53,7 +53,7 @@ Now the override can be specified from the blueprint, removing the need to inclu

```python
for t in range(1000):
rr.set_index("frame_nr", sequence=t)
rr.set_time_sequence("frame_nr", t)
rr.log("data",rr.Scalar(get_data(t))),

rr.send_blueprint(
Expand Down
6 changes: 3 additions & 3 deletions docs/content/reference/migration/migration-0-23.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ We're moving towards a more explicit API for setting time, where you need to exp
Previously we would infer the user intent at runtime based on the value: if it was large enough, it was interpreted as time since the Unix epoch, otherwise it was interpreted as a timedelta.

To this end, we're deprecated `rr.set_time_seconds`, `rr.set_time_nanos`, as well as `rr.set_time_sequence` and replaced them with `rr.set_index`.
`set_index` takes either a `sequence=`, `timedelta=` or `datetime=` argument.
`set_index` takes either a `seq=`, `timedelta=` or `datetime=` argument.

`timedelta` must be either:
* seconds as `int` or `float`
Expand All @@ -28,7 +28,7 @@ To this end, we're deprecated `rr.set_time_seconds`, `rr.set_time_nanos`, as wel

### Migrating
##### `rr.set_sequence("foo", 42)`
New: `rr.set_index("foo", sequence=42)`
New: `rr.set_index("foo", seq=42)`

##### `rr.set_time_seconds("foo", duration_seconds)`
When using relative times (durations/timedeltas): `rr.set_index("foo", timedelta=duration_seconds)`
Expand Down Expand Up @@ -59,7 +59,7 @@ The migration is very similar to the above.

### Migration
##### `rr.TimeSequenceColumn("foo", values)`
New: `rr.IndexColumn("foo", sequence=values)`
New: `rr.IndexColumn("foo", seq=values)`

##### `rr.TimeSecondsColumn("foo", duration_seconds)`
New: `rr.IndexColumn("foo", timedelta=duration_seconds)`
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/all/archetypes/image_column_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# Send all images at once.
rr.send_columns(
"images",
indexes=[rr.IndexColumn("step", sequence=times)],
indexes=[rr.IndexColumn("step", seq=times)],
# Reshape the images so `Image` can tell that this is several blobs.
#
# Note that the `Image` consumes arrays of bytes, so we should ensure that we take a
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/all/archetypes/image_row_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
rr.init("rerun_example_image_row_updates", spawn=True)

for t in range(20):
rr.set_index("time", sequence=t)
rr.set_index("time", seq=t)

image = np.zeros((200, 300, 3), dtype=np.uint8)
image[:, :, 2] = 255
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/all/archetypes/instance_poses3d_combined.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

rr.init("rerun_example_instance_pose3d_combined", spawn=True)

rr.set_index("frame", sequence=0)
rr.set_index("frame", seq=0)

# Log a box and points further down in the hierarchy.
rr.log("world/box", rr.Boxes3D(half_sizes=[[1.0, 1.0, 1.0]]))
rr.log("world/box/points", rr.Points3D(np.vstack([xyz.ravel() for xyz in np.mgrid[3 * [slice(-10, 10, 10j)]]]).T))

for i in range(0, 180):
rr.set_index("frame", sequence=i)
rr.set_index("frame", seq=i)

# Log a regular transform which affects both the box and the points.
rr.log("world/box", rr.Transform3D(rotation_axis_angle=rr.RotationAxisAngle([0, 0, 1], angle=rr.Angle(deg=i * 2))))
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/all/archetypes/mesh3d_instancing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import rerun as rr

rr.init("rerun_example_mesh3d_instancing", spawn=True)
rr.set_index("frame", sequence=0)
rr.set_index("frame", seq=0)

rr.log(
"shape",
Expand All @@ -20,7 +20,7 @@
)

for i in range(0, 100):
rr.set_index("frame", sequence=i)
rr.set_index("frame", seq=i)
rr.log(
"shape",
rr.InstancePoses3D(
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/all/archetypes/mesh3d_partial_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
vertex_positions = np.array([[-1.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0]], dtype=np.float32)

# Log the initial state of our triangle
rr.set_index("frame", sequence=0)
rr.set_index("frame", seq=0)
rr.log(
"triangle",
rr.Mesh3D(
Expand All @@ -21,5 +21,5 @@
# Only update its vertices' positions each frame
factors = np.abs(np.sin(np.arange(1, 300, dtype=np.float32) * 0.04))
for i, factor in enumerate(factors):
rr.set_index("frame", sequence=i)
rr.set_index("frame", seq=i)
rr.log("triangle", rr.Mesh3D.from_fields(vertex_positions=vertex_positions * factor))
6 changes: 3 additions & 3 deletions docs/snippets/all/archetypes/points3d_partial_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

positions = [[i, 0, 0] for i in range(0, 10)]

rr.set_index("frame", sequence=0)
rr.set_index("frame", seq=0)
rr.log("points", rr.Points3D(positions))

for i in range(0, 10):
colors = [[20, 200, 20] if n < i else [200, 20, 20] for n in range(0, 10)]
radii = [0.6 if n < i else 0.2 for n in range(0, 10)]

# Update only the colors and radii, leaving everything else as-is.
rr.set_index("frame", sequence=i)
rr.set_index("frame", seq=i)
rr.log("points", rr.Points3D.from_fields(radii=radii, colors=colors))

# Update the positions and radii, and clear everything else in the process.
rr.set_index("frame", sequence=20)
rr.set_index("frame", seq=20)
rr.log("points", rr.Points3D.from_fields(clear_unset=True, positions=positions, radii=0.3))
2 changes: 1 addition & 1 deletion docs/snippets/all/archetypes/scalar_column_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

rr.send_columns(
"scalars",
indexes=[rr.IndexColumn("step", sequence=times)],
indexes=[rr.IndexColumn("step", seq=times)],
columns=rr.Scalar.columns(scalar=scalars),
)
2 changes: 1 addition & 1 deletion docs/snippets/all/archetypes/scalar_multiple_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# Log the data on a timeline called "step".
for t in range(0, int(tau * 2 * 100.0)):
rr.set_index("step", sequence=t)
rr.set_index("step", seq=t)

rr.log("trig/sin", rr.Scalar(sin(float(t) / 100.0)))
rr.log("trig/cos", rr.Scalar(cos(float(t) / 100.0)))
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/all/archetypes/scalar_row_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
rr.init("rerun_example_scalar_row_updates", spawn=True)

for step in range(64):
rr.set_index("step", sequence=step)
rr.set_index("step", seq=step)
rr.log("scalars", rr.Scalar(math.sin(step / 10.0)))
2 changes: 1 addition & 1 deletion docs/snippets/all/archetypes/scalar_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

# Log the data on a timeline called "step".
for step in range(0, 64):
rr.set_index("step", sequence=step)
rr.set_index("step", seq=step)
rr.log("scalar", rr.Scalar(math.sin(step / 10.0)))
2 changes: 1 addition & 1 deletion docs/snippets/all/archetypes/series_line_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Log the data on a timeline called "step".
for t in range(0, int(tau * 2 * 100.0)):
rr.set_index("step", sequence=t)
rr.set_index("step", seq=t)

rr.log("trig/sin", rr.Scalar(sin(float(t) / 100.0)))
rr.log("trig/cos", rr.Scalar(cos(float(t) / 100.0)))
2 changes: 1 addition & 1 deletion docs/snippets/all/archetypes/series_point_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

# Log the data on a timeline called "step".
for t in range(0, int(tau * 2 * 10.0)):
rr.set_index("step", sequence=t)
rr.set_index("step", seq=t)

rr.log("trig/sin", rr.Scalar(sin(float(t) / 10.0)))
rr.log("trig/cos", rr.Scalar(cos(float(t) / 10.0)))
4 changes: 2 additions & 2 deletions docs/snippets/all/archetypes/transform3d_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

rr.init("rerun_example_transform3d_axes", spawn=True)

rr.set_index("step", sequence=0)
rr.set_index("step", seq=0)

# Set the axis lengths for all the transforms
rr.log("base", rr.Transform3D(axis_length=1))

# Now sweep out a rotation relative to the base
for deg in range(360):
rr.set_index("step", sequence=deg)
rr.set_index("step", seq=deg)
rr.log(
"base/rotated",
rr.Transform3D(
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/all/archetypes/transform3d_column_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def truncated_radians(deg: float) -> float:

rr.init("rerun_example_transform3d_column_updates", spawn=True)

rr.set_index("tick", sequence=0)
rr.set_index("tick", seq=0)
rr.log(
"box",
rr.Boxes3D(half_sizes=[4.0, 2.0, 1.0], fill_mode=rr.components.FillMode.Solid),
Expand All @@ -24,7 +24,7 @@ def truncated_radians(deg: float) -> float:

rr.send_columns(
"box",
indexes=[rr.IndexColumn("tick", sequence=range(1, 101))],
indexes=[rr.IndexColumn("tick", seq=range(1, 101))],
columns=rr.Transform3D.columns(
translation=[[0, 0, t / 10.0] for t in range(100)],
rotation_axis_angle=[
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/all/archetypes/transform3d_row_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ def truncated_radians(deg: float) -> float:

rr.init("rerun_example_transform3d_row_updates", spawn=True)

rr.set_index("tick", sequence=0)
rr.set_index("tick", seq=0)
rr.log(
"box",
rr.Boxes3D(half_sizes=[4.0, 2.0, 1.0], fill_mode=rr.components.FillMode.Solid),
rr.Transform3D(clear=False, axis_length=10),
)

for t in range(100):
rr.set_index("tick", sequence=t + 1)
rr.set_index("tick", seq=t + 1)
rr.log(
"box",
rr.Transform3D(
Expand Down
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 @@ -5,7 +5,7 @@

rr.init("rerun_example_different_data_per_timeline", spawn=True)

rr.set_index("blue timeline", sequence=0)
rr.set_index("blue timeline", seq=0)
rr.set_index("red timeline", timedelta=0.0)
rr.log("points", rr.Points2D([[0, 0], [1, 1]], radii=rr.Radius.ui_points(10.0)))

Expand All @@ -16,7 +16,7 @@

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


Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/all/concepts/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

rr.init("rerun_example_different_indices", spawn=True)

rr.set_index("frame_nr", sequence=42)
rr.set_index("frame_nr", seq=42)
rr.set_index("elapsed", timedelta=12) # elapsed seconds
rr.set_index("time", datetime=1_741_017_564) # Seconds since unix epoch
rr.set_index("time", datetime=datetime.fromisoformat("2025-03-03T15:59:24"))
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/all/concepts/static/log_temporal_10x.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rr.set_index("frame", sequence=4)
rr.set_index("frame", seq=4)
for _ in range(10):
rr.log("camera/image", camera.save_current_frame())
2 changes: 1 addition & 1 deletion docs/snippets/all/howto/any_batch_value_column_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

rr.send_columns(
"/",
indexes=[rr.IndexColumn("step", sequence=timestamps)],
indexes=[rr.IndexColumn("step", seq=timestamps)],
columns=[
# log one value per timestamp
rr.AnyBatchValue.column("custom_component_single", one_per_timestamp),
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/all/howto/any_values_column_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@

rr.send_columns(
"/",
indexes=[rr.IndexColumn("step", sequence=timestamps)],
indexes=[rr.IndexColumn("step", seq=timestamps)],
columns=rr.AnyValues.columns(sin=np.sin(timestamps / 10.0), cos=np.cos(timestamps / 10.0)),
)
2 changes: 1 addition & 1 deletion docs/snippets/all/howto/any_values_row_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
rr.init("rerun_example_any_values_row_updates", spawn=True)

for step in range(64):
rr.set_index("step", sequence=step)
rr.set_index("step", seq=step)
rr.log("/", rr.AnyValues(sin=math.sin(step / 10.0), cos=math.cos(step / 10.0)))
4 changes: 2 additions & 2 deletions docs/snippets/all/tutorials/data_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# log the jaw open state signal as a scalar
rr.send_columns(
"/jaw_open_state",
indexes=[rr.IndexColumn("frame_nr", sequence=df["frame_nr"])],
indexes=[rr.IndexColumn("frame_nr", seq=df["frame_nr"])],
columns=rr.Scalar.columns(scalar=df["jawOpenState"]),
)

Expand All @@ -41,6 +41,6 @@
rr.log(target_entity, rr.Boxes2D.from_fields(show_labels=True), static=True)
rr.send_columns(
target_entity,
indexes=[rr.IndexColumn("frame_nr", sequence=df["frame_nr"])],
indexes=[rr.IndexColumn("frame_nr", seq=df["frame_nr"])],
columns=rr.Boxes2D.columns(labels=np.where(df["jawOpenState"], "OPEN", "CLOSE")),
)
2 changes: 1 addition & 1 deletion docs/snippets/all/tutorials/timelines_example.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
for frame in read_sensor_frames():
rr.set_index("frame_idx", sequence=frame.idx)
rr.set_index("frame_idx", seq=frame.idx)
rr.set_index("sensor_time", datetime=frame.timestamp)

rr.log("sensor/points", rr.Points3D(frame.points))
Loading
Loading