io_gratings, list(component.ports.values()), component_name=component.name, layer_label=layer_label, gc_port_name=gc_port_name, ) cnew.add(labels) return cnew def add_te(*args, **kwargs): return add_grating_couplers(*args, **kwargs) def add_tm(*args, grating_coupler=grating_coupler_tm, **kwargs): return add_grating_couplers(*args, grating_coupler=grating_coupler, **kwargs) if __name__ == "__main__": # from pp.add_labels import get_optical_text # c = pp.c.grating_coupler_elliptical_te() # print(c.wavelength) # print(c.get_property('wavelength')) c = pp.c.waveguide(width=2) # cc = add_grating_couplers(c) cc = add_tm(c) print(cc) pp.show(cc)
ymin0 = width / 2 yminL = width / 2 ymax0 = width / 2 + trench_width ymaxL = width / 2 + trench_width + slab_offset x = [0, length, length, 0] ytt = [ymin0, yminL, ymaxL, ymax0] ytb = [-ymin0, -yminL, -ymaxL, -ymax0] c.add_polygon((x, ytt), layer=trench_layer) c.add_polygon((x, ytb), layer=trench_layer) c.add_port(name="W0", midpoint=[0, 0], width=width, orientation=180, layer=wg_layer) c.add_port(name="E0", midpoint=[length, 0], width=width, orientation=0, layer=wg_layer) return c if __name__ == "__main__": c = taper(width2=1, layers_cladding=[pp.LAYER.WGCLAD]) # c = taper_strip_to_ridge() # print(c.get_optical_ports()) # c = taper_strip_to_ridge_trenches() pp.show(c)
for port in po.portlist.keys(): port_loc = po.portlist[port]["port"] direction = direction_to_degree(po.portlist[port]["direction"]) c.add_port( name=port, midpoint=[port_loc[0], port_loc[1]], width=po.wgt.wg_width, orientation=direction, ) return c if __name__ == "__main__": wgt = pc.WaveguideTemplate( bend_radius=50.0, wg_width=1.0, wg_layer=1, wg_datatype=0, clad_layer=2, clad_datatype=0, ) # gc = pc.GratingCoupler(wgt, port=(10, 20), direction=np.pi * 7 / 8) gc = pc.GratingCoupler(wgt, port=(10, 20), direction=0.0) gcc = picwriter2component(gc) pp.show(gcc)
def test_select_ports_prefix(): import pp c = pp.c.waveguide() ports = c.get_ports_list(prefix="W") assert len(ports) == 1 def test_select_ports_type(): import pp c = pp.c.mzi2x2(with_elec_connections=True) ports = c.get_ports_list(port_type="dc") assert len(ports) == 3 if __name__ == "__main__": test_select_ports_type() import pp name = "mmi1x2" gdspath = pp.CONFIG["gdslib"] / "gds" / f"{name}.gds" csvpath = pp.CONFIG["gdslib"] / "gds" / f"{name}.ports" pp.show(gdspath) # read_port_markers(gdspath, layer=66) p = csv2port(csvpath) print(p)
coupler_lengths = [10, 20, 30, 40] coupler_gaps = [0.1, 0.2, 0.4, 0.5] delta_lengths = [10, 100, 200] c = pp.c.mzi_lattice( coupler_lengths=coupler_lengths, coupler_gaps=coupler_gaps, delta_lengths=delta_lengths, ) c.get_netlist() print(c.get_netlist_yaml()) if __name__ == "__main__": from pprint import pprint from omegaconf import OmegaConf import pp from pp.test_component_from_yaml import sample_2x2_connections c = pp.component_from_yaml(sample_2x2_connections) pp.show(c) pprint(c.get_netlist()) n = c.get_netlist() yaml_str = OmegaConf.to_yaml(n, sort_keys=True) c2 = pp.component_from_yaml(yaml_str) pp.show(c2)
def demo2(): c = simple_mzi2x2(waveguide_factory=pp.c.waveguide_heater) pp.show(c)
def demo1(): c = simple_mzi2x2() pp.show(c)