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_countintNumber of input (designed) polygons on this layer.
attributepredicted_polygon_countintNumber of predicted polygons on this layer.
attributemetricsLayerMetrics | NoneComparison metrics between designed and predicted geometry. None if
metrics computation was skipped.
attributeviolationslist[DfmViolation]List of DFM violations detected on this layer.
attributehas_rasterboolTrue if raw raster data is available (requires keep_raster=True in
DfmConfig).
attributeraster_datalist[float] | NoneRaw 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 | NoneWidth of the raster in pixels. None if keep_raster was False.
attributeraster_heightint | NoneHeight of the raster in pixels. None if keep_raster was False.
attributeraster_origintuple[float, float] | NoneOrigin (x, y) of the raster in design units. None if keep_raster
was False.