def split1_2_4_8(taper_in = True): with nd.Cell(name='Yjunction_taper_in') as yj: a = dha(name='y_junction_taper_input',layer=layer_inner_path, olayer=layer_outer_path,width=W_t_out, owidth=w_trench, return_path=True) b = dha(name='y_junction_connector',layer=layer_inner_path, olayer=layer_outer_path,width=W_t_out, owidth=w_trench, return_path=True) c = dha(name='y_junction_connector',layer=layer_inner_path, olayer=layer_outer_path,width=W_t_out, owidth=w_trench, return_path=True) if taper_in == True: a.strt(1000) a.taper(width2=w_SM) a.strt(700) a.taper(width2=W_out, length=10) a.strt(length=10) a.getcell().put(0,0) else: a = dha(name='y_junction_taper_input',layer=layer_inner_path, olayer=layer_outer_path,width=W_t_out, owidth=w_trench, return_path=False) a.strt(1710) a.taper(width2=W_out, length=10) a.strt(length=10) a.getcell().put(0,0) b.strt() b.taper(width2=w_SM,length=10) b.strt(375) b.taper(width2=W_t_out) b.strt() b = b.getcell() c.strt(100) c = c.getcell() y0 = y_junction(layer=layer_inner_poly, olayer=layer_outer_poly, height=100).put(nd.cp.move(-5)) s0_0 = b.put(y0.pin['b0'].move(-5)) s0_1 = b.put(y0.pin['b1'].move(-5)) y1_0 = y_junction(layer=layer_inner_poly, olayer=layer_outer_poly,height=50).put(s0_0.pin['b0'].move(-5)) y1_1 = y_junction(layer=layer_inner_poly, olayer=layer_outer_poly,height=50).put(s0_1.pin['b0'].move(-5)) s1_0 = b.put(y1_0.pin['b0'].move(-5)) s1_1 = b.put(y1_0.pin['b1'].move(-5)) s1_2 = b.put(y1_1.pin['b0'].move(-5)) s1_3 = b.put(y1_1.pin['b1'].move(-5)) y=[] y.append(y_junction(layer=layer_inner_poly, olayer=layer_outer_poly,height=25).put(s1_0.pin['b0'].move(-5))) y.append(y_junction(layer=layer_inner_poly, olayer=layer_outer_poly,height=25).put(s1_1.pin['b0'].move(-5))) y.append(y_junction(layer=layer_inner_poly, olayer=layer_outer_poly,height=25).put(s1_2.pin['b0'].move(-5))) y.append(y_junction(layer=layer_inner_poly, olayer=layer_outer_poly,height=25).put(s1_3.pin['b0'].move(-5))) for i in range(len(y)): nd.Pin(name='b'+str(2*i)).put(y[i].pin['b0'].move(-5)) nd.Pin(name='b'+str(2*i+1)).put(y[i].pin['b1'].move(-5)) return yj
def eulbendtest(L=10000, r1=200, r2=200, l1=500, layer=1, w1=1, w2=0.5, p=0.2, n=4, olayer=2): with nd.Cell('Bend_test') as ebt: path = dha(layer=1, width=w1, olayer=olayer, owidth=w_trench) path.strt(length=l1 / 4) path.taper(length=l1, width1=w1, width2=w2) L = L - 4 * l1 l = L / (2 * n) - (r1 + r2) for i in range(n): path.strt(length=l) path.eulerbend(angle=90, radius=r1, p=p) path.eulerbend(angle=-180, radius=r2, p=p) path.eulerbend(angle=90, radius=r1, p=p) path.strt(length=l) path.taper(length=l1, width1=w2, width2=w1) path.strt(length=l1 * (7 / 4)) path.getcell().put() return ebt
def Crossings(taper_left = False): with nd.Cell(name='crossings') as cr: in_section = dha(name='crossing test, input', layer=1, olayer=13, width=w_SM, owidth=w_trench) connector = dha(name='crossing test, conn', layer=1, olayer=13, width=W_cross, owidth=w_trench) out_section = dha(name='crossing test, output', layer=1, olayer=13, width=W_cross, owidth=w_trench) if taper_left == False: in_section.strt(length=L_in-70+1000) in_section.taper(length=L_t, width1=w_SM, width2=W_cross) in_section.strt(length=L_s+L_ovl) a = in_section.getcell().put(0,0) else: in_section = dha(name='crossing test, input', layer=1, olayer=13, width=W_t_out, owidth=w_trench) in_section.strt(length=L_io) in_section.taper(width2=w_SM,length=L_t_out) in_section.strt(L_in-75) in_section.taper(L_t, width2=W_t_out) in_section.strt(10) a = in_section.getcell().put(0,0) connector.strt(length=L_s+L_ovl) connector.taper(width1=W_cross,width2=w_SM,length=L_t) connector.strt(length=D_cross-(2*L_t+2*L_s+L_cross)) connector.taper(width2=W_cross,width1=w_SM,length=L_t) connector.strt(length=L_s+L_ovl) con = connector.getcell() if taper_left == False: out_section.strt(10) out_section.taper(width2=w_SM, length=L_t) out_section.strt(L_in-555) out_section.taper(width2=W_out,length=L_t) out_section.strt(L_io) out = out_section.getcell() else: out_section.strt(10) out_section.taper(width2=w_SM, length=L_t) out_section.strt(L_in-545+1000) out = out_section.getcell() for j in range(len(angles)-1): # bend b = crossing(angles[j], W_cross, L_cross).put(a.pin['b0'].move(-L_ovl)) a = con.put(b.pin['b0'].move(-L_ovl)) crossing(angles[-1], W_cross, L_cross).put(a.pin['b0'].move(-L_ovl)) out.put(nd.cp.move(-L_ovl)) return cr
def y_junction(radius=10, width=w_SM, angle=45, height=50,layer=1111, olayer=1112, p=0.2): with nd.Cell() as eb: a = dha(name='poly_yj1',layer=layer, olayer=olayer,width=W_out, owidth=w_trench, return_path=False) b = dha(name='poly_yj2',layer=layer, olayer=olayer,width=w_SM, owidth=w_trench, return_path=False) c = dha(name='poly_yj3',layer=layer, olayer=olayer,width=w_SM, owidth=w_trench, return_path=False) d = dha(name='poly_yj4',layer=layer, olayer=olayer,width=w_SM, owidth=w_trench, return_path=False) #input section a.strt(5) a.taper(width2=w_SM, length=10) a.strt(5) a = a.getcell() #bend b.strt(1) b.eulerbend(radius=radius,angle=angle, p=p,N=40) b.strt(1) b_height = b.end[1] - b.start[1] l = np.sqrt(2)*(height/2 - 2*b_height)+1 b = b.getcell() #diagonals c.strt(l) c = c.getcell() #output d.strt(5) d.taper(width2=W_out, length=10) d.strt(5) d = d.getcell() a0 = a.put() b.put(a0.pin['b0'].move(-1)) c.put() b0 = b.put(flip=True) d0 = d.put() b.put(a0.pin['b0'].move(-1),flip=True) c.put() b.put(flip=False) d1 = d.put() nd.Pin(name='a0').put(a0.pin['a0']) nd.Pin(name='b0').put(d0.pin['b0']) nd.Pin(name='b1').put(d1.pin['b0']) return eb
def parametrized_cell(w1, w2, bend_radius, length1, length2, trenchwidth=5): name = 'parametrized cell with taper lenght = ' + str(length2) p = dha(name=name, layer=1, olayer=2, width=w1, owidth=trenchwidth) p.strt(length=length1) p.taper(width1=w1, width2=w2, length=length2) p.eulerbend(radius=bend_radius, angle=90) p.taper(width1=w2, width2=w1, length=length2) p.strt(length=length1) cell = p.getcell() return cell
def stts(w1=1, w2=0.3, w3=5, l1=2000, l2=1000, l3=4000, l4=1000, l5=2000, layer=1, olayer=2): with nd.Cell('straight_taper_straight') as sts: path = dha(layer=layer, olayer=olayer, width=w1, owidth=w_trench) path.strt(length=l1) path.taper(length=l2, width1=w1, width2=w2) path.strt(length=l3) path.taper(length=l4, width1=w2, width2=w3) path.strt(length=l5) path.getcell().put() return sts
ypos = 5980 - 25 * i stts(w1=1.5, w2=widths[i], w3=1.5).put(0, ypos) y = 5500 # Make straight taper straight section 2 widths = [0.8, 0.8, 0.5, 0.5, 0.3, 0.3, 0.25, 0.25, 0.15, 0.15] for i in range(len(widths)): ypos = 5700 - 20 * i stts(w1=1, w2=widths[i], w3=1).put(0, ypos) y = 5500 widths = [0.2, 0.3, 0.4, 0.5, 0.8, 1, 1.5, 2, 3, 5, 10, 20] for i in widths: straight = dha(name='Straight guides', layer=1, olayer=2, width=i, owidth=w_trench, maxlength=5000) straight.strt(length=10000) y -= 20 straight.getcell().put(0, y) y = 5000 r1 = [220, 150, 100, 68, 47, 33, 22, 15] #,10,6.8] for i in range(len(r1)): bendtest(r1=r1[i], r2=r1[i], w1=1, w2=0.5, n=4, L=10000).put(10000, y + i * 20, flip=True, flop=True) #bendtest(r1=r1[i],r2=r1[i],w1=1,w2=0.5,n=2, L=5010).put(5010,y+i*20, flip=True, flop=True)
# 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 L_t = np.array([50, 50, 100, 10, 50, 50, 50]) L_str = 2000 L_t_out = 10 W_t_out = 2 + w_bias for i in range(len(W_straight)): for j in range(N_repeats): path = dha(name='taper_test_p1'+str(i)+str(j), layer = layer_inner, olayer = layer_trench, width=W_straight[i], owidth=w_trench) path.strt(length = chip_width/2 - L_t[i] - L_str/2, N=2) path.taper(width1 = W_straight[i], width2 = W_taper[i], length=L_t[i]) path.strt(length = L_str/2, N=2) path.getcell().put(0,y1) ##split path in middle path = dha(name='taper_test_p2 asd'+str(i)+str(j), layer = layer_inner, olayer = layer_trench, width=W_taper[i], owidth=w_trench) path.strt(length = L_str/2, N=2) path.taper(width1 = W_taper[i], width2=W_straight[i], length=L_t[i]) path.strt(length=chip_width/2 - L_t[i] - L_str/2 - L_t_out - L_io, N=2) path.taper(width1=W_straight[i], width2=W_t_out, length=L_t_out) path.strt(length=L_io, N=2) path.getcell().put() y1 += 20
#import nazca and custom path-based class import nazca as nd from dha_elements_v01 import dha # instantiate dha object, and set some parameters: # layer refers to layer in which central waveguide will be placed, width is initial width used. # this will be changed automatically when tapers are used. # owidth refers to the width of the outline paths, which are played in olayer path_structure = dha(name='path_structure_1', layer=1, width=0.5, owidth=5, olayer=2) # we can then define some structures using the methods in the dha object: path_structure.strt(length=20) path_structure.arc(angle=90, radius=20) path_structure.eulerbend(p=0.2, angle=-90, radius=20) path_structure.taper(width1=0.5, width2=5, length=50) path_structure.strt(length=10) path_structure.taper(width1=5, width2=0.5, length=20) # to place the structure, get the cell with the getcell() method, then place that using the cells put() method # cells can also be place multiple places with specified position cell = path_structure.getcell() cell.put() cell.put(0, -50)