column
¶
The telemetry column model: a column's name, split into its parts, together with its metadata.
Every column in a telemetry file is named Category/subgroup/...:attr (for example Bodies/box1/xpos:x). Column is the one place that builds and parses that grammar, so the writer (SignalManager.post) and any reader agree on it, and a name part that would corrupt it fails loudly at construction instead of silently landing in a different position.
MATRIX_ATTRS
module-attribute
¶
The attrs of a flattened 3x3 rotation matrix (xmat, ximat), which posts one column per element.
Column
¶
Bases: BaseModel
One telemetry column: its name parts and its metadata. str(column) is the column name as it appears in the telemetry file.
-
Code Reference
mujoco_mojoutils
category
instance-attribute
¶
Top-level category, e.g. Bodies (see SignalCategory for the built-in ones). Must not be empty or contain / or :.
subgroups
class-attribute
instance-attribute
¶
subgroups: tuple[_Part, ...] = ()
Folders under the category, e.g. ("box1", "xpos"). Empty parts are dropped; none may contain / or :.
attr
class-attribute
instance-attribute
¶
attr: _Part | None = Field(default=None)
The component or attribute name, e.g. x. An empty value is treated as unset; it may not contain / or :.
metadata
class-attribute
instance-attribute
¶
metadata: ColumnMetadata = Field(
default_factory=ColumnMetadata
)
Metadata persisted for this column in the telemetry file's footer. Validated when the column is built (a plain dict is accepted), so the per-timestep merges that produce it can skip validation.
parse
classmethod
¶
parse(
name: str, metadata: ColumnMetadata | None = None
) -> Column
Splits a column name into its parts; the exact inverse of str(). Raises ValueError for a malformed name (an empty part).
Each distinct name is parsed once per process and then served from a cache, so parsing every column of a large frame repeatedly costs a dictionary lookup per name. The returned Column is shared, which is safe because it is frozen.
Source code in src/mujoco_mojo/utils/column.py
covers
¶
True if other is this column or lies beneath it: the same category, other's subgroups start with this column's subgroups, and this column's attr is unset or equal to other's. Metadata is ignored.
A partial column therefore selects a whole subtree: Column(category="Bodies", subgroups=("box1",)) covers Bodies/box1/xpos:x and Bodies/box1:ke_trans.
Source code in src/mujoco_mojo/utils/column.py
__contains__
¶
child in parent, the same test as parent.covers(child); a name string is parsed first, and a string outside the telemetry grammar is never contained. Equality is untouched, so ==, hashing, and x in [columns] keep meaning exact match.
Source code in src/mujoco_mojo/utils/column.py
covering_pattern
¶
One anchored regex matching every column name that any of columns covers (see Column.covers), with every name part escaped so it matches literally.
It lets a frame select by Column inside polars' regex engine instead of parsing each column name in Python, which matters for frames with tens of thousands of columns.
Source code in src/mujoco_mojo/utils/column.py
fan_out
¶
fan_out(
category: str,
subgroups: tuple[str, ...],
attrs: Iterable[str],
metadata: ColumnMetadata | None = None,
) -> tuple[Column, ...]
One Column per attr, all sharing the same category, subgroups, and metadata (e.g. the x/y/z/m columns of a vector). Build these once and reuse them: SignalManager.post is called every timestep.
Source code in src/mujoco_mojo/utils/column.py
pose_column_names
cached
¶
pose_column_names(
source: Column | str,
pos_channel: str = "xpos",
quat_channel: str = "quat",
) -> tuple[tuple[str, ...], tuple[str, ...]]
The telemetry column names holding an object's pose: (x, y, z) position names and (w, x, y, z) quaternion names, in that order.
source names the object, e.g. Sites/A or Column(category="Sites", subgroups=("A",)), and gives Sites/A/xpos:x through Sites/A/quat:z for the default channels. Cached per source, so repeated lookups cost a dictionary hit. Raises ValueError if source names a single column (has an attr) instead of an object.
Source code in src/mujoco_mojo/utils/column.py
pose_missing_error
¶
pose_missing_error(
source: Column | str,
available: Iterable[str],
pos_channel: str = "xpos",
quat_channel: str = "quat",
) -> ValueError | None
A ValueError naming every pose column of source that is not in available, or None if the pose is complete.