def test_rectangle_write(top_cell): TOP, layout = top_cell() layer = "1/0" center = kdb.DPoint(0, 0) width = 20 height = 10 ex = kdb.DVector(1, 1) ey = kdb.DVector(0, 1) r = rectangle(center, width, height, ex, ey) assert repr(r) == "(-10,-15;-10,-5;10,15;10,5)" insert_shape(TOP, layer, r) TOP.write("tests/tmp/test_rectangle.gds")
def main(): layout = pya.Layout() TOP = layout.create_cell("TOP") layer = pya.LayerInfo(1, 0) # First layer origin = pya.DPoint(0, 0) ex = pya.DVector(1, 0) ey = pya.DVector(0, 1) angles = np.linspace(-170, 170, 13) for i, angle_0 in enumerate(angles): for j, angle_3 in enumerate(angles): curve = bezier_curve(origin + ey * i * 150 + ex * j * 150, angle_0, angle_3, ex, ey) layout_waveguide(TOP, layer, curve, width=0.5) layout.write("bezier_waveguides.gds")
def origin_ex_ey(self, multiple_of_90=False): # pylint: disable=unused-argument EX = kdb.DVector(1, 0) cp = self.get_cell_params() origin = kdb.DPoint(0, 0) # if 'angle_ex' not in cp.__dict__: # cp.angle_ex = 0 if multiple_of_90: if cp.angle_ex % 90 != 0: raise RuntimeError("Specify an angle multiple of 90 degrees") from math import pi ex = rotate(EX, cp.angle_ex * pi / 180) ey = rotate90(ex) return origin, ex, ey
import numpy as np from functions import * layout = pya.Layout() layout.dbu = 0.001 TOP = layout.create_cell("TOP") workingLayer = layout.layer(4, 0) chipBorder = layout.layer(7, 0) #computational layer maskBorder = layout.layer(10, 0) #nbtin layer outputLayer = layout.layer(1, 0) sourceLayer = layout.layer(3, 0) port1Layer = layout.layer(2, 0) port2Layer = layout.layer(5, 0) ex = pya.DVector(1, 0) ey = pya.DVector(0, 1) upperRegion = pya.Region() lowerRegion = pya.Region() feedlineRegion = pya.Region() lowZRegion = pya.Region() highZRegion = pya.Region() #insert chip/mask border chipWidth = 11000 chipLength = 19000 #layout_box(TOP, chipBorder, -chipWidth*ex-50000*ey, chipWidth*ex + 50000*ey, ex) maskWidth = 11600 maskHeight = 19600