Skip to content

feat(io): add extra_columns option to preserve additional columns when loading txt trajectories - #592

Open
M-Colley wants to merge 2 commits into
PedestrianDynamics:mainfrom
M-Colley:feat/preserve-extra-columns-in-txt-loader
Open

M-Colley wants to merge 2 commits into
PedestrianDynamics:mainfrom
M-Colley:feat/preserve-extra-columns-in-txt-loader

Conversation

@M-Colley

Copy link
Copy Markdown

Summary

Fixes #553
Fixes #534

Adds an optional extra_columns parameter to load_trajectory_from_txt (and load_trajectory) so columns beyond the standard id, rame, x, y (such as z, marker_id, or group) can be preserved on raj.data instead of being dropped:

  • Default (extra_columns=None): Existing behavior is completely unchanged (usecols=[0, 1, 2, 3]).
  • Sequence of names (extra_columns=["z", "marker_id"]): Preserves consecutive columns starting at 0-based index 4.
  • Index-to-name mapping (extra_columns={4: "z", 6: "marker_id"}): Preserves arbitrary column indices >= 4 (sorted internally so pandas.read_csv maps names accurately regardless of dict insertion order).
  • Validation: Rejects bare strings, indices < 4, duplicate names, reserved column names (id, rame, x, y, point), and out-of-range indices with descriptive PedPyTypeError / PedPyValueError messages.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to preserve additional columns when loading from txt Include handling of z-component and markerIDs in trajectory file

1 participant