gdsfactory.grid#
- gdsfactory.grid(components: tuple[str | ~collections.abc.Callable[[...], ~gdsfactory.component.Component] | dict[str, ~typing.Any] | ~kfactory.kcell.KCell | ~gdsfactory.component.Component, ...] = (<function rectangle>, <function triangle>), spacing: tuple[float, float] | float = (5.0, 5.0), shape: tuple[int, int] | None = None, align_x: ~typing.Literal['origin', 'xmin', 'xmax', 'center'] = 'center', align_y: ~typing.Literal['origin', 'ymin', 'ymax', 'center'] = 'center', rotation: int = 0, mirror: bool = False) Component [source]#
Returns Component with a 1D or 2D grid of components.
- Parameters:
components – Iterable to be placed onto a grid. (can be 1D or 2D).
spacing – between adjacent elements on the grid, can be a tuple for different distances in height and width.
shape – x, y shape of the grid (see np.reshape). If no shape and the list is 1D, if np.reshape were run with (1, -1).
align_x – x alignment along (origin, xmin, xmax, center).
align_y – y alignment along (origin, ymin, ymax, center).
rotation – for each component in degrees.
mirror – horizontal mirror y axis (x, 1) (1, 0). most common mirror.
- Returns:
Component containing components grid.
import gdsfactory as gf components = [gf.components.triangle(x=i) for i in range(1, 10)] c = gf.grid( components, shape=(1, len(components)), rotation=0, h_mirror=False, v_mirror=True, spacing=(100, 100), ) c.plot()