LayerPrediction

Prediction result for a single layer.

Each LayerPrediction in a DfmResult contains the predicted polygons, comparison metrics, violations, and optional raster data for one layer.

result = run_dfm(cell, layers=[Layer(1)])
for lp in result.layers:
    print(f"Layer {lp.layer}: {lp.predicted_polygon_count} predicted polygons")
    if lp.metrics:
        print(f"  Area deviation: {lp.metrics.area_deviation:.1%}")
    for v in lp.violations:
        print(f"  Violation: {v.message}")

Attributes

attributelayertuple[int, int]

The (number, datatype) of the layer.

attributepredicted_polygonslist[Polygon]

List of predicted (post-fabrication) polygons extracted from the contour.

attributeinput_polygon_countint

Number of input (designed) polygons on this layer.

attributepredicted_polygon_countint

Number of predicted polygons on this layer.

attributemetricsLayerMetrics | None

Comparison metrics between designed and predicted geometry. None if metrics computation was skipped.

attributeviolationslist[DfmViolation]

List of DFM violations detected on this layer.

attributehas_rasterbool

True if raw raster data is available (requires keep_raster=True in DfmConfig).

attributeraster_datalist[float] | None

Raw raster data as a flat list of float values in [0.0, 1.0], row-major order. None if keep_raster was False.

attributeraster_widthint | None

Width of the raster in pixels. None if keep_raster was False.

attributeraster_heightint | None

Height of the raster in pixels. None if keep_raster was False.

attributeraster_origintuple[float, float] | None

Origin (x, y) of the raster in design units. None if keep_raster was False.

On this page