Skip to content

Datatypes

rerun.datatypes

class Angle

Bases: AngleExt

Datatype: Angle in either radians or degrees.

inner: float = field(converter=float) class-attribute instance-attribute

Radians (float): 3D rotation angle in radians. Only one of degrees or radians should be set.

Degrees (float): 3D rotation angle in degrees. Only one of degrees or radians should be set.

def __init__(rad=None, deg=None)

Create a new instance of the Angle datatype.

PARAMETER DESCRIPTION
rad

Angle in radians, specify either rad or deg.

TYPE: float | None DEFAULT: None

deg

Angle in degrees, specify either rad or deg.

TYPE: float | None DEFAULT: None

class AnnotationInfo

Bases: AnnotationInfoExt

Datatype: Annotation info annotating a class id or key-point id.

Color and label will be used to annotate entities/keypoints which reference the id. The id refers either to a class or key-point id

def __init__(id, label=None, color=None)

Create a new instance of the AnnotationInfo datatype.

PARAMETER DESCRIPTION
id

ClassId or KeypointId to which this annotation info belongs.

TYPE: int

label

The label that will be shown in the UI.

TYPE: Utf8Like | None DEFAULT: None

color

The color that will be applied to the annotated entity.

TYPE: Rgba32Like | None DEFAULT: None

class ClassDescription

Bases: ClassDescriptionExt

Datatype: The description of a semantic Class.

If an entity is annotated with a corresponding ClassId, rerun will use the attached AnnotationInfo to derive labels and colors.

Keypoints within an annotation class can similarly be annotated with a KeypointId in which case we should defer to the label and color for the AnnotationInfo specifically associated with the Keypoint.

Keypoints within the class can also be decorated with skeletal edges. Keypoint-connections are pairs of KeypointIds. If an edge is defined, and both keypoints exist within the instance of the class, then the keypoints should be connected with an edge. The edge should be labeled and colored as described by the class's AnnotationInfo.

Note that a ClassDescription can be directly logged using rerun.log. This is equivalent to logging a rerun.AnnotationContext containing a single ClassDescription.

def __init__(*, info, keypoint_annotations=[], keypoint_connections=[])

Create a new instance of the ClassDescription datatype.

PARAMETER DESCRIPTION
info

The AnnotationInfo for the class.

TYPE: AnnotationInfoLike

keypoint_annotations

The AnnotationInfo for all the keypoints.

TYPE: Sequence[AnnotationInfoLike] | None DEFAULT: []

keypoint_connections

The connections between keypoints.

TYPE: Sequence[KeypointPairLike] | None DEFAULT: []

class ClassDescriptionMapElem

Bases: ClassDescriptionMapElemExt

Datatype: A helper type for mapping class IDs to class descriptions.

This is internal to the AnnotationContext structure.

def __init__(class_id, class_description)

Create a new instance of the ClassDescriptionMapElem datatype.

PARAMETER DESCRIPTION
class_id

The key: the class ID.

TYPE: ClassIdLike

class_description

The value: class name, color, etc.

TYPE: ClassDescriptionLike

class ClassId

Bases: ClassIdExt

Datatype: A 16-bit ID representing a type of semantic class.

def __init__(id)

Create a new instance of the ClassId datatype.

class Float32

Datatype: A single-precision 32-bit IEEE 754 floating point number.

def __init__(value)

Create a new instance of the Float32 datatype.

class KeypointId

Bases: KeypointIdExt

Datatype: A 16-bit ID representing a type of semantic keypoint within a class.

KeypointIds are only meaningful within the context of a [rerun.datatypes.ClassDescription].

Used to look up an [rerun.datatypes.AnnotationInfo] for a Keypoint within the [rerun.components.AnnotationContext].

def __init__(id)

Create a new instance of the KeypointId datatype.

class KeypointPair

Bases: KeypointPairExt

Datatype: A connection between two Keypoints.

def __init__(keypoint0, keypoint1)

Create a new instance of the KeypointPair datatype.

PARAMETER DESCRIPTION
keypoint0

The first point of the pair.

TYPE: KeypointIdLike

keypoint1

The second point of the pair.

TYPE: KeypointIdLike

class Mat3x3

Bases: Mat3x3Ext

Datatype: A 3x3 Matrix.

Matrices in Rerun are stored as flat list of coefficients in column-major order:

            column 0       column 1       column 2
       -------------------------------------------------
row 0 | flat_columns[0] flat_columns[3] flat_columns[6]
row 1 | flat_columns[1] flat_columns[4] flat_columns[7]
row 2 | flat_columns[2] flat_columns[5] flat_columns[8]

However, construction is done from a list of rows, which follows NumPy's convention:

np.testing.assert_array_equal(
    rr.datatypes.Mat3x3([1, 2, 3, 4, 5, 6, 7, 8, 9]).flat_columns, np.array([1, 4, 7, 2, 5, 8, 3, 6, 9], dtype=np.float32)
)
np.testing.assert_array_equal(
    rr.datatypes.Mat3x3([[1, 2, 3], [4, 5, 6], [7, 8, 9]]).flat_columns,
    np.array([1, 4, 7, 2, 5, 8, 3, 6, 9], dtype=np.float32),
)
If you want to construct a matrix from a list of columns instead, use the named columns parameter:
np.testing.assert_array_equal(
    rr.datatypes.Mat3x3(columns=[1, 2, 3, 4, 5, 6, 7, 8, 9]).flat_columns,
    np.array([1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=np.float32),
)
np.testing.assert_array_equal(
    rr.datatypes.Mat3x3(columns=[[1, 2, 3], [4, 5, 6], [7, 8, 9]]).flat_columns,
    np.array([1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=np.float32),
)

def __init__(rows=None, *, columns=None)

class Mat4x4

Bases: Mat4x4Ext

Datatype: A 4x4 Matrix.

Matrices in Rerun are stored as flat list of coefficients in column-major order:

           column 0         column 1         column 2         column 3
       --------------------------------------------------------------------
row 0 | flat_columns[0]  flat_columns[4]  flat_columns[8]  flat_columns[12]
row 1 | flat_columns[1]  flat_columns[5]  flat_columns[9]  flat_columns[13]
row 2 | flat_columns[2]  flat_columns[6]  flat_columns[10] flat_columns[14]
row 3 | flat_columns[3]  flat_columns[7]  flat_columns[11] flat_columns[15]

However, construction is done from a list of rows, which follows NumPy's convention:

np.testing.assert_array_equal(
    rr.datatypes.Mat4x4([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]).flat_columns,
    np.array([1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16], dtype=np.float32),
)
np.testing.assert_array_equal(
    rr.datatypes.Mat4x4([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]).flat_columns,
    np.array([1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16], dtype=np.float32),
)
If you want to construct a matrix from a list of columns instead, use the named columns parameter:
np.testing.assert_array_equal(
    rr.datatypes.Mat4x4(columns=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]).flat_columns,
    np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], dtype=np.float32),
)
np.testing.assert_array_equal(
    rr.datatypes.Mat4x4(columns=[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]).flat_columns,
    np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], dtype=np.float32),
)

def __init__(rows=None, *, columns=None)

class Material

Bases: MaterialExt

Datatype: Material properties of a mesh.

def __init__(albedo_factor=None)

Create a new instance of the Material datatype.

PARAMETER DESCRIPTION
albedo_factor

Optional color multiplier.

TYPE: Rgba32Like | None DEFAULT: None

class MeshProperties

Bases: MeshPropertiesExt

Datatype: Optional triangle indices for a mesh.

def __init__(indices=None)

Create a new instance of the MeshProperties datatype.

PARAMETER DESCRIPTION
indices

A flattened array of vertex indices that describe the mesh's triangles.

Its length must be divisible by 3.

TYPE: ArrayLike | None DEFAULT: None

class Quaternion

Bases: QuaternionExt

Datatype: A Quaternion represented by 4 real numbers.

Note: although the x,y,z,w components of the quaternion will be passed through to the datastore as provided, when used in the viewer Quaternions will always be normalized.

class Rgba32

Bases: Rgba32Ext

Datatype: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.

The color is stored as a 32-bit integer, where the most significant byte is R and the least significant byte is A.

Float colors are assumed to be in 0-1 gamma sRGB space. All other colors are assumed to be in 0-255 gamma sRGB space. If there is an alpha, we assume it is in linear space, and separate (NOT pre-multiplied).

def __init__(rgba)

Create a new instance of the Rgba32 datatype.

class Rotation3D

Bases: Rotation3DExt

Datatype: A 3D rotation.

inner: datatypes.Quaternion | datatypes.RotationAxisAngle = field(converter=Rotation3DExt.inner__field_converter_override) class-attribute instance-attribute

Quaternion (datatypes.Quaternion): Rotation defined by a quaternion.

AxisAngle (datatypes.RotationAxisAngle): Rotation defined with an axis and an angle.

class RotationAxisAngle

Bases: RotationAxisAngleExt

Datatype: 3D rotation represented by a rotation around a given axis.

def __init__(axis, angle=None, *, radians=None, degrees=None)

Create a new instance of the RotationAxisAngle datatype.

PARAMETER DESCRIPTION
axis

Axis to rotate around.

This is not required to be normalized. If normalization fails (typically because the vector is length zero), the rotation is silently ignored.

TYPE: Vec3DLike

angle

How much to rotate around the axis.

TYPE: AngleLike | None DEFAULT: None

radians

How much to rotate around the axis, in radians. Specify this instead of degrees or angle.

TYPE: float | None DEFAULT: None

degrees

How much to rotate around the axis, in radians. Specify this instead of radians or angle.

TYPE: float | None DEFAULT: None

class Scale3D

Bases: Scale3DExt

Datatype: 3D scaling factor, part of a transform representation.

Example
# uniform scaling
scale = rr.datatypes.Scale3D(3.)

# non-uniform scaling
scale = rr.datatypes.Scale3D([1, 1, -1])
scale = rr.datatypes.Scale3D(rr.datatypes.Vec3D([1, 1, -1]))
inner: datatypes.Vec3D | float = field(converter=Scale3DExt.inner__field_converter_override) class-attribute instance-attribute

ThreeD (datatypes.Vec3D): Individual scaling factors for each axis, distorting the original object.

Uniform (float): Uniform scaling factor along all axis.

class TensorBuffer

Bases: TensorBufferExt

Datatype: The underlying storage for a Tensor.

Tensor elements are stored in a contiguous buffer of a single type.

inner: npt.NDArray[np.float16] | npt.NDArray[np.float32] | npt.NDArray[np.float64] | npt.NDArray[np.int16] | npt.NDArray[np.int32] | npt.NDArray[np.int64] | npt.NDArray[np.int8] | npt.NDArray[np.uint16] | npt.NDArray[np.uint32] | npt.NDArray[np.uint64] | npt.NDArray[np.uint8] = field(converter=TensorBufferExt.inner__field_converter_override) class-attribute instance-attribute

U8 (npt.NDArray[np.uint8]):

U16 (npt.NDArray[np.uint16]):

U32 (npt.NDArray[np.uint32]):

U64 (npt.NDArray[np.uint64]):

I8 (npt.NDArray[np.int8]):

I16 (npt.NDArray[np.int16]):

I32 (npt.NDArray[np.int32]):

I64 (npt.NDArray[np.int64]):

F16 (npt.NDArray[np.float16]):

F32 (npt.NDArray[np.float32]):

F64 (npt.NDArray[np.float64]):

JPEG (npt.NDArray[np.uint8]):

class TensorData

Bases: TensorDataExt

Datatype: A multi-dimensional Tensor of data.

The number of dimensions and their respective lengths is specified by the shape field. The dimensions are ordered from outermost to innermost. For example, in the common case of a 2D RGB Image, the shape would be [height, width, channel].

These dimensions are combined with an index to look up values from the buffer field, which stores a contiguous array of typed values.

def __init__(*, shape=None, buffer=None, array=None, dim_names=None)

Construct a TensorData object.

The TensorData object is internally represented by three fields: shape and buffer.

This constructor provides additional arguments 'array', and 'dim_names'. When passing in a multi-dimensional array such as a np.ndarray, the shape and buffer fields will be populated automagically.

PARAMETER DESCRIPTION
self

The TensorData object to construct.

TYPE: Any

shape

The shape of the tensor. If None, and an array is proviced, the shape will be inferred from the shape of the array.

TYPE: Sequence[TensorDimensionLike] | None DEFAULT: None

buffer

The buffer of the tensor. If None, and an array is provided, the buffer will be generated from the array.

TYPE: TensorBufferLike | None DEFAULT: None

array

A numpy array (or The array of the tensor. If None, the array will be inferred from the buffer.

TYPE: TensorLike | None DEFAULT: None

dim_names

The names of the tensor dimensions when generating the shape from an array.

TYPE: Sequence[str | None] | None DEFAULT: None

class TensorDimension

Datatype: A single dimension within a multi-dimensional tensor.

def __init__(size, name=None)

Create a new instance of the TensorDimension datatype.

PARAMETER DESCRIPTION
size

The length of this dimension.

TYPE: int

name

The name of this dimension, e.g. "width", "height", "channel", "batch', ….

TYPE: str | None DEFAULT: None

class Transform3D

Bases: Transform3DExt

Datatype: Representation of a 3D affine transform.

inner: datatypes.TranslationAndMat3x3 | datatypes.TranslationRotationScale3D = field() class-attribute instance-attribute

TranslationAndMat3x3 (datatypes.TranslationAndMat3x3):

TranslationRotationScale (datatypes.TranslationRotationScale3D):

class TranslationAndMat3x3

Bases: TranslationAndMat3x3Ext

Datatype: Representation of an affine transform via a 3x3 affine matrix paired with a translation.

First applies the matrix, then the translation.

def __init__(translation=None, mat3x3=None, *, from_parent=False)

Create a new instance of the TranslationAndMat3x3 datatype.

PARAMETER DESCRIPTION
translation

3D translation, applied after the matrix.

TYPE: Vec3DLike | None DEFAULT: None

mat3x3

3x3 matrix for scale, rotation & shear.

TYPE: Mat3x3Like | None DEFAULT: None

from_parent

If true, the transform maps from the parent space to the space where the transform was logged. Otherwise, the transform maps from the space to its parent.

TYPE: bool DEFAULT: False

class TranslationRotationScale3D

Bases: TranslationRotationScale3DExt

Datatype: Representation of an affine transform via separate translation, rotation & scale.

class UVec2D

Datatype: A uint32 vector in 2D space.

def __init__(xy)

Create a new instance of the UVec2D datatype.

class UVec3D

Datatype: A uint32 vector in 3D space.

def __init__(xyz)

Create a new instance of the UVec3D datatype.

class UVec4D

Datatype: A uint vector in 4D space.

def __init__(xyzw)

Create a new instance of the UVec4D datatype.

class Utf8

Bases: Utf8Ext

Datatype: A string of text, encoded as UTF-8.

def __init__(value)

Create a new instance of the Utf8 datatype.

class Vec2D

Bases: Vec2DExt

Datatype: A vector in 2D space.

def __init__(xy)

Create a new instance of the Vec2D datatype.

class Vec3D

Bases: Vec3DExt

Datatype: A vector in 3D space.

def __init__(xyz)

Create a new instance of the Vec3D datatype.

class Vec4D

Bases: Vec4DExt

Datatype: A vector in 4D space.

def __init__(xyzw)

Create a new instance of the Vec4D datatype.