通过i3.Boundary也可以来定义宽度随长度变化的波导,
如:
全部代码如下:
from si_fab import all as pdk
from ipkiss3 import all as i3
import numpy as np
def width_change_with_length(L, a, m, w0):
x = np.linspace(0, L, 101)
y1 = (a * (L - x) ** m + w0) / 2
y2 = -y1[::-1]
x_list = np.concatenate((x, x[::-1]))
y_list = np.concatenate((y1, y2))
return list(zip(x_list, y_list))
class waveguide(i3.PCell):
L = i3.PositiveNumberProperty(default=1)
a = i3.PositiveNumberProperty(default=0.1)
m = i3.IntProperty(default=4)
w0 = i3.PositiveNumberProperty(default=0.2)
class Layout(i3.LayoutView):
def _generate_elements(self, elems):
position = width_change_with_length(L=self.L, a=self.a, m=self.m, w0=self.w0)
elems += i3.Boundary(
layer=i3.TECH.PPLAYER.SI,
shape=position)
return elems
def _generate_ports(self, ports):
ports += i3.OpticalPort(name="in",
position=(0, 0),
angle=180.0,
layer=i3.TECH.PPLAYER.SI)
ports += i3.OpticalPort(name="out",
position=(self.L, 0),
angle=0.0,
layer=i3.TECH.PPLAYER.SI)
return ports
class Netlist(i3.NetlistFromLayout):
pass
if __name__ == '__main__':
waveguide().Layout().visualize(annotate=True)
通过:
def width_change_with_length(L, a, m, w0):
x = np.linspace(0, L, 101)
y1 = (a * (L - x) ** m + w0) / 2
y2 = -y1[::-1]
x_list = np.concatenate((x, x[::-1]))
y_list = np.concatenate((y1, y2))
return list(zip(x_list, y_list))
可以得到波导边界的坐标点,再通过i3.Boundary可以画出波导