예제 #1
0
 def __init__(self):
     super(AddDrop, self).__init__()
     self.term_in = pt.Source()
     self.term_pass = pt.Detector()
     self.term_add = pt.Detector()
     self.term_drop = pt.Detector()
     self.dc1 = pt.DirectionalCoupler()
     self.dc2 = pt.DirectionalCoupler()
     self.wg1 = pt.Waveguide()
     self.wg2 = pt.Waveguide()
     self.link("term_in:0", "0:dc1:2", "0:wg1:1", "1:dc2:3", "0:term_drop")
     self.link("term_add:0", "2:dc2:0", "0:wg2:1", "3:dc1:1", "0:term_pass")
예제 #2
0
def conn():
    """ default connector """
    wg = pt.Waveguide()
    s = pt.Source()
    d = pt.Detector()
    conn = wg["ab"] * s["a"] * d["b"]
    return conn
예제 #3
0
def nw():
    """ default network (source-waveguide-detector) """
    with pt.Network() as nw:
        nw.wg = pt.Waveguide(length=1e-5)
        nw.s = pt.Source()
        nw.d = pt.Detector()
        nw.link("s:0", "0:wg:1", "0:d")
    return nw
예제 #4
0
def test_network_with_component_with_different_name_as_attribute():
    with pytest.raises(ValueError):
        with pt.Network() as nw:
            nw.wg = pt.Waveguide(name="wg0")
예제 #5
0
 def __init__(self):
     super(NewNetwork, self).__init__()
     self.wg1 = pt.Waveguide()
     self.wg2 = pt.Waveguide()
     self.link("wg3:1", "0:wg2")
예제 #6
0
def unw():
    """ default unterminated network """
    with pt.Network() as nw:
        nw.wg1 = nw.wg2 = pt.Waveguide(length=5e-6)
        nw.link(1, "0:wg1:1", "0:wg2:1", 0)
    return nw
예제 #7
0
def wg():
    """ default base waveguide """
    return pt.Waveguide()