Skip to content

Commit

Permalink
adding dbu to function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasc-ubc committed Nov 20, 2023
1 parent 3a79502 commit 01568f5
Show file tree
Hide file tree
Showing 17 changed files with 83 additions and 57 deletions.
12 changes: 12 additions & 0 deletions Developers/Scripting_ExternalPython_GitHub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# Code snipets to help with development of PCells and Scripted Layout

# SiEPIC - can be loaded from PyPI or in KLayout Application, or loaded from a local folder such as GitHub
import os, sys
path_GitHub = os.path.expanduser('~/Documents/GitHub/')
if os.path.exists(path_GitHub):
path_siepic = os.path.join(path_GitHub, 'SiEPIC-Tools/klayout_dot_config/python')
if not path_siepic in sys.path:
sys.path.insert(0,path_siepic) # put SiEPIC at the beginning so that it is overrides the system-installed module
import SiEPIC

Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,21 @@
in the SiEPIC-EBeam-PDK "EBeam" technology
by Lukas Chrostowski, 2020-2023
'''

print('SiEPIC_EBeam_PDK: example_Ring_resonator_sweep.py')
print('SiEPIC_EBeam_PDK: Example - Ring_resonator_sweep.py')
import pya
from pya import *

# SiEPIC - can be loaded from PyPI or in KLayout Application, or loaded from a local folder such as GitHub
import os, sys
path_GitHub = '/Users/lukasc/Documents/GitHub/'
if os.path.exists(path_GitHub):
path_siepic = os.path.join(path_GitHub, 'SiEPIC-Tools/klayout_dot_config/python')
if not path_siepic in sys.path:
sys.path.insert(0,path_siepic) # put SiEPIC at the beginning so that it is overrides the system-installed module
import SiEPIC

from SiEPIC._globals import Python_Env
from SiEPIC.scripts import load_klayout_technology
from SiEPIC.scripts import zoom_out, export_layout

if Python_Env == 'Script':
# Load the PDK from a folder, e.g, GitHub, when running externally from the KLayout Application
import os, sys
from SiEPIC.utils import load_klayout_technology
path_GitHub = os.path.expanduser('~/Documents/GitHub/')
path_module = os.path.join(path_GitHub, 'SiEPIC_EBeam_PDK/klayout')
path_lyt_file = os.path.join(path_GitHub, 'SiEPIC_EBeam_PDK/klayout/EBeam/EBeam.lyt')
tech = load_klayout_technology('EBeam', path_module, path_lyt_file)
Expand Down Expand Up @@ -73,8 +67,8 @@ def dbl_bus_ring_res():
cell, ly = new_layout(tech_name, 'top', GUI=True, overwrite = True)
floorplan(cell, 605e3, 410e3)

if SiEPIC.__version__ < '0.4.7':
pya.MessageBox.warning("Errors", "This example requires SiEPIC-Tools version 0.4.7 or greater.", pya.MessageBox.Ok)
if SiEPIC.__version__ < '0.5.1':
pya.MessageBox.warning("Errors", "This example requires SiEPIC-Tools version 0.5.1 or greater.", pya.MessageBox.Ok)

# Layer mapping:
LayerSiN = ly.layer(ly.TECHNOLOGY['Si'])
Expand Down Expand Up @@ -183,10 +177,8 @@ def dbl_bus_ring_res():
file_lyrdb = os.path.join(path,filename+'.lyrdb')
layout_check(cell = cell, verbose=False, GUI=True, file_rdb=file_lyrdb)

from SiEPIC.utils import klive
klive.show(file_out, lyrdb_filename=file_lyrdb, technology=tech_name)

# klive.lyrbd(file_lyrdb, technology=tech_name)

if Python_Env == 'Script':
from SiEPIC.utils import klive
klive.show(file_out, lyrdb_filename=file_lyrdb, technology=tech_name)

print('SiEPIC_EBeam_PDK: example_Ring_resonator_sweep.py - done')
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
import pya # klayout
import os, sys

path_GitHub = '/Users/lukasc/Documents/GitHub/'
if 'SiEPIC' not in sys.modules:
path_siepic = os.path.join(path_GitHub, 'SiEPIC-Tools/klayout_dot_config/python')
if not path_siepic in sys.path:
sys.path.append(path_siepic)
import SiEPIC
path_GitHub = os.path.expanduser('~/Documents/GitHub/')
if 0:
if 'SiEPIC' not in sys.modules:
path_siepic = os.path.join(path_GitHub, 'SiEPIC-Tools/klayout_dot_config/python')
if not path_siepic in sys.path:
sys.path.insert(0,path_siepic)
import SiEPIC
from SiEPIC._globals import Python_Env
print('KLayout running in mode: %s' % Python_Env)
from SiEPIC.utils.layout import new_layout, floorplan
from SiEPIC.scripts import load_klayout_technology, instantiate_all_library_cells, zoom_out, export_layout
from SiEPIC.utils import load_klayout_technology
from SiEPIC.scripts import instantiate_all_library_cells, zoom_out, export_layout

path_module = os.path.join(path_GitHub, 'SiEPIC_EBeam_PDK/klayout')
path_lyt_file = os.path.join(path_GitHub, 'SiEPIC_EBeam_PDK/klayout/EBeam/EBeam.lyt')
Expand Down
2 changes: 1 addition & 1 deletion klayout/EBeam/pymacros/SiEPIC_EBeam_Library.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def __init__(self):
print("Initializing '%s' Library." % library)

# Set the description
self.description = "v0.3.58, Components with models"
self.description = "v0.3.59, Components with models"

# Save the path, used for loading WAVEGUIDES.XML
import os
Expand Down
2 changes: 1 addition & 1 deletion klayout/EBeam/pymacros/SiEPIC_EBeam_Library_ANT.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self):
print("Initializing '%s' Library." % library)

# Set the description
self.description = "v0.3.58, ANT components"
self.description = "v0.3.59, ANT components"

# Save the path, used for loading WAVEGUIDES.XML
import os
Expand Down
2 changes: 1 addition & 1 deletion klayout/EBeam/pymacros/SiEPIC_EBeam_Library_Beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def __init__(self):
print("Initializing '%s' Library." % library)

# Set the description
self.description = "v0.3.58, Beta components"
self.description = "v0.3.59, Beta components"

# Save the path, used for loading WAVEGUIDES.XML
import os
Expand Down
2 changes: 1 addition & 1 deletion klayout/EBeam/pymacros/SiEPIC_EBeam_Library_SiN.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(self):
print("Initializing '%s' Library." % library)

# Set the description
self.description = "v0.3.58, Silicon Nitride"
self.description = "v0.3.59, Silicon Nitride"

# Save the path, used for loading WAVEGUIDES.XML
import os
Expand Down
2 changes: 1 addition & 1 deletion klayout/EBeam/pymacros/opics_ebeam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ def load_sparameters(

components_list = list(component_factory.keys())
__all__ = components_list
__version__ = "0.3.58"
__version__ = "0.3.59"

if __name__ == "__main__":
import SiEPIC.opics as op
Expand Down
11 changes: 9 additions & 2 deletions klayout/EBeam/pymacros/pcells_EBeam/Waveguide_Bend.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ def produce(self, layout, layers, parameters, cell):
y = r
# layout_arc_wg_dbu(self.cell, LayerSiN, x, y, r, w, 270, 360)
t = Trans(Trans.R0,x, y)
self.cell.shapes(LayerSiN).insert(arc_to_waveguide(arc(r, 270, 360), w).transformed(t))
from SiEPIC import __version__
if __version__ > '0.5.0':
self.cell.shapes(LayerSiN).insert(arc_to_waveguide(arc(r, 270, 360, dbu=dbu), w).transformed(t))
else:
self.cell.shapes(LayerSiN).insert(arc_to_waveguide(arc(r, 270, 360), w).transformed(t))

# Create the pins on the waveguides, as short paths:
from SiEPIC._globals import PIN_LENGTH as pin_length
Expand Down Expand Up @@ -100,7 +104,10 @@ def produce(self, layout, layers, parameters, cell):

# Create the device recognition layer -- make it 1 * wg_width away from the waveguides.
t = Trans(Trans.R0,x, y)
self.cell.shapes(LayerDevRecN).insert(arc_to_waveguide(arc(r, 270, 360), w*3).transformed(t))
if __version__ > '0.5.0':
self.cell.shapes(LayerDevRecN).insert(arc_to_waveguide(arc(r, 270, 360,dbu=dbu), w*3).transformed(t))
else:
self.cell.shapes(LayerDevRecN).insert(arc_to_waveguide(arc(r, 270, 360), w*3).transformed(t))
#layout_arc_wg_dbu(self.cell, LayerDevRecN, x, y, r, w*3, 270, 360)

# Compact model information
Expand Down
20 changes: 14 additions & 6 deletions klayout/EBeam/pymacros/pcells_EBeam/Waveguide_bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,20 @@ def solve_theta(delta_length, r):
delta_length = waveguide_length - length

t = Trans(Trans.R0,x, round(y+r))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 270., 270.+theta).transformed(t))
t = Trans(Trans.R0,round(x+length/2), round(y-r+ 2*r*(1-cos(theta/180.0*pi))))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 90.-theta, 90.+theta).transformed(t))
t = Trans(Trans.R0,round(x+length), round(y+r))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 270.-theta, 270).transformed(t))

from SiEPIC import __version__
if __version__ > '0.5.0':
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 270., 270.+theta, dbu=dbu).transformed(t))
t = Trans(Trans.R0,round(x+length/2), round(y-r+ 2*r*(1-cos(theta/180.0*pi))))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 90.-theta, 90.+theta, dbu=dbu).transformed(t))
t = Trans(Trans.R0,round(x+length), round(y+r))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 270.-theta, 270, dbu=dbu).transformed(t))
else:
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 270., 270.+theta, dbu=dbu).transformed(t))
t = Trans(Trans.R0,round(x+length/2), round(y-r+ 2*r*(1-cos(theta/180.0*pi))))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 90.-theta, 90.+theta, dbu=dbu).transformed(t))
t = Trans(Trans.R0,round(x+length), round(y+r))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 270.-theta, 270, dbu=dbu).transformed(t))

# Create the pins on the waveguides, as short paths:
from SiEPIC.utils.layout import make_pin
make_pin(self.cell, "pin1", [x,y], w, LayerPinRecN, 180)
Expand Down
4 changes: 2 additions & 2 deletions klayout/EBeam/pymacros/pcells_EBeam/Wireguide.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ def produce_impl(self):
pt_radius = dis2/2
# wireguide bends:
if(self.adiab):
wg_pts += Path(arc_bezier(pt_radius, 270, 270 + inner_angle_b_vectors(pts[i-1]-pts[i], pts[i+1]-pts[i]), self.bezier, DevRec='DevRec' in self.layers[lr]), 0).transformed(Trans(angle, turn < 0, pts[i])).get_points()
wg_pts += Path(arc_bezier(pt_radius, 270, 270 + inner_angle_b_vectors(pts[i-1]-pts[i], pts[i+1]-pts[i]), self.bezier, DevRec='DevRec' in self.layers[lr], dbu=dbu), 0).transformed(Trans(angle, turn < 0, pts[i])).get_points()
else:
wg_pts += Path(arc_xy(-pt_radius, pt_radius, pt_radius, 270, 270 + inner_angle_b_vectors(pts[i-1]-pts[i], pts[i+1]-pts[i]),DevRec='DevRec' in self.layers[lr]), 0).transformed(Trans(angle, turn < 0, pts[i])).get_points()
wg_pts += Path(arc_xy(-pt_radius, pt_radius, pt_radius, 270, 270 + inner_angle_b_vectors(pts[i-1]-pts[i], pts[i+1]-pts[i]),DevRec='DevRec' in self.layers[lr], dbu=dbu), 0).transformed(Trans(angle, turn < 0, pts[i])).get_points()
wg_pts += [pts[-1]]
wg_pts = pya.Path(wg_pts, 0).unique_points().get_points()
wg_polygon = Path(wg_pts, wg_width)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def produce_impl(self):

t = Trans(Trans.R180, 0, y_offset_top)
shapes_wg += layout_waveguide_sbend(self.cell, LayerSiN,
t, w1, sbend_r, sbend_offset, sbend_length, insert=False)
t, w1, sbend_r, sbend_offset, sbend_length, insert=False, dbu=dbu)
t = Trans(Trans.R0, -sbend_length-taper_length, y_offset_top-sbend_offset)
shapes_wg += layout_taper(self.cell, LayerSiN, t, port_w,
w1, taper_length, insert=False)
Expand Down Expand Up @@ -303,7 +303,7 @@ def produce_impl(self):

t = Trans(Trans.R0, length, y_offset_top)
shapes_wg += layout_waveguide_sbend(self.cell, LayerSiN, t,
w1, sbend_r, -sbend_offset, sbend_length, insert=False)
w1, sbend_r, -sbend_offset, sbend_length, insert=False, dbu=dbu)
t = Trans(Trans.R0, length+sbend_length, y_offset_top-sbend_offset)
shapes_wg += layout_taper(self.cell, LayerSiN, t, w1,
port_w, taper_length, insert=False)
Expand Down
16 changes: 8 additions & 8 deletions klayout/EBeam/pymacros/pcells_EBeam/ebeam_dc_te1550.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,24 @@ def produce_impl(self):
dc_angle = acos((r-abs(port_spacing/2))/r)*180/pi

# bottom S-bends
self.cell.shapes(LayerSiN).insert(arc_wg_xy(Lc/2,-r-(w+g)/2, r, w, 90-dc_angle, 90))
self.cell.shapes(LayerSiN).insert(arc_wg_xy(-Lc/2, -r-(w+g)/2, r, w, 90, 90+dc_angle))
self.cell.shapes(LayerSiN).insert(arc_wg_xy(Lc/2,-r-(w+g)/2, r, w, 90-dc_angle, 90, dbu=dbu))
self.cell.shapes(LayerSiN).insert(arc_wg_xy(-Lc/2, -r-(w+g)/2, r, w, 90, 90+dc_angle, dbu=dbu))
y_bottom = round(-2*(1-cos(dc_angle/180.0*pi))*r)-(w+g)/2
x_bottom = round(2*sin(dc_angle/180.0*pi)*r)
t = Trans(Trans.R0,-x_bottom-Lc/2, y_bottom+r)
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, -90, -90+dc_angle).transformed(t))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, -90, -90+dc_angle, dbu=dbu).transformed(t))
t = Trans(Trans.R0,x_bottom+Lc/2, y_bottom+r)
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, -90-dc_angle, -90).transformed(t))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, -90-dc_angle, -90, dbu=dbu).transformed(t))

# top S-bends
self.cell.shapes(LayerSiN).insert(arc_wg_xy(Lc/2,r+(w+g)/2, r, w, 270, 270+dc_angle))
self.cell.shapes(LayerSiN).insert(arc_wg_xy(-Lc/2, r+(w+g)/2, r, w, 270-dc_angle, 270))
self.cell.shapes(LayerSiN).insert(arc_wg_xy(Lc/2,r+(w+g)/2, r, w, 270, 270+dc_angle, dbu=dbu))
self.cell.shapes(LayerSiN).insert(arc_wg_xy(-Lc/2, r+(w+g)/2, r, w, 270-dc_angle, 270, dbu=dbu))
y_top = round(2*(1-cos(dc_angle/180.0*pi))*r)+(w+g)/2
x_top = round(2*sin(dc_angle/180.0*pi)*r)
t = Trans(Trans.R0,-x_top-Lc/2, y_top-r)
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 90-dc_angle, 90).transformed(t))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 90-dc_angle, 90, dbu=dbu).transformed(t))
t = Trans(Trans.R0,x_top+Lc/2, y_top-r)
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 90, 90+dc_angle).transformed(t))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 90, 90+dc_angle, dbu=dbu).transformed(t))

# Pins on the bottom waveguide side:
pin = Path([Point(-x_bottom+PIN_LENGTH/2-Lc/2, y_bottom), Point(-x_bottom-PIN_LENGTH/2-Lc/2, y_bottom)], w)
Expand Down
2 changes: 1 addition & 1 deletion klayout/EBeam/pymacros/pcells_SiN/Universal_GC.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def effective_index(wl = self.wavelength, etch_depth = self.etch_depth, Si_thick
# calculate such that the vertex & edge placement error is < 0.5 nm.
# see "SiEPIC_EBeam_functions - points_per_circle" for more details
radius = N*lambda_0 / (n_e*( 1 - e )) + j*period
seg_points = int(points_per_circle(radius/dbu)/360.*self.angle_e) # number of points grating arc
seg_points = int(points_per_circle(radius/dbu, dbu=dbu)/360.*self.angle_e) # number of points grating arc
theta_up = []
for m in range(seg_points+1):
theta_up = theta_up + [start + m*(stop-start)/seg_points]
Expand Down
6 changes: 3 additions & 3 deletions klayout/EBeam/pymacros/pcells_SiN/Waveguide_bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ def solve_theta(delta_length, r):
delta_length = waveguide_length - length

t = Trans(Trans.R0,x, round(y+r))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 270., 270.+theta).transformed(t))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 270., 270.+theta, dbu=dbu).transformed(t))
t = Trans(Trans.R0,round(x+length/2), round(y-r+ 2*r*(1-cos(theta/180.0*pi))))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 90.-theta, 90.+theta).transformed(t))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 90.-theta, 90.+theta, dbu=dbu).transformed(t))
t = Trans(Trans.R0,round(x+length), round(y+r))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 270.-theta, 270).transformed(t))
self.cell.shapes(LayerSiN).insert(arc_wg(r, w, 270.-theta, 270, dbu=dbu).transformed(t))

# Create the pins on the waveguides, as short paths:
from SiEPIC.utils.layout import make_pin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ def produce_impl(self):
# draw the half-circle
x = 0
y = r+w+g
self.cell.shapes(LayerSiN).insert(arc_wg_xy(x-Lc2, y, r, w, 180, 270))
self.cell.shapes(LayerSiN).insert(arc_wg_xy(x+Lc2, y, r, w, 270, 360))
from SiEPIC import __version__
if __version__ > '0.5.0':
self.cell.shapes(LayerSiN).insert(arc_wg_xy(x-Lc2, y, r, w, 180, 270, dbu=dbu))
self.cell.shapes(LayerSiN).insert(arc_wg_xy(x+Lc2, y, r, w, 270, 360, dbu=dbu))
else:
self.cell.shapes(LayerSiN).insert(arc_wg_xy(x-Lc2, y, r, w, 180, 270))
self.cell.shapes(LayerSiN).insert(arc_wg_xy(x+Lc2, y, r, w, 270, 360))

# Pins on the top side:
make_pin(self.cell, "pin2", [-r-Lc2, y], w, LayerPinRecN, 90)
Expand Down
2 changes: 1 addition & 1 deletion klayout/grain.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<salt-grain>
<name>siepic_ebeam_pdk</name>
<version>0.3.56</version>
<version>0.3.59</version>
<api-version>0.27</api-version>
<title>SiEPIC EBeam PDK</title>
<doc>A Process Design Kit for Silicon Photonics fabricated using Electron Beam Lithography (UW, ANT, SiEPICfab)</doc>
Expand Down

0 comments on commit 01568f5

Please sign in to comment.