Skip to content

Demo utilities

rerun_demo

The rerun_demo package contains utilities for easily demonstrating rerun features.

main.py is a program which tries to load a pre-baked .rrd file into the viewer

The data module contains a collection of reference objects and helpers that can be easily logged with a few lines of code, but still produce visually interesting content.

As an example, consider:

import rerun as rr
from rerun_demo.data import color_grid

rr.init("rerun_example_log_points", True)

rr.log_points("my_points", color_grid.positions, colors=color_grid.colors)

Note that because this package is shipped with the rerun-sdk pypi package, it cannot carry any dependencies beyond those of rerun itself. This generally limits demos to only using the standard library and numpy for data generation.

__main__

Demo program which loads an rrd file built into the package.

data

Simple data to be used for Rerun demos.

color_grid = build_color_grid() module-attribute

Default color grid

color_spiral = build_color_spiral() module-attribute

Default color spiral

rect_pyramid = build_rect_pyramid() module-attribute

Default rect pyramid data

def build_color_grid(x_count=10, y_count=10, z_count=10, twist=0)

Create a cube of points with colors.

The total point cloud will have x_count * y_count * z_count points.

PARAMETER DESCRIPTION
x_count

Number of points in each dimension.

DEFAULT: 10

y_count

Number of points in each dimension.

DEFAULT: 10

z_count

Number of points in each dimension.

DEFAULT: 10

twist

Angle to twist from bottom to top of the cube

DEFAULT: 0

def build_color_spiral(num_points=100, radius=2, angular_step=0.02, angular_offset=0, z_step=0.1)

Create a spiral of points with colors along the Z axis.

PARAMETER DESCRIPTION
num_points

Total number of points.

DEFAULT: 100

radius

The radius of the spiral.

DEFAULT: 2

angular_step

The factor applied between each step along the trigonemetric circle.

DEFAULT: 0.02

angular_offset

Offsets the starting position on the trigonemetric circle.

DEFAULT: 0

z_step

The factor applied between each step along the Z axis.

DEFAULT: 0.1

def build_rect_pyramid(count=20, width=100, height=100)

Create a stack of N colored rectangles.

PARAMETER DESCRIPTION
count

Number of rectangles to create.

DEFAULT: 20

width

Width of the base of the pyramid.

DEFAULT: 100

height

Height of the pyramid.

DEFAULT: 100

util

Simpe utilities to be used for Rerun demos.

def bounce_lerp(a, b, t)

A linear interpolator that bounces between a and b as t goes above 1.0.

PARAMETER DESCRIPTION
a

Start value (t == 0).

b

End value (t == 1).

t

Interpolation coefficient.

def interleave(arr1, arr2)

Interleaves two numpy arrays.

PARAMETER DESCRIPTION
arr1

A numpy array of arbitrary shape and length.

arr2

A numpy array with the same shape and length as arr1.