jupedsim_scenarios.simulation_init#

Attributes#

Functions#

build_agent_path_state(→ dict[str, Any] | None)

Build DS routing state as origin->weighted-next mapping.

create_agent_parameters(model_type, position, params)

Create appropriate agent parameters based on the model type

dry_run_static_placement(→ list[tuple[float, float]])

Run the real placer for one static start area without a simulation.

fallback_placement_index(→ int)

Position of dist_id in the fallback path's distribution list.

initialize_simulation_from_json(→ tuple[dict[str, ...)

Initialize a JuPedSim simulation from a JSON configuration with fallback logic.

install_if_missing(pip_name[, import_name])

Pip install missing packages.

is_package_installed(→ bool)

Check if packages is installed.

uses_complete_config(→ bool)

True when the journeys_v2 path runs; False selects the fallback path.

Module Contents#

build_agent_path_state(variant_data: dict[str, Any], journey_key: str | None, transitions: list[dict[str, Any]], direct_steering_info: dict[str, dict[str, Any]], waypoint_routing: dict[str, Any] | None, seed: int, agent_id: int, agent_radius: float = 0.2) dict[str, Any] | None[source]#

Build DS routing state as origin->weighted-next mapping.

create_agent_parameters(model_type: str, position: tuple, params: dict, global_params=None, journey_id=None, stage_id=None)[source]#

Create appropriate agent parameters based on the model type

dry_run_static_placement(data: dict[str, Any], walkable_polygon: shapely.geometry.Polygon, dist_id: str, requested_count: int, seed: int) list[tuple[float, float]][source]#

Run the real placer for one static start area without a simulation.

Uses the same spawn area, radius, distances and seed derivation as the run that initialize_simulation_from_json() performs for seed, so a scenario that passes here places the same agents in the real run. Raises whatever the run would raise (the capacity ValueError or jupedsim’s AgentNumberError).

fallback_placement_index(data: dict[str, Any], dist_id: str) int[source]#

Position of dist_id in the fallback path’s distribution list.

Mirrors the filter in _initialize_with_fallback() (a distribution counts when it has at least three coordinates); the fallback placer seeds start area i with seed + i.

initialize_simulation_from_json(json_path: str, simulation: jupedsim.Simulation, walkable_area: pedpy.WalkableArea, seed: int = 42, model_type: str = 'CollisionFreeSpeedModel', global_parameters=None) tuple[dict[str, Any], list[tuple[float, float]], dict[int, float], dict[str, Any]][source]#

Initialize a JuPedSim simulation from a JSON configuration with fallback logic.

install_if_missing(pip_name: str, import_name: str | None = None)[source]#

Pip install missing packages.

is_package_installed(import_name: str) bool[source]#

Check if packages is installed.

uses_complete_config(data: dict[str, Any]) bool[source]#

True when the journeys_v2 path runs; False selects the fallback path.

Journey Definition v2 (issue #376) is the only journey path. The fallback runs when no distribution has journeys or a journey is missing altogether.

clip_exit_to_walkable[source]#
find_nearest_exit[source]#
logger[source]#
random_point_in_polygon[source]#
required_packages = [('jupedsim', 'jupedsim'), ('shapely', 'shapely'), ('numpy', 'numpy'), ('matplotlib',...[source]#
sample_agent_values[source]#