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
attributeresolutionfloatRasterization resolution in design units per pixel.
attributepaddingfloatPadding around the geometry bounding box in design units.
attributecontour_thresholdfloatThreshold for binarizing the prediction output. Values above this threshold are treated as fabricated.
attributekeep_rasterboolWhether 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 | NoneGlobal maximum allowed relative area deviation. Set to None to skip
area deviation checking.
attributehas_tolerancesboolTrue 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') -> NoneCreate a new DFM configuration.
paramresolutionfloat= 0.01Rasterization resolution in design units per pixel. Smaller values give higher fidelity but use more memory and time.
parampaddingfloat= 1.0Padding around the geometry bounding box in design units.
paramcontour_thresholdfloat= 0.5Threshold for binarizing the prediction. Values in [0.0, 1.0].
paramkeep_rasterbool= FalseWhether to retain raw raster data in the result.
parammax_area_deviationfloat | None= NoneGlobal 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
Nonefuncset_layer_config(layer, sigma=None, max_area_deviation=None, severity=None) -> NoneSet 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= NoneGaussian blur sigma for this layer. Creates a per-layer GaussianModel.
parammax_area_deviationfloat | None= NoneMaximum allowed relative area deviation for this layer.
paramseveritystr | None= NoneSeverity override for this layer: "error" or "warning".
Returns
None