Ejemplo n.º 1
0
    def getcell(self):
        with nd.Cell(name=self.name) as dha_cell:
            inpin = nd.Pin(name='a0').put(self.start[0], self.start[1],
                                          self.start[2])
            nd.Pin(name='b0').put(self.end[0], self.end[1], self.end[2])
            a, b = self.outline()

            if self.return_path == True:
                nd.Polygon(nd.util.polyline2polygon(xy=self.points,
                                                    width=self.ww),
                           layer=self.layer).put()
                nd.Polyline(width=self.owidth, points=a,
                            layer=self.olayer).put(inpin.rotate(180))
                nd.Polyline(width=self.owidth, points=b,
                            layer=self.olayer).put(inpin.rotate(180))
            else:
                nd.Polygon(nd.util.polyline2polygon(xy=self.points,
                                                    width=self.ww),
                           layer=self.layer).put()
                nd.Polygon(nd.util.polyline2polygon(xy=a, width=self.owidth),
                           layer=self.olayer).put(inpin.rotate(180))
                nd.Polygon(nd.util.polyline2polygon(xy=b, width=self.owidth),
                           layer=self.olayer).put(inpin.rotate(180))

        return dha_cell
Ejemplo n.º 2
0
 def _plot(self):
     nd.Polyline(points=self.points,
                 width=self.width,
                 olayer=self.olayer,
                 layer=self.layer).put()
     nd.export_gds()
     return
Ejemplo n.º 3
0
def bezier(a=0,
           b=0,
           c=0,
           p0_x=0,
           p0_y=0,
           length=2000,
           width=5000,
           orientation=-1):
    """Create a Bezier waveguide based on parameters a, b and c."""
    with nd.Cell(name='Bezier') as bez:
        t = np.arange(0, 1, 0.001)
        width = width * orientation
        p1_x = p0_x + length
        p1_y = p0_y
        p2_x = p1_x
        p2_y = p1_y - width
        p3_x = p0_x
        p3_y = p0_y - width

        x = p0_x * (1 - t)**3 + 3 * p1_x * t * (
            1 - t)**2 + 3 * p2_x * t * t * (1 - t) + p3_x * t**3
        y = p0_y * (1 - t)**3 + 3 * p1_y * t * (
            1 - t)**2 + 3 * p2_y * t * t * (1 - t) + p3_y * t**3

        #l = list(product(x, y))
        #mylist = [[0,1],  [0,2],  [0,2],  [0,5]];
        x1 = np.array([x])
        y1 = np.array([y])
        x2 = x1.T
        y2 = y1.T
        bezier_curve = np.hstack((x2, y2))
        #bezier_curve = [(0, 0), (3, 3), (500, 500),(500, 900)] # Bezier waveguide outline
        #nd.Polygon(layer=1,points=bezier_curve ).put(0)
        nd.Polyline(layer=0, points=bezier_curve, width=50).put(0)
        #add pins to the input and output, pointing outwards of the bezier guide
        nd.Pin('a0').put(0, 0, 180)  #if bezier starts in (0, 0, 0)
        #        nd.Pin('b0').put(xout, yout, aout)
        nd.strt(length=100, width=100).put(p0_x, p0_y)
        nd.strt(length=100, width=100).put(p1_x, p1_y)
        nd.strt(length=100, width=100).put(p2_x, p2_y)
        nd.strt(length=100, width=100).put(p3_x, p3_y)

        width_x = (p1_x + p2_x) / 2
        width_y = (p1_y + p2_y) / 2
        nd.text('width', height=250, align='cc', layer=2).put(width_x, width_y)

        length_x = (p0_x + p1_x) / 2
        length_y = (p0_y + p1_y) / 2
        nd.text('length', height=250, align='cc',
                layer=2).put(length_x, length_y)

    return bez
Ejemplo n.º 4
0
import numpy as np

#global design settings

w_bias = 0.030*2   # writing pocess takes away 30nm on both sides 
w_trench = 2.5       
w_SM = 0.3 + w_bias        
chip_width = 12000
chip_height = 10000
N_repeats = 2
L_io = 1000

# make a grid indicating frames for raster mode


gridline_x = nd.Polyline(points=[[0,0],[12000,0]], layer=3, width=1)
gridline_y = nd.Polyline(points=[[0,0],[6000,0]], layer=3, width=1)


for y in range(-1500,4501,500):
    gridline_x.put(0,y)
for x in range(0,12001,500):
    gridline_y.put(x,-1500,90)


# First section, straight - taper out - straight - taper in straight - taper to output 
y1 = 50
layer_inner = 1
layer_trench = 11
W_straight = np.array([0.05, 0.1, 0.2, 0.3, 0.3, 0.5, 0.8]) + w_bias
W_taper = np.array([5, 5, 5, 2, 5, 5, 5]) + w_bias
Ejemplo n.º 5
0
    xya = (1000, 1000, 20)

    # Curve with different accuracy. Placed at an angle to prevent klayout
    # from removing points which are needed to check the number of points.
    A, B, L = gb_coefficients(xya, Rin=0, Rout=0)
    xy = curve2polyline(gb_point, xya, 0.1, (A, B, L))
    xy = nd.util.polyline2polygon(xy, width=2)
    nd.Polygon(layer=202, points=xy).put(0, 0, 10)
    xy = curve2polyline(gb_point, xya, 0.001, (A, B, L))
    xy = nd.util.polyline2polygon(xy, width=2)
    nd.Polygon(layer=203, points=xy).put(0, 0, 10)

    # Curve with different accuracy and curvature at start and finish.
    A, B, L = gb_coefficients(xya, Rin=300, Rout=-100)
    xy = curve2polyline(gb_point, xya, 0.1, (A, B, L))
    nd.Polyline(layer=1, width=2, points=xy).put(0, 0, 10)
    xy = curve2polyline(gb_point, xya, 0.001, (A, B, L))
    nd.Polyline(layer=2, width=2, points=xy).put(0, 0, 10)

    # Curves with different "length".
    A, B, L = gb_coefficients(xya, Rin=0, Rout=0)  # sets X and Z
    for L in range(300, 2000, 100):
        A, B = curve_AB(L)
        xy = [gb_point(t / 1000, A, B, L) for t in range(1001)]
        nd.Polyline(layer=2, width=2, points=xy).put(500, 0, 10)

    A, B, L = gb_coefficients(xya, Rin=300, Rout=-100)  # sets X and Z
    for L in range(300, 2000, 100):
        A, B = curve_AB(L)
        xy = [gb_point(t / 1000, A, B, L) for t in range(1001)]
        nd.Polyline(layer=3, width=2, points=xy).put(500, 0, 10)