scenic.core.pruning
Pruning parts of the sample space which violate requirements.
The toplevel function here, prune
, is called as the very last step of scenario
compilation (from translator.constructScenarioFrom
).
Summary of Module Members
Functions
Returns true if A depends on B 





Get the current value of an object's property, taking into account prior pruning. 

Find where objects aligned to the given fields can satisfy the given RH bounds. 

Match calls to a given function, taking into account distribution decorators. 

Match calls to a given method, taking into account distribution decorators. 

Match uniform samples from a 

Match orientation yaw defined by a 

Upper bound the distance between the given Objects. 



Prune a 

Prune based on the requirement that individual Objects fit within their container. 

Prune based on requirements bounding the relative heading of an Object. 



Lower/upper bound the possible RH between two headings with bounded disturbances. 



Upper bound the distance from an Object to another it can see. 
Member Details
 currentPropValue(obj, prop)[source]
Get the current value of an object’s property, taking into account prior pruning.
 isMethodCall(thing, method)[source]
Match calls to a given method, taking into account distribution decorators.
 isFunctionCall(thing, function)[source]
Match calls to a given function, taking into account distribution decorators.
 matchInRegion(position)[source]
Match uniform samples from a
Region
Returns the Region, if any, the offset that should be added to the base, and the PointInRegionDistribution itself.
 matchPolygonalField(heading, position)[source]
Match orientation yaw defined by a
PolygonalVectorField
at the given position.Matches the yaw attribute of orientations exactly equal to a
PolygonalVectorField
, or offset by a bounded disturbance. Returns a triple consisting of the matched field if any, together with lower/upper bounds on the disturbance.
 prune(scenario, verbosity=1)[source]
Prune a
Scenario
, removing infeasible parts of the space.This function directly modifies the Distributions used in the Scenario, but leaves the conditional distribution under the scenario’s requirements unchanged. See
Samplable.conditionTo
.Currently, the following pruning techniques are applied in order:
Pruning based on containment (
pruneContainment
)Pruning based on relative heading bounds (
pruneRelativeHeading
)
 pruneContainment(scenario, verbosity)[source]
Prune based on the requirement that individual Objects fit within their container.
Specifically, if O is positioned uniformly (with a possible offset) in region B and has container C, then we can instead pick a position uniformly in their intersection. If we can also lower bound the radius of O, then we can first erode C by that distance minus that maximum offset distance.
 pruneRelativeHeading(scenario, verbosity)[source]
Prune based on requirements bounding the relative heading of an Object.
Specifically, if an object O is:
positioned uniformly within a polygonal region B;
aligned to a polygonal vector field F (up to a bounded offset);
and another object O’ is:
aligned to a polygonal vector field F’ (up to a bounded offset);
at most some finite maximum distance from O;
required to have relative heading within a bounded offset of that of O;
then we can instead position O uniformly in the subset of B intersecting the cells of F which satisfy the relative heading requirements w.r.t. some cell of F’ which is within the distance bound.
 maxDistanceBetween(scenario, obj, target)[source]
Upper bound the distance between the given Objects.
 visibilityBound(obj, target)[source]
Upper bound the distance from an Object to another it can see.
 feasibleRHPolygon(field, offsetL, offsetR, tField, tOffsetL, tOffsetR, lowerBound, upperBound, maxDist)[source]
Find where objects aligned to the given fields can satisfy the given RH bounds.