How do I change a zone’s speed factor?#
A zone is a region of the walkable area that scales every agent’s
desired speed while the agent is inside it. A speed_factor of 1.0
means “no change,” values below 1.0 slow agents down, and values
above 1.0 speed them up.
Use set_zone_speed_factor(zone_id, factor) to update an existing
zone’s factor.
import logging
from datetime import datetime
# Silence jupedsim-scenarios' INFO/DEBUG output. See the howto
# "How do I inspect a scenario?" for the full list of levels.
logging.getLogger("jupedsim_scenarios").setLevel(logging.WARNING)
print(f"Executed on {datetime.now().strftime('%d.%m.%Y, %H:%M')}")
Executed on 21.07.2026, 09:45
Load a scenario that already contains a zone, then list zones to find the id you want to change:
from jupedsim_scenarios import load_scenario
scenario = load_scenario("../assets/bottleneck-zone")
scenario.list_zones()
[{'index': 0, 'id': 'jps-zones_0', 'speed_factor': 0.4}]
Apply the change by index or by string id — both forms work:
scenario.set_zone_speed_factor(0, 0.5) # by index
scenario.set_zone_speed_factor("jps-zones_0", 0.5) # by string id
Verify the change#
There’s no dedicated getter. Read the underlying dict to confirm the new factor:
scenario.zones["jps-zones_0"]["speed_factor"]
0.5
When to use this#
Zones are useful when you want a region-specific speed change without authoring a new geometry. Typical uses:
Stairs: slow agents to a realistic stair-climbing speed.
Narrow corridors: model a local slowdown without changing individual agent speeds.
Parameter sweeps: vary the factor across trials with
run_sweep(see How do I sweep parameters?).