diff --git a/klayout/EBeam/pymacros/tests/test_waveguide_sliver.py b/klayout/EBeam/pymacros/tests/test_waveguide_sliver.py index 2cf79095..4e2b821c 100644 --- a/klayout/EBeam/pymacros/tests/test_waveguide_sliver.py +++ b/klayout/EBeam/pymacros/tests/test_waveguide_sliver.py @@ -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()