def simple_create(): D = phidl.Device() ipc.trace_phidladd(D, 'debuglobal.gds') l1 = phidl.Layer(1) for i in range(4): for j in range(4): box = phidl.geometry.rectangle(size=(10, 10), layer=l1) box.move((15 * i, 15 * j)) D << box
def pfunc(*args, **kwargs): for k in kwargs.keys(): if k not in all_kwargs.keys(): raise ValueError('Invalid argument. "{}" is not in {}'.format( k, all_kwargs.keys())) all_kwargs.update(kwargs) for k, v in all_kwargs.keys(): setattr(pyaPCell, k, v) layout = pya.Layout() layout.place( pyaPCell.pcell()) # WRONG method. I forget what "place" is called new_Device = phidl.Device() anyCell_to_anyCell(layout, new_Device) return new_Device
try: import lyipc except ImportError: print('Warning: lyipc is not installed on your PYTHONPATH.') print('Continuing with relative path for now...\n' + '-' * 50) import sys from os.path import join, dirname sys.path.append(join(dirname(__file__), '..', 'python')) import phidl import lyipc.client as ipc import os import time # Define layouts, layers, cell TOP = phidl.Device('TOP') somelayer = phidl.Layer(1) ### Basic lyipc usage ### gdsname = os.path.realpath('box.gds') # Create and place a rectangle box = phidl.geometry.rectangle(size=(20, 20), layer=somelayer) box_ref = TOP.add_ref(box) # Write and tell Klayout GUI to open the file TOP.write_gds(gdsname) ipc.load(gdsname) ### Using python debugger and quick plot function ###
from os.path import join, dirname sys.path.append(join(dirname(__file__), '..', 'python')) import lyipc.client.phidl as ipc import os import time import phidl debug_file = os.path.realpath('debuglobal.gds') # Clear and open the file if not os.path.isfile(debug_file): from lygadgets import any_write any_write(phidl.Device(), debug_file) ipc.load(debug_file) def simple_create(grids=4): t0 = time.time() D = phidl.Device() ipc.trace_phidladd(D, 'debuglobal.gds') l1 = phidl.Layer(1) for i in range(grids): for j in range(grids): box = phidl.geometry.rectangle(size=(10, 10), layer=l1) box.move((15 * i, 15 * j)) D << box print(time.time() - t0)