Exemplo n.º 1
0
def loss_deembedding_ch12_34(
    io_sep=127.0,
    R=10.0,
    grating_coupler_function=grating_coupler_te,
    input_port_indexes=[0, 2],
):
    gc = grating_coupler_function()

    c = pp.Component()
    dx = io_sep
    gcs = [
        gc.ref(position=(i * dx, 0), port_id="W0", rotation=-90)
        for i in range(4)
    ]

    gc_ports = [g.ports["W0"] for g in gcs]
    c.add(gcs)

    c.add(
        connect_strip(gc_ports[0],
                      gc_ports[1],
                      start_straight=40.0,
                      taper_factory=None))
    c.add(
        connect_strip(gc_ports[2],
                      gc_ports[3],
                      start_straight=40.0,
                      taper_factory=None))
    for i, index in enumerate(input_port_indexes):
        label = get_input_label(gc_ports[index],
                                gc,
                                i,
                                component_name=inspect.stack()[0][3])
        label.position = gc_ports[index].position
        c.add(label)
    return c
def loss_deembedding_ch14_23(
        io_sep: float = 127.0,
        R: float = 10.0,
        grating_coupler_function: Callable = grating_coupler_te,
        input_port_indexes: Iterable[int] = (0, 1),
) -> Component:
    gc = grating_coupler_function()

    c = pp.Component()
    dx = io_sep
    gcs = [
        gc.ref(position=(i * dx, 0), port_id="W0", rotation=-90)
        for i in range(4)
    ]

    gc_ports = [g.ports["W0"] for g in gcs]
    c.add(gcs)

    c.add(
        connect_strip(gc_ports[0],
                      gc_ports[3],
                      start_straight=40.0,
                      taper_factory=None)["references"])
    c.add(
        connect_strip(gc_ports[1],
                      gc_ports[2],
                      start_straight=30.0,
                      taper_factory=None)["references"])
    for i, index in enumerate(input_port_indexes):
        label = get_input_label(gc_ports[index],
                                gc,
                                i,
                                component_name=inspect.stack()[0][3])
        label.position = gc_ports[index].position
        c.add(label)
    return c
Exemplo n.º 3
0
def loss_deembedding_ch13_24(
        io_sep=127.0,
        R=10.0,
        grating_coupler_function=grating_coupler_te,
        input_port_indexes=(0, 1),
):

    gc = grating_coupler_function()
    c = pp.Component()
    dx = io_sep
    gcs = [
        gc.ref(position=(i * dx, 0), port_id="W0", rotation=-90)
        for i in range(4)
    ]

    gc_ports = [g.ports["W0"] for g in gcs]
    c.add(gcs)

    c.add(
        connect_strip(gc_ports[0],
                      gc_ports[2],
                      start_straight=40.0,
                      taper_factory=None))

    gsi = gc.size_info
    p1 = gc_ports[1]
    p3 = gc_ports[3]
    a = R + 5.0  # 0.5
    b = max(2 * a, io_sep / 2)
    y_bot_align_route = -gsi.width - 5.0

    c.add(connect_loop_back(p1, p3, a, b, R, y_bot_align_route))
    for i, index in enumerate(input_port_indexes):
        label = get_input_label(gc_ports[index],
                                gc,
                                i,
                                component_name=inspect.stack()[0][3])
        label.position = gc_ports[index].position
        c.add(label)

    return c
Exemplo n.º 4
0
def splitter_tree(
        coupler,
        n_o_outputs=4,
        bend_radius=10.0,
        separation=50,
        termination_component=waveguide(length=0.1),
):
    n_o_outputs = n_o_outputs
    c = pp.Component()

    coupler = pp.call_if_func(coupler)
    _coupler = c.add_ref(coupler)
    coupler_sep = coupler.ports["E1"].y - coupler.ports["E0"].y

    if n_o_outputs > 2:
        _cmp = splitter_tree(
            coupler=coupler,
            n_o_outputs=n_o_outputs // 2,
            bend_radius=bend_radius,
            separation=separation / 2,
        )
    else:
        _cmp = termination_component

    a = separation or _cmp.ports["W0"].y - _coupler.size_info.south
    if a < coupler_sep:
        tree_top = _cmp.ref(port_id="W0", position=_coupler.ports["E1"])
        tree_bot = _cmp.ref(
            port_id="W0",
            position=_coupler.ports["E0"],
            v_mirror=False  # True
        )

    else:
        d = 2 * bend_radius + 1
        a = max(a, d)

        tree_top = _cmp.ref(port_id="W0",
                            position=_coupler.ports["E1"].position + (d, a))
        tree_bot = _cmp.ref(
            port_id="W0",
            position=_coupler.ports["E0"].position + (d, -a),
            v_mirror=False,  # True,
        )

        c.add(connect_strip(coupler.ports["E1"], tree_top.ports["W0"]))
        c.add(connect_strip(coupler.ports["E0"], tree_bot.ports["W0"]))

    i = 0
    for p in get_ports_facing(tree_bot, "E"):
        c.add_port(name="{}".format(i), port=p)
        i += 1

    for p in get_ports_facing(tree_top, "E"):
        c.add_port(name="{}".format(i), port=p)
        i += 1

    c.add(tree_bot)
    c.add(tree_top)
    c.add_port(name="W0", port=_coupler.ports["W0"])

    return c
Exemplo n.º 5
0
def splitter_tree(
    coupler: Callable = mmi1x2,
    n_o_outputs: int = 4,
    bend_radius: float = 10.0,
    spacing: float = 50.0,
    termination_component=None,
):
    """tree of 1x2 splitters

    Args:
        coupler: 1x2 coupler factory
        n_o_outputs:
        bend_radius: for routing
        spacing: 2X spacing
        termination_component: factory or component for EAST termination

    .. code::

             __|
          __|  |__
        _|  |__
         |__       spacing


    .. plot::
      :include-source:

      import pp

      c = pp.c.splitter_tree(coupler=pp.c.mmi1x2(), n_o_outputs=4, spacing=50, bend_radius=10)
      pp.plotgds(c)

    """
    n_o_outputs = n_o_outputs
    c = pp.Component()

    coupler = pp.call_if_func(coupler)
    _coupler = c.add_ref(coupler)
    coupler_sep = coupler.ports["E1"].y - coupler.ports["E0"].y

    if n_o_outputs > 2:
        _cmp = splitter_tree(
            coupler=coupler,
            n_o_outputs=n_o_outputs // 2,
            bend_radius=bend_radius,
            spacing=spacing / 2,
        )
    else:
        termination_component = (termination_component if termination_component
                                 is not None else waveguide(length=0.1))
        _cmp = pp.call_if_func(termination_component)

    spacing = (spacing if spacing is not None else _cmp.ports["W0"].y -
               _coupler.size_info.south)
    if spacing < coupler_sep:
        tree_top = _cmp.ref(port_id="W0", position=_coupler.ports["E1"])
        tree_bot = _cmp.ref(
            port_id="W0",
            position=_coupler.ports["E0"],
            v_mirror=False  # True
        )

    else:
        d = 2 * bend_radius + 1
        spacing = max(spacing, d)

        tree_top = _cmp.ref(port_id="W0",
                            position=_coupler.ports["E1"].position +
                            (d, spacing))
        tree_bot = _cmp.ref(
            port_id="W0",
            position=_coupler.ports["E0"].position + (d, -spacing),
            v_mirror=False,  # True,
        )

        c.add(connect_strip(coupler.ports["E1"], tree_top.ports["W0"]))
        c.add(connect_strip(coupler.ports["E0"], tree_bot.ports["W0"]))

    i = 0
    for p in get_ports_facing(tree_bot, "E"):
        c.add_port(name="{}".format(i), port=p)
        i += 1

    for p in get_ports_facing(tree_top, "E"):
        c.add_port(name="{}".format(i), port=p)
        i += 1

    c.add(tree_bot)
    c.add(tree_top)
    c.add_port(name="W0", port=_coupler.ports["W0"])

    return c