Skip to content
Snippets Groups Projects
Commit 3d6f5a78 authored by Tom Polakovic's avatar Tom Polakovic
Browse files

example file

parent 496f3ee3
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
import gdspy
lib = gdspy.GdsLibrary('Lib')
pi = 3.1416
p = {-1:'r',1:'l'}
def make_resonator(length, width, trench, coupling_length, coupling_radius, turn_length, turn_radius, n_turns=0):
res = gdspy.Path(width)
res.segment(coupling_length,'+x')
res.turn(coupling_radius,'r')
if n_turns == 0:
res.segment(length, '-y')
else:
_p = 1
ext_length = (n_turns+1)*pi
length = length - ext_length
res.segment(length/2,'-y')
res.turn(turn_radius,'r')
for i in range(n_turns):
res.turn(turn_radius,p[_p])
res.turn(turn_radius,p[_p])
res.segment(turn_length)
_p *= -1
res.turn(turn_radius, p[_p])
res.segment(length/2,'-y')
res_poly = gdspy.boolean(res, res, 'or', max_points=10000)
tr = gdspy.offset(res_poly, trench)
res.segment(trench)
out = gdspy.boolean(tr, res, 'not', layer=1, max_points=10000)
#out.fracture(max_points=5)
return out
def _cpw(length, width, pad_length, pad_width, tapper_length):
cpw = gdspy.Path(pad_width)
cpw.segment(pad_length)
cpw.segment(tapper_length, final_width=width)
cpw.segment(length)
cpw.segment(tapper_length, final_width=pad_width)
cpw.segment(pad_length)
cpw = gdspy.boolean(cpw, cpw, 'or', layer=2)
return cpw
def make_cpw(length, width, pad_length, pad_width, tapper_length, trench):
cpw = _cpw(length, width, pad_length, pad_width, tapper_length)
cpw_tr = _cpw(length,width+2*trench,pad_length*2,pad_width*2,tapper_length+trench)
cpw_tr.translate(-(pad_length+trench), 0)
out = gdspy.boolean(cpw_tr, cpw, 'not', layer=2)
return out
# Construction of gds file
cell_res = gdspy.Cell('Resonator')
res = make_resonator(5e3,2,1,20,5,100,100,3)
cell_res.add(res)
lib.add(cell_res)
cell_cpw = gdspy.Cell('CPW')
cpw = make_cpw(5e3, 10, 350, 350, 100, 5)
cell_cpw.add(cpw)
lib.add(cell_cpw)
gdspy.LayoutViewer(lib)
lib.write_gds('example.gds')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment