def coupler_straight( length: float = 10.0, width: float = 0.5, gap: float = 0.27, layer: Tuple[int, int] = pp.LAYER.WG, layers_cladding: List[Tuple[int, int]] = [pp.LAYER.WGCLAD], cladding_offset: float = 3.0, ) -> Component: """ straight coupled waveguides. Two multimode ports .. plot:: :include-source: import pp c = pp.c.coupler_straight() pp.plotgds(c) """ c = Component() # Top path c.add_polygon([(0, 0), (length, 0), (length, width), (0, width)], layer=layer) y = width + gap # Bottom path c.add_polygon([(0, y), (length, y), (length, width + y), (0, width + y)], layer=layer) # One multimode port on each side port_w = width * 2 + gap c.add_port(name="W0", midpoint=[0, port_w / 2], width=port_w, orientation=180) c.add_port(name="E0", midpoint=[length, port_w / 2], width=port_w, orientation=0) c.width = width c.length = length # cladding ymax = 2 * width + gap + cladding_offset for layer_cladding in layers_cladding: c.add_polygon( [ (0, -cladding_offset), (length, -cladding_offset), (length, ymax), (0, ymax), ], layer=layer_cladding, ) return c
def waveguide( length: float = 10.0, width: float = 0.5, layer: Tuple[int, int] = pp.LAYER.WG, layers_cladding: Optional[Iterable[Tuple[int, int]]] = None, cladding_offset: float = pp.conf.tech.cladding_offset, ) -> Component: """Straight waveguide Args: length: in X direction width: in Y direction layer layers_cladding cladding_offset .. plot:: :include-source: import pp c = pp.c.waveguide(length=10, width=0.5) pp.plotgds(c) """ c = Component() w = width / 2 c.add_polygon([(0, -w), (length, -w), (length, w), (0, w)], layer=layer) wc = w + cladding_offset if layers_cladding: for layer_cladding in layers_cladding: c.add_polygon([(0, -wc), (length, -wc), (length, wc), (0, wc)], layer=layer_cladding) c.add_port(name="W0", midpoint=[0, 0], width=width, orientation=180, layer=layer) c.add_port(name="E0", midpoint=[length, 0], width=width, orientation=0, layer=layer) c.width = width c.length = length 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