コード例 #1
0
def _demo():
    import pp

    e1 = pp.c.ellipse()
    e2 = pp.c.ellipse(radii=(10, 6)).movex(2)
    e3 = pp.c.ellipse(radii=(10, 4)).movex(5)
    pp.qp([e1, e2, e3])
    c = boolean(A=[e1, e3], B=e2, operation="A-B")
    pp.show(c)
コード例 #2
0
ファイル: 04_connect.py プロジェクト: smartalecH/gdsfactory
""" based on phidl tutorial

# Connecting devices with connect()

The connect command allows us to connect DeviceReference ports together like
Lego blocks.  There is an optional parameter called ``overlap`` which is
useful if you have shapes you want to intersect with some overlap (or with a
negative number, separate the ports).

"""

import pp

c = pp.Component("waveguides_sample")

wg1 = c << pp.c.waveguide(length=10, width=1)
wg2 = c << pp.c.waveguide(length=10, width=2, layer=pp.LAYER.SLAB90)
wg3 = c << pp.c.waveguide(length=10, width=3, layer=pp.LAYER.SLAB150)

wg2.connect(port="W0", destination=wg1.ports["E0"])
wg3.connect(port="W0", destination=wg2.ports["E0"], overlap=1)

pp.qp(c)  # quickplot it!
pp.show(c)  # show it in klayout
コード例 #3
0
        _md5.update(str(string_to_device_in_out_ports).encode())
        _md5.update(str(sequence).encode())
        component.name = "{}_{}".format(name_prefix, _md5.hexdigest())
    return component


if __name__ == "__main__":
    import pp

    bend180 = pp.c.bend_circular180()
    wg_heater = pp.c.waveguide_heater()
    wg = pp.c.waveguide()

    # Define a map between symbols and (component, input port, output port)
    string_to_device_in_out_ports = {
        "A": (bend180, "W0", "W1"),
        "B": (bend180, "W1", "W0"),
        "H": (wg_heater, "W1", "E1"),
        "-": (wg, "W0", "E0"),
    }

    # Generate a sequence
    # This is simply a chain of characters. Each of them represents a component
    # with a given input and and a given output

    sequence = "AB-H-H-H-H-BA"
    component = pp.c.component_sequence(sequence,
                                        string_to_device_in_out_ports)
    pp.qp(component)
    pp.show(component)
コード例 #4
0
ファイル: mzi.py プロジェクト: smartalecH/gdsfactory
    l0br.connect(port="W0", destination=l1r.ports["E0"])
    blbmrb.connect(port="N0", destination=l0br.ports["E0"])
    blbmrb.connect(port="W0", destination=cout.ports["E1"])  # just for netlist

    # west ports
    for port_name, port in cin.ports.items():
        if port.angle == 180:
            c.add_port(name=port_name, port=port)

    # east ports
    i = 0
    for port_name, port in cout.ports.items():
        if port.angle == 0:
            c.add_port(name=f"E{i}", port=port)
            i += 1

    return c


if __name__ == "__main__":
    DL = 116.8 / 2
    # print(DL)
    c = mzi(DL=DL, pins=True)
    # print(c.ports["E0"].midpoint[1])
    # c.plot_netlist()
    print(c.ports.keys())
    print(c.ports["E0"].midpoint)
    pp.show(c)
    pp.qp(c)
    # print(c.get_settings())
コード例 #5
0
ファイル: boolean.py プロジェクト: flaport/gdsfactory
        the 2 input Devices performed.

    Notes
    -----
    'A+B' is equivalent to 'or'.
    'A-B' is equivalent to 'not'.
    'B-A' is equivalent to 'not' with the operands switched.
    """
    num_divisions = num_divisions or [1, 1]
    c = pg.boolean(
        A=A,
        B=B,
        operation=operation,
        precision=precision,
        num_divisions=num_divisions,
        max_points=max_points,
        layer=layer,
    )
    return import_phidl_component(component=c)


if __name__ == "__main__":
    import pp

    e1 = pp.c.ellipse()
    e2 = pp.c.ellipse(radii=(10, 6)).movex(2)
    e3 = pp.c.ellipse(radii=(10, 4)).movex(5)
    pp.qp([e1, e2, e3])
    c = boolean(A=[e1, e3], B=e2, operation="A-B")
    pp.show(c)