def cdsem_target(width_center=0.5, label="", layer=LAYER.WG): radii = [5.0, 10.0] c = pp.Component() a = 1.0 w = 3 * a / 4 for pos in [(0, 0), (w, w), (-w, w), (w, -w), (-w, -w)]: _c = c.add_ref(square_middle()) _c.move(pos) c.absorb(_c) w_min = width_center * 0.92 w0 = width_center w_max = width_center * 1.08 for radius in radii: b = a + radius _b_tr = bend_circular(radius=radius, width=w0) b_tr = _b_tr.ref(position=(b, a), rotation=90, port_id="W0") _b_bl = bend_circular(radius=radius, width=w0) b_bl = _b_bl.ref(position=(-b, -a), rotation=270, port_id="W0") _b_br = bend_circular(radius=radius, width=w_max) b_br = _b_br.ref(position=(a, -b), rotation=0, port_id="W0") _b_tl = bend_circular(radius=radius, width=w_min) b_tl = _b_tl.ref(position=(-a, b), rotation=180, port_id="W0") c.add([b_tr, b_tl, b_bl, b_br]) if label: marker_label = manhattan_text(text="{}".format(label), size=1.0, layer=layer) _marker_label = c.add_ref(marker_label) _marker_label.movey(-max(radii) - 10.0) c.absorb(_marker_label) return c
def cdsem_target(width_center=0.5): radii = [5.0, 10.0] c = pp.Component() a = 1.0 w = 3 * a / 4 c.add_ref(square_middle()) ctr = c.add_ref(square_middle()) ctl = c.add_ref(square_middle()) cbr = c.add_ref(square_middle()) cbl = c.add_ref(square_middle()) ctr.move((w, w)) ctl.move((-w, w)) cbr.move((w, -w)) cbl.move((-w, -w)) w_min = width_center * 0.92 w0 = width_center w_max = width_center * 1.08 for radius in radii: b = a + radius _b_tr = bend_circular(radius=radius, width=w0) b_tr = _b_tr.ref(position=(b, a), rotation=90, port_id="W0") _b_bl = bend_circular(radius=radius, width=w0) b_bl = _b_bl.ref(position=(-b, -a), rotation=270, port_id="W0") _b_br = bend_circular(radius=radius, width=w_max) b_br = _b_br.ref(position=(a, -b), rotation=0, port_id="W0") _b_tl = bend_circular(radius=radius, width=w_min) b_tl = _b_tl.ref(position=(-a, b), rotation=180, port_id="W0") c.add([b_tr, b_tl, b_bl, b_br]) return c
def test_manhattan(): from pp.components.bend_circular import bend_circular from pp.component import Port top_cell = pp.Component() inputs = [ Port("in1", (10, 5), 0.5, 90), Port("in2", (-10, 20), 0.5, 0), Port("in3", (10, 30), 0.5, 0), Port("in4", (-10, -5), 0.5, 90), ] outputs = [ Port("in1", (90, -60), 0.5, 180), Port("in2", (-100, 20), 0.5, 0), Port("in3", (100, -25), 0.5, 0), Port("in4", (-150, -65), 0.5, 270), ] for input_port, output_port in zip(inputs, outputs): # input_port = Port("input_port", (10,5), 0.5, 90) # output_port = Port("output_port", (90,-60), 0.5, 180) bend = bend_circular(radius=5.0) pp.ports.add_port_markers(bend) cell = route_manhattan( input_port, output_port, bend, waveguide, start_straight=5.0, end_straight=5.0, ) top_cell.add(cell) return top_cell
def test_manhattan(): from pp.components.bend_circular import bend_circular top_cell = pp.Component() inputs = [ Port("in1", (10, 5), 0.5, 90), Port("in2", (-10, 20), 0.5, 0), Port("in3", (10, 30), 0.5, 0), Port("in4", (-10, -5), 0.5, 90), ] outputs = [ Port("in1", (90, -60), 0.5, 180), Port("in2", (-100, 20), 0.5, 0), Port("in3", (100, -25), 0.5, 0), Port("in4", (-150, -65), 0.5, 270), ] lengths = [158.562, 121.43600000000002, 160.70800000000003, 231.416] for input_port, output_port, length in zip(inputs, outputs, lengths): # input_port = Port("input_port", (10,5), 0.5, 90) # output_port = Port("output_port", (90,-60), 0.5, 180) bend = bend_circular(radius=5.0) route = route_manhattan( input_port, output_port, bend, waveguide, start_straight=5.0, end_straight=5.0, ) top_cell.add(route["references"]) np.isclose(route["settings"]["length"], length) return top_cell
def coupler90(bend_radius=10.0, width=0.5, gap=0.2): """ Waveguide coupled to a bend with gap Args: bend_radius: um width: waveguide width (um) gap: um .. plot:: :include-source: import pp c = pp.c.coupler90() pp.plotgds(c) """ y = width + gap _bend = bend_circular(radius=bend_radius, width=width).ref((0, y)) c = Component() _wg = c.add_ref(waveguide(length=bend_radius, width=width)) c.add(_bend) # This component is a leaf cell => using absorb c.absorb(_wg) c.absorb(_bend) port_width = 2 * width + gap c.add_port(port=_wg.ports["E0"], name="E0") c.add_port(port=_bend.ports["N0"], name="N0") c.add_port(name="W0", midpoint=[0, y / 2], width=port_width, orientation=180) c.y = y return c
def _bend_circular_heater( radius: float = 10, wg_width: float = 0.5, theta: int = -90, start_angle: int = 0, angle_resolution: float = 2.5, heater_to_wg_distance: float = 1.2, heater_width: float = 0.5, ) -> Component: """ Creates an arc of arclength ``theta`` starting at angle ``start_angle`` Args: radius width: of the waveguide theta: arc length start_angle: angle_resolution """ component = Component() wg_bend = bend_circular( radius=radius, width=wg_width, theta=theta, start_angle=start_angle, angle_resolution=angle_resolution, layer=LAYER.WG, ).ref((0, 0)) a = heater_to_wg_distance + wg_width / 2 + heater_width / 2 heater_outer = bend_circular( radius=radius + a, width=heater_width, theta=theta, start_angle=start_angle, angle_resolution=angle_resolution, layer=LAYER.HEATER, ).ref((0, -a)) heater_inner = bend_circular( radius=radius - a, width=heater_width, theta=theta, start_angle=start_angle, angle_resolution=angle_resolution, layer=LAYER.HEATER, ).ref((0, a)) component.add(wg_bend) component.add(heater_outer) component.add(heater_inner) component.absorb(wg_bend) component.absorb(heater_outer) component.absorb(heater_inner) i = 0 for device in [wg_bend, heater_outer, heater_inner]: for port in device.ports.values(): component.ports["{}".format(i)] = port i += 1 component.info["length"] = wg_bend.info["length"] component.radius = radius component.width = wg_width return component
def cdsem_uturn( width=0.5, radius=10.0, symbol_bot="S", symbol_top="U", wg_length=LINE_LENGTH, waveguide=pp.c.waveguide, layer=pp.layer("wgcore"), layer_cladding=pp.layer("wgclad"), cladding_offset=3, ): """ Args: width: of the line cladding_offset: radius: bend radius wg_length """ c = pp.Component() r = radius bend90 = bend_circular( width=width, radius=r, layer=layer, cladding_layer=layer_cladding ) if wg_length is None: wg_length = 2 * r wg = waveguide( width=width, length=wg_length, layer=layer, layer_cladding=layer_cladding, cladding_offset=cladding_offset, ) # bend90.ports() rename_ports_by_orientation(bend90) # Add the U-turn on waveguide layer b1 = c.add_ref(bend90) b2 = c.add_ref(bend90) b2.connect("N0", b1.ports["W0"]) wg1 = c.add_ref(wg) wg1.connect("W0", b1.ports["N0"]) wg2 = c.add_ref(wg) wg2.connect("W0", b2.ports["W0"]) # Add symbols sym1 = c.add_ref(CENTER_SHAPES_MAP[symbol_bot]()) sym1.rotate(-90) sym1.movey(r) sym2 = c.add_ref(CENTER_SHAPES_MAP[symbol_top]()) sym2.rotate(-90) sym2.movey(2 * r) c.absorb(sym1) c.absorb(sym2) c.rotate(angle=90) # print(c._bb_valid) # print(c.size_info) c.move(c.size_info.cc, (0, 0)) return c
def cutback_bend_circular(bend_radius=10.0, n_steps=3, n_stairs=4): bend90 = bend_circular(radius=bend_radius) c = cutback_bend(bend90=bend90, n_steps=n_steps, n_stairs=n_stairs) cc = add_fiber_array(c, optical_routing_type=1) return cc