Skip to content

fix(profiles): fix float arange grid overshoot and add RsetMethod.PERCENTILE - #590

Open
M-Colley wants to merge 1 commit into
PedestrianDynamics:mainfrom
M-Colley:fix/rset-map-grid-edges-and-percentile
Open

M-Colley wants to merge 1 commit into
PedestrianDynamics:mainfrom
M-Colley:fix/rset-map-grid-edges-and-percentile

Conversation

@M-Colley

Copy link
Copy Markdown

Summary

Fixes #581
Fixes #580

Changes

  1. Eliminate floating-point
    p.arange cell overshoot (compute_rset_map: float arange adds an extra column of cells #581):
    • Introduce _compute_grid_edges using
      _cells = max(1, math.ceil((max_val - min_val) / grid_size - 1e-12)) and min_val + grid_size * np.arange(n_cells + 1) across get_grid_cells, compute_rset_map, _compute_classic_density_profile, and _compute_mean_speed_profile.
    • For a 30 x 10 m geometry with grid_size=0.6, both get_grid_cells and compute_rset_map now produce (17, 50) cells without adding an out-of-bounds 51st column.
  2. Add RsetMethod.PERCENTILE and update RSET documentation (compute_rset_map: fix paper reference, add a percentile method #580):
    • Add RsetMethod.PERCENTILE with configurable percentile: float = 95.0 parameter ([0, 100]).
    • Fix the Schröder et al. (2020) reference in RsetMethod and compute_rset_map to Section 2.3, Eqs. 4-5 (doi:10.1016/j.firesaf.2020.103154), and document grid origin alignment, vertical row flipping (
      ow 0 corresponds to max_y), and rame / frame_rate time conversion.
  3. Unit tests: Add regression tests in ests/unit_tests/methods/test_rset_map.py covering 30 x 10 m at grid_size=0.6 (including boundary points at x = 30.0) and RsetMethod.PERCENTILE.

@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.93939% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.05%. Comparing base (0604d9a) to head (43231ae).

Files with missing lines Patch % Lines
pedpy/methods/profile_calculator.py 93.93% 2 Missing ⚠️

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compute_rset_map: float arange adds an extra column of cells compute_rset_map: fix paper reference, add a percentile method

1 participant