Trajectory¶

class standard_e2e.data_structures.Trajectory(data=None, score=None, time_lattice=None)[source]¶

Bases: object

Single trajectory data container (numpy) with helpers for processing.

  • Components: 1D np.float32 arrays of equal length N.

  • Accepts shapes (N,) or (N,1) from ndarray/list/tuple; stored as (N,).

  • Auto IS_VALID: first non-IS_VALID set -> is_valid = 1;

    user-provided IS_VALID overrides.

  • score: optional scalar (float).

  • get(one or many, strict=True) -> (N, K) np.float32.

  • pad/trim/pad_or_trim with zeros; padded rows marked invalid via is_valid zeros.

Parameters:
components()[source]¶

List the trajectory components currently stored.

Return type:

List[TrajectoryComponent]

get(components, *, strict=True)[source]¶

Fetch one or more components as a stacked (N, K) array.

Return type:

ndarray

Parameters:
has(component)[source]¶

Check if a trajectory component is present.

Return type:

bool

Parameters:

component (TrajectoryComponent)

property isEmpty: bool¶

Check if the trajectory is empty or has no valid data.

property length: int¶

Return the number of timesteps stored in this trajectory. If no data has been added yet, this returns 0. :returns: Number of timesteps (rows) in the trajectory. :rtype: int

pad(target_length, *, side='right')[source]¶

Pad all components with zeros to target_length (left/right).

Return type:

Trajectory

Parameters:
  • target_length (int)

  • side (str)

pad_or_trim(target_length, *, side='right')[source]¶

Pad or trim to target_length depending on current length.

Return type:

Trajectory

Parameters:
  • target_length (int)

  • side (str)

resample(time_lattice, inplace=False)[source]¶

Resample trajectory components onto a new time lattice using linear interpolation.

Parameters:
Returns:

Modified trajectory with resampled data.

Return type:

Trajectory

Raises:

ValueError – If TIMESTAMP component is missing or time_lattice is invalid.

set(component, values)[source]¶

Add or replace a trajectory component, enforcing length consistency.

Return type:

Trajectory

Parameters:
set_many(mapping)[source]¶

Set multiple components in one call, respecting IS_VALID ordering.

Return type:

Trajectory

Parameters:

mapping (Mapping[TrajectoryComponent, ndarray | List[float] | List[int] | Tuple[float, ...] | Tuple[int, ...]])

trim(target_length, *, side='right')[source]¶

Trim components to target_length from the specified side.

Return type:

Trajectory

Parameters:
  • target_length (int)

  • side (str)