Exemple #1
0
def add_trenches(
    c: Component,
    sstw: float = 2.0,
    trench_width: float = 0.5,
    trench_keep_out: float = 2.0,
    trenches: List[Dict[str, int]] = [
        {
            "nb_segments": 2,
            "lane": 1,
            "x_start_offset": 0
        },
        {
            "nb_segments": 2,
            "lane": -1,
            "x_start_offset": 0
        },
    ],
    layer_trench: Tuple[int, int] = LAYER.DEEPTRENCH,
) -> Component:
    """
    Add trenches to a waveguide-heater-like component
    """

    heater_width = c.settings["heater_width"]
    heater_spacing = c.settings["heater_spacing"]
    width = c.settings["width"]
    length = c.settings["length"]

    a = heater_spacing + (width + heater_width) / 2

    # Add trenches
    if trench_width and trench_width > 0:
        tko = trench_keep_out

        for trench in trenches:
            lane = trench["lane"]
            td = tko + a + (trench_width + heater_width) / 2
            y = np.sign(lane) * (td + (abs(lane) - 1) * (trench_width + tko))
            x_start_offset = trench["x_start_offset"]

            if "segments" not in trench:
                nb_segments = trench["nb_segments"]
                trench_length = (length -
                                 (nb_segments - 1) * sstw) / nb_segments
                segments = [trench_length] * nb_segments
            else:
                segments = trench["segments"]
            x = x_start_offset
            for i, trench_length in enumerate(segments):
                trench = hline(length=trench_length,
                               width=trench_width,
                               layer=layer_trench)
                _trench = trench.ref(port_id="W0",
                                     position=c.ports["W0"].position + (x, y))
                c.add(_trench)
                c.absorb(_trench)
                x += trench_length + sstw

    return c
def heater(length=10, width=0.5, layers_heater=[LAYER.HEATER]):
    """ straight heater
    """
    c = pp.Component()
    for layer in layers_heater:
        _ref = c.add_ref(hline(length=length, width=width, layer=layer))
        c.ports = _ref.ports  # Use ports from latest layer as heater ports
        c.absorb(_ref)
    return c
Exemple #3
0
def wire(length=50.0, width=WIRE_WIDTH, layer=LAYER.M3):
    """ electrical straight wire

    .. plot::
      :include-source:

      import pp

      c = pp.c.wire(length=50., width=10., layer=pp.LAYER.M3)
      pp.plotgds(c)
    """
    return hline(length=length, width=width, layer=layer)
Exemple #4
0
def heater(
    length: float = 10.0,
    width: float = 0.5,
    layers_heater: List[Tuple[int, int]] = [LAYER.HEATER],
) -> Component:
    """ straight heater
    """
    c = pp.Component()
    for layer in layers_heater:
        _ref = c.add_ref(hline(length=length, width=width, layer=layer))
        c.ports = _ref.ports  # Use ports from latest layer as heater ports
        c.absorb(_ref)
    return c
Exemple #5
0
def heater(
    length: float = 10.0,
    width: float = 0.5,
    layer_heater: Tuple[int, int] = LAYER.HEATER,
) -> Component:
    """straight heater"""
    c = pp.Component()
    _ref = c.add_ref(hline(length=length, width=width, layer=layer_heater))
    c.ports = _ref.ports  # Use ports from latest layer as heater ports
    for p in c.ports.values():
        p.layer = layer_heater
        p.port_type = "heater"
    c.absorb(_ref)
    return c
Exemple #6
0
def _arbitrary_straight_waveguide(length, windows):
    """
    Args:
        length: length
        windows: [(y_start, y_stop, layer), ...]
    """
    md5 = hashlib.md5()
    for e in windows:
        md5.update(str(e).encode())

    component = Component()
    component.name = "ARB_SW_L{}_HASH{}".format(length, md5.hexdigest())
    y_min, y_max, layer0 = windows[0]
    y_min, y_max = min(y_min, y_max), max(y_min, y_max)

    # Add one port on each side centered at y=0
    for y_start, y_stop, layer in windows:
        w = abs(y_stop - y_start)
        y = (y_stop + y_start) / 2
        _wg = hline(length=length, width=w, layer=layer).ref()
        _wg.movey(y)
        component.add(_wg)
        component.absorb(_wg)
        y_min = min(y_stop, y_start, y_min)
        y_max = max(y_stop, y_start, y_max)
    width = y_max - y_min

    component.add_port(name="W0",
                       midpoint=[0, 0],
                       width=width,
                       orientation=180,
                       layer=layer0)
    component.add_port(name="E0",
                       midpoint=[length, 0],
                       width=width,
                       orientation=0,
                       layer=layer0)

    return component
Exemple #7
0
def wire(length=50, width=WIRE_WIDTH, layer=LAYER.M3):
    """
    straight wire
    """
    return hline(length=length, width=width, layer=layer)