Skip to content

Refactor correct_invalid_trajectories to use NumPy/Shapely helpers #518

@schroedtert

Description

@schroedtert

The correct_invalid_trajectories feature in pedpy/preprocessing/trajectory_projector.py currently uses custom implementations for geometric calculations and Python loops for data processing. This issue tracks the refactoring to leverage Numpy's vectorization capabilities and Shapely's built-in geometric functions, which will improve performance, readability, and maintainability.

Benefits of refactoring:

  • Performance: Numpy vectorized operations are significantly faster than Python loops when processing large trajectory datasets
  • Reliability: Using well-tested library functions reduces the risk of bugs in geometric calculations
  • Maintainability: Less custom code means fewer potential error sources and easier future modifications
  • Readability: Library functions often express intent more clearly than custom implementations

Metadata

Metadata

Assignees

No one assigned

    Labels

    code qualityAnything related to increasing the code quality (e.g., refactoring, design patterns, ...)pre-processingAnything related to pre-processing the data

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions