laygo2.util package#
laygo2 utility package implements various useful functions for layout manipulations.
laygo2.util.transform module#
Utility functions for coordinate tranformations.
- laygo2.util.transform.combine(transform1, transform2)[source]#
Returns the resulting transform parameter of two consecutive transforms
- laygo2.util.transform.Mt(transform)[source]#
Returns the transform matrix.
- Parameters:
transform (str) – The transform parameter. Possible values are ‘R0’, ‘MX’, ‘MY’, ‘MXY’, and ‘R180’.
- Returns:
The transform matrix corresponding to the transform parameter.
- Return type:
numpy.ndarray(dtype=int)
- laygo2.util.transform.Mtinv(transform)[source]#
Returns the inverse of the transform matrix.
- Parameters:
transform (str) – The transform parameter. possible values are ‘R0’, ‘MX’, ‘MY’, ‘MXY’, and ‘R180’.
- Returns:
The inverse of the transform matrix.
- Return type:
numpy.ndarray(dtype=int)
- laygo2.util.transform.Md(direction)[source]#
Returns the direction(projection) matrix. The direction matrix is used when placing an object based on relative information to other instance(s). For example, if an instance’s center is located at xyc0=[xc0, yc0], the xy-coordinate of the center of the new instance xyc1 can be computed from the following equation:
xyc1 = xyc0 + 0.5 * Md * (xys0 + xys1)
where xys0, xys1 are the size of the reference and the new instance, respectively, and Md is the direction matrix corresponding to the direction of the placement.
- Parameters:
direction (str) – The direction parameter. Possible values are ‘left’, ‘right’, ‘top’, ‘bottom’, ‘omni’, ‘x’, ‘y’.
- Returns:
The direction matrix.
- Return type:
Notes
The following equation will be used instead of (1) in the future versions, to avoid the 0.5 scaling that increases the precision requirement.
xy1 = xy0 + 0.5 * [(Md + Mt0) * xys0 + (Md - Mt1) * xys1]