Exemplo n.º 1
0
    """

    waveguide = pp.call_if_func(waveguide)
    coupler = pp.call_if_func(coupler)

    # Create the circuit, add all individual instances
    circuit = Subcircuit("mzi")
    circuit.add(
        [(coupler, "ct"), (coupler, "cb"), (waveguide, "wl"), (waveguide, "wr"),]
    )

    # Circuits can be connected using the elements' string names:
    circuit.connect_many(
        [
            ("cb", "N0", "wl", "n1"),
            ("wl", "n2", "ct", "N1"),
            ("ct", "N0", "wr", "n2"),
            ("wr", "n1", "cb", "N1"),
        ]
    )
    circuit.elements["cb"].pins["W0"] = "input"
    circuit.elements["cb"].pins["E0"] = "output"
    circuit.elements["ct"].pins["W0"] = "drop"
    circuit.elements["ct"].pins["E0"] = "cdrop"
    return circuit


if __name__ == "__main__":
    c = ring_double()
    sweep_simulation(c)
Exemplo n.º 2
0
    """ add input and output gratings

    Args:
        circuit: needs to have `input` and `output` pins
        gc: grating coupler
    """
    c = Subcircuit(f"{circuit}_gc")
    gc = pp.call_if_func(gc)
    c.add([
        (gc, "gci"),
        (gc, "gco"),
        (circuit, "circuit"),
    ])
    c.connect_many([
        ("gci", "n1", "circuit", "input"),
        ("gco", "n1", "circuit", "output"),
    ])

    # c.elements["circuit"].pins["input"] = "input_circuit"
    # c.elements["circuit"].pins["output"] = "output_circuit"
    c.elements["gci"].pins["n2"] = "input"
    c.elements["gco"].pins["n2"] = "output"

    return c


if __name__ == "__main__":
    c1 = mzi()
    c2 = add_gc(c1)
    sweep_simulation(c2)