Skip to content

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

Description

@schroedtert

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    speedAnything related to computing the speedusabilityAnything increasing the usablity

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions