backup.py
backup.py
import numpy as np
import gdstk
from tidy3d_lambda import entrypoint
@entrypoint
def generate_object(param):
# parameters
x0=0 # x coordinate of directional coupler center (um)
y0=0 # y coordinate of directional coupler center (um)
z0=0 # z coordinate of directional coupler center (um)
wg_width=0.5 # width of the waveguide (um)
wg_thickness=0.22 # thickness of the waveguide (um)
wg_spacing_in=0 # spacing between the input straight waveguides (um)
wg_spacing_coup=1.0 # gap size of the coupling region (um)
wg_length=4 # length of the input straight waveguides (um)
coup_length=4 #length of the coupling region (um)
bend_length=4 # length of the bending (um)
sidewall_angle=0 # side wall angle of the waveguide (rad)
# medium of the waveguide
medium=td.material_library["cSi"]["Li1993_293K"]
cell = gdstk.Cell("dc") # define a gds cell
# define a path
coup = gdstk.RobustPath(
(-wg_length - bend_length - coup_length / 2 + x0, wg_spacing_in / 2 + y0),
wg_width,
layer=1,
datatype=0,
)
coup.segment(
(-coup_length /2 + x0, wg_spacing_in / 2 + y0), offset=lambda u: A/100 *
2*np.cos(np.pi * u) - A
)
# Modify this part to create a full circular loop replacing the blue-marked
portion.
coup.arc(radius=coup_length/1.5, initial_angle=-np.pi/2, final_angle=
0.05*np.pi/2)
return [dc]