attach_values is the safety check to run before showing results on a rebuilt layout. It only verifies: it does not synthesize anything.
attach_values
attach_values(
layout: "FacadeLayout", columns: Any, *, expected_layout_key: str
) -> AnyVerify a layout against a live or reloaded SurfaceColumns.
The check refuses a mismatch. It first compares layout.layout_key with expected_layout_key, which covers the geometry, the synthesis parameters, the surfgrid version and the core version, so a rebuild whose geometry drifted gets a different key. This catches even a change too small to move a frame's origin, axes or grid, such as a small hole inside a cell that is still present.
Two further checks guard against a columns mismatch the key alone cannot catch, such as the wrong surface entirely. They join by surface id, never by row, so the row order of columns does not have to match the job and frame order of layout. For every frame the layout names, this checks that:
columnshas that surface;- its origin, axes and grid dimensions agree with the layout's, within float rounding;
- its cell layout -- which grid cells actually have a sensor, in canonical row-major order -- matches exactly.
columns.has_valueis False for a grid cell with no sensor, one entry per cell in the orderframe.cellsuses, so presence is compared exactly.
Store layout_key with every result so you can pass it back here later.
Warnings
Never read expected_layout_key off layout itself: that checks nothing, because a layout always agrees with its own key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layout | FacadeLayout | The rebuilt or reloaded layout. | required |
columns | SurfaceColumns | The surface columns of the result to verify against. | required |
expected_layout_key | str | The layout_key stored alongside the result when it first ran. | required |
Returns:
| Type | Description |
|---|---|
SurfaceColumns | columns, unchanged. This function only verifies. |
Raises:
| Type | Description |
|---|---|
ValueError | If the layout key differs, if frame keys are not unique across the layout, or if a surface of the layout is missing from columns or differs in geometry or cell layout. |