Skip to content

Commit 4bf6b66

Browse files
authored
Merge pull request #178 from gdsfactory/simpler_containers
simpler containers
2 parents e9289cb + f71a026 commit 4bf6b66

File tree

1 file changed

+4
-91
lines changed

1 file changed

+4
-91
lines changed

cspdk/si220/cband/cells/containers.py

Lines changed: 4 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
"""This module contains cells that contain other cells."""
22

3-
from typing import Any
4-
53
import gdsfactory as gf
64
from gdsfactory.component import Component
75
from gdsfactory.typings import (
8-
CellSpec,
96
ComponentSpec,
107
CrossSectionSpec,
118
Strs,
129
)
1310

1411
gc = "grating_coupler_elliptical"
1512

13+
pack_doe = gf.c.pack_doe
14+
pack_doe_grid = gf.c.pack_doe_grid
15+
1616

1717
@gf.cell
1818
def add_fiber_array(
@@ -183,7 +183,7 @@ def add_pads_top(
183183
port_type: str = "electrical",
184184
allow_width_mismatch: bool = True,
185185
fanout_length: float | None = 80,
186-
route_width: float | list[float] | None = 0,
186+
route_width: float | list[float] = 0,
187187
**kwargs,
188188
) -> Component:
189189
"""Returns new component with ports connected top pads.
@@ -239,90 +239,3 @@ def add_pads_top(
239239
route_width=route_width,
240240
**kwargs,
241241
)
242-
243-
244-
@gf.cell
245-
def pack_doe(
246-
doe: ComponentSpec,
247-
settings: dict[str, tuple[Any, ...]],
248-
do_permutations: bool = False,
249-
function: CellSpec | None = None,
250-
**kwargs,
251-
) -> Component:
252-
"""Packs a component DOE (Design of Experiment) using pack.
253-
254-
Args:
255-
doe: function to return Components.
256-
settings: component settings.
257-
do_permutations: for each setting.
258-
function: to apply (add padding, grating couplers).
259-
kwargs: for pack.
260-
261-
Keyword Args:
262-
spacing: Minimum distance between adjacent shapes.
263-
aspect_ratio: (width, height) ratio of the rectangular bin.
264-
max_size: Limits the size into which the shapes will be packed.
265-
sort_by_area: Pre-sorts the shapes by area.
266-
density: Values closer to 1 pack tighter but require more computation.
267-
precision: Desired precision for rounding vertex coordinates.
268-
text: Optional function to add text labels.
269-
text_prefix: for labels. For example. 'A' for 'A1', 'A2'...
270-
text_offsets: relative to component size info anchor. Defaults to center.
271-
text_anchors: relative to component (ce cw nc ne nw sc se sw center cc).
272-
name_prefix: for each packed component (avoids the Unnamed cells warning).
273-
Note that the suffix contains a uuid so the name will not be deterministic.
274-
rotation: for each component in degrees.
275-
h_mirror: horizontal mirror in y axis (x, 1) (1, 0). This is the most common.
276-
v_mirror: vertical mirror using x axis (1, y) (0, y).
277-
"""
278-
return gf.components.pack_doe(
279-
doe=doe,
280-
settings=settings,
281-
do_permutations=do_permutations,
282-
function=function,
283-
**kwargs,
284-
)
285-
286-
287-
@gf.cell
288-
def pack_doe_grid(
289-
doe: ComponentSpec,
290-
settings: dict[str, tuple[Any, ...]],
291-
do_permutations: bool = False,
292-
function: CellSpec | None = None,
293-
with_text: bool = False,
294-
**kwargs,
295-
) -> Component:
296-
"""Packs a component DOE (Design of Experiment) using grid.
297-
298-
Args:
299-
doe: function to return Components.
300-
settings: component settings.
301-
do_permutations: for each setting.
302-
function: to apply to component (add padding, grating couplers).
303-
with_text: includes text label.
304-
kwargs: for grid.
305-
306-
Keyword Args:
307-
spacing: between adjacent elements on the grid, can be a tuple for
308-
different distances in height and width.
309-
separation: If True, guarantees elements are separated with fixed spacing
310-
if False, elements are spaced evenly along a grid.
311-
shape: x, y shape of the grid (see np.reshape).
312-
If no shape and the list is 1D, if np.reshape were run with (1, -1).
313-
align_x: {'x', 'xmin', 'xmax'} for x (column) alignment along.
314-
align_y: {'y', 'ymin', 'ymax'} for y (row) alignment along.
315-
edge_x: {'x', 'xmin', 'xmax'} for x (column) (ignored if separation = True).
316-
edge_y: {'y', 'ymin', 'ymax'} for y (row) (ignored if separation = True).
317-
rotation: for each component in degrees.
318-
h_mirror: horizontal mirror y axis (x, 1) (1, 0). most common mirror.
319-
v_mirror: vertical mirror using x axis (1, y) (0, y).
320-
"""
321-
return gf.components.pack_doe_grid(
322-
doe=doe,
323-
settings=settings,
324-
do_permutations=do_permutations,
325-
function=function,
326-
with_text=with_text,
327-
**kwargs,
328-
)

0 commit comments

Comments
 (0)