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
Summary
Add a new parameter to
compute_individual_speedandcompute_individual_accelerationthat 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_EXCLUDEandBORDER_ADAPTIVEboth 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_SIDEDalready preserves the full length and serves as a reference for the expected output shape.Technical Details
compute_individual_speed(pedpy/methods/speed_calculator.py),compute_individual_acceleration(pedpy/methods/acceleration_calculator.py)pedpy/methods/method_utils.pyBORDER_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 unaffectedNaN(insertNaNat dropped positions),last_value(forward/backward fill from the nearest valid value)Acceptance Criteria
compute_individual_speedandcompute_individual_accelerationNaNfill andlast_valuefill are both supportedBORDER_SINGLE_SIDEDis used