Skip to content

Density and windows

Density checks return Check. Bounds are inclusive fractions; supply at least one. Global/polygon density measures union coverage. Hierarchical accounting sums instance contributions, so overlapping instances can produce a ratio above one.

Call Scope / options What it does and why
a.window_density(within=boundary, window=window, minimum=..., maximum=..., ...) Window-by-window; default formula "clipped_container", zero_denominator "skip", skip_empty_target False Checks coverage in many placed windows and reports failing window markers. Use it to find local sparse or dense areas that an overall average could hide.
Window(size=(50, 50), step=(25, 25), placement="legacy_backup", marker="base_tile") Explicit settings supported by the execution backend; frame / origin optional Holds the window size, movement step, positions, and marker choices. Use it to state exactly where local density is sampled; backend size and border limits may also apply.
a.polygon_density(within=boundary, minimum=..., maximum=...) Each container polygon; zero_denominator defaults to "skip" Checks that same coverage fraction separately for each container polygon. Use it when each independent area must meet the limits on its own.
a.global_density(within=boundary, minimum=..., maximum=...) One union-area ratio; zero_denominator defaults to "error" Measures the fraction of boundary covered by the union of a and checks the limits. Use it for one density result over an entire area.
layout.hierarchy_density(layers=((10, 0),), within=boundary, minimum=..., ...) Local cell area by instance multiplicity and magnification squared; ratio can exceed one Adds area from cell definitions for each placed copy, including magnification squared. Use it for instance-based area accounting; overlapping copies are counted separately.

Windows default to placement="legacy_backup", marker="base_tile", partial="none", and trailing=("none", "none").

Density options

Option Choices / meaning What it does and why
formula "clipped_container", "full_window", "container_normalized", "weighted_full_window", "weighted_container_normalized" Chooses the area calculation: full-window forms divide by window area, container-normalized forms divide by the container area in the window, and weighted forms add a scaled extra layer. Match it to the density rule.
weighted, weight Explicit weighted Region and coefficient for weighted formulas weighted supplies extra geometry and weight scales its area contribution. Use them when another material must count partly or fully in the density numerator.
include, exempt Window masks; add backend capability requirements include requires positive-area window overlap with the mask; exempt skips windows with such overlap. Use them to choose which windows are evaluated without subtracting target material.
zero_denominator "error", "skip", "zero" Chooses what happens when the area used as the divisor is zero: fail, skip that sample, or use density zero. Use it to state the empty-area policy.
area_rounding "none" / "truncate_dbu_area" on global, polygon, window checks Chooses unchanged area values or truncation to whole input-grid area units before accumulation. Use it when the rule requires a particular area-rounding policy.
tile_size Global density only; tiled integer-area accumulation with area_rounding="truncate_dbu_area" Splits global density accumulation into tiles of this size before adding the areas. Use it with the required integer-area rounding recipe.
Window.origin Explicit lattice origin Sets the starting point of the regular window grid. Use it when samples must line up with a known layout origin instead of a default placement.
Window.partial "none" Omits windows that cross the frame edge.
Window.trailing ("none", "none") Uses the placement recipe without extra trailing windows.
Window.placement "legacy_backup" Uses the legacy backup placement recipe to choose window positions.
Window.marker, Window.marker_border "base_tile"; nonnegative border Reports a failing sample as its base tile. marker_border adjusts the reported border without changing the target material.

child_rounding="nearest_even_dbu_area" is the supported hierarchy-density default. It rounds child contributions before summing instance multiplicity and magnification². Global tiled density sums clipped integer areas per tile before forming the ratio.