From 3a79502239bcc49261faa59a62272bbdb0a42d8e Mon Sep 17 00:00:00 2001 From: Lukas Chrostowski Date: Sun, 19 Nov 2023 00:34:21 -0800 Subject: [PATCH] Verification in PyPI working, with KLive show(gds, rdb) --- .../example_Ring_resonator_sweep.py | 32 +++++++++++++------ .../EBeam/pymacros/SiEPIC_EBeam_Library.py | 25 ++++++++++----- .../pymacros/SiEPIC_EBeam_Library_ANT.py | 19 +++++++---- .../pymacros/SiEPIC_EBeam_Library_Beta.py | 28 ++++++++++------ .../pymacros/SiEPIC_EBeam_Library_Dream.py | 20 ++++++++---- .../pymacros/SiEPIC_EBeam_Library_SiN.py | 31 ++++++++++++------ 6 files changed, 106 insertions(+), 49 deletions(-) diff --git a/klayout/EBeam/pymacros/Example_scripted_layouts/example_Ring_resonator_sweep.py b/klayout/EBeam/pymacros/Example_scripted_layouts/example_Ring_resonator_sweep.py index d79f0bc0..78a353aa 100644 --- a/klayout/EBeam/pymacros/Example_scripted_layouts/example_Ring_resonator_sweep.py +++ b/klayout/EBeam/pymacros/Example_scripted_layouts/example_Ring_resonator_sweep.py @@ -27,19 +27,21 @@ 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': 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) +tech_name = 'EBeam' # Example layout function def dbl_bus_ring_res(): # Import functions from SiEPIC-Tools from SiEPIC.extend import to_itype - from SiEPIC.scripts import connect_cell, connect_pins_with_waveguide, zoom_out, export_layout + from SiEPIC.scripts import connect_cell, connect_pins_with_waveguide from SiEPIC.utils.layout import new_layout, floorplan # Create a layout for testing a double-bus ring resonator. @@ -68,7 +70,6 @@ def dbl_bus_ring_res(): with a top cell and Draw the floor plan ''' - tech_name = 'EBeam' cell, ly = new_layout(tech_name, 'top', GUI=True, overwrite = True) floorplan(cell, 605e3, 410e3) @@ -159,22 +160,33 @@ def dbl_bus_ring_res(): # GC3 to bottom-right of ring connect_pins_with_waveguide(instGCs[3], 'opt1', inst_dc2, 'pin3', waveguide_type=waveguide_type) - - # Zoom out - zoom_out(cell) - - # Save - path = os.path.dirname(os.path.realpath(__file__)) - export_layout(cell, path, 'Test_structures_ring_resonators', relative_path = '', format='oas', screenshot=True) + + # Introduce an error, to demonstrate the Functional Verification + inst_dc2.transform(Trans(1000,-1000)) + return ly, cell ly, cell = dbl_bus_ring_res() +# Zoom out +zoom_out(cell) + +# Save +path = os.path.dirname(os.path.realpath(__file__)) +filename = 'Test_structures_ring_resonators' +file_out = export_layout(cell, path, filename, relative_path = '', format='oas', screenshot=True) + from SiEPIC.verification import layout_check print('SiEPIC_EBeam_PDK: example_Ring_resonator_sweep.py - verification') -layout_check(cell = cell, verbose=True, GUI=True) +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) print('SiEPIC_EBeam_PDK: example_Ring_resonator_sweep.py - done') diff --git a/klayout/EBeam/pymacros/SiEPIC_EBeam_Library.py b/klayout/EBeam/pymacros/SiEPIC_EBeam_Library.py index 3527b5bd..665834d7 100644 --- a/klayout/EBeam/pymacros/SiEPIC_EBeam_Library.py +++ b/klayout/EBeam/pymacros/SiEPIC_EBeam_Library.py @@ -102,6 +102,7 @@ """ +verbose=False import pya from pya import * @@ -133,9 +134,11 @@ pcells_=[] for f in files: module = 'pcells_EBeam.%s' % f.replace('.py','') ### folder name ### - print(' - found module: %s' % module) + if verbose: + print(' - found module: %s' % module) m = importlib.import_module(module) - print(m) + if verbose: + print(m) pcells_.append(importlib.reload(m)) @@ -150,7 +153,8 @@ def __init__(self): library = tech_name self.technology=tech_name - print("Initializing '%s' Library." % library) + if verbose: + print("Initializing '%s' Library." % library) # Set the description self.description = "v0.3.58, Components with models" @@ -162,28 +166,33 @@ def __init__(self): # Import all the GDS files from the tech folder import os, fnmatch dir_path = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../gds/EBeam")) - print(' library path: %s' % dir_path) + if verbose: + print(' library path: %s' % dir_path) search_str = '*.[Oo][Aa][Ss]' # OAS for root, dirnames, filenames in os.walk(dir_path, followlinks=True): for filename in fnmatch.filter(filenames, search_str): file1=os.path.join(root, filename) - print(" - reading %s" % file1 ) + if verbose: + print(" - reading %s" % file1 ) self.layout().read(file1) search_str = '*.[Gg][Dd][Ss]' # GDS for root, dirnames, filenames in os.walk(dir_path, followlinks=True): for filename in fnmatch.filter(filenames, search_str): file1=os.path.join(root, filename) - print(" - reading %s" % file1 ) + if verbose: + print(" - reading %s" % file1 ) self.layout().read(file1) # Create the PCell declarations for m in pcells_: mm = m.__name__.replace('pcells_EBeam.','') mm2 = m.__name__+'.'+mm+'()' - print(' - register_pcell %s, %s' % (mm,mm2)) + if verbose: + print(' - register_pcell %s, %s' % (mm,mm2)) self.layout().register_pcell(mm, eval(mm2)) - print(' done with pcells') + if verbose: + print(' done with pcells') # Register us the library with the technology name # If a library with that name already existed, it will be replaced then. diff --git a/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_ANT.py b/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_ANT.py index 8790651e..fbd1b80a 100644 --- a/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_ANT.py +++ b/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_ANT.py @@ -6,7 +6,9 @@ This file implements a library called "EBeam-ANT", consisting of components that are biased to work the best with ANT process. """ -print('SiEPIC_EBeam_Library_ANT') +verbose=False +if verbose: + print('SiEPIC_EBeam_Library_ANT') import pya from pya import * @@ -43,7 +45,8 @@ def __init__(self): library = tech_name +'-ANT' self.technology=tech_name - print("Initializing '%s' Library." % library) + if verbose: + print("Initializing '%s' Library." % library) # Set the description self.description = "v0.3.58, ANT components" @@ -55,18 +58,21 @@ def __init__(self): # Import all the GDS files from the tech folder import os, fnmatch dir_path = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../gds/ANT")) - print(' library path: %s' % dir_path) + if verbose: + print(' library path: %s' % dir_path) search_str = '*.[Oo][Aa][Ss]' # OAS for root, dirnames, filenames in os.walk(dir_path, followlinks=True): for filename in fnmatch.filter(filenames, search_str): file1=os.path.join(root, filename) - print(" - reading %s" % file1 ) + if verbose: + print(" - reading %s" % file1 ) self.layout().read(file1) search_str = '*.[Gg][Dd][Ss]' # GDS for root, dirnames, filenames in os.walk(dir_path, followlinks=True): for filename in fnmatch.filter(filenames, search_str): file1=os.path.join(root, filename) - print(" - reading %s" % file1 ) + if verbose: + print(" - reading %s" % file1 ) self.layout().read(file1) # Create the PCell declarations @@ -76,7 +82,8 @@ def __init__(self): # print(' - register_pcell %s, %s' % (mm,mm2)) # self.layout().register_pcell(mm, eval(mm2)) - print(' done with pcells') + if verbose: + print(' done with pcells') # Register us the library with the technology name # If a library with that name already existed, it will be replaced then. diff --git a/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_Beta.py b/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_Beta.py index 208621ae..7375940d 100644 --- a/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_Beta.py +++ b/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_Beta.py @@ -124,7 +124,9 @@ def PCell_get_parameters ( pcell ): """ -print('SiEPIC_EBeam_Library_Beta') +verbose=False +if verbose: + print('SiEPIC_EBeam_Library_Beta') import pya from pya import * @@ -145,9 +147,11 @@ def PCell_get_parameters ( pcell ): pcells_=[] for f in files: module = 'pcells_EBeam_Beta.%s' % f.replace('.py','') ### folder name ### - print(' - found module: %s' % module) + if verbose: + print(' - found module: %s' % module) m = importlib.import_module(module) - print(m) + if verbose: + print(m) pcells_.append(importlib.reload(m)) @@ -162,7 +166,8 @@ def __init__(self): library = tech_name +'_Beta' self.technology=tech_name - print("Initializing '%s' Library." % library) + if verbose: + print("Initializing '%s' Library." % library) # Set the description self.description = "v0.3.58, Beta components" @@ -174,28 +179,33 @@ def __init__(self): # Import all the GDS files from the tech folder import os, fnmatch dir_path = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../gds/EBeam_Beta")) - print(' library path: %s' % dir_path) + if verbose: + print(' library path: %s' % dir_path) search_str = '*.[Oo][Aa][Ss]' # OAS for root, dirnames, filenames in os.walk(dir_path, followlinks=True): for filename in fnmatch.filter(filenames, search_str): file1=os.path.join(root, filename) - print(" - reading %s" % file1 ) + if verbose: + print(" - reading %s" % file1 ) self.layout().read(file1) search_str = '*.[Gg][Dd][Ss]' # GDS for root, dirnames, filenames in os.walk(dir_path, followlinks=True): for filename in fnmatch.filter(filenames, search_str): file1=os.path.join(root, filename) - print(" - reading %s" % file1 ) + if verbose: + print(" - reading %s" % file1 ) self.layout().read(file1) # Create the PCell declarations for m in pcells_: mm = m.__name__.replace('pcells_EBeam_Beta.','') mm2 = m.__name__+'.'+mm+'()' - print(' - register_pcell %s, %s' % (mm,mm2)) + if verbose: + print(' - register_pcell %s, %s' % (mm,mm2)) self.layout().register_pcell(mm, eval(mm2)) - print(' done with pcells') + if verbose: + print(' done with pcells') # Register us the library with the technology name # If a library with that name already existed, it will be replaced then. diff --git a/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_Dream.py b/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_Dream.py index 5432bb57..f2946fef 100644 --- a/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_Dream.py +++ b/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_Dream.py @@ -6,7 +6,10 @@ consisting of components developed by Dream Photonics Inc, that have been validated in the ANT process. """ -print('EBeam-Dream') +verbose=False + +if verbose: + print('EBeam-Dream') import pya from pya import * @@ -26,9 +29,11 @@ pcells_=[] for f in files: module = 'pcells_EBeam_Dream.%s' % f.replace('.py','') ### folder name ### - print(' - found module: %s' % module) + if verbose: + print(' - found module: %s' % module) m = importlib.import_module(module) - print(m) + if verbose: + print(m) pcells_.append(importlib.reload(m)) @@ -43,7 +48,8 @@ def __init__(self): library = tech_name +'-Dream' self.technology=tech_name - print("Initializing '%s' Library." % library) + if verbose: + print("Initializing '%s' Library." % library) # Set the description self.description = "v0.0.1, Dream Photonics" @@ -75,10 +81,12 @@ def __init__(self): for m in pcells_: mm = m.__name__.replace('pcells_EBeam_Dream.','') mm2 = m.__name__+'.'+mm+'()' - print(' - register_pcell %s, %s' % (mm,mm2)) + if verbose: + print(' - register_pcell %s, %s' % (mm,mm2)) self.layout().register_pcell(mm, eval(mm2)) - print(' done with pcells') + if verbose: + print(' done with pcells') # Register us the library with the technology name # If a library with that name already existed, it will be replaced then. diff --git a/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_SiN.py b/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_SiN.py index 362f8cb8..a0637c37 100644 --- a/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_SiN.py +++ b/klayout/EBeam/pymacros/SiEPIC_EBeam_Library_SiN.py @@ -21,7 +21,10 @@ - compatibility with PyPI usage of KLayout """ -print('siepic_ebeam_library_SiN') +verbose=False + +if verbose: + print('siepic_ebeam_library_SiN') import pya from pya import * @@ -43,9 +46,11 @@ pcells_=[] for f in files: module = 'pcells_SiN.%s' % f.replace('.py','') ### folder name ### - print(' - found module: %s' % module) + if verbose: + print(' - found module: %s' % module) m = importlib.import_module(module) - print(m) + if verbose: + print(m) pcells_.append(importlib.reload(m)) @@ -56,11 +61,13 @@ class siepic_ebeam_library_hubbard(Library): def __init__(self): + tech_name = 'EBeam' library = tech_name +'-SiN' self.technology=tech_name - print("Initializing '%s' Library." % library) + if verbose: + print("Initializing '%s' Library." % library) # Set the description self.description = "v0.3.58, Silicon Nitride" @@ -72,28 +79,32 @@ def __init__(self): # Import all the GDS files from the tech folder import os, fnmatch dir_path = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../gds/EBeam_SiN")) - print(' library path: %s' % dir_path) + if verbose: + print(' library path: %s' % dir_path) search_str = '*.[Oo][Aa][Ss]' # OAS for root, dirnames, filenames in os.walk(dir_path, followlinks=True): for filename in fnmatch.filter(filenames, search_str): file1=os.path.join(root, filename) - print(" - reading %s" % file1 ) + if verbose: + print(" - reading %s" % file1 ) self.layout().read(file1) search_str = '*.[Gg][Dd][Ss]' # GDS for root, dirnames, filenames in os.walk(dir_path, followlinks=True): for filename in fnmatch.filter(filenames, search_str): file1=os.path.join(root, filename) - print(" - reading %s" % file1 ) + if verbose: + print(" - reading %s" % file1 ) self.layout().read(file1) # Create the PCell declarations for m in pcells_: mm = m.__name__.replace('pcells_SiN.','') mm2 = m.__name__+'.'+mm+'()' - print(' - register_pcell %s, %s' % (mm,mm2)) + if verbose: + print(' - register_pcell %s, %s' % (mm,mm2)) self.layout().register_pcell(mm, eval(mm2)) - - print(' done with pcells') + if verbose: + print(' done with pcells') # Register us the library with the technology name # If a library with that name already existed, it will be replaced then.