Skip to content

Custom Data

rerun

class AnyValues

Bases: AsComponents

Helper to log arbitrary values as a bundle of components.

def __init__(**kwargs)

Construct a new AnyValues bundle.

Each kwarg will be logged as a separate component using the provided data. - The key will be used as the name of the component - The value must be able to be converted to an array of arrow types. In general, if you can pass it to pyarrow.array, you can log it as a extension component.

All values must either have the same length, or be singular in which case they will be treated as a splat.

Note: rerun requires that a given component only take on a single type. The first type logged will be the type that is used for all future logs of that component. The API will make a best effort to do type conversion if supported by numpy and arrow. Any components that can't be converted will be dropped.

If you are want to inspect how your component will be converted to the underlying arrow code, the following snippet is what is happening internally:

np_value = np.atleast_1d(np.array(value, copy=False))
pa_value = pa.array(value)

Example
rr.log(
    "any_values",
    rr.AnyValues(
        foo=[1.2, 3.4, 5.6],
        bar="hello world",
    ),
)