|
| 1 | +''' |
| 2 | +--- Fabry Perot cavity using Bragg gratings and long multi-mode waveguides --- |
| 3 | + |
| 4 | +by Lukas Chrostowski, 2025 |
| 5 | + |
| 6 | +Simple script to |
| 7 | + - create a new layout with a top cell |
| 8 | + - create the Bragg cavity |
| 9 | + - export to OASIS for submission to fabrication |
| 10 | +
|
| 11 | +using SiEPIC-Tools function including connect_pins_with_waveguide and connect_cell |
| 12 | +
|
| 13 | +usage: |
| 14 | + - run this script in Python |
| 15 | +''' |
| 16 | + |
| 17 | +designer_name = 'LukasChrostowski' |
| 18 | +top_cell_name = 'EBeam_%s_BraggMMcavityB' % designer_name |
| 19 | + |
| 20 | +import pya |
| 21 | +from pya import * |
| 22 | + |
| 23 | +import SiEPIC |
| 24 | +from SiEPIC._globals import Python_Env |
| 25 | +from SiEPIC.scripts import connect_cell, connect_pins_with_waveguide, zoom_out, export_layout |
| 26 | +from SiEPIC.utils.layout import new_layout, floorplan |
| 27 | +from SiEPIC.extend import to_itype |
| 28 | + |
| 29 | +import os |
| 30 | + |
| 31 | +if Python_Env == 'Script': |
| 32 | + try: |
| 33 | + # For external Python mode, when installed using pip install siepic_ebeam_pdk |
| 34 | + import siepic_ebeam_pdk |
| 35 | + except: |
| 36 | + # Load the PDK from a folder, e.g, GitHub, when running externally from the KLayout Application |
| 37 | + import os, sys |
| 38 | + path_GitHub = os.path.expanduser('~/Documents/GitHub/') |
| 39 | + sys.path.append(os.path.join(path_GitHub, 'SiEPIC_EBeam_PDK/klayout')) |
| 40 | + import siepic_ebeam_pdk |
| 41 | + |
| 42 | +tech_name = 'EBeam' |
| 43 | + |
| 44 | +if SiEPIC.__version__ < '0.5.1': |
| 45 | + raise Exception("Errors", "This example requires SiEPIC-Tools version 0.5.1 or greater.") |
| 46 | + |
| 47 | +''' |
| 48 | +Create a new layout using the EBeam technology, |
| 49 | +with a top cell |
| 50 | +and Draw the floor plan |
| 51 | +''' |
| 52 | +topcell, ly = new_layout(tech_name, top_cell_name, GUI=True, overwrite = True) |
| 53 | +floorplan(topcell, 605e3, 410e3) |
| 54 | + |
| 55 | +dbu = ly.dbu |
| 56 | + |
| 57 | +from SiEPIC.scripts import connect_pins_with_waveguide, connect_cell |
| 58 | +waveguide_type='Strip TE 1310 nm, w=350 nm' |
| 59 | +waveguide_type_delay='Si routing TE 1310 nm (compound waveguide)' |
| 60 | + |
| 61 | +# Load cells from library |
| 62 | +cell_ebeam_gc = ly.create_cell('GC_TE_1310_8degOxide_BB', tech_name) |
| 63 | +cell_ebeam_y = ly.create_cell('ebeam_y_1310', 'EBeam_Beta') |
| 64 | + |
| 65 | +# define parameters for the designs |
| 66 | +params_BraggN = [6, 7, 8, 9] |
| 67 | + |
| 68 | +for i in range(0,4): |
| 69 | + cell = ly.create_cell('cell%s' % i) |
| 70 | + |
| 71 | + x,y = 52000*i, -40000*i |
| 72 | + t = Trans(Trans.R0,x,y) |
| 73 | + topcell.insert(CellInstArray(cell.cell_index(), t)) |
| 74 | + |
| 75 | + cell_bragg = ly.create_cell('BraggWaveguide_holes', 'EBeam_Beta', { |
| 76 | + 'number_of_periods':params_BraggN[i], |
| 77 | + 'grating_period':0.326, 'wg_width':0.35}) |
| 78 | + ''' |
| 79 | + cell_bragg = ly.create_cell('BraggWaveguide_holes', 'EBeam_Beta', { |
| 80 | + 'number_of_periods':params_BraggN[i], |
| 81 | + 'grating_period':0.45, 'wg_width':0.5}) |
| 82 | + ''' |
| 83 | + |
| 84 | + if not cell_bragg: |
| 85 | + raise Exception ('Cannot load Bragg grating cell; please check the script carefully.') |
| 86 | + |
| 87 | + # Circuit design, with a very long delay line |
| 88 | + cell_ebeam_delay = ly.create_cell('spiral_paperclip', 'EBeam_Beta',{ |
| 89 | + 'waveguide_type':waveguide_type_delay, |
| 90 | + 'length':160, |
| 91 | + 'loops':1, |
| 92 | + 'flatten':True}) |
| 93 | + x,y = 41000, 140000 |
| 94 | + t = Trans(Trans.R0,x,y) |
| 95 | + instGC1 = cell.insert(CellInstArray(cell_ebeam_gc.cell_index(), t)) |
| 96 | + t = Trans(Trans.R0,x,y+127000) |
| 97 | + instGC2 = cell.insert(CellInstArray(cell_ebeam_gc.cell_index(), t)) |
| 98 | + t = Trans(Trans.R0,x,y+127000*2) |
| 99 | + instGC3 = cell.insert(CellInstArray(cell_ebeam_gc.cell_index(), t)) |
| 100 | + |
| 101 | + # automated test label |
| 102 | + text = Text ("opt_in_TE_1310_device_%s_BraggMMcavityB%s" % (designer_name, params_BraggN[i]), t) |
| 103 | + cell.shapes(ly.layer(ly.TECHNOLOGY['Text'])).insert(text).text_size = 5/dbu |
| 104 | + |
| 105 | + # Y branches: |
| 106 | + instY1 = connect_cell(instGC3, 'opt1', cell_ebeam_y, 'opt3') |
| 107 | + instY1.transform(Trans(20000,0)) |
| 108 | + |
| 109 | + # Bragg grating |
| 110 | + instBragg1 = connect_cell(instY1, 'opt1', cell_bragg, 'opt1') |
| 111 | + instBragg1.transform(Trans(10000,0)) |
| 112 | + |
| 113 | + # Spiral: |
| 114 | + instSpiral = connect_cell(instBragg1, 'opt2', cell_ebeam_delay, 'optA') |
| 115 | + |
| 116 | + # Bragg grating |
| 117 | + instBragg2 = connect_cell(instSpiral, 'optB', cell_bragg, 'opt2') |
| 118 | + |
| 119 | + # Waveguides: |
| 120 | + connect_pins_with_waveguide(instGC3, 'opt1', instY1, 'opt3', waveguide_type=waveguide_type) |
| 121 | + connect_pins_with_waveguide(instGC2, 'opt1', instY1, 'opt2', waveguide_type=waveguide_type, turtle_B=[15,90,5,-90]) |
| 122 | + connect_pins_with_waveguide(instGC1, 'opt1', instBragg2, 'opt1', waveguide_type=waveguide_type, turtle_A=[10 ,90, 100,-90], turtle_B=[5,90,10,-90,20,90]) |
| 123 | + connect_pins_with_waveguide(instY1, 'opt1', instBragg1, 'opt1', waveguide_type=waveguide_type,turtle_B=[5,-90]) |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | +# Zoom out |
| 128 | +zoom_out(cell) |
| 129 | + |
| 130 | +# Save |
| 131 | +path = os.path.dirname(os.path.realpath(__file__)) |
| 132 | +filename = os.path.splitext(os.path.basename(__file__))[0] |
| 133 | +file_out = export_layout(topcell, path, filename, relative_path = '..', format='oas', screenshot=False) |
| 134 | + |
0 commit comments