TrajectoryFile
TrajectoryFile(trajectory_file: DotNetTrajectoryFile) -> NonePython wrapper around OakEmu's end-of-episode TrajectoryFile.
Initialize the wrapper.
Parameters:
trajectory_file(TrajectoryFile) – The underlying .NETTrajectoryFile.
Properties
action_map
action_map: tuple[str, ...]Return the action names stored in the trajectory map.
Returns:
tuple[str, ...]– The action names as a tuple.
actions
actions: bytesReturn the action indices up to the last interesting marker.
Returns:
bytes– The action indices as one contiguous byte buffer.
captured_expression_labels
captured_expression_labels: tuple[str, ...]Return the captured value labels, in marker value order.
Returns:
tuple[str, ...]– The labels as a tuple.
emulator_type
emulator_type: intReturn the OakEmu emulator type.
Returns:
int– The emulator type value.
end_state
end_state: bytes | NoneReturn the snapshot at the last interesting marker, if present.
Returns:
bytes | None– The last interesting-marker snapshot, orNone.
end_values
end_values: dict[str, int]Return the values captured at the last interesting marker.
Returns:
dict[str, int]– The last interesting-marker values dictionary.
episode_actions
episode_actions: bytesReturn the full episode action indices.
Returns:
bytes– The full episode action indices as one contiguous byte buffer.
episode_end_state
episode_end_state: bytesReturn the snapshot at the end marker.
Returns:
bytes– The end-of-episode snapshot bytes.
episode_end_values
episode_end_values: dict[str, int]Return the values captured at the end marker.
Returns:
dict[str, int]– The episode-end values dictionary.
frame_skip
frame_skip: intReturn the frame-skip value stored in the trajectory.
Returns:
int– The frame-skip value.
frame_stack_definitions
frame_stack_definitions: tuple[FrameStackDefinition, ...]Return the frame stack definitions stored in the episode block.
Returns:
tuple[FrameStackDefinition, ...]– The definitions, empty when the trajectory carries no frame stacks.
has_end_state
has_end_state: boolReturn whether the episode contains at least one interesting marker.
Returns:
bool–Truewhen an interesting marker is present.
initial_state
initial_state: bytesReturn the serialised emulator state at the start of the episode.
Returns:
bytes– The initial emulator state bytes.
interesting_markers
interesting_markers: tuple[TrajectoryMarker, ...]Return only interesting-point markers.
Returns:
tuple[TrajectoryMarker, ...]– The interesting markers as Python dataclasses.
markers
markers: tuple[TrajectoryMarker, ...]Return the ordered markers emitted for the episode.
Returns:
tuple[TrajectoryMarker, ...]– The markers as Python dataclasses.
screen_type
screen_type: intReturn the OakEmu screen type.
Returns:
int– The screen type value.
start_values
start_values: dict[str, int]Return the values captured at the start marker.
Returns:
dict[str, int]– The start values dictionary.
trigger_definitions
trigger_definitions: tuple[TrajectoryTriggerDefinition, ...]Return the trigger definitions stored in the episode block.
Returns:
tuple[TrajectoryTriggerDefinition, ...]– The trigger definitions as Python dataclasses.
Methods
from_dotnet
from_dotnet(trajectory_file: DotNetTrajectoryFile) -> TrajectoryFileWrap an existing .NET TrajectoryFile.
Parameters:
trajectory_file(TrajectoryFile) – The .NET object to wrap.
Returns:
TrajectoryFile– The wrapped trajectory.
interesting_segments
interesting_segments() -> tuple[TrajectorySegment, ...]Split the full episode into boundary-to-boundary segments ending at interesting or final markers.
Adjacent interesting markers with no intervening action block are treated as the same boundary and do not create zero-length segments.
Returns:
tuple[TrajectorySegment, ...]– The derived interesting segments in episode order.
load
load(path: str | PathLike) -> TrajectoryFileLoad a trajectory file from disk. Compressed files, for example .oet.zst, are decompressed automatically.
Parameters:
path(str | PathLike) – Source path.
Returns:
TrajectoryFile– The loaded wrapper.
save
save(path: str | PathLike) -> NoneSave the trajectory file.
Parameters:
path(str | PathLike) – Destination path.