PedestrianDynamics / PedestrianDynamics/PedPy
Add fill strategy parameter to individual speed and accleration computation for border frames
Nobody has claimed this yet.
- Dominant language
- Pascal
- Stars
- 35
- Forks
- 18
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 2
Description
Summary
Add a new parameter to compute_individual_speed and compute_individual_acceleration that controls how border frames — positions where the result is currently dropped — are filled, so the output DataFrame always has the same length as the input.
Background / Context
BORDER_EXCLUDE and BORDER_ADAPTIVE both drop rows at the trajectory boundaries where the window cannot be fully computed, shortening the result. This complicates downstream use cases where a 1:1 alignment between trajectory rows and computed values is expected (e.g. merging with other per-frame data or exporting). BORDER_SINGLE_SIDED already preserves the full length and serves as a reference for the expected output shape.
Technical Details
- Affected functions:
compute_individual_speed(pedpy/methods/speed_calculator.py),compute_individual_acceleration(pedpy/methods/acceleration_calculator.py) - Border handling logic lives in
pedpy/methods/method_utils.py BORDER_EXCLUDEdrops rows via.dropna(),BORDER_ADAPTIVEdrops rows viaresult[result.window_size > 0]— these are the two cases the new parameter targetsBORDER_SINGLE_SIDEDalready produces a full-length result and is unaffected- Proposed fill options:
NaN(insertNaNat dropped positions),last_value(forward/backward fill from the nearest valid value)
Acceptance Criteria
- New fill parameter added to both
compute_individual_speedandcompute_individual_acceleration - Output DataFrame has the same number of rows as the input when the parameter is set (to be discussed)
-
NaNfill andlast_valuefill are both supported - Parameter has no effect when
BORDER_SINGLE_SIDEDis used - Existing default behaviour (dropping border rows) is unchanged when the parameter is not set
- 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 compute_individual_speed in pedpy/methods/speed_calculator.py and compute_individual_acceleration in pedpy/methods/acceleration_calculator.py, then inspect the border handling in pedpy/methods/method_utils.py. Clarify the fill parameter and its NaN and last_value semantics, preserve the default dropping behavior, and add tests plus API-reference documentation covering both functions and BORDER_SINGLE_SIDED.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100