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")
def conn(): """ default connector """ wg = pt.Waveguide() s = pt.Source() d = pt.Detector() conn = wg["ab"] * s["a"] * d["b"] return conn
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
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")
def __init__(self): super(NewNetwork, self).__init__() self.wg1 = pt.Waveguide() self.wg2 = pt.Waveguide() self.link("wg3:1", "0:wg2")
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
def wg(): """ default base waveguide """ return pt.Waveguide()