DfmConfig

Configuration for DFM prediction.

Controls rasterization resolution, padding, contour extraction, and tolerance thresholds for pass/fail checking. Use set_layer_config() to override settings for specific layers.

# Basic usage
config = DfmConfig(resolution=0.01, padding=1.0)
result = run_dfm(cell, layers=[Layer(1)], config=config)

# With tolerances for pass/fail checking
config = DfmConfig(resolution=0.01, max_area_deviation=0.10, severity="error")
config.set_layer_config(Layer(1, 0), sigma=0.05, max_area_deviation=0.05)
config.set_layer_config(Layer(2, 0), sigma=0.15)

Attributes

attributeresolutionfloat

Rasterization resolution in design units per pixel.

attributepaddingfloat

Padding around the geometry bounding box in design units.

attributecontour_thresholdfloat

Threshold for binarizing the prediction output. Values above this threshold are treated as fabricated.

attributekeep_rasterbool

Whether to retain raw raster data in the result. When True, each LayerPrediction includes raster_data, raster_width, raster_height, and raster_origin.

attributemax_area_deviationfloat | None

Global maximum allowed relative area deviation. Set to None to skip area deviation checking.

attributehas_tolerancesbool

True if any tolerance thresholds are configured (global or per-layer).

Methods

func__init__(resolution=0.01, padding=1.0, contour_threshold=0.5, keep_raster=False, max_area_deviation=None, severity='error') -> None

Create a new DFM configuration.

paramresolutionfloat
= 0.01

Rasterization resolution in design units per pixel. Smaller values give higher fidelity but use more memory and time.

parampaddingfloat
= 1.0

Padding around the geometry bounding box in design units.

paramcontour_thresholdfloat
= 0.5

Threshold for binarizing the prediction. Values in [0.0, 1.0].

paramkeep_rasterbool
= False

Whether to retain raw raster data in the result.

parammax_area_deviationfloat | None
= None

Global maximum allowed relative area deviation (e.g., 0.10 for 10%). Set to None to skip area deviation checking.

paramseveritystr
= "error"

Default severity for violations: "error" or "warning".

Returns

None
funcset_layer_config(layer, sigma=None, max_area_deviation=None, severity=None) -> None

Set per-layer model and tolerance overrides.

Per-layer settings override the global defaults for a specific layer. Parameters left as None fall back to the global config. If sigma is provided, a per-layer GaussianModel is created with the specified sigma.

Example

config = DfmConfig(resolution=0.01)
config.set_layer_config(Layer(1, 0), sigma=0.05, max_area_deviation=0.05)
config.set_layer_config(Layer(2, 0), sigma=0.15)
paramlayerLayer | int | tuple[int, int]

Target layer.

paramsigmafloat | None
= None

Gaussian blur sigma for this layer. Creates a per-layer GaussianModel.

parammax_area_deviationfloat | None
= None

Maximum allowed relative area deviation for this layer.

paramseveritystr | None
= None

Severity override for this layer: "error" or "warning".

Returns

None

On this page