PedestrianDynamics / PedestrianDynamics/PedPy

Add fill strategy parameter to individual speed and accleration computation for border frames

Open
#552 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

speed usability
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_EXCLUDE drops rows via .dropna(), BORDER_ADAPTIVE drops rows via result[result.window_size > 0] — these are the two cases the new parameter targets
  • BORDER_SINGLE_SIDED already produces a full-length result and is unaffected
  • Proposed fill options: NaN (insert NaN at dropped positions), last_value (forward/backward fill from the nearest valid value)

Acceptance Criteria

  • New fill parameter added to both compute_individual_speed and compute_individual_acceleration
  • Output DataFrame has the same number of rows as the input when the parameter is set (to be discussed)
  • NaN fill and last_value fill are both supported
  • Parameter has no effect when BORDER_SINGLE_SIDED is 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.