Trajectory¶
- class standard_e2e.data_structures.Trajectory(data=None, score=None, time_lattice=None)[source]¶
Bases:
objectSingle 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:
- get(components, *, strict=True)[source]¶
Fetch one or more components as a stacked
(N, K)array.- Return type:
- Parameters:
components (TrajectoryComponent | Sequence[TrajectoryComponent])
strict (bool)
- has(component)[source]¶
Check if a trajectory component is present.
- Return type:
- Parameters:
component (TrajectoryComponent)
- 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:
- Parameters:
- pad_or_trim(target_length, *, side='right')[source]¶
Pad or trim to
target_lengthdepending on current length.- Return type:
- Parameters:
- 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:
- 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.