jupedsim_scenarios.runner#
High-level helpers for loading and running JuPedSim web-UI scenario JSON files.
A thin scenario layer on top of the simulation primitives in utils.simulation_init and shared.direct_steering_runtime. Used by the trajectory regression test and the scripts/run_scenario.py CLI; the web runtime itself goes through services.simulation_service.
This module replaced the previous backend/core/scenario.py mirror — see the chore/drop-core-mirror PR. The longer-term plan is to migrate to jupedsim.internal.scenarios (jupedsim PR #1565) once it lands upstream.
Usage:
from scenarios import load_scenario, run_scenario
scenario = load_scenario("scenario.zip")
print(scenario.summary())
result = run_scenario(scenario)
print(result.metrics)
df = result.trajectory_dataframe()
Classes#
A loaded scenario ready for inspection and execution. |
|
Results from running a scenario. |
Functions#
|
Load a scenario ZIP or directory exported from the JuPedSim web UI. |
|
Run a scenario with the same shared setup/runtime semantics as the web app. |
Module Contents#
- class Scenario[source]#
A loaded scenario ready for inspection and execution.
- copy(**overrides) Scenario[source]#
Return an independent deep copy of this scenario, with optional field overrides.
- plot(ax=None)[source]#
Plot the scenario geometry with labeled distributions, exits, zones, and checkpoints.
Returns the matplotlib Axes so callers can further customise the figure.
- set_agent_params(distribution_id: int | str, **kwargs)[source]#
Set agent parameters for a distribution.
Supported keys: radius, desired_speed (or v0), radius_distribution, radius_std, desired_speed_distribution (or v0_distribution), desired_speed_std (or v0_std), use_flow_spawning, flow_start_time, flow_end_time, distribution_mode, number.
- set_checkpoint_waiting_time(checkpoint_id: int | str, waiting_time: float)[source]#
Set the waiting time for a checkpoint/stage.
- set_flow_schedule(distribution_id: int | str, schedule: list[dict], *, keep_initial_agents: bool = False)[source]#
Attach a time-windowed inflow schedule to one source distribution.
- class ScenarioResult[source]#
Results from running a scenario.
- trajectory_dataframe()[source]#
Load trajectory data into a pandas DataFrame.
Columns: frame, id, x, y, ori_x, ori_y