unilab.tasks.motion_tracking.common.motion_loader.MotionLoader

class unilab.tasks.motion_tracking.common.motion_loader.MotionLoader[source]

Bases: object

Loads and provides access to motion data from NPZ files.

Parameters:

Methods

__init__(motion_file[, body_indices])

Initialize motion loader.

clip_end_frames_torch(device)

Return immutable clip end frames as a device-resident Torch table.

clip_offsets_torch(device)

Return immutable clip start frames as a device-resident Torch table.

get_clip_indices(frame_idx)

Map global frame indices to clip indices.

motion_features_torch(device)

Return the immutable motion feature table on the requested device.

__init__(motion_file, body_indices=None)[source]

Initialize motion loader.

Parameters:
  • motion_file (str | Sequence[str]) – Path to one NPZ file, or a sequence of NPZ files

  • body_indices (Sequence[int] | None) – Optional indices into the NPZ body axis. The exported motion files currently keep MuJoCo body-id layout, so these indices are expected to follow that convention.

get_clip_indices(frame_idx)[source]

Map global frame indices to clip indices.

Parameters:

frame_idx (ndarray)

Return type:

ndarray

motion_features_torch(device)[source]

Return the immutable motion feature table on the requested device.

NPZ parsing and validation remain inside this cold-path leaf. Runtime consumers receive one contiguous float32 table with columns packed in the documented motion-feature order rather than mutable NumPy arrays.

Parameters:

device (str | device)

Return type:

Tensor

clip_offsets_torch(device)[source]

Return immutable clip start frames as a device-resident Torch table.

Parameters:

device (str | device)

Return type:

Tensor

clip_end_frames_torch(device)[source]

Return immutable clip end frames as a device-resident Torch table.

Parameters:

device (str | device)

Return type:

Tensor