for i in range(N): port = Port(name="S{}".format(i), midpoint=p0 + ((i - N / 2) * port_pitch, -dy), orientation=-90, **port_params) component.add_port(port) return component if __name__ == "__main__": component = big_device(N=10) bend_radius = 5.0 # import cProfile, pstats, io # pr = cProfile.Profile() # pr.enable() # Had to fix the fanout length by hand here to give enough space. c = add_io_optical(component, bend_radius=bend_radius, fanout_length=50.0) # pr.disable() # s = io.StringIO() # sortby = "cumtime" # ps = pstats.Stats(pr, stream=s).sort_stats(sortby) # ps.print_stats() # print(s.getvalue()) pp.show(c)
def SPIRAL(N=6, x=50.0): c = spiral_external_io(N=N, x_inner_length_cutback=x) return add_io_optical(c, x_grating_offset=-200, fanout_length=30)
def cutback_bend_circular(bend_radius=10.0, n_steps=3, n_stairs=4): bend90 = bend_circular(radius=bend_radius) c = cutback_bend(bend90=bend90, n_steps=n_steps, n_stairs=n_stairs) cc = add_io_optical(c, optical_routing_type=1) return cc
def CP2x2(gap=0.3, length=10.0): c = coupler(gap=gap, length=length) return add_io_optical(c)