jupedsim-scenarios
Python toolkit for running, sweeping, and analyzing JuPedSim scenarios authored in the Web-Based JuPedSim editor.
Install
pip install jupedsim-scenarios
For development from a clone:
pip install -e ".[dev]"
Single-run usage
from jupedsim_scenarios import load_scenario, run_scenario
scenario = load_scenario("my_scenario.zip")
result = run_scenario(scenario, seed=42)
print(result.evacuation_time)
df = result.trajectory_dataframe()
result.cleanup()
load_scenario accepts a ZIP archive, a directory containing
<name>.json + <name>.wkt, or a single self-contained JSON file
(geometry embedded as walkable_area_wkt).
To build a Scenario in pure Python — without going through a
web-app export — see
examples/howtos/09_build_from_scratch.ipynb.
Already writing vanilla jupedsim code by hand? See
examples/howtos/12_from_vanilla_jupedsim.ipynb:
the same bottleneck study in ~45 lines of vanilla JuPedSim vs. ~10
lines here, plus a parameters × seeds sweep in one call.
Quick CLI: run a ZIP and bundle the trajectory
examples/run_zip.py loads a scenario ZIP,
runs it, prints summary metrics (evacuation time, wall-clock time,
agent counts), and writes <name>_run.zip containing the original
config.json + geometry.wkt plus trajectory.sqlite — ready to
drop back into the web app for visualization.
python examples/run_zip.py my_scenario.zip [seed]
Mutating a scenario — copy first, then assign
Scenario is a mutable object. Direct assignments and add_* /
remove_* / set_* calls all change the instance in place:
base = load_scenario(...)
base.seed = 99 # this mutates `base` — every later use sees seed=99
That's fine when you only want one variant. For sweeps or any time
you want to keep the original intact, call .copy() first and edit
the clone:
trial = base.copy()
trial.seed = 99
trial.max_simulation_time = 60
# base is untouched
run_sweep does this for you per trial. The pattern only matters
when you build variants manually (see
examples/howtos/11_sweep_via_copy.ipynb).
Monte Carlo sweep
from jupedsim_scenarios import load_scenario, run_sweep
base = load_scenario("faster_is_slower.zip")
sweep = run_sweep(
base,
axes={"v0": [0.8, 1.2, 1.6, 1.8]},
apply={"v0": lambda s, v: s.set_agent_params(0, desired_speed=v)},
seeds=range(40, 50),
workers=4,
)
df = sweep.to_dataframe()
print(df.groupby("v0")["evacuation_time"].agg(["mean", "std"]))
sweep.cleanup()
run_sweep walks the cartesian product of axes, applies each axis's
mutator to an isolated .copy() of the base, and runs the trials.
workers=0 uses one worker per CPU. For sweeps that need a different
scenario shape per trial — geometry that depends on the parameters,
journeys that vary — use run_sweep_from_factory instead.
For the plain seed sweep the CLI runs, run_local(scenario, out_dir=..., seeds=10, workers=4) loads the scenario, runs the seeds and writes
scenario.json plus sweep.json next to the trial sqlites, ready for
jps-scenarios report. It prints nothing; pass progress= to render
per-trial completion yourself.
For deeper coverage see the how-to notebooks:
05_sweep_basics— axes / apply / paired conditions10_sweep_save_load—SweepResult.save/load11_sweep_via_copy— factory sweeps andScenario.copy()
Population profiles
A scenario can describe a mixed crowd. Profiles are declared once at the top level and referenced by share from each spawn area:
{
"population_profiles": {
"adults": {
"desired_speed": {"mean": 1.44, "std": 0.29, "distribution": "gaussian"},
"radius": {"mean": 0.2, "std": null, "distribution": "constant"}
},
"older_adults": {
"desired_speed": {"mean": 1.04, "std": 0.27, "distribution": "gaussian"},
"radius": {"mean": 0.2, "std": null, "distribution": "constant"}
}
},
"distributions": {
"start": {"parameters": {"population_mix": [
{"profile": "adults", "share": 70},
{"profile": "older_adults", "share": 30}
]}}
}
}
Shares are integers of at least 1 and total 100. When a mix is present it
exclusively owns radius and desired speed for that area; areas without a
mix behave as before. With two or more groups, fixed-count areas assign
agents by largest-remainder counts shuffled with the seed, and flow areas
draw one seeded profile per arrival. Placement spacing uses twice the
largest effective mean radius, a heuristic that does not guarantee
non-overlap. Invalid mixes raise PopulationMixError.
load_population_presets() returns five bundled presets: general_population
(ages 10-85), children (5-12), young_people (13-29), adults (30-59) and
older_adults (60-80), all with radius 0.2 m. general_population is
weighted by the RiMEA standard population (age N(50, 20) truncated to
10-85); the other bands are weighted uniformly. Desired speeds are derived from
RiMEA 4.0.0 section 3.2.2.2 Abb. 3 (after Weidmann 1992) and were read from
a figure. The age bands, the radius, the Gaussian shape and the derivation
method are application choices. The values were reviewed by the maintainer on 2026-11-07. Method and provenance
are in scripts/population_presets/README.md.
Visualisation
Visualisation needs the optional viz extra (matplotlib + plotly):
pip install "jupedsim-scenarios[viz]"
Two entry points cover the common cases:
scenario = load_scenario("my_scenario.zip")
scenario.plot() # static geometry: distributions, exits, zones, checkpoints
result = run_scenario(scenario, seed=42)
result.visualise() # interactive plotly playback of the trajectory
result.visualise(save_path="run.html") # write a self-contained interactive page
Scenario.plot() returns a matplotlib Axes; pass ax= to draw into an
existing figure, or show_journeys=False / show_trajectories= to control
overlays. ScenarioResult.visualise() returns a plotly.graph_objects.Figure
that renders inline in Jupyter — just make it the last line of a cell. Frames
are subsampled automatically for long runs; override with every_nth_frame.
See 02_visualisation for a full
walkthrough.
Command line
jps-scenarios run scenario.json --seed 42 --out trajectory.sqlite
Runs a single scenario and prints a one-line JSON summary
(evacuation_time, agent counts, sqlite_file) to stdout. Useful in CI
or scripted pipelines; notebook workflows should stay on the Python API.
Documentation
API reference, bottleneck tutorial, and how-tos are built with Sphinx
and deployed on every push to main via GitHub Pages.
To build locally:
pip install -e .
pip install -r docs/requirements.txt
sphinx-build -b html docs/source docs/build/html
Roadmap
Shipped: see CHANGELOG.md. Current release: 0.11.0.
On the table for future releases:
- Greenfield
Scenario()constructor — a builder shape that doesn't require pre-loading a JSON template (R3.7 indocs/dev/api-design-cleanup.md). - Typed
Zone/Stageview classes with property setters, replacing theset_zone_speed_factor/set_checkpoint_waiting_timewrappers (R3.10). - Removal of the
v0/v0_std/v0_distributiondeprecated kwargs (currently still accepted withDeprecationWarning).
Concrete proposals are tracked under issues.
Citation
If jupedsim-scenarios supports work you publish, please cite the
upstream JuPedSim
project and link to this repository. A dedicated DOI for this
toolkit will be added once a Zenodo deposit is in place.
Contributing
See CONTRIBUTING.md for the dev install, local checks, and PR conventions.
License
MIT. See LICENSE.
Metadata
Release files for jupedsim-scenarios 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jupedsim_scenarios-0.11.0.tar.gz | 137.2 kB | With provenance | Details for jupedsim_scenarios-0.11.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jupedsim_scenarios-0.11.0-py3-none-any.whl | Python 3 | none | any | Details for jupedsim_scenarios-0.11.0-py3-none-any.whl |
Total release size: 227.5 kB
Release files / jupedsim_scenarios-0.11.0.tar.gz
| Download URL | jupedsim_scenarios-0.11.0.tar.gz |
|---|---|
| Size | 137.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9def71d925636f182d22b3465ee2396af95dc05cb28ac7e58cfcd8ad89aa0c87
|
|
BLAKE2b-256 checksum How to use checksums |
6f96e258d721a1d457b931dff33734ea9743206b44a6a0a17a92e4de198a9b8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / jupedsim_scenarios-0.11.0-py3-none-any.whl
| Download URL | jupedsim_scenarios-0.11.0-py3-none-any.whl |
|---|---|
| Size | 90.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc7871fcc04d21251ee8c922ce9ccc04174014fea4ae648c3d0f1cc5342ab642
|
|
BLAKE2b-256 checksum How to use checksums |
675709d67c6867c4ae62c93d172acb665c068027c6c14b013cb7d70a77fb427f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logSecurity for jupedsim-scenarios 0.11.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for jupedsim_scenarios-0.11.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.