jupedsim_scenarios.population#
Population mixes: validation and resolution of per-area profile shares.
A spawn area may carry parameters.population_mix, a list of
{"profile": id, "share": int} entries referencing the top-level
population_profiles map. Resolved groups are attached to each area’s
parameters under GROUPS_KEY, which is derived state and is rebuilt
on every initialisation.
Attributes#
Exceptions#
A population mix or a referenced profile is invalid; the run does not start. |
Functions#
|
Split |
|
Rebuild |
|
The packaged population presets. |
|
Refuse direct radius or speed settings on an area that has a mix. |
|
Resolved groups of a validated mix, in mix order. |
|
Reject invalid mixes and the profiles they reference before placement. |
Module Contents#
- exception PopulationMixError[source]#
Bases:
ValueErrorA population mix or a referenced profile is invalid; the run does not start.
- allocate_counts(shares: list[int], n: int) list[int][source]#
Split
nagents by percentage shares using the largest remainder.
- attach_population_groups(data: dict) None[source]#
Rebuild
GROUPS_KEYon every area from its current mix.
- reject_mix_owned_params(key: str, entry: dict, kwargs: dict) None[source]#
Refuse direct radius or speed settings on an area that has a mix.
- resolve_groups(mix: list, profiles: dict) list[dict][source]#
Resolved groups of a validated mix, in mix order.