TrajectoryCollection - jasonxfrazier/puddy GitHub Wiki

TrajectoryCollection

TrajectoryCollection is used to load, normalize, and group raw trajectory data in Puddy.
It supports loading from CSV, JSON, Parquet, Arrow, or in-memory DataFrames.


Initialization

from puddy import TrajectoryCollection

collection = TrajectoryCollection()

Methods

load_from_file

load_from_file(
    source: Union[str, TextIO, pd.DataFrame, pa.Table],
    config: Optional[ColumnConfig] = None,
    min_points: int = 20
) -> None

Loads trajectory data from file or in-memory object, groups and normalizes it.

  • source: Filename, file-like object, pandas DataFrame, or Arrow Table
  • config: ColumnConfig mapping of columns to X/Y/Z and identifier
  • min_points: Minimum number of points required per group/trajectory

visualize_sample

visualize_sample(n: int = 5) -> None

Plots a random sample of up to n trajectories in 3D.
If there are fewer than n, shows all available.


Attributes

  • trajectories: List of NormalizedTrajectory
    All trajectories that have been loaded, grouped, and normalized.

  • config: ColumnConfig or None
    The column mapping and coordinate type used for this collection.


See ColumnConfig for info on setting up coordinate/identifier mapping. See TrajectoryAnalyzer for feature extraction and anomaly detection.