Skip to content

Commit

Permalink
Update test_waveguide_sliver.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasc-ubc committed Jul 8, 2024
1 parent 4f9fb36 commit 5c4258c
Showing 1 changed file with 31 additions and 25 deletions.
56 changes: 31 additions & 25 deletions klayout/EBeam/pymacros/tests/test_waveguide_sliver.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,44 @@
import siepic_ebeam_pdk

import os
tech_name = 'EBeam'
from SiEPIC.utils import get_technology, get_technology_by_name
TECHNOLOGY = get_technology_by_name(tech_name)

cell, ly = new_layout(tech_name, top_cell_name, GUI=True, overwrite = True)
def test_sliver():

waveguide_type='Strip TE 1550 nm, w=500 nm'
tech_name = 'EBeam'
from SiEPIC.utils import get_technology, get_technology_by_name
TECHNOLOGY = get_technology_by_name(tech_name)

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)
cell, ly = new_layout(tech_name, top_cell_name, GUI=True, overwrite = True)

instY1.delete()
instY2.delete()
waveguide_type='Strip TE 1550 nm, w=500 nm'

# 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:
print(' Polygon error: %s' %p)
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()

# Save
path = os.path.dirname(os.path.realpath(__file__))
filename = 'test_waveguide_sliver'
file_out = export_layout(cell, path, filename, relative_path = '', format='oas')
# 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:
print(' Polygon error: %s' %p)

from SiEPIC.utils import klive
klive.show(file_out, technology=tech_name, keep_position=True)

# 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()

0 comments on commit 5c4258c

Please sign in to comment.