PedestrianDynamics / PedestrianDynamics/PedPy
Add option to preserve additional columns when loading from txt
Nobody has claimed this yet.
- Dominant language
- Pascal
- Stars
- 35
- Forks
- 18
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 2
Description
Summary
Add a parameter to load_trajectory_from_txt that preserves columns beyond the standard id, frame, x, y instead of silently dropping them.
Background / Context
The txt loader currently uses usecols=[0, 1, 2, 3] in pd.read_csv, discarding any columns past the first four. Users who have extra data in their txt files (e.g. z, group id, or other per-agent attributes) lose it on load. Constructing TrajectoryData directly from a DataFrame already preserves extra columns, so the file-based loader is inconsistent with the direct construction path.
Technical Details
- Column selection happens in
_load_trajectory_data_from_txtviausecols=[0, 1, 2, 3]andnames=[ID_COL, FRAME_COL, X_COL, Y_COL] - The txt format has no column headers, so extra columns beyond the standard four have no names — the parameter should accept an optional mapping or list of names for those columns
TrajectoryData.__post_init__already passes extra columns through unchanged, so no changes needed there
Acceptance Criteria
-
load_trajectory_from_txtaccepts a new optional parameter to preserve additional columns - Extra columns are accessible on
traj.dataafter loading - When the parameter is not set, existing behaviour is unchanged (extra columns are dropped)
- New behaviour is covered by tests
- New parameter is documented in the API reference
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with load_trajectory_from_txt and _load_trajectory_data_from_txt, especially the pd.read_csv usecols and names arguments described in the issue. Add tests for preserving named extra columns and for unchanged default behavior, then update the API reference; done means extra values are available on traj.data while the default still drops them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100