예제 #1
0
파일: mzi.py 프로젝트: tvt173/ubc
    # Create the circuit, add all individual instances
    circuit = Subcircuit("mzi")
    circuit.add([
        (y, "splitter"),
        (y, "recombiner"),
        (wg_long, "wg_long"),
        (wg_short, "wg_short"),
    ])
    circuit.elements["splitter"].pins = ("in1", "out1", "out2")
    circuit.elements["recombiner"].pins = ("out1", "in2", "in1")

    # Circuits can be connected using the elements' string names:
    circuit.connect_many([
        ("splitter", "out1", "wg_long", "n1"),
        ("splitter", "out2", "wg_short", "n1"),
        ("recombiner", "in1", "wg_long", "n2"),
        ("recombiner", "in2", "wg_short", "n2"),
    ])
    circuit.elements["splitter"].pins["in1"] = "input"
    circuit.elements["recombiner"].pins["out1"] = "output"
    return circuit


if __name__ == "__main__":
    import matplotlib.pyplot as plt

    c = mzi()
    sweep_simulation(c)
    plt.show()
예제 #2
0
파일: add_gc.py 프로젝트: tvt173/ubc
def add_gc_te(circuit, gc=siepic.ebeam_gc_te1550):
    """ 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__":
    import matplotlib.pyplot as plt
    from ubc.cm.mzi import mzi

    c1 = mzi()
    c2 = add_gc_te(c1)
    sweep_simulation(c2)
    plt.show()