Dataframe
dataframe
¶
ColumnManifest
¶
Bases: TypedDict
Manifest of all columns available for plotting.
rotatable_vectors
instance-attribute
¶
All columns in self.all which are available be rotated using self.available_quats.
available_quats
instance-attribute
¶
All quaternion names which have enough information to rotate self.rotateable_vectors.
column_metadata
instance-attribute
¶
All per-column signal metadata keyed by column name. Contains all metadata keys (e.g. unit, dimension, custom keys) for every column that has any metadata. Populated only when column_metadata is passed to get_manifest().
MojoNamespace
¶
Enhanced Polars DataFrame for MuJoCo Mojo telemetry.
Supports hierarchical signal filtering and common physics transformations.
Source code in src/mujoco_mojo/utils/dataframe.py
rotatable_bases
property
¶
Returns the unique base names for 3-component vectors (x, y, z).
quaternion_bases
property
¶
Returns the unique base names for 4-component quaternions (w, x, y, z).
rotatable_columns
property
¶
Returns column names ending in :x, :y, or :z (excluding quaternions which end with :w).
quaternion_columns
property
¶
Returns all columns that form a full quaternion group. Specifically looks for columns ending with quat:w, quat:x, quat:y, quat:z.
select_category
¶
select_category(
category: SignalCategory | str,
) -> MojoDataFrame
Filter columns belonging to a specific SignalCategory (e.g., 'Bodies').
select_name
¶
select_name(name: str) -> MojoDataFrame
General filter for columns associated with a specific object name (e.g., 'racket').
Source code in src/mujoco_mojo/utils/dataframe.py
select_channel
¶
select_channel(channel: str) -> MojoDataFrame
Selects all components of a specific channel across any category.
Matches the logical 'folder' before the attribute separator. Example: 'xpos' matches 'Bodies/Hand/xpos:x' and 'Bodies/Hand/xpos:y'.
Source code in src/mujoco_mojo/utils/dataframe.py
select_attribute
¶
select_attribute(attr: str) -> MojoDataFrame
Selects a specific attribute across all categories and objects. Matches columns ending in ':attr' (e.g. attr='x' matches 'Bodies/racket/xpos:x' and 'Sensors/gyro/data:x').
Source code in src/mujoco_mojo/utils/dataframe.py
select_path_part
¶
select_path_part(part: str) -> MojoDataFrame
Selects any column whose full path contains part as a substring, anywhere.
Unlike the other select_* methods, this does not anchor to a specific position in the path (category, name, channel, or attribute) - it matches part wherever it appears.
Example
select_path_part("racket") matches Bodies/racket/xpos:x, Custom/MyGroup:racket, and Bodies/racket_arm/xpos:x.
Source code in src/mujoco_mojo/utils/dataframe.py
select_joint
¶
select_joint(name: JointName) -> MojoDataFrame
Select all signals belonging to a specific Joint (qpos, qvel, etc.).
Source code in src/mujoco_mojo/utils/dataframe.py
select_site
¶
select_site(name: SiteName) -> MojoDataFrame
Select all signals recorded at a specific Site.
select_geom
¶
select_geom(name: GeomName) -> MojoDataFrame
Select all signals associated with a specific Geom (contacts, etc.).
select_sensor
¶
select_sensor(name: SensorName) -> MojoDataFrame
Select data from a specific named Sensor.
select_actuator
¶
select_actuator(name: ActuatorName) -> MojoDataFrame
Select data from a specific Actuator.
select_tendon
¶
select_tendon(name: TendonName) -> MojoDataFrame
Select data from a specific Tendon.
select_camera
¶
select_camera(name: CameraName) -> MojoDataFrame
Select pose or FOV data from a specific Camera.
select_light
¶
select_light(name: LightName) -> MojoDataFrame
Select pose or intensity data from a specific Light.
select_equality
¶
select_equality(name: EqualityName) -> MojoDataFrame
Select force/error data from an Equality constraint.
select_plugin
¶
select_plugin(name: InstanceName) -> MojoDataFrame
Select custom state data from a specific Plugin Instance.
select_flex
¶
select_flex(name: FlexName) -> MojoDataFrame
Select vertex/stress data from a Deformable Flex object.
get_manifest
¶
get_manifest(
extra_columns: list[str] | None = None,
column_metadata: dict[str, dict[str, Any]]
| None = None,
) -> ColumnManifest
Returns the structured manifest used by the frontend. extra_columns are appended to all and included in rotatable/quat discovery. Pass column_metadata (from read_column_metadata()) to populate column_units.
Source code in src/mujoco_mojo/utils/dataframe.py
with_unit_system
¶
with_unit_system(
target: UnitSystem,
*,
path: Path | str | None = None,
column_metadata: dict[str, dict[str, Any]]
| None = None,
assume_source: UnitSystem | None = None,
) -> MojoDataFrame
Converts all columns with known units into the target unit system.
For each column whose metadata carries a concrete "unit" key, applies a unit conversion from that stored unit into the equivalent unit in target. If assume_source is given, columns that only carry a "dimension" key (no concrete unit) are treated as if their source unit is the corresponding unit in assume_source, so they are converted too.
All conversions are collected and applied in a single with_columns() call (Polars handles the vectorised execution across columns), so this is equivalent in cost to one pass over the data regardless of how many unit groups there are.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
UnitSystem
|
The target unit system (e.g. |
required |
path
|
Path | str | None
|
Path to the parquet file to read column metadata from. Used when |
None
|
column_metadata
|
dict[str, dict[str, Any]] | None
|
Pre-loaded metadata dict (from |
None
|
assume_source
|
UnitSystem | None
|
When set, columns with only a |
None
|
Source code in src/mujoco_mojo/utils/dataframe.py
| Python | |
|---|---|
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | |
with_rotation
¶
Rotates all 3D vectors into a new frame using the specified quaternion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quat_base
|
str
|
Prefix for the [w,x,y,z] quaternion group. |
required |
invert
|
bool
|
If True, performs World to Local transformation (use False with the same |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
MojoDataFrame
|
DataFrame with transformed :x, :y, :z columns. |
Source code in src/mujoco_mojo/utils/dataframe.py
with_filter_map
¶
with_filter_map(
filter_map: dict[str, list[AnyFilter]],
omit_time: bool = True,
) -> MojoDataFrame
Applies specific filter stacks to mapped columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filter_map
|
dict[str, list[AnyFilter]]
|
Dictionary mapping column names to a list of filters. |
required |
omit_time
|
bool
|
If True, skips the 'time' column even if present in the map. Defaults to True. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
MojoDataFrame
|
DataFrame with the transformed columns overwritten. |
Source code in src/mujoco_mojo/utils/dataframe.py
with_filters
¶
with_filters(
filters: list[AnyFilter],
columns: list[str] | None = None,
omit_time: bool = True,
) -> MojoDataFrame
Applies a sequential stack of filters to the specified or all numeric columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filters
|
list[AnyFilter]
|
List of Filter objects to apply in order (e.g., LowPass -> Derivative). |
required |
columns
|
list[str] | None
|
Specific columns to transform. If None, applies to all available columns. Defaults to None. |
None
|
omit_time
|
bool
|
If True, prevents filters from being applied to the 'time' column. Defaults to True. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
MojoDataFrame
|
DataFrame with the transformed columns overwritten. |
Source code in src/mujoco_mojo/utils/dataframe.py
read_column_metadata
¶
Reads the per-column metadata dict from the parquet file footer written by SignalManager. Returns an empty dict if the file has no embedded metadata.