Skip to content

RSET Maps#523

Open
chraibi wants to merge 10 commits intoPedestrianDynamics:mainfrom
chraibi:rset
Open

RSET Maps#523
chraibi wants to merge 10 commits intoPedestrianDynamics:mainfrom
chraibi:rset

Conversation

@chraibi
Copy link
Collaborator

@chraibi chraibi commented Mar 14, 2026

closes #508

@chraibi chraibi marked this pull request as draft March 14, 2026 13:25
@chraibi chraibi changed the title Rset RSET Mar 14, 2026
@chraibi chraibi changed the title RSET RSET Maps Mar 14, 2026
cb_label = kwargs.pop("cb_label", None)
color_by_column = kwargs.pop("color_by_column", None)
voronoi_colormap = plt.get_cmap(kwargs.pop("cmap", "YlGn"))
voronoi_colormap = plt.get_cmap(kwargs.pop("cmap", "YlGng"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a typo

@chraibi chraibi marked this pull request as ready for review March 17, 2026 14:57
@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.44%. Comparing base (29f9126) to head (2ad2f4b).

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Collaborator

@schroedtert schroedtert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only some minor things, but overall it looks great!

Comment on lines +1123 to +1124
if not isinstance(traj_data, TrajectoryData):
raise PedPyTypeError(f"`traj_data` must be an instance of TrajectoryData, got {type(traj_data).__name__}.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't check this anywhere else, not sure if we should add a test here. Otherwise, we would also have to check the other parameters. I think use type hints should be enough, as the dynamic types are a Python property

Comment on lines +230 to +247
def test_plot_rset_map_preserves_title_and_labels():
"""Title and axis labels set by plot_rset_map must survive the
internal call to plot_walkable_area."""
walkable_area = WalkableArea(shapely.box(0, 0, 2, 2))
rset_map = np.array([[np.nan, 1.0], [2.0, 3.0]])

fig, ax = plt.subplots()
returned_ax = plot_rset_map(
walkable_area=walkable_area,
rset_map=rset_map,
axes=ax,
title="Custom Title",
)

assert returned_ax.get_title() == "Custom Title"
assert "x" in returned_ax.get_xlabel().lower()
assert "y" in returned_ax.get_ylabel().lower()
plt.close(fig)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved to a plotting unit test file as here not the rset functionality but the plotting is tested. Currently, plotting is not tested at all, we should discuss, if this is something we want and need

from pedpy.methods.profile_calculator import RsetMethod, compute_rset_map
from pedpy.plotting.plotting import plot_rset_map

matplotlib.use("Agg")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this import do?

Comment on lines +16 to +24
def _make_traj(
ids: list[int],
frames: list[int],
xs: list[float],
ys: list[float],
frame_rate: float = 1.0,
) -> TrajectoryData:
df = pd.DataFrame({"id": ids, "frame": frames, "x": xs, "y": ys})
return TrajectoryData(data=df, frame_rate=frame_rate)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something which can be moved to tests/utils as it can be reused by other tests, see https://github.com/PedestrianDynamics/PedPy/pull/515/changes#diff-fa021950f52f334d684b781cb14faca79bcf9802d1bb292d732377eb99ae5bc4R33-R44

")\n",
"plt.show()"
]
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add hide-input as cell tag (as the other plotting cells)

" walkable_area=walkable_area,\n",
" rset_map=rset_min,\n",
" axes=ax1,\n",
" title=\"RSET (min)\",\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add the time here too? As for RSET with max

" walkable_area=walkable_area,\n",
" rset_map=rset_mean,\n",
" axes=ax2,\n",
" title=\"RSET (mean)\",\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add the time here too? As for RSET with max

"- **MIN**: earliest time any pedestrian was observed in each cell\n",
"- **MEAN**: average time pedestrians were observed in each cell\n",
"\n",
"> **Note:** Cells with no trajectory data contain *NaN*. Use `np.nanmax`, `np.nanmin`, etc. instead of `np.max`/`np.min` when computing summary statistics from the returned array.\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better use:

:::{note}
Cells with no trajectory data contain *NaN*. Use `np.nanmax`, `np.nanmin`, etc. instead of `np.max`/`np.min` when computing summary statistics from the returned array
:::

This will create something like this:

Image

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.

RSET Maps

2 participants