-
Notifications
You must be signed in to change notification settings - Fork 156
/
Copy pathtest_waveguide_sliver.py
71 lines (52 loc) · 1.96 KB
/
test_waveguide_sliver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""
Debug sliver issue foundy by Susan at CMC
by Lukas Chrostowski 2024
Caused when a bezier curve ending is the end of the waveguide.
Caused by translate_from_normal(wg_pts, width/2 + (offset if turn > 0 else - offset))
Caused by Bezier curve, which returns:
433, 12745
220, 12748
1, 12750
0, 12750
(length 111)
"""
designer_name = "Example"
top_cell_name = "EBeam_%s_MZI" % designer_name
import pya
from pya import *
import siepic_ebeam_pdk
from SiEPIC.scripts import connect_pins_with_waveguide, export_layout
from SiEPIC.utils.layout import new_layout
import os
def test_sliver():
tech_name = "EBeam"
from SiEPIC.utils import get_technology_by_name
TECHNOLOGY = get_technology_by_name(tech_name)
cell, ly = new_layout(tech_name, top_cell_name, GUI=True, overwrite=True)
waveguide_type = "Strip TE 1550 nm, w=500 nm"
cell_ebeam_y = ly.create_cell("ebeam_y_1550", tech_name)
t = pya.Trans.from_s("r0 %s, %s" % (-7400, 0))
instY1 = cell.insert(pya.CellInstArray(cell_ebeam_y.cell_index(), t))
t = pya.Trans.from_s("r0 %s, %s" % (-7400, 10e3))
instY2 = cell.insert(pya.CellInstArray(cell_ebeam_y.cell_index(), t))
wg1 = connect_pins_with_waveguide(
instY1, "opt2", instY2, "opt2", waveguide_type=waveguide_type
)
instY1.delete()
instY2.delete()
# check for sliver:
wg1.cell.shapes(ly.layer(ly.TECHNOLOGY["Si"])).each
polygon = [p for p in wg1.cell.shapes(ly.layer(ly.TECHNOLOGY["Si"])).each()][
0
].polygon
for p in [r for r in polygon.to_simple_polygon().each_point()]:
if p.x < 0:
raise Exception(" Polygon error: %s" % p)
# Save
path = os.path.dirname(os.path.realpath(__file__))
filename = "test_waveguide_sliver"
file_out = export_layout(cell, path, filename, relative_path="", format="oas")
from SiEPIC.utils import klive
klive.show(file_out, technology=tech_name, keep_position=True)
if __name__ == "__main__":
test_sliver()