-
Notifications
You must be signed in to change notification settings - Fork 0
NormalizedTrajectory
Jason Frazier edited this page Jun 9, 2025
·
1 revision
A NormalizedTrajectory represents a single trajectory (track, path, or trip) that has been normalized to a local origin, ready for feature extraction and analysis.
-
points:
List[NormalizedPoint]
The sequence of normalized points in the trajectory. -
identifier:
str
The group or trajectory ID (as specified by your data andColumnConfig).
NormalizedTrajectory.from_df_group(
df: pd.DataFrame,
config: ColumnConfig
) -> NormalizedTrajectoryCreates a normalized trajectory from a DataFrame group and column config.
Normalization Details:
- If using
trajectory_type="geo":- The first latitude and longitude are used as the origin.
- Points are converted to meters (equirectangular approximation).
- Altitude is zeroed relative to the starting point.
- If using
trajectory_type="xyz":- The first point’s (x, y, z) is subtracted from all subsequent points.
from puddy import NormalizedTrajectory, ColumnConfig
import pandas as pd
df = pd.DataFrame([
{"lon": 10, "lat": 20, "alt": 100, "id": "A"},
{"lon": 10.1, "lat": 20.2, "alt": 105, "id": "A"}
])
config = ColumnConfig.create_geo(lon_col="lon", lat_col="lat", alt_col="alt", identifier_col="id")
traj = NormalizedTrajectory.from_df_group(df, config)
print(traj.points)
print(traj.identifier)