diff --git a/cspdk/cells.py b/cspdk/cells.py index 5a3edb6..1f2d27f 100644 --- a/cspdk/cells.py +++ b/cspdk/cells.py @@ -357,14 +357,14 @@ def gc_rectangular( ) mzi_nc = partial( - gf.components.mzi, + mzi, straight=straight_nc, cross_section="xs_nc", combiner=mmi1x2_nc, splitter=mmi1x2_nc, ) mzi_no = partial( - gf.components.mzi, + mzi, straight=straight_no, cross_section="xs_no", combiner=mmi1x2_no, @@ -375,11 +375,19 @@ def gc_rectangular( ################ # Packaging ################ + pad = partial( gf.components.pad, layer=LAYER.PAD, ) +rectangle = partial(gf.components.rectangle, layer=LAYER.FLOORPLAN) +grating_coupler_array = partial( + gf.components.grating_coupler_array, + cross_section="xs_nc", + grating_coupler=gc_rectangular_nc, +) + @gf.cell def die_nc( @@ -406,28 +414,27 @@ def die_nc( """ c = gf.Component() - fp = c << gf.components.rectangle(size=size, layer=LAYER.FLOORPLAN, centered=True) + fp = c << rectangle(size=size, layer=LAYER.FLOORPLAN, centered=True) # Add optical ports x0 = -4925 + 2.827 y0 = 1650 - grating_coupler = grating_coupler() - grating_coupler_array = gf.components.grating_coupler_array( - grating_coupler=grating_coupler, + gca = grating_coupler_array( + grating_coupler=grating_coupler(), n=ngratings, pitch=grating_pitch, with_loopback=True, rotation=90, cross_section=cross_section, # type: ignore ) - left = c << grating_coupler_array + left = c << gca left.rotate(90) left.xmax = x0 left.y = fp.y c.add_ports(left.ports, prefix="W") - right = c << grating_coupler_array + right = c << gca right.rotate(-90) right.xmax = -x0 right.y = fp.y diff --git a/cspdk/models.py b/cspdk/models.py index 1b56232..f5169f3 100644 --- a/cspdk/models.py +++ b/cspdk/models.py @@ -228,7 +228,17 @@ def _crossing(wl=1.5): ################ pad = _2port("o1", "o2") # dummy model heater = _2port("o1", "o2") # dummy model +rectangle = _2port("o1", "o2") # dummy model + +def grating_coupler_array(n=6): + ports = tuple([f"o{i}" for i in range(n + n % 2)]) + return sax.models.passthru(num_links=(n + n % 2) // 2, ports=ports)() + + +################ +# Models Dict +################ models = dict( _2port=_2port("o1", "o2"), _3port=_3port("o1", "o2", "o3"), @@ -279,4 +289,6 @@ def _crossing(wl=1.5): crossing_sc=crossing_sc, pad=pad, heater=heater, + rectangle=rectangle, + grating_coupler_array=grating_coupler_array, )