Scenario and scene objects.

Summary of Module Members



A compiled Scenic scenario, from which scenes can be sampled.


A scene generated from a Scenic scenario.

Member Details

class Scene(workspace, objects, egoObject, params)[source]

Bases: object

A scene generated from a Scenic scenario.

  • objects (tuple(Object)) – All objects in the scene. The ego object is first.

  • egoObject (Object) – The ego object.

  • params (dict) – Dictionary mapping the name of each global parameter to its value.

  • workspace (Workspace) – Workspace for the scenario.

show(zoom=None, block=True)[source]

Render a schematic of the scene for debugging.

class Scenario(workspace, objects, egoObject, params, externalParams, requirements, requirementDeps)[source]

Bases: object

A compiled Scenic scenario, from which scenes can be sampled.


Make some simple static checks for inconsistent built-in requirements.

generate(maxIterations=2000, verbosity=0, feedback=None)[source]

Sample a Scene from this scenario.

  • maxIterations (int) – Maximum number of rejection sampling iterations.

  • verbosity (int) – Verbosity level.

  • feedback (float) – Feedback to pass to external samplers doing active sampling. See scenic.core.external_params.


A pair with the sampled Scene and the number of iterations used.


RejectionException – if no valid sample is found in maxIterations iterations.


Reset the scenario’s external sampler, if any.

If the Python random seed is reset before calling this function, this should cause the sequence of generated scenes to be deterministic.